MCPcopy Create free account
hub / github.com/SecurityAnalysts01/ShellcodeLoader / lazy_module

Class lazy_module

Loading_1.2/Loading/lazy_importer.hpp:511–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

509
510 template<offset_hash_pair OHP>
511 struct lazy_module : lazy_base<lazy_module<OHP>> {
512 template<class T = void*, class Enum = unsafe_module_enumerator>
513 LAZY_IMPORTER_FORCEINLINE static T get() noexcept
514 {
515 Enum e;
516 do {
517 if(hash(e.value->BaseDllName, get_offset(OHP)) == get_hash(OHP))
518 return (T)(e.value->DllBase);
519 } while(e.next());
520 return {};
521 }
522
523 template<class T = void*, class Ldr>
524 LAZY_IMPORTER_FORCEINLINE static T in(Ldr ldr) noexcept
525 {
526 safe_module_enumerator e((const detail::win::LDR_DATA_TABLE_ENTRY_T*)(ldr));
527 do {
528 if(hash(e.value->BaseDllName, get_offset(OHP)) == get_hash(OHP))
529 return (T)(e.value->DllBase);
530 } while(e.next());
531 return {};
532 }
533
534 template<class T = void*, class Ldr>
535 LAZY_IMPORTER_FORCEINLINE static T in_cached(Ldr ldr) noexcept
536 {
537 auto& cached = lazy_base<lazy_module<OHP>>::_cache();
538 if(!cached)
539 cached = in(ldr);
540
541 return (T)(cached);
542 }
543 };
544
545 template<offset_hash_pair OHP, class T>
546 struct lazy_function : lazy_base<lazy_function<OHP, T>, T> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected