From f389b01bbef5ac979d6e232a6b5fbbc34fc0be7a Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 22 Oct 2008 17:19:39 -0500 Subject: [PATCH] setupapi: support SubDir entry in ProfileItems sections --- dlls/setupapi/install.c | 11 +++++++++-- dlls/setupapi/tests/install.c | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c index aa0c6cb..c9992ff 100644 --- a/dlls/setupapi/install.c +++ b/dlls/setupapi/install.c @@ -86,6 +86,7 @@ static const WCHAR UnregisterDlls[] = {'U','n','r','e','g','i','s','t','e','r', static const WCHAR ProfileItems[] = {'P','r','o','f','i','l','e','I','t','e','m','s',0}; static const WCHAR Name[] = {'N','a','m','e',0}; static const WCHAR CmdLine[] = {'C','m','d','L','i','n','e',0}; +static const WCHAR SubDir[] = {'S','u','b','D','i','r',0}; static const WCHAR WineFakeDlls[] = {'W','i','n','e','F','a','k','e','D','l','l','s',0}; static const WCHAR DisplayName[] = {'D','i','s','p','l','a','y','N','a','m','e',0}; static const WCHAR Description[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; @@ -827,7 +828,7 @@ static LPWSTR join_stringsW(DWORD count, ...) static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg ) { - LPWSTR name=NULL, lnkpath=NULL, cmdline=NULL; + LPWSTR name=NULL, lnkpath=NULL, cmdline=NULL, subdir=NULL; WCHAR lnkdir[MAX_PATH]; INFCONTEXT context; IShellLinkW* shelllink=NULL; @@ -877,8 +878,11 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg ) return TRUE; } + subdir = dup_section_line_field( hinf, field, SubDir, 1 ); + TRACE( "name: %s\n", debugstr_w(name) ); TRACE( "cmdline: %s\n", debugstr_w(cmdline) ); + TRACE( "subdir: %s\n", debugstr_w(subdir) ); CoInitialize(NULL); @@ -893,7 +897,9 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg ) SHGetFolderPathW( NULL, CSIDL_COMMON_PROGRAMS, NULL, SHGFP_TYPE_CURRENT, lnkdir ); - lnkpath = join_stringsW( 4, lnkdir, pathsepW(lnkdir), name, dotlnk ); + lnkpath = join_stringsW( 6, lnkdir, pathsepW(lnkdir), subdir, pathsepW(subdir), name, dotlnk ); + + SHPathPrepareForWriteW( NULL, NULL, lnkpath, SHPPFW_DIRCREATE|SHPPFW_IGNOREFILENAME ); if (SUCCEEDED(IShellLinkW_QueryInterface( shelllink, &IID_IPersistFile, (LPVOID*)&persistfile))) { @@ -907,6 +913,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg ) HeapFree( GetProcessHeap(), 0, name ); HeapFree( GetProcessHeap(), 0, cmdline ); HeapFree( GetProcessHeap(), 0, lnkpath ); + HeapFree( GetProcessHeap(), 0, subdir ); IShellLinkW_Release( shelllink ); diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c index daa4661..d2e6ddf 100644 --- a/dlls/setupapi/tests/install.c +++ b/dlls/setupapi/tests/install.c @@ -429,9 +429,9 @@ static void test_profile_items(void) else { snprintf(path, MAX_PATH, "%s\\TestDir", commonprogs); - todo_wine ok(INVALID_FILE_ATTRIBUTES != GetFileAttributes(path), "directory not created\n"); + ok(INVALID_FILE_ATTRIBUTES != GetFileAttributes(path), "directory not created\n"); snprintf(path, MAX_PATH, "%s\\TestDir\\TestItem2.lnk", commonprogs); - todo_wine ok(INVALID_FILE_ATTRIBUTES != GetFileAttributes(path), "link not created\n"); + ok(INVALID_FILE_ATTRIBUTES != GetFileAttributes(path), "link not created\n"); } snprintf(path, MAX_PATH, "%s\\TestItem.lnk", commonprogs); -- 1.5.6.3