mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 09:12:20 +00:00
- 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
This commit is contained in:
parent
37f33b89cb
commit
69f86788f8
1 changed files with 17 additions and 1 deletions
|
@ -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 InfDirectory[] = {'i','n','f','\\',0};
|
||||||
static const WCHAR OemFileMask[] = {'o','e','m','*','.','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 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 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};
|
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;
|
INFCONTEXT Context;
|
||||||
LPWSTR LinkSubDir = NULL, LinkName = NULL;
|
LPWSTR LinkSubDir = NULL, LinkName = NULL;
|
||||||
INT LinkAttributes = 0;
|
INT LinkAttributes = 0;
|
||||||
|
INT LinkFolder = 0;
|
||||||
INT FileDirId = 0;
|
INT FileDirId = 0;
|
||||||
|
INT CSIDL = CSIDL_COMMON_PROGRAMS;
|
||||||
LPWSTR FileSubDir = NULL;
|
LPWSTR FileSubDir = NULL;
|
||||||
INT DirId = 0;
|
INT DirId = 0;
|
||||||
LPWSTR SubDirPart = NULL, NamePart = NULL;
|
LPWSTR SubDirPart = NULL, NamePart = NULL;
|
||||||
|
@ -921,6 +924,11 @@ profile_items_callback(
|
||||||
if (!SetupGetIntField(&Context, 2, &LinkAttributes))
|
if (!SetupGetIntField(&Context, 2, &LinkAttributes))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
if (SetupGetFieldCount(&Context) >= 3)
|
||||||
|
{
|
||||||
|
if (!SetupGetIntField(&Context, 3, &LinkFolder))
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* Read 'CmdLine' entry */
|
/* Read 'CmdLine' entry */
|
||||||
if (!SetupFindFirstLineW(hInf, SectionName, CmdLine, &Context))
|
if (!SetupFindFirstLineW(hInf, SectionName, CmdLine, &Context))
|
||||||
|
@ -1053,6 +1061,8 @@ profile_items_callback(
|
||||||
/* Fill link properties */
|
/* Fill link properties */
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
hr = IShellLinkW_SetPath(psl, FullFileName);
|
hr = IShellLinkW_SetPath(psl, FullFileName);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
hr = IShellLinkW_SetArguments(psl, L"");
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
hr = IShellLinkW_SetWorkingDirectory(psl, FullWorkingDir);
|
hr = IShellLinkW_SetWorkingDirectory(psl, FullWorkingDir);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
|
@ -1076,10 +1086,15 @@ profile_items_callback(
|
||||||
{
|
{
|
||||||
if (LinkAttributes & (FLG_PROFITEM_DELETE | FLG_PROFITEM_GROUP))
|
if (LinkAttributes & (FLG_PROFITEM_DELETE | FLG_PROFITEM_GROUP))
|
||||||
FIXME("Need to handle FLG_PROFITEM_DELETE and FLG_PROFITEM_GROUP\n");
|
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(
|
if (SHGetSpecialFolderPathW(
|
||||||
NULL,
|
NULL,
|
||||||
FullLinkName,
|
FullLinkName,
|
||||||
LinkAttributes & FLG_PROFITEM_CURRENTUSER ? CSIDL_PROGRAMS : CSIDL_COMMON_PROGRAMS,
|
CSIDL,
|
||||||
TRUE))
|
TRUE))
|
||||||
{
|
{
|
||||||
if (FullLinkName[wcslen(FullLinkName) - 1] != '\\')
|
if (FullLinkName[wcslen(FullLinkName) - 1] != '\\')
|
||||||
|
@ -1091,6 +1106,7 @@ profile_items_callback(
|
||||||
wcscat(FullLinkName, BackSlash);
|
wcscat(FullLinkName, BackSlash);
|
||||||
}
|
}
|
||||||
wcscat(FullLinkName, LinkName);
|
wcscat(FullLinkName, LinkName);
|
||||||
|
wcscat(FullLinkName, DotLnk);
|
||||||
hr = IPersistFile_Save(ppf, FullLinkName, TRUE);
|
hr = IPersistFile_Save(ppf, FullLinkName, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue