Author: weiden
Date: Wed Jul 11 22:49:01 2007
New Revision: 27595
URL:
http://svn.reactos.org/svn/reactos?rev=27595&view=rev
Log:
Set a working directory for the start menu items
Modified:
trunk/reactos/dll/win32/syssetup/install.c
Modified: trunk/reactos/dll/win32/syssetup/install.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/install…
==============================================================================
--- trunk/reactos/dll/win32/syssetup/install.c (original)
+++ trunk/reactos/dll/win32/syssetup/install.c Wed Jul 11 22:49:01 2007
@@ -148,6 +148,10 @@
LPTSTR p = path;
TCHAR szSystemPath[MAX_PATH];
TCHAR szProgramPath[MAX_PATH];
+ TCHAR szWorkingDir[MAX_PATH];
+ LPTSTR lpWorkingDir = NULL;
+ LPTSTR lpFilePart;
+ DWORD dwLen;
if (bCheckExistence)
{
@@ -178,7 +182,31 @@
if (!LoadString(hDllInstance, nIdTitle, title, sizeof(title)/sizeof(title[0])))
return FALSE;
- return SUCCEEDED(CreateShellLink(path, command, _T(""), NULL, NULL, 0,
title));
+ dwLen = GetFullPathName(path,
+ sizeof(szWorkingDir) / sizeof(szWorkingDir[0]),
+ szWorkingDir,
+ &lpFilePart);
+ if (dwLen != 0 && dwLen <= sizeof(szWorkingDir) /
sizeof(szWorkingDir[0]))
+ {
+ /* Successfully determined the file path */
+
+ if (lpFilePart != NULL)
+ {
+ /* We're only interested in the path. Cut the file name off.
+ Also remove the trailing backslash unless the working directory
+ is only going to be a drive, ie. C:\ */
+ *(lpFilePart--) = _T('\0');
+ if (!(lpFilePart - szWorkingDir == 2 && szWorkingDir[1] ==
_T(':') &&
+ szWorkingDir[2] == _T('\\')))
+ {
+ *lpFilePart = _T('\0');
+ }
+ }
+
+ lpWorkingDir = szWorkingDir;
+ }
+
+ return SUCCEEDED(CreateShellLink(path, command, _T(""), lpWorkingDir, NULL,
0, title));
}