use parent of windows directory as "program files" directory, if no program

files directory exists
bug 238133 r=dveditz sr=roc
This commit is contained in:
cbiesinger%web.de 2004-04-26 12:48:11 +00:00
parent 368c5f07f7
commit 5f4e7cb5b0
2 changed files with 30 additions and 0 deletions

View File

@ -7948,11 +7948,31 @@ HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize)
{
/* parse for the "c:\Program Files" directory */
GetWinReg(HKEY_LOCAL_MACHINE, szWRMSCurrentVersion, "ProgramFilesDir", szVariable, dwVariableSize);
/* see if that failed */
if (*szVariable == 0)
{
char* backslash;
/* Use the parent of the windows directory */
GetWindowsDirectory(szVariable, dwVariableSize);
backslash = strrchr(szVariable, '\\');
if (backslash)
*backslash = 0;
}
}
else if(lstrcmpi(szVariable, "PROGRAMFILESPATH") == 0)
{
/* parse for the "\Program Files" directory -- NOTE does not include the drive letter */
GetWinReg(HKEY_LOCAL_MACHINE, szWRMSCurrentVersion, "ProgramFilesDir", szBuf, sizeof(szBuf));
/* see if that failed */
if (*szBuf == 0)
{
char* backslash;
/* Use the parent of the windows directory */
GetWindowsDirectory(szBuf, sizeof(szBuf));
backslash = strrchr(szBuf, '\\');
if (backslash)
*backslash = 0;
}
lstrcpy(szVariable, szBuf+2);
}
else if(lstrcmpi(szVariable, "INSTALLDRIVE") == 0)

View File

@ -2202,6 +2202,16 @@ HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize)
{
/* parse for the "c:\Program Files" directory */
GetWinReg(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", "ProgramFilesDir", szVariable, dwVariableSize);
/* see if that failed */
if (*szVariable == 0)
{
char* backslash;
/* Use the parent of the windows directory */
GetWindowsDirectory(szVariable, dwVariableSize);
backslash = strrchr(szVariable, '\\');
if (backslash)
*backslash = 0;
}
}
else if(lstrcmpi(szVariable, "COMMONFILESDIR") == 0)
{