12 RtlEnterCriticalSection(&
section);
17 RtlLeaveCriticalSection(&
section);
46 return (PPEB)__readgsqword(0x60);
47#elif defined(_M_ARM64)
48 PPEB peb = (PPEB)(*(__getReg(18) + 0x60));
50 std::cout <<
"[+] ARM64 TEB: " << __getReg(18) <<
" PEB: " << peb <<
"\n";
54 return (PPEB)__readfsdword(0x30);
72 if (c1 <= L
'Z' && c1 >= L
'A') {
73 c1 = (c1 - L
'A') + L
'a';
80 if (wanted_name == NULL || curr_name == NULL)
return false;
82 LPCWSTR curr_end_ptr = curr_name;
83 while (*curr_end_ptr != L
'\0') {
86 if (curr_end_ptr == curr_name)
return false;
88 LPCWSTR wanted_end_ptr = wanted_name;
89 while (*wanted_end_ptr != L
'\0') {
92 if (wanted_end_ptr == wanted_name)
return false;
94 while ((curr_end_ptr != curr_name) && (wanted_end_ptr != wanted_name)) {
112 LIST_ENTRY head = peb->Ldr->InLoadOrderModuleList;
123 if (curr_module == NULL || curr_module->
BaseAddress == NULL) {
131 }
while (curr_module != first_module);
143 LIST_ENTRY head = peb->Ldr->InLoadOrderModuleList;
154 if (curr_module == NULL || curr_module->
BaseAddress == NULL) {
157 if (hModule == (HMODULE)(curr_module->
BaseAddress)) {
162 }
while (curr_module != first_module);
174 peb->ImageBaseAddress = module_ptr;
185 return (HMODULE) peb->ImageBaseAddress;
SectionLocker(RTL_CRITICAL_SECTION &_section)
RTL_CRITICAL_SECTION & section
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