Skip to content

Commit

Permalink
fix: coding style
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Olivier <[email protected]>
  • Loading branch information
martin-olivier authored Aug 1, 2024
1 parent 2dce2f9 commit 1575bdf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ std::string get_demangled_name(const char *symbol) {
res = abi::__cxa_demangle(symbol, buf, &size, &status);
if (!res) {
free(buf);

return "";
}

Expand Down
12 changes: 6 additions & 6 deletions src/symbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ std::vector<std::string> get_symbols(HMODULE hModule, bool demangle) {
throw std::string("Invalid DOS header");

// Get the NT headers
PIMAGE_NT_HEADERS pNTHeaders = (PIMAGE_NT_HEADERS)((BYTE*)hModule + pDosHeader->e_lfanew);
PIMAGE_NT_HEADERS pNTHeaders = (PIMAGE_NT_HEADERS)((BYTE *)hModule + pDosHeader->e_lfanew);
if (pNTHeaders->Signature != IMAGE_NT_SIGNATURE)
throw std::string("Invalid NT headers");

Expand All @@ -60,15 +60,15 @@ std::vector<std::string> get_symbols(HMODULE hModule, bool demangle) {
if (exportDirRVA == 0)
throw std::string("No export directory found");

PIMAGE_EXPORT_DIRECTORY pExportDir = (PIMAGE_EXPORT_DIRECTORY)((BYTE*)hModule + exportDirRVA);
PIMAGE_EXPORT_DIRECTORY pExportDir = (PIMAGE_EXPORT_DIRECTORY)((BYTE *)hModule + exportDirRVA);

// Get the list of exported function names
DWORD* pNames = (DWORD*)((BYTE*)hModule + pExportDir->AddressOfNames);
DWORD* pFunctions = (DWORD*)((BYTE*)hModule + pExportDir->AddressOfFunctions);
WORD* pNameOrdinals = (WORD*)((BYTE*)hModule + pExportDir->AddressOfNameOrdinals);
DWORD *pNames = (DWORD *)((BYTE *)hModule + pExportDir->AddressOfNames);
DWORD *pFunctions = (DWORD *)((BYTE *)hModule + pExportDir->AddressOfFunctions);
WORD *pNameOrdinals = (WORD *)((BYTE *)hModule + pExportDir->AddressOfNameOrdinals);

for (DWORD i = 0; i < pExportDir->NumberOfNames; ++i) {
const char* name = (const char*)((BYTE*)hModule + pNames[i]);
const char *name = (const char *)((BYTE *)hModule + pNames[i]);

add_symbol(result, name, demangle);
}
Expand Down

0 comments on commit 1575bdf

Please sign in to comment.