[PATCH resend 1/2] wusa: Use case insensitive comparison for expressions.
Some update packages use both lowercase and uppercase names for expressions. For example, Microsoft-Windows-MediaFeaturePack-OOB-Package_x64.msu uses both Runtime and runtime for expressions. Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> --- programs/wusa/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/programs/wusa/main.c b/programs/wusa/main.c index d1bb385cd06..de8387cd575 100644 --- a/programs/wusa/main.c +++ b/programs/wusa/main.c @@ -480,10 +480,10 @@ static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *ke { WCHAR path[MAX_PATH]; - if (!wcscmp(key, L"runtime.system32")) + if (!wcsicmp(key, L"runtime.system32")) { #ifdef __x86_64__ - if (!wcscmp(assembly->identity.architecture, L"x86")) + if (!wcsicmp(assembly->identity.architecture, L"x86")) { GetSystemWow64DirectoryW(path, ARRAY_SIZE(path)); return strdupW(path); @@ -492,7 +492,7 @@ static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *ke GetSystemDirectoryW(path, ARRAY_SIZE(path)); return strdupW(path); } - if (!wcscmp(key, L"runtime.windows")) + if (!wcsicmp(key, L"runtime.windows")) { GetWindowsDirectoryW(path, ARRAY_SIZE(path)); return strdupW(path); -- 2.35.1
This allows more update packages to install. Example: Microsoft-Windows-MediaFeaturePack-OOB-Package_x64.msu. Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> --- programs/wusa/main.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/programs/wusa/main.c b/programs/wusa/main.c index de8387cd575..d68ade82cd6 100644 --- a/programs/wusa/main.c +++ b/programs/wusa/main.c @@ -242,6 +242,17 @@ static INT_PTR CDECL cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION } } +static DWORD copy_filename( const WCHAR *name, WCHAR *buffer, DWORD len ) +{ + UINT ret = lstrlenW( name ) + 1; + if (buffer && len >= ret) + { + lstrcpyW( buffer, name ); + ret--; + } + return ret; +} + static BOOL extract_cabinet(const WCHAR *filename, const WCHAR *destination) { char *filenameA = NULL; @@ -478,7 +489,18 @@ static BOOL strbuf_append(struct strbuf *buf, const WCHAR *str, DWORD len) static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *key) { + WCHAR common_dir[] = L"C:\\Program Files\\Common Files"; + WCHAR common_x86_dir[] = L"C:\\Program Files (x86)\\Common Files"; + WCHAR data_dir[] = L"C:\\ProgramData"; + WCHAR drivers_dir[] = L"C:\\windows\\system32\\drivers"; + WCHAR files_dir[] = L"C:\\Program Files"; + WCHAR files_x86_dir[] = L"C:\\Program Files (x86)"; + WCHAR fonts_dir[] = L"C:\\windows\\Fonts"; + WCHAR inf_dir[] = L"C:\\windows\\inf"; + WCHAR wbem_dir[] = L"C:\\windows\\system32\\wbem"; + WCHAR path[MAX_PATH]; + WCHAR *dir = NULL; if (!wcsicmp(key, L"runtime.system32")) { @@ -498,6 +520,22 @@ static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *ke return strdupW(path); } + if (!wcsicmp(key, L"runtime.commonFiles")) dir = common_dir; + else if (!wcsicmp(key, L"runtime.commonFilesX86")) dir = common_x86_dir; + else if (!wcsicmp(key, L"runtime.programData")) dir = data_dir; + else if (!wcsicmp(key, L"runtime.drivers")) dir = drivers_dir; + else if (!wcsicmp(key, L"runtime.programFiles")) dir = files_dir; + else if (!wcsicmp(key, L"runtime.programFilesX86")) dir = files_x86_dir; + else if (!wcsicmp(key, L"runtime.fonts")) dir = fonts_dir; + else if (!wcsicmp(key, L"runtime.inf")) dir = inf_dir; + else if (!wcsicmp(key, L"runtime.wbem")) dir = wbem_dir; + + if (dir) + { + copy_filename(dir, path, ARRAY_SIZE(path)); + return strdupW(path); + } + FIXME("Unknown expression %s\n", debugstr_w(key)); return NULL; } -- 2.35.1
Hi, May I please have feedback for this patch? -- Kind regards, Mohamad
participants (1)
-
Mohamad Al-Jaf