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@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);
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- v2: Use const for dirs. --- programs/wusa/main.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c index de8387cd575..da0e18e73de 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,6 +489,17 @@ static BOOL strbuf_append(struct strbuf *buf, const WCHAR *str, DWORD len)
static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *key) { + const WCHAR common_dir[] = L"C:\Program Files\Common Files"; + const WCHAR common_x86_dir[] = L"C:\Program Files (x86)\Common Files"; + const WCHAR data_dir[] = L"C:\ProgramData"; + const WCHAR drivers_dir[] = L"C:\windows\system32\drivers"; + const WCHAR files_dir[] = L"C:\Program Files"; + const WCHAR files_x86_dir[] = L"C:\Program Files (x86)"; + const WCHAR fonts_dir[] = L"C:\windows\Fonts"; + const WCHAR inf_dir[] = L"C:\windows\inf"; + const WCHAR wbem_dir[] = L"C:\windows\system32\wbem"; + + const WCHAR *dir = NULL; WCHAR path[MAX_PATH];
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; }
On Tue, 2022-02-22 at 18:35 -0500, Mohamad Al-Jaf wrote:
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com
v2: Use const for dirs.
programs/wusa/main.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c index de8387cd575..da0e18e73de 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,6 +489,17 @@ static BOOL strbuf_append(struct strbuf *buf, const WCHAR *str, DWORD len)
static WCHAR *lookup_expression(struct assembly_entry *assembly, const WCHAR *key) {
- const WCHAR common_dir[] = L"C:\Program Files\Common Files";
- const WCHAR common_x86_dir[] = L"C:\Program Files (x86)\Common Files";
- const WCHAR data_dir[] = L"C:\ProgramData";
- const WCHAR drivers_dir[] = L"C:\windows\system32\drivers";
- const WCHAR files_dir[] = L"C:\Program Files";
- const WCHAR files_x86_dir[] = L"C:\Program Files (x86)";
- const WCHAR fonts_dir[] = L"C:\windows\Fonts";
- const WCHAR inf_dir[] = L"C:\windows\inf";
- const WCHAR wbem_dir[] = L"C:\windows\system32\wbem"
These paths should be looked up like runtime.system32 and runtime.windows. The (x86) versions should probably be recognized only on 64-bit.
Hi Hans,
Thanks for the feedback. I was able to look up the paths for some of those directories, but not for inf, drivers and wbem. I've submitted the revision. And for x86, you're right, they should probably be recognized on 64-bit only.
-- Kind regards, Mohamad