From 69f86788f8f8aadd2f60bd643ff42c0b505d207a Mon Sep 17 00:00:00 2001 From: Marc Piulachs Date: Thu, 26 Jun 2008 23:49:42 +0000 Subject: [PATCH] - small fix to create valid shortcuts when using the [ProfileItems] directive - Add support for a third undocumented parameter to Name entry. reference http://www.msfn.org/board/Using-INF-file-to-create-shortcuts-anywh-t95621.html svn path=/trunk/; revision=34118 --- reactos/dll/win32/setupapi/install.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/setupapi/install.c b/reactos/dll/win32/setupapi/install.c index e0b2d2d5f52..a1bf52e57a6 100644 --- a/reactos/dll/win32/setupapi/install.c +++ b/reactos/dll/win32/setupapi/install.c @@ -29,6 +29,7 @@ static const WCHAR GroupOrderListKey[] = {'S','Y','S','T','E','M','\\','C','u',' static const WCHAR InfDirectory[] = {'i','n','f','\\',0}; static const WCHAR OemFileMask[] = {'o','e','m','*','.','i','n','f',0}; static const WCHAR OemFileSpecification[] = {'o','e','m','%','l','u','.','i','n','f',0}; +static const WCHAR DotLnk[] = {'.','l','n','k',0}; static const WCHAR DependenciesKey[] = {'D','e','p','e','n','d','e','n','c','i','e','s',0}; static const WCHAR DescriptionKey[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; @@ -888,7 +889,9 @@ profile_items_callback( INFCONTEXT Context; LPWSTR LinkSubDir = NULL, LinkName = NULL; INT LinkAttributes = 0; + INT LinkFolder = 0; INT FileDirId = 0; + INT CSIDL = CSIDL_COMMON_PROGRAMS; LPWSTR FileSubDir = NULL; INT DirId = 0; LPWSTR SubDirPart = NULL, NamePart = NULL; @@ -921,6 +924,11 @@ profile_items_callback( if (!SetupGetIntField(&Context, 2, &LinkAttributes)) goto cleanup; } + if (SetupGetFieldCount(&Context) >= 3) + { + if (!SetupGetIntField(&Context, 3, &LinkFolder)) + goto cleanup; + } /* Read 'CmdLine' entry */ if (!SetupFindFirstLineW(hInf, SectionName, CmdLine, &Context)) @@ -1053,6 +1061,8 @@ profile_items_callback( /* Fill link properties */ if (SUCCEEDED(hr)) hr = IShellLinkW_SetPath(psl, FullFileName); + if (SUCCEEDED(hr)) + hr = IShellLinkW_SetArguments(psl, L""); if (SUCCEEDED(hr)) hr = IShellLinkW_SetWorkingDirectory(psl, FullWorkingDir); if (SUCCEEDED(hr)) @@ -1076,10 +1086,15 @@ profile_items_callback( { if (LinkAttributes & (FLG_PROFITEM_DELETE | FLG_PROFITEM_GROUP)) FIXME("Need to handle FLG_PROFITEM_DELETE and FLG_PROFITEM_GROUP\n"); + if (LinkAttributes & FLG_PROFITEM_CSIDL) + CSIDL = LinkFolder; + else if (LinkAttributes & FLG_PROFITEM_CURRENTUSER) + CSIDL = CSIDL_PROGRAMS; + if (SHGetSpecialFolderPathW( NULL, FullLinkName, - LinkAttributes & FLG_PROFITEM_CURRENTUSER ? CSIDL_PROGRAMS : CSIDL_COMMON_PROGRAMS, + CSIDL, TRUE)) { if (FullLinkName[wcslen(FullLinkName) - 1] != '\\') @@ -1091,6 +1106,7 @@ profile_items_callback( wcscat(FullLinkName, BackSlash); } wcscat(FullLinkName, LinkName); + wcscat(FullLinkName, DotLnk); hr = IPersistFile_Save(ppf, FullLinkName, TRUE); } else