| 558 | |
| 559 | template<class F = T, class Enum = unsafe_module_enumerator> |
| 560 | LAZY_IMPORTER_FORCEINLINE static F get() noexcept |
| 561 | { |
| 562 | // for backwards compatability. |
| 563 | // Before 2.0 it was only possible to resolve forwarded exports when |
| 564 | // this macro was enabled |
| 565 | #ifdef LAZY_IMPORTER_RESOLVE_FORWARDED_EXPORTS |
| 566 | return forwarded<F, Enum>(); |
| 567 | #else |
| 568 | |
| 569 | Enum e; |
| 570 | |
| 571 | do { |
| 572 | #ifdef LAZY_IMPORTER_HARDENED_MODULE_CHECKS |
| 573 | if(!e.value->DllBase || !e.value->FullDllName.Length) |
| 574 | continue; |
| 575 | #endif |
| 576 | |
| 577 | const exports_directory exports(e.value->DllBase); |
| 578 | |
| 579 | if(exports) { |
| 580 | auto export_index = exports.size(); |
| 581 | while(export_index--) |
| 582 | if(hash(exports.name(export_index), get_offset(OHP)) == get_hash(OHP)) |
| 583 | return (F)(exports.address(export_index)); |
| 584 | } |
| 585 | } while(e.next()); |
| 586 | return {}; |
| 587 | #endif |
| 588 | } |
| 589 | |
| 590 | template<class F = T, class Enum = unsafe_module_enumerator> |
| 591 | LAZY_IMPORTER_FORCEINLINE static F forwarded() noexcept |