[pki] have GetSignatureName() use the current binary on NULL parameter

This commit is contained in:
Pete Batard 2017-06-15 17:25:13 +01:00
parent 92d8ac26b0
commit 54ee68f6fc
3 changed files with 15 additions and 7 deletions

View file

@ -61,6 +61,14 @@ char* GetSignatureName(const char* path)
SPROG_PUBLISHERINFO ProgPubInfo = { 0 };
wchar_t *szFileName = utf8_to_wchar(path);
// If the path is NULL, get the signature of the current runtime
if (path == NULL) {
szFileName = calloc(MAX_PATH, sizeof(wchar_t));
if (szFileName == NULL)
return NULL;
GetModuleFileNameW(GetModuleHandle(NULL), szFileName, MAX_PATH);
}
// Get message handle and store handle from the signed file.
r = CryptQueryObject(CERT_QUERY_OBJECT_FILE, szFileName,
CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED, CERT_QUERY_FORMAT_FLAG_BINARY,