On Tue, 2022-02-22 at 18:35 -0500, Mohamad Al-Jaf wrote:
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)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.