From cce74aaee0a96b13b5793de4f2f2099ea1d29338 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 16 Apr 2018 11:04:57 +0200 Subject: Windows: handle case when parameter of VerifyModuleSignature is enclosed between quotation marks --- src/Common/Dlgcode.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index fdff1f07..347f1207 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -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); -- cgit v1.2.3