@@ -99,7 +99,7 @@ bool IsBadLibrary(TCHAR* filename, DWORD filenameLength)
9999
100100#ifdef _X86_
101101 TCHAR syswow64Path[MAX_PATH];
102- SHGetFolderPath (NULL , CSIDL_SYSTEMX86, NULL , 0 , syswow64Path);
102+ SHGetFolderPath (NULL , CSIDL_SYSTEMX86, NULL , 0 , syswow64Path);
103103 StringCbCat (syswow64Path, MAX_PATH, _T (" \\ " ));
104104 size_t syswow64PathLength = 0 ;
105105 StringCbLength (syswow64Path, MAX_PATH, &syswow64PathLength);
@@ -120,7 +120,7 @@ bool IsBadLibrary(TCHAR* filename, DWORD filenameLength)
120120
121121 // printf("systemDriveDevice: %S (%d)\n", systemDriveDevice, systemDriveDevicelength);
122122
123- if (StrNCmpI (systemDriveDevice, filename, (int )(min (systemDriveDevicelength, filenameLength) / sizeof (TCHAR)) ) == 0 )
123+ if (StrNCmpI (systemDriveDevice, filename, (int )(min (systemDriveDevicelength, filenameLength) / sizeof (TCHAR))) == 0 )
124124 {
125125 // path matched the NT file path
126126 return false ;
@@ -132,14 +132,14 @@ bool IsBadLibrary(TCHAR* filename, DWORD filenameLength)
132132
133133 // printf("systemRootPath: %S (%d)\n", systemRootPath, systemRootPathLength);
134134
135- if (StrNCmpI (systemRootPath, normalisedPath, (int )(min (systemRootPathLength, normalisedPathLength) / sizeof (TCHAR)) ) == 0 )
135+ if (StrNCmpI (systemRootPath, normalisedPath, (int )(min (systemRootPathLength, normalisedPathLength) / sizeof (TCHAR))) == 0 )
136136 {
137137 // path matched the regular system path
138138 return false ;
139139 }
140140
141141#ifdef _X86_
142- if (IsWoW64 () && StrNCmpI (syswow64Path, normalisedPath, (int )(min (syswow64PathLength, normalisedPathLength) / sizeof (TCHAR)) ) == 0 )
142+ if (IsWoW64 () && StrNCmpI (syswow64Path, normalisedPath, (int )(min (syswow64PathLength, normalisedPathLength) / sizeof (TCHAR))) == 0 )
143143 {
144144 // path matched the wow64 system path
145145 return false ;
@@ -164,15 +164,15 @@ BOOL ScanForModules_EnumProcessModulesEx_Internal(DWORD moduleFlag)
164164 DWORD currentSize = 1024 * sizeof (HMODULE);
165165 DWORD requiredSize = 0 ;
166166 bool anyBadLibs = false ;
167-
167+
168168 // the EnumProcessModulesEx API was moved from psapi.dll into kernel32.dll for Windows 7, then back out afterwards.
169169 // check for availability of either.
170170 if (!API::IsAvailable (API_EnumProcessModulesEx_PSAPI) && !API::IsAvailable (API_EnumProcessModulesEx_Kernel))
171171 {
172172 // neither available
173173 return FALSE ;
174174 }
175-
175+
176176 // API is available in one of the two libraries, use whichever is available.
177177 pEnumProcessModulesEx fnEnumProcessModulesEx;
178178 if (API::IsAvailable (API_EnumProcessModulesEx_PSAPI))
@@ -235,7 +235,7 @@ BOOL ScanForModules_EnumProcessModulesEx_32bit()
235235
236236BOOL ScanForModules_EnumProcessModulesEx_64bit ()
237237{
238-
238+
239239 return ScanForModules_EnumProcessModulesEx_Internal (LIST_MODULES_64BIT);
240240}
241241
@@ -270,7 +270,7 @@ BOOL ScanForModules_MemoryWalk_GMI()
270270
271271 // printf("Scanning %p - %p ...\n", addr, regionEnd);
272272
273- while (addr < regionEnd)
273+ while (addr < regionEnd)
274274 {
275275 bool skippedForward = false ;
276276 if (VirtualQuery (addr, &memInfo, sizeof (MEMORY_BASIC_INFORMATION)) >= sizeof (MEMORY_BASIC_INFORMATION))
@@ -338,16 +338,16 @@ BOOL ScanForModules_MemoryWalk_Hidden()
338338 while (addr < regionEnd)
339339 {
340340 bool skippedForward = false ;
341-
341+
342342 if (GetModuleHandleEx (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (TCHAR*)addr, &moduleHandle) == FALSE )
343343 {
344344 // not a known module
345345 if ((region->State & MEM_COMMIT) == MEM_COMMIT &&
346346 ((region->Protect == PAGE_READONLY) ||
347- (region->Protect == PAGE_READWRITE) ||
348- (region->Protect == PAGE_EXECUTE_READ) ||
349- (region->Protect == PAGE_EXECUTE_READWRITE) ||
350- (region->Protect == PAGE_EXECUTE_WRITECOPY)))
347+ (region->Protect == PAGE_READWRITE) ||
348+ (region->Protect == PAGE_EXECUTE_READ) ||
349+ (region->Protect == PAGE_EXECUTE_READWRITE) ||
350+ (region->Protect == PAGE_EXECUTE_WRITECOPY)))
351351 {
352352 auto moduleData = static_cast <PBYTE>(region->BaseAddress );
353353 if (moduleData[0 ] == ' M' && moduleData[1 ] == ' Z' )
@@ -385,7 +385,7 @@ BOOL ScanForModules_MemoryWalk_Hidden()
385385 }
386386 }
387387
388- SecureZeroMemory (moduleName, sizeof (TCHAR)* MAX_PATH);
388+ SecureZeroMemory (moduleName, sizeof (TCHAR) * MAX_PATH);
389389 DWORD len;
390390 if ((len = GetMappedFileName (GetCurrentProcess (), region->AllocationBase , moduleName, MAX_PATH)) > 0 )
391391 {
@@ -413,7 +413,6 @@ BOOL ScanForModules_MemoryWalk_Hidden()
413413BOOL ScanForModules_DotNetModuleStructures ()
414414{
415415 HMODULE moduleHandle = 0 ;
416- TCHAR moduleName[MAX_PATH];
417416
418417 auto memoryRegions = enumerate_memory ();
419418
@@ -517,8 +516,7 @@ std::vector<LDR_DATA_TABLE_ENTRY*>* WalkLDR(PPEB_LDR_DATA ldrData)
517516 printf (" [!] Error reading entry.\n " );
518517 break ;
519518 }
520- }
521- while (node != head);
519+ } while (node != head);
522520
523521 entryList->pop_back ();
524522
@@ -603,7 +601,7 @@ BOOL ScanForModules_LDR_Direct()
603601 {
604602 PPEB64 peb64 = reinterpret_cast <PPEB64>(GetPeb64 ());
605603 PEB_LDR_DATA64 ldrData = { 0 };
606-
604+
607605 if (peb64 && attempt_to_read_memory_wow64 (&ldrData, sizeof (PEB_LDR_DATA64), peb64->Ldr ))
608606 {
609607 auto ldrEntries = WalkLDR (&ldrData);
@@ -623,7 +621,7 @@ BOOL ScanForModules_LDR_Direct()
623621 {
624622 printf (" [!] Failed to read module name at %llx.\n " , reinterpret_cast <ULONGLONG>(ldrEntry->FullDllName .Buffer ));
625623 }
626- delete [] dllNameBuffer;
624+ delete[] dllNameBuffer;
627625 delete ldrEntry;
628626 }
629627 delete ldrEntries;
@@ -635,7 +633,7 @@ BOOL ScanForModules_LDR_Direct()
635633 return anyBadLibs ? TRUE : FALSE ;
636634}
637635
638- VOID NTAPI LdrEnumCallback (_In_ PLDR_DATA_TABLE_ENTRY ModuleInformation, _In_ PVOID Parameter, _Out_ BOOLEAN * Stop)
636+ VOID NTAPI LdrEnumCallback (_In_ PLDR_DATA_TABLE_ENTRY ModuleInformation, _In_ PVOID Parameter, _Out_ BOOLEAN* Stop)
639637{
640638 // add ldr entry to table from param
641639 auto ldtEntries = static_cast <std::vector<LDR_DATA_TABLE_ENTRY>*>(Parameter);
0 commit comments