diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-27 22:59:43 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-27 23:00:45 +0300 |
commit | e06a3bd4b50fd001f4d0d49c10a0c4b988c563a0 (patch) | |
tree | ca8d3fba504b185adf1928b998935f8345d66cfd /tools | |
parent | 6281960ec0d178935ca2881aff052a9eae5da337 (diff) |
comparison of MIRANDA_VERSION_COREVERSION solves the problem of plugins who differ only in a build number
Diffstat (limited to 'tools')
-rw-r--r-- | tools/checksum/checksum.cpp | 31 | ||||
-rw-r--r-- | tools/checksum/checksum.exe | bin | 18432 -> 17920 bytes |
2 files changed, 7 insertions, 24 deletions
diff --git a/tools/checksum/checksum.cpp b/tools/checksum/checksum.cpp index aee6b6102f..da062f4148 100644 --- a/tools/checksum/checksum.cpp +++ b/tools/checksum/checksum.cpp @@ -18,31 +18,26 @@ #pragma comment(lib, "version.lib")
int debug = 0;
-DWORD dwVersion;
-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)
@@ -219,21 +214,9 @@ int PEChecksum(wchar_t *filename, BYTE digest[16]) // patch resources
if (resSize > 0 && resAddr >= pISH->VirtualAddress && resAddr + resSize <= pISH->VirtualAddress + pISH->SizeOfRawData) {
- dwVersion = 0;
-
DWORD shift = resAddr - pISH->VirtualAddress + pISH->PointerToRawData;
IMAGE_RESOURCE_DIRECTORY *pIRD = (IMAGE_RESOURCE_DIRECTORY*)(ptr + shift);
- PatchResourcesDirectory(pIRD, ptr + shift, 0);
-
- // patch version
- if (dwVersion) {
- shift = dwVersion - pISH->VirtualAddress + pISH->PointerToRawData;
-
- UINT blockSize;
- VS_FIXEDFILEINFO *vsffi;
- VerQueryValue(ptr + shift, L"\\", (PVOID*)&vsffi, &blockSize);
- vsffi->dwProductVersionLS = vsffi->dwProductVersionMS = 0;
- }
+ PatchResourcesDirectory(pIRD, ptr + shift);
}
// rebase to zero address
diff --git a/tools/checksum/checksum.exe b/tools/checksum/checksum.exe Binary files differindex 9cc85cb66e..d5a37d7c4c 100644 --- a/tools/checksum/checksum.exe +++ b/tools/checksum/checksum.exe |