Author: mpiulachs
Date: Thu Jun 26 18:49:42 2008
New Revision: 34118
URL:
http://svn.reactos.org/svn/reactos?rev=34118&view=rev
Log:
- 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.h…
Modified:
trunk/reactos/dll/win32/setupapi/install.c
Modified: trunk/reactos/dll/win32/setupapi/install.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/install…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/install.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/install.c [iso-8859-1] Thu Jun 26 18:49:42 2008
@@ -29,6 +29,7 @@
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 @@
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;
@@ -919,6 +922,11 @@
if (SetupGetFieldCount(&Context) >= 2)
{
if (!SetupGetIntField(&Context, 2, &LinkAttributes))
+ goto cleanup;
+ }
+ if (SetupGetFieldCount(&Context) >= 3)
+ {
+ if (!SetupGetIntField(&Context, 3, &LinkFolder))
goto cleanup;
}
@@ -1054,6 +1062,8 @@
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))
hr = IShellLinkW_SetIconLocation(psl, FullIconName, IconIdx);
@@ -1076,10 +1086,15 @@
{
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 @@
wcscat(FullLinkName, BackSlash);
}
wcscat(FullLinkName, LinkName);
+ wcscat(FullLinkName, DotLnk);
hr = IPersistFile_Save(ppf, FullLinkName, TRUE);
}
else