From 21d23dd83c05356a60a4cbd3ecd2ad159b7d1c2c Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Sat, 28 Mar 2020 18:34:28 +0000 Subject: [PATCH] [pki] fix handling of non western paths during cat generation * Closes #177 --- examples/wdi-simple.rc | 8 ++++---- examples/zadic.rc | 8 ++++---- examples/zadig.c | 2 +- examples/zadig.h | 2 +- examples/zadig.rc | 8 ++++---- libwdi/libwdi.c | 3 ++- libwdi/libwdi.rc | 8 ++++---- libwdi/pki.c | 10 ++++------ 8 files changed, 24 insertions(+), 25 deletions(-) diff --git a/examples/wdi-simple.rc b/examples/wdi-simple.rc index f8da8e5a..4c9de06b 100644 --- a/examples/wdi-simple.rc +++ b/examples/wdi-simple.rc @@ -7,8 +7,8 @@ #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,727,0 - PRODUCTVERSION 1,3,727,0 + FILEVERSION 1,3,728,0 + PRODUCTVERSION 1,3,728,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -25,13 +25,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "WDI-Simple" - VALUE "FileVersion", "1.3.727" + VALUE "FileVersion", "1.3.728" VALUE "InternalName", "WDI-Simple" VALUE "LegalCopyright", "© 2010-2018 Pete Batard (LGPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/lesser.html" VALUE "OriginalFilename", "wdi-simple.exe" VALUE "ProductName", "WDI-Simple" - VALUE "ProductVersion", "1.3.727" + VALUE "ProductVersion", "1.3.728" VALUE "Comments", "http://libwdi.akeo.ie" END END diff --git a/examples/zadic.rc b/examples/zadic.rc index ed64dafe..605362c3 100644 --- a/examples/zadic.rc +++ b/examples/zadic.rc @@ -56,8 +56,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,727,0 - PRODUCTVERSION 1,3,727,0 + FILEVERSION 1,3,728,0 + PRODUCTVERSION 1,3,728,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -74,13 +74,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "Zadic" - VALUE "FileVersion", "1.3.727" + VALUE "FileVersion", "1.3.728" VALUE "InternalName", "Zadic" VALUE "LegalCopyright", "© 2010-2018 Pete Batard (LGPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/lesser.html" VALUE "OriginalFilename", "zadic.exe" VALUE "ProductName", "Zadic" - VALUE "ProductVersion", "1.3.727" + VALUE "ProductVersion", "1.3.728" VALUE "Comments", "http://libwdi.akeo.ie" END END diff --git a/examples/zadig.c b/examples/zadig.c index ce05ad26..29a936df 100644 --- a/examples/zadig.c +++ b/examples/zadig.c @@ -1007,7 +1007,7 @@ BOOL parse_ini(void) { // Check if the ini file exists if (GetFileAttributesU(INI_NAME) == INVALID_FILE_ATTRIBUTES) { - dprintf("ini file '%s' not found - default parameters will be used", INI_NAME); + dprintf("ini file '%s' not found in '%s' - default parameters will be used", INI_NAME, app_dir); return FALSE; } diff --git a/examples/zadig.h b/examples/zadig.h index d43083f5..3ba313f3 100644 --- a/examples/zadig.h +++ b/examples/zadig.h @@ -59,7 +59,7 @@ #define FIELD_ORANGE RGB(255,240,200) #define ARROW_GREEN RGB(92,228,65) #define ARROW_ORANGE RGB(253,143,56) -#define APP_VERSION "Zadig 2.4.727" +#define APP_VERSION "Zadig 2.4.728" // These are used to flag end users about the driver they are going to replace enum driver_type { diff --git a/examples/zadig.rc b/examples/zadig.rc index a8f5fa7b..4312c24e 100644 --- a/examples/zadig.rc +++ b/examples/zadig.rc @@ -246,8 +246,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,4,727,0 - PRODUCTVERSION 2,4,727,0 + FILEVERSION 2,4,728,0 + PRODUCTVERSION 2,4,728,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -264,13 +264,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "Zadig" - VALUE "FileVersion", "2.4.727" + VALUE "FileVersion", "2.4.728" VALUE "InternalName", "Zadig" VALUE "LegalCopyright", "© 2010-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "zadig.exe" VALUE "ProductName", "Zadig" - VALUE "ProductVersion", "2.4.727" + VALUE "ProductVersion", "2.4.728" VALUE "Comments", "http://libwdi.akeo.ie" END END diff --git a/libwdi/libwdi.c b/libwdi/libwdi.c index a0796aeb..d565651d 100644 --- a/libwdi/libwdi.c +++ b/libwdi/libwdi.c @@ -1302,7 +1302,8 @@ int LIBWDI_API wdi_prepare_driver(struct wdi_device_info* device_info, const cha while (isspace(*token)) token++; while (strlen(token) && isspace(token[strlen(token)-1])) token[strlen(token)-1] = 0; - if ((*token == '#') || (*token == 0)) continue; + if ((*token == '#') || (*token == 0)) + continue; cat_list[nb_entries++] = token; if (nb_entries >= CAT_LIST_MAX_ENTRIES) { wdi_warn("more than %d cat entries - ignoring the rest", CAT_LIST_MAX_ENTRIES); diff --git a/libwdi/libwdi.rc b/libwdi/libwdi.rc index a62d606d..01680456 100644 --- a/libwdi/libwdi.rc +++ b/libwdi/libwdi.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,727,0 - PRODUCTVERSION 1,3,727,0 + FILEVERSION 1,3,728,0 + PRODUCTVERSION 1,3,728,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,13 +68,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "libwdi: Windows Driver Installer Library" - VALUE "FileVersion", "1.3.727" + VALUE "FileVersion", "1.3.728" VALUE "InternalName", "libwdi" VALUE "LegalCopyright", "© 2010-2017 Pete Batard (LGPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/lesser.html" VALUE "OriginalFilename", "libwdi" VALUE "ProductName", "libwdi" - VALUE "ProductVersion", "1.3.727" + VALUE "ProductVersion", "1.3.728" VALUE "Comments", "http://libwdi.akeo.ie" END END diff --git a/libwdi/pki.c b/libwdi/pki.c index 19d23434..3bc90404 100644 --- a/libwdi/pki.c +++ b/libwdi/pki.c @@ -35,6 +35,7 @@ #include "mssign32.h" #include +#include "msapi_utf8.h" #include "installer.h" #include "libwdi.h" #include "logging.h" @@ -1224,13 +1225,9 @@ static BOOL GetFullPath(LPCSTR szSrc, LPSTR szDst, DWORD dwDstSize) if ((szSrcCopy = (LPSTR)malloc(strlen(szSrc) + 1)) == NULL) return 1; memcpy(szSrcCopy, szSrc, strlen(szSrc) + 1); HandleSeparators(szSrcCopy); - r = GetFullPathNameA(szSrcCopy, (DWORD)dwDstSize, szDst, NULL); + r = GetFullPathNameU(szSrcCopy, (DWORD)dwDstSize, szDst, NULL); free(szSrcCopy); - if ((r != 0) && (r <= dwDstSize)) { - return TRUE; - } - fprintf(stderr, "Unable to get full path for '%s'.\n", szSrc); - return FALSE; + return ((r != 0) && (r <= dwDstSize)); } // Modified from http://www.zemris.fer.hr/predmeti/os1/misc/Unix2Win.htm @@ -1352,6 +1349,7 @@ BOOL CreateCat(LPCSTR szCatPath, LPCSTR szHWID, LPCSTR szSearchDir, LPCSTR* szFi // Setup the hash file members if (!GetFullPath(szSearchDir, szInitialDir, sizeof(szInitialDir))) { + wdi_warn("Unable to get full path for '%s'.\n", szSearchDir); goto out; } // Make sure the list entries are all lowercase