- Create Common Files directory when creating Program Files to match windows fresh install and add registry key for CommonFilesDir.

This prevents the key from being incorrectly set using an environment variable.

svn path=/trunk/; revision=40377
This commit is contained in:
Michael Martin 2009-04-05 20:05:40 +00:00
parent 4d50892aaa
commit 43bbef89b5
23 changed files with 63 additions and 0 deletions

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Ìåñòíè íàñòðîéêè\\Ïîñåòåíè"
IDS_COOKIES "Êóðàáèéêè"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -45,4 +45,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Lokale Einstellungen\\Verlauf"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Programme"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -50,4 +50,5 @@ BEGIN
IDS_HISTORY "Configuración local\\Historial"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Archivos de programa"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,5 +44,6 @@ BEGIN
IDS_HISTORY "Paikalliset Asetukset\\Historia"
IDS_COOKIES "Keksit"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Local Settings\\Historique"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -45,4 +45,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -38,4 +38,5 @@ BEGIN
IDS_HISTORY "Impostazioni locali\\Cronologia"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Programmi"
IDS_COMMONFILES "Common Files"
END

View file

@ -26,4 +26,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -46,4 +46,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Slapukai"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Local Settings\\Geschiedenis"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -47,4 +47,5 @@ BEGIN
IDS_HISTORY "Lokale innstillinger\\Logg"
IDS_COOKIES "Informasjonkapsel"
IDS_PROGRAMFILES "%SystemDrive%\\Programfiler"
IDS_COMMONFILES "Common Files"
END

View file

@ -49,4 +49,5 @@ BEGIN
IDS_HISTORY "Ustawienia lokalne\\Historia"
IDS_COOKIES "Ciasteczka"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -48,4 +48,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Lokala inställningar\\Tidigare"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "¡ÒõÑ駤èÒµÑé§µé¹\\»ÃÐÇѵÔãªé§Ò¹"
IDS_COOKIES "¤Ø¡¡Õé"
IDS_PROGRAMFILES "%SystemDrive%\\â»Ãá¡ÃÁä¿Åì"
IDS_COMMONFILES "Common Files"
END

View file

@ -44,4 +44,5 @@ BEGIN
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
IDS_PROGRAMFILES "%SystemDrive%\\Program Files"
IDS_COMMONFILES "Common Files"
END

View file

@ -49,5 +49,6 @@
#define IDS_HISTORY 22
#define IDS_COOKIES 23
#define IDS_PROGRAMFILES 24
#define IDS_COMMONFILES 25
/* EOF */

View file

@ -109,6 +109,7 @@ InitializeProfiles(VOID)
{
WCHAR szProfilesPath[MAX_PATH];
WCHAR szProfilePath[MAX_PATH];
WCHAR szCommonFilesDirPath[MAX_PATH];
WCHAR szBuffer[MAX_PATH];
DWORD dwLength;
PFOLDERDATA lpFolderData;
@ -584,6 +585,14 @@ InitializeProfiles(VOID)
return FALSE;
}
if (!LoadStringW(hInstance,
IDS_COMMONFILES,
szCommonFilesDirPath,
MAX_PATH))
{
DPRINT1("Warning: %lu\n", GetLastError());
}
/* Expand it */
if (!ExpandEnvironmentStringsW(szBuffer,
szProfilesPath,
@ -593,6 +602,17 @@ InitializeProfiles(VOID)
return FALSE;
}
wcscpy(szBuffer, szProfilesPath);
wcscat(szBuffer, L"\\");
wcscat(szBuffer, szCommonFilesDirPath);
if (!ExpandEnvironmentStringsW(szBuffer,
szCommonFilesDirPath,
MAX_PATH))
{
DPRINT1("Warning: %lu\n", GetLastError());
}
/* Store it */
Error = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
@ -621,6 +641,18 @@ InitializeProfiles(VOID)
return FALSE;
}
dwLength = (wcslen(szCommonFilesDirPath) + 1) * sizeof(WCHAR);
Error = RegSetValueExW(hKey,
L"CommonFilesDir",
0,
REG_SZ,
(LPBYTE)szCommonFilesDirPath,
dwLength);
if (Error != ERROR_SUCCESS)
{
DPRINT1("Warning: %lu\n", Error);
}
RegCloseKey (hKey);
/* Create directory */
@ -633,6 +665,15 @@ InitializeProfiles(VOID)
}
}
/* Create directory */
if (!CreateDirectoryW(szCommonFilesDirPath, NULL))
{
if (GetLastError () != ERROR_ALREADY_EXISTS)
{
DPRINT1("Warning: %lu\n", GetLastError());
}
}
DPRINT("Success\n");
return TRUE;