From 6665e83c184dd41ada7b02fbf2384c29fc960f4e Mon Sep 17 00:00:00 2001 From: "dprice%netscape.com" Date: Tue, 30 Apr 2002 09:07:00 +0000 Subject: [PATCH] 139641 r-ssu sr=dveditz allow the windows installer to use filenames from keys in the registry git-svn-id: svn://10.0.0.236/trunk@120292 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpinstall/wizard/windows/setup/extra.c | 42 ++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/mozilla/xpinstall/wizard/windows/setup/extra.c b/mozilla/xpinstall/wizard/windows/setup/extra.c index b465ed372e5..a51e15f3155 100644 --- a/mozilla/xpinstall/wizard/windows/setup/extra.c +++ b/mozilla/xpinstall/wizard/windows/setup/extra.c @@ -6217,16 +6217,19 @@ HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize) char szKey[MAX_BUF]; char szName[MAX_BUF]; char szValue[MAX_BUF]; + char szLookupSection[MAX_BUF]; char szWRMSCurrentVersion[] = "Software\\Microsoft\\Windows\\CurrentVersion"; char szWRMSShellFolders[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"; char szWRMSMapGroup[] = "Software\\Microsoft\\Windows\\CurrentVersion\\GrpConv\\MapGroup"; - + HKEY hkeyRoot; /* zero out the memory allocations */ - ZeroMemory(szBuf, sizeof(szBuf)); - ZeroMemory(szKey, sizeof(szKey)); - ZeroMemory(szName, sizeof(szName)); - ZeroMemory(szValue, sizeof(szValue)); + ZeroMemory(szBuf, sizeof(szBuf)); + ZeroMemory(szKey, sizeof(szKey)); + ZeroMemory(szName, sizeof(szName)); + ZeroMemory(szValue, sizeof(szValue)); + ZeroMemory(szBuf2, sizeof(szBuf2)); + ZeroMemory(szLookupSection, sizeof(szLookupSection)); if(lstrcmpi(szVariable, "PROGRAMFILESDIR") == 0) { @@ -6594,6 +6597,35 @@ HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize) wsprintf(szVariable, "Software\\%s\\%s\\%s", sgProduct.szCompanyName, sgProduct.szProductNamePrevious, szBuf); } + else if(szVariable[0] == '$') + { + // the $ indicates that there's another section that defines a lookup for this string. + // find that section to get the registry information, lookup the proper value and + // stick it into szVariable + wsprintf(szLookupSection,"Path Lookup %s",szVariable); + + GetPrivateProfileString(szLookupSection, "Path Reg Key Root", "", szBuf, sizeof(szBuf), szFileIniConfig); + if(*szBuf == '\0') + return(FALSE); + hkeyRoot = ParseRootKey(szBuf); + + GetPrivateProfileString(szLookupSection, "Path Reg Key", "", szKey, sizeof(szKey), szFileIniConfig); + + GetPrivateProfileString(szLookupSection, "Path Reg Name", "", szName, sizeof(szName), szFileIniConfig); + + GetWinReg(hkeyRoot, szKey, szName, szBuf, sizeof(szBuf)); + + GetPrivateProfileString(szLookupSection, "Strip Filename", "", szBuf2, sizeof(szBuf2), szFileIniConfig); + if(lstrcmpi(szBuf2, "TRUE") == 0) + { + ParsePath(szBuf, szVariable, dwVariableSize, FALSE, PP_PATH_ONLY); + RemoveBackSlash(szVariable); + } + else + { + lstrcpy(szVariable,szBuf); + } + } else return(FALSE);