From 410e2f5d9c86ad3052bcba24229d0600eab2d9eb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 28 May 2018 14:26:09 +0300 Subject: fix for dll checker - Load & Unload are not mandatory now, also void export table is not a problem --- src/mir_app/src/dll_sniffer.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/dll_sniffer.cpp b/src/mir_app/src/dll_sniffer.cpp index 1d8f928e74..639d12b91e 100644 --- a/src/mir_app/src/dll_sniffer.cpp +++ b/src/mir_app/src/dll_sniffer.cpp @@ -126,7 +126,10 @@ MUUID* GetPluginInterfaces(const wchar_t *ptszFileName, bool &bIsPlugin) // Export information entry DWORD expAddr = pIDD[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; DWORD expSize = pIDD[IMAGE_DIRECTORY_ENTRY_EXPORT].Size; - if (expSize < sizeof(IMAGE_EXPORT_DIRECTORY)) __leave; + if (expSize == 0) + nChecks++; + else if (expSize < sizeof(IMAGE_EXPORT_DIRECTORY)) + __leave; BYTE* pImage = ptr + pIDH->e_lfanew + pINTH->FileHeader.SizeOfOptionalHeader + sizeof(IMAGE_NT_HEADERS) - sizeof(IMAGE_OPTIONAL_HEADER); @@ -144,22 +147,15 @@ MUUID* GetPluginInterfaces(const wchar_t *ptszFileName, bool &bIsPlugin) DWORD *ptrFuncList = (DWORD*)&pSecStart[pED->AddressOfFunctions]; MUUID *pIds = nullptr; - bool bHasLoad = false, bHasUnload = false, bHasMuuids = false; + bool bHasMuuids = false; for (size_t i = 0; i < pED->NumberOfNames; i++, ptrRVA++, ptrOrdRVA++) { char *szName = (char*)&pSecStart[*ptrRVA]; - if (!mir_strcmp(szName, "Load")) - bHasLoad = true; - else if (!mir_strcmp(szName, "Unload")) - bHasUnload = true; - else if (!mir_strcmp(szName, "MirandaInterfaces")) { + if (!mir_strcmp(szName, "MirandaInterfaces")) { bHasMuuids = true; pIds = (MUUID*)&pSecStart[ptrFuncList[*ptrOrdRVA]]; } } - if (!bHasLoad || !bHasUnload) - __leave; - nChecks++; // a plugin might have no interfaces -- cgit v1.2.3