MCPcopy Create free account
hub / github.com/Faran-17/Windows-Internals / main

Function main

codes/Processes and Jobs/PEB_walker.cpp:28–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26} MY_LDR_DATA_TABLE_ENTRY, * PMY_LDR_DATA_TABLE_ENTRY;
27
28int main()
29{
30 // Fetching PEB Address
31 PPEB PEB_Address = (PPEB) __readgsqword( 0x60 );
32
33 // Fetching PEB_LDR_DATA Structure Address
34 PMY_PEB_LDR_DATA P_Ldr = (PMY_PEB_LDR_DATA) PEB_Address->Ldr;
35
36 // Getting the 1st InLoadOrderModuleList Entry
37 PLIST_ENTRY P_NextModule = P_Ldr->InLoadOrderModuleList.Flink;
38
39 // parse it to LDR_DATA_TABLE_ENTRY structure
40 PMY_LDR_DATA_TABLE_ENTRY P_DataTableEntry = (PMY_LDR_DATA_TABLE_ENTRY) P_NextModule;
41
42 while (P_DataTableEntry->DllBase != NULL)
43 {
44 // Fetch module base address
45 PVOID P_ModuleBase = P_DataTableEntry->DllBase;
46
47 // Fetch module name
48 UNICODE_STRING BaseDllName = P_DataTableEntry->BaseDllName;
49
50 // Printing the output
51 printf("DLL Name : %ls\n", BaseDllName.Buffer);
52 printf("DLL Base Address: %p\n", P_ModuleBase);
53 printf("\n");
54
55 // Load the next entry
56 P_DataTableEntry = (PMY_LDR_DATA_TABLE_ENTRY) P_DataTableEntry->InLoadOrderLinks.Flink;
57 }
58 return 0;
59}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected