Windows: handle case when parameter of VerifyModuleSignature is enclosed between quotation marks

This commit is contained in:
Mounir IDRASSI 2018-04-16 11:04:57 +02:00
parent 3f3a567782
commit cce74aaee0
No known key found for this signature in database
GPG Key ID: DD0C382D5FCFB8FC
1 changed files with 16 additions and 1 deletions

View File

@ -13457,12 +13457,27 @@ BOOL VerifyModuleSignature (const wchar_t* path)
GUID gActionID = WINTRUST_ACTION_GENERIC_VERIFY_V2;
WINTRUST_FILE_INFO fileInfo = {0};
WINTRUST_DATA WVTData = {0};
wchar_t filePath [TC_MAX_PATH + 1024];
// Strip quotation marks (if any)
if (path [0] == L'"')
{
StringCbCopyW (filePath, sizeof(filePath), path + 1);
}
else
{
StringCbCopyW (filePath, sizeof(filePath), path);
}
// Strip quotation marks (if any)
if (filePath [wcslen (filePath) - 1] == L'"')
filePath [wcslen (filePath) - 1] = 0;
if (!InitializeWintrust ())
return FALSE;
fileInfo.cbStruct = sizeof(WINTRUST_FILE_INFO);
fileInfo.pcwszFilePath = path;
fileInfo.pcwszFilePath = filePath;
fileInfo.hFile = NULL;
WVTData.cbStruct = sizeof(WINTRUST_DATA);