10 RtlEnterCriticalSection(&
section);
15 RtlLeaveCriticalSection(&
section);
44 return (PPEB)__readgsqword(0x60);
45#elif defined(_M_ARM64)
46 PPEB peb = (PPEB)(*(__getReg(18) + 0x60));
47 LOG_DEBUG(
"ARM64 TEB: %p PEB: %p.", (
void*)__getReg(18), peb);
50 return (PPEB)__readfsdword(0x30);
68 if (c1 <= L
'Z' && c1 >= L
'A') {
69 c1 = (c1 - L
'A') + L
'a';
76 if (wanted_name == NULL || curr_name == NULL)
return false;
78 LPCWSTR curr_end_ptr = curr_name;
79 while (*curr_end_ptr != L
'\0') {
82 if (curr_end_ptr == curr_name)
return false;
84 LPCWSTR wanted_end_ptr = wanted_name;
85 while (*wanted_end_ptr != L
'\0') {
88 if (wanted_end_ptr == wanted_name)
return false;
90 while ((curr_end_ptr != curr_name) && (wanted_end_ptr != wanted_name)) {
108 LIST_ENTRY head = peb->Ldr->InLoadOrderModuleList;
119 if (curr_module == NULL || curr_module->
BaseAddress == NULL) {
127 }
while (curr_module != first_module);
139 LIST_ENTRY head = peb->Ldr->InLoadOrderModuleList;
150 if (curr_module == NULL || curr_module->
BaseAddress == NULL) {
153 if (hModule == (HMODULE)(curr_module->
BaseAddress)) {
158 }
while (curr_module != first_module);
170 peb->ImageBaseAddress = module_ptr;
181 return (HMODULE) peb->ImageBaseAddress;
SectionLocker(RTL_CRITICAL_SECTION &_section)
RTL_CRITICAL_SECTION & section
#define LOG_DEBUG(fmt,...)
HMODULE get_main_module_via_peb()
HMODULE get_module_via_peb(IN OPTIONAL LPCWSTR module_name=nullptr)
bool set_main_module_in_peb(HMODULE hModule)
size_t get_module_size_via_peb(IN OPTIONAL HMODULE hModule=nullptr)
struct _LDR_MODULE * PLDR_MODULE
bool is_wanted_module(LPCWSTR curr_name, LPCWSTR wanted_name)
WCHAR to_lowercase(WCHAR c1)
struct _LDR_MODULE LDR_MODULE
Functions for retrieving process information from PEB.
LIST_ENTRY InLoadOrderModuleList
UNICODE_STRING FullDllName
LIST_ENTRY InMemoryOrderModuleList
UNICODE_STRING BaseDllName
LIST_ENTRY InInitializationOrderModuleList