This method, while "documented", just doesn't seem to work for me.
I'm trying to verify the signature of the currently running executable. Used GetModuleHandle
as the first param (base address) and GetModuleInformation
to find the size.
I keep getting back CORSEC_E_INVALID_IMAGE_FORMAT
.
I also thought maybe the method expects the address of the manifest, so I use FindResource
etc to get that address, but it didn't work either.
Has anyone successfully used this method?
Sample code:
HMODULE modHandle = GetModuleHandle(NULL);
MODULEINFO modInfo;
GetModuleInformation(GetCurrentProcess(), modHandle, &modInfo, sizeof(MODULEINFO));
DWORD temp;
BOOL valid = StrongNameSignatureVerificationFromImage((BYTE*)modHandle, modInfo.SizeOfImage, 0, &temp);
DWORD res = StrongNameErrorInfo(); // returns CORSEC_E_INVALID_IMAGE_FORMAT