diff options
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r-- | plugins/PluginUpdater/src/checksum.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/plugins/PluginUpdater/src/checksum.cpp b/plugins/PluginUpdater/src/checksum.cpp index 73d8a30734..19f9da9ece 100644 --- a/plugins/PluginUpdater/src/checksum.cpp +++ b/plugins/PluginUpdater/src/checksum.cpp @@ -17,7 +17,6 @@ #define DEBUG_REALLOCS 1
int debug = 0;
-DWORD dwVersion = 0;
#pragma comment(lib, "version.lib")
@@ -51,29 +50,25 @@ struct MFileMapping }
};
-static void PatchResourcesDirectory(PIMAGE_RESOURCE_DIRECTORY pIRD, PBYTE pBase, DWORD dwType);
+static void PatchResourcesDirectory(PIMAGE_RESOURCE_DIRECTORY pIRD, PBYTE pBase);
-static void PatchResourceEntry(PIMAGE_RESOURCE_DIRECTORY_ENTRY pIRDE, PBYTE pBase, DWORD dwType)
+static void PatchResourceEntry(PIMAGE_RESOURCE_DIRECTORY_ENTRY pIRDE, PBYTE pBase)
{
if (pIRDE->DataIsDirectory)
- PatchResourcesDirectory(PIMAGE_RESOURCE_DIRECTORY(pBase + pIRDE->OffsetToDirectory), pBase, dwType == 0 ? pIRDE->Name : dwType);
- else if (dwType == 16) {
- PIMAGE_RESOURCE_DATA_ENTRY pItem = PIMAGE_RESOURCE_DATA_ENTRY(pBase + pIRDE->OffsetToData);
- dwVersion = pItem->OffsetToData;
- }
+ PatchResourcesDirectory(PIMAGE_RESOURCE_DIRECTORY(pBase + pIRDE->OffsetToDirectory), pBase);
}
-static void PatchResourcesDirectory(PIMAGE_RESOURCE_DIRECTORY pIRD, PBYTE pBase, DWORD dwType)
+static void PatchResourcesDirectory(PIMAGE_RESOURCE_DIRECTORY pIRD, PBYTE pBase)
{
UINT i;
pIRD->TimeDateStamp = 0;
PIMAGE_RESOURCE_DIRECTORY_ENTRY pIRDE = PIMAGE_RESOURCE_DIRECTORY_ENTRY(pIRD + 1);
for (i = 0; i < pIRD->NumberOfNamedEntries; i++, pIRDE++)
- PatchResourceEntry(pIRDE, pBase, dwType);
+ PatchResourceEntry(pIRDE, pBase);
for (i = 0; i < pIRD->NumberOfIdEntries; i++, pIRDE++)
- PatchResourceEntry(pIRDE, pBase, dwType);
+ PatchResourceEntry(pIRDE, pBase);
}
__forceinline bool Contains(PIMAGE_SECTION_HEADER pISH, DWORD address, DWORD size = 0)
@@ -198,21 +193,9 @@ LBL_NotPE: // patch resources
if (resSize > 0 && Contains(pISH, resAddr, resSize)) {
- dwVersion = 0;
-
DWORD shift = resAddr - pISH->VirtualAddress + pISH->PointerToRawData;
IMAGE_RESOURCE_DIRECTORY *pIRD = (IMAGE_RESOURCE_DIRECTORY*)(map.ptr + shift);
- PatchResourcesDirectory(pIRD, map.ptr + shift, 0);
-
- // patch version
- if (dwVersion) {
- shift = dwVersion - pISH->VirtualAddress + pISH->PointerToRawData;
-
- UINT blockSize;
- VS_FIXEDFILEINFO *vsffi;
- VerQueryValue(map.ptr + shift, L"\\", (PVOID*)&vsffi, &blockSize);
- vsffi->dwProductVersionLS = vsffi->dwProductVersionMS = 0;
- }
+ PatchResourcesDirectory(pIRD, map.ptr + shift);
}
// rebase to zero address
|