Skip to content

Commit 1222db3

Browse files
committed
[REFACT] In exceptions_parser: refactored for backward compatibility
with C99. Small cleanup.
1 parent d5ae2ba commit 1222db3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

libpeconv/src/exceptions_parser.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,15 +429,14 @@ namespace details {
429429
HMODULE hModule = nullptr, hNtdll = GetModuleHandleW(L"ntdll.dll");
430430
auto NtdllHeaders = reinterpret_cast<PIMAGE_NT_HEADERS>(RtlImageNtHeader(hNtdll));
431431
PIMAGE_NT_HEADERS ModuleHeaders = nullptr;
432-
_RTL_INVERTED_FUNCTION_TABLE_ENTRY_WIN7_32 entry{};
432+
_RTL_INVERTED_FUNCTION_TABLE_ENTRY_WIN7_32 entry = { 0 };
433433
RtlSecureZeroMemory(&entry, sizeof(entry));
434434
LPCSTR lpSectionName = ".data";
435-
SEARCH_CONTEXT SearchContext{
436-
};
435+
SEARCH_CONTEXT SearchContext = { 0 };
437436
SearchContext.SearchPattern = reinterpret_cast<LPBYTE>(&entry);
438437
SearchContext.PatternSize = sizeof(entry);
439438
PLIST_ENTRY ListHead = &NtCurrentPeb()->Ldr->InMemoryOrderModuleList,
440-
ListEntry = ListHead->Flink;
439+
ListEntry = ListHead->Flink;
441440
PLDR_DATA_TABLE_ENTRY CurEntry = nullptr;
442441
DWORD SEHTable, SEHCount;
443442
BYTE Offset = 0x20; //sizeof(_RTL_INVERTED_FUNCTION_TABLE_ENTRY)*2
@@ -471,7 +470,7 @@ namespace details {
471470
entry.SEHandlerCount = SEHCount;
472471

473472
while (NT_SUCCESS(RtlFindMemoryBlockFromModuleSection(hNtdll, lpSectionName, &SearchContext))) {
474-
PRTL_INVERTED_FUNCTION_TABLE_WIN7_32 tab = decltype(tab)(SearchContext.Result - Offset);
473+
PRTL_INVERTED_FUNCTION_TABLE_WIN7_32 tab = reinterpret_cast<decltype(tab)>(SearchContext.Result - Offset);
475474

476475
//Note: Same memory layout for RTL_INVERTED_FUNCTION_TABLE_ENTRY in Windows 10 x86 and x64.
477476
if (RtlIsWindowsVersionOrGreater(6, 2, 0) && tab->MaxCount == 0x200 && !tab->NextEntrySEHandlerTableEncoded) return tab;
@@ -523,7 +522,7 @@ namespace details {
523522

524523
#else
525524
DWORD ptr = 0, count = 0;
526-
bool IsWin8OrGreater = RtlIsWindowsVersionOrGreater(6, 2, 0);
525+
BOOL IsWin8OrGreater = RtlIsWindowsVersionOrGreater(6, 2, 0);
527526
ULONG Index = IsWin8OrGreater ? 1 : 0;
528527

529528
if (InvertedTable->Count == InvertedTable->MaxCount) {

0 commit comments

Comments
 (0)