mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Create "Program Files" directory and store its location in the registry.
Not sure if this is the correct place to implement it, feel free to move around. svn path=/trunk/; revision=11287
This commit is contained in:
parent
218066682a
commit
e2e8956ca7
3 changed files with 60 additions and 2 deletions
|
@ -43,4 +43,5 @@ BEGIN
|
|||
IDS_CACHE "Local Settings\\Temporary Internet Files"
|
||||
IDS_HISTORY "Local Settings\\History"
|
||||
IDS_COOKIES "Cookies"
|
||||
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
|
||||
END
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: resources.h,v 1.1 2004/10/08 11:52:30 ekohl Exp $
|
||||
/* $Id: resources.h,v 1.2 2004/10/13 18:14:07 gvg Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -48,5 +48,6 @@
|
|||
#define IDS_CACHE 21
|
||||
#define IDS_HISTORY 22
|
||||
#define IDS_COOKIES 23
|
||||
#define IDS_PROGRAMFILES 24
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: setup.c,v 1.11 2004/10/10 18:28:05 ekohl Exp $
|
||||
/* $Id: setup.c,v 1.12 2004/10/13 18:14:07 gvg Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -540,6 +540,62 @@ InitializeProfiles (VOID)
|
|||
|
||||
RegCloseKey(hKey);
|
||||
|
||||
/* Load 'Program Files' location */
|
||||
if (!LoadString(hInstance,
|
||||
IDS_PROGRAMFILES,
|
||||
szBuffer,
|
||||
MAX_PATH))
|
||||
{
|
||||
DPRINT1("Error: %lu\n", GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Expand it */
|
||||
if (!ExpandEnvironmentStringsW (szBuffer,
|
||||
szProfilesPath,
|
||||
MAX_PATH))
|
||||
{
|
||||
DPRINT1("Error: %lu\n", GetLastError());
|
||||
RegCloseKey (hKey);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Store it */
|
||||
if (RegOpenKeyExW (HKEY_LOCAL_MACHINE,
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
&hKey))
|
||||
{
|
||||
DPRINT1("Error: %lu\n", GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dwLength = (wcslen (szProfilesPath) + 1) * sizeof(WCHAR);
|
||||
if (RegSetValueExW (hKey,
|
||||
L"ProgramFilesDir",
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)szProfilesPath,
|
||||
dwLength))
|
||||
{
|
||||
DPRINT1("Error: %lu\n", GetLastError());
|
||||
RegCloseKey (hKey);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RegCloseKey (hKey);
|
||||
|
||||
/* Create directory */
|
||||
if (!CreateDirectoryW (szProfilesPath, NULL))
|
||||
{
|
||||
if (GetLastError () != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
DPRINT1("Error: %lu\n", GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DPRINT("Success\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue