fixing bug 173195 - Changes in the Mozilla/Netscape Installer to run Palm Conduit Installer. r=curt, sr=dveditz

This commit is contained in:
ssu%netscape.com 2002-11-14 09:04:16 +00:00
Родитель 3e21acf47b
Коммит 194639b404
23 изменённых файлов: 291 добавлений и 69 удалений

Просмотреть файл

@ -1,2 +0,0 @@
xpicleanup
Makefile

Просмотреть файл

@ -507,15 +507,23 @@ if(verifyDiskSpace(fProgram, srDest))
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/xbl-marquee/");
/* Log files that are created after the installer is done, so they can be uninstalled */
logComment("Installing: " + fProgram + ".autoreg");
logComment("Installing: " + fProgram + "Xpcs Registry.dat");
logComment("Installing: " + fProgram + "xpcom.log");
logComment("Create Folder: " + fProgram + "components");
logComment("Installing: " + fProgram + "components\\xpti.dat");
logComment("Installing: " + fProgram + "components\\xptitemp.dat");
logComment("Installing: " + fProgram + "components\\compreg.dat");
logComment("Create Folder: " + fProgram + "chrome");
logComment("Installing: " + fProgram + "chrome\\installed-chrome.txt");
logComment("Installing: " + fProgram + "chrome\\chrome.rdf");
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo");
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\cookie");
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\cookie\\content");
logComment("Installing: " + fProgram + "chrome\\overlayinfo\\cookie\\content\\overlays.rdf");
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\inspector");
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\inspector\\content");
logComment("Installing: " + fProgram + "chrome\\overlayinfo\\inspector\\content\\overlays.rdf");
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\communicator");
logComment("Create Folder: " + fProgram + "chrome\\overlayinfo\\communicator\\content");
logComment("Installing: " + fProgram + "chrome\\overlayinfo\\communicator\\content\\overlays.rdf");

Просмотреть файл

@ -68,15 +68,20 @@ function createShortcuts()
var restrictedAccess;
var ikwDefined;
var folderQuickLaunchExists;
var filePalmSyncInstallExe;
var scDescPalmSyncInstall;
var scDescPalmSyncUninstall;
winreg = getWinRegistry();
fWindows = getFolder("Windows");
fProgram = getFolder("Program");
fTemp = fProgram + "$MainExeFile$";
fileExe = getFolder("file:///", fTemp);
scExeDesc = "Mail";
scParam = "-mail";
scFolderName = "$ProductName$";
winreg = getWinRegistry();
fWindows = getFolder("Windows");
fProgram = getFolder("Program");
fileExe = getFolder("Program", "$MainExeFile$");
filePalmSyncInstallExe = getFolder("Program", "PalmSyncInstall.exe");
scDescPalmSyncInstall = "Address Book Palm Sync Install";
scDescPalmSyncUninstall = "Address Book Palm Sync Uninstall";
scExeDesc = "Mail";
scParam = "-mail";
scFolderName = "$ProductName$";
if(winreg != null)
{
/* This will check to see if the user has restricted access or not.
@ -182,6 +187,13 @@ function createShortcuts()
/* create the shortcuts */
File.windowsShortcut(fileExe, fFolderPath, scExeDesc, fProgram, scParam, fileExe, 0);
// only create these two shortcuts if the files exist
if(File.exists(filePalmSyncInstallExe))
{
File.windowsShortcut(filePalmSyncInstallExe, fFolderPath, scDescPalmSyncInstall, fProgram, "", filePalmSyncInstallExe, 0);
File.windowsShortcut(filePalmSyncInstallExe, fFolderPath, scDescPalmSyncUninstall, fProgram, "/u", filePalmSyncInstallExe, 0);
}
//
// Disabled for now because mail does not have a different shortcut icon from Mozilla
//
@ -409,6 +421,13 @@ if(verifyDiskSpace(fProgram, srDest))
{
err = performInstall();
logComment("performInstall() returned: " + err);
if(err == SUCCESS)
{
// Log the uninstall command to run PalmSyncInstall.exe to uninstall itself.
// This needs to be logged after all the files have been installed.
logComment("Uninstall Command: \"" + fProgram + "PalmSyncInstall.exe\" /us");
}
}
else
cancelInstall(err);

Просмотреть файл

@ -1 +1,8 @@
module.rc
module.res
xpinstal.dll
xpinstal.exp
xpinstal.ilk
xpinstal.lib
xpinstal.pdb
Makefile

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1,26 +0,0 @@
deflate.h
infblock.h
infcodes.h
inffast.h
inftrees.h
infutil.h
zconf.h
zlib.h
zutil.h
adler32.c
compress.c
crc32.c
deflate.c
example.c
gzio.c
infblock.c
infcodes.c
inffast.c
inflate.c
inftrees.c
infutil.c
minigzip.c
trees.c
uncompr.c
zutil.c
Makefile

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1 +0,0 @@
Makefile

Просмотреть файл

@ -1 +1,14 @@
dialogs.pdb
extra.pdb
ifuncns.pdb
setup.exp
setup.ilk
setup.lib
setup.pdb
setup.res
shortcut.pdb
xpi.pdb
xpnethook.pdb
logging.pdb
nsescape.pdb
Makefile

Просмотреть файл

@ -767,6 +767,22 @@ void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize)
lpszDest[lstrlen(lpszDest) - 1] = '\0';
}
/* Function to copy strings safely.
* returns the amount of memory required (including NULL byte) if there's not enough
* else, it returns 0 for success.
*/
int MozCopyStr(LPSTR szSrc, LPSTR szDest, DWORD dwDestBufSize)
{
DWORD length = lstrlen(szSrc) + 1;
strncpy(szDest, szSrc, dwDestBufSize);
if(length > dwDestBufSize)
{
szDest[dwDestBufSize - 1] = '\0';
return(length);
}
return(0);
}
/* Function to locate the first non space character in a string,
* and return a pointer to it. */
LPSTR GetFirstNonSpace(LPSTR lpszString)

Просмотреть файл

@ -158,6 +158,7 @@ void UpdateSiteSelector(void);
DWORD GetAdditionalComponentsCount(void);
DWORD GetTotalArchivesToDownload();
void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize);
int MozCopyStr(LPSTR szSrc, LPSTR szDest, DWORD dwDestBufSize);
LPSTR GetFirstNonSpace(LPSTR lpszString);
int GetArgC(LPSTR lpszCommandLine);
LPSTR GetArgV(LPSTR lpszCommandLine,

Просмотреть файл

@ -1685,6 +1685,72 @@ DWORD GetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, LPSTR szReturnValue,
return(dwType);
}
LONG _CreateWinRegKey(HKEY hkRootKey,
LPSTR szKey,
BOOL bLogForUninstall,
BOOL bDnu,
BOOL bForceCreate)
{
HKEY hkResult;
LONG err = ERROR_SUCCESS;
DWORD dwDisp;
char szBuf[MAX_BUF];
char szRootKey[MAX_BUF_TINY];
if(!WinRegKeyExists(hkRootKey, szKey) || bForceCreate)
{
err = RegCreateKeyEx(hkRootKey, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkResult, &dwDisp);
/* log the win reg command */
if(((err == ERROR_SUCCESS) &&
bLogForUninstall &&
ParseRootKeyString(hkRootKey, szRootKey, sizeof(szRootKey))) || bForceCreate)
{
wsprintf(szBuf, "%s\\%s []", szRootKey, szKey);
UpdateInstallLog(KEY_CREATE_REG_KEY, szBuf, bDnu);
}
RegCloseKey(hkResult);
}
return(err);
}
LONG CreateWinRegKey(HKEY hkRootKey,
LPSTR szKey,
BOOL bLogForUninstall,
BOOL bDnu)
{
char szTempKeyPath[MAX_BUF];
char saveChar;
LPSTR pointerToBackslashChar = NULL;
LPSTR pointerToStrWalker = NULL;
if(MozCopyStr(szKey, szTempKeyPath, sizeof(szTempKeyPath)))
return(ERROR_BUFFER_OVERFLOW);
// Make sure that we create all the keys (starting from the root) that
// do not exist. We need to do this in order to log it for uninstall.
// If this was not done, then only the last key in the key path would be
// uninstalled.
RemoveBackSlash(szTempKeyPath);
pointerToStrWalker = szTempKeyPath;
while((pointerToBackslashChar = strstr(pointerToStrWalker, "\\")) != NULL)
{
saveChar = *pointerToBackslashChar;
*pointerToBackslashChar = '\0';
// Log the registry only if it was created here
_CreateWinRegKey(hkRootKey, szTempKeyPath, bLogForUninstall, bDnu, DO_NOT_LOG_IT);
*pointerToBackslashChar = saveChar;
pointerToStrWalker = &pointerToBackslashChar[1];
}
// Log the registry regardless if it was created here or not. If it was
// explicitly listed to be created, we should log for uninstall. This
// covers the case where the user deletes the uninstall log file from a
// previous build where a new install would not log the creation because
// it already exists.
return(_CreateWinRegKey(hkRootKey, szKey, bLogForUninstall, bDnu, LOG_IT));
}
void SetWinReg(HKEY hkRootKey,
LPSTR szKey,
BOOL bOverwriteKey,
@ -1698,31 +1764,17 @@ void SetWinReg(HKEY hkRootKey,
{
HKEY hkResult;
DWORD dwErr;
DWORD dwDisp;
BOOL bKeyExists;
BOOL bNameExists;
char szBuf[MAX_BUF];
char szRootKey[MAX_BUF_TINY];
/* We don't care if it failed or not because it could already exist. */
CreateWinRegKey(hkRootKey, szKey, bLogForUninstall, bDnu);
bKeyExists = WinRegKeyExists(hkRootKey, szKey);
bNameExists = WinRegNameExists(hkRootKey, szKey, szName);
dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_WRITE, &hkResult);
if(dwErr != ERROR_SUCCESS)
{
dwErr = RegCreateKeyEx(hkRootKey, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkResult, &dwDisp);
/* log the win reg command */
if(bLogForUninstall &&
ParseRootKeyString(hkRootKey, szRootKey, sizeof(szRootKey)))
{
wsprintf(szBuf, "%s\\%s []", szRootKey, szKey);
UpdateInstallLog(KEY_CREATE_REG_KEY, szBuf, bDnu);
}
}
dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_WRITE, &hkResult);
if(dwErr == ERROR_SUCCESS)
{
bNameExists = WinRegNameExists(hkRootKey, szKey, szName);
if((bNameExists == FALSE) ||
((bNameExists == TRUE) && (bOverwriteName == TRUE)))
{

Просмотреть файл

@ -66,6 +66,9 @@ typedef int PRInt32;
#define FILE_ALL_JS "all-proxy.js"
#define VR_DEFAULT_PRODUCT_NAME "Mozilla"
#define LOG_IT TRUE
#define DO_NOT_LOG_IT FALSE
#define NEXT_DLG 1
#define PREV_DLG 2
#define OTHER_DLG_1 3

Просмотреть файл

@ -1,3 +1,8 @@
.cvsignore
setuprsc.dll
setuprsc.ilk
setuprsc.lib
setuprsc.pdb
setuprsc.res
setuprsc.aps
Makefile

Просмотреть файл

@ -1 +1,9 @@
dialogs.pdb
extra.pdb
ifuncns.pdb
parser.pdb
rdi.pdb
uninstall.ilk
uninstall.pdb
uninstall.res
Makefile

Просмотреть файл

@ -285,22 +285,62 @@ void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize)
lpszDest[lstrlen(lpszDest) - 1] = '\0';
}
/* Function to copy strings safely.
* returns the amount of memory required (including NULL byte) if there's not enough
* else, it returns 0 for success.
*/
int MozCopyStr(LPSTR szSrc, LPSTR szDest, DWORD dwDestBufSize)
{
DWORD length = lstrlen(szSrc) + 1;
strncpy(szDest, szSrc, dwDestBufSize);
if(length > dwDestBufSize)
{
szDest[dwDestBufSize - 1] = '\0';
return(length);
}
return(0);
}
/* Function to locate the first non space character in a string,
* and return a pointer to it. */
LPSTR GetFirstNonSpace(LPSTR lpszString)
{
int i;
int iStrLength;
char* p = lpszString;
while (*p && isspace(*p))
p = CharNext(p);
iStrLength = lstrlen(lpszString);
if(*p == '\0') // null means end of string
return NULL;
for(i = 0; i < iStrLength; i++)
{
if(!isspace(lpszString[i]))
return(&lpszString[i]);
}
return p;
}
return(NULL);
/* Function to locate the first space character in a string,
* and return a pointer to it. */
LPSTR GetFirstSpace(LPSTR lpszString)
{
char* p = lpszString;
while (*p && !isspace(*p))
p = CharNext(p);
if (*p == '\0') // null means end of string
return NULL;
return p;
}
/* Function to locate the first character c in lpszString,
* and return a pointer to it. */
LPSTR MozStrChar(LPSTR lpszString, char c)
{
char* p = lpszString;
while (*p && (*p != c))
p = CharNext(p);
if (*p == '\0') // null means end of string
return NULL;
return p;
}
/* Function to return the argument count given a command line input

Просмотреть файл

@ -82,7 +82,10 @@ BOOL GetFileVersion(LPSTR szFile, verBlock *vbVersion);
BOOL CheckLegacy(HWND hDlg);
int CompareVersion(verBlock vbVersionOld, verBlock vbVersionNew);
void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize);
int MozCopyStr(LPSTR szSrc, LPSTR szDest, DWORD dwDestBufSize);
LPSTR GetFirstSpace(LPSTR lpszString);
LPSTR GetFirstNonSpace(LPSTR lpszString);
LPSTR MozStrChar(LPSTR lpszString, char c);
int GetArgC(LPSTR lpszCommandLine);
LPSTR GetArgV(LPSTR lpszCommandLine, int iIndex, LPSTR lpszDest, int iDestSize);
void ParseCommandLine(LPSTR lpszCmdLine);

Просмотреть файл

@ -40,5 +40,6 @@
#define KEY_RENAME_DIR "rename dir: "
#define KEY_WINDOWS_SHORTCUT "windows shortcut: "
#define KEY_WINDOWS_REGISTER_SERVER "windows register server: "
#define KEY_UNINSTALL_COMMAND "uninstall command: "
#endif

Просмотреть файл

@ -227,6 +227,76 @@ void DeleteWinRegValue(HKEY hkRootKey, LPSTR szKey, LPSTR szName)
}
}
void ParseForUninstallCommand(LPSTR szString, LPSTR szKeyStr, LPSTR szFile, DWORD dwFileBufSize, LPSTR szParam, DWORD dwParamBufSize)
{
LPSTR szFirstNonSpace;
LPSTR szBeginParamStr;
LPSTR szEndOfFilePath;
LPSTR szEndQuote;
char *cmdStart;
int length;
ZeroMemory(szFile, dwFileBufSize);
ZeroMemory(szParam, dwParamBufSize);
length = lstrlen(szString);
if(szString[length - 1] == '\n')
szString[length - 1] = '\0';
// get to the beginning of the command given an install log string
cmdStart = szString + lstrlen(szKeyStr);
if((szFirstNonSpace = GetFirstNonSpace(cmdStart)) != NULL)
{
if(*szFirstNonSpace == '\"')
{
++szFirstNonSpace;
// found a beginning quote, look for the ending quote now
if((szEndQuote = MozStrChar(szFirstNonSpace, '\"')) != NULL)
{
// found ending quote. copy file path string *not* including the quotes
*szEndQuote = '\0';
MozCopyStr(szFirstNonSpace, szFile, dwFileBufSize);
// get the params substring now
if((szBeginParamStr = GetFirstNonSpace(++szEndQuote)) != NULL)
{
// the params string should be the first non space char after the
// quoted file path string to the end of the string.
MozCopyStr(szBeginParamStr, szParam, dwParamBufSize);
}
}
else
{
// could not find the ending quote. assume the _entire_ string is the file path
MozCopyStr(szFirstNonSpace, szFile, dwFileBufSize);
}
}
else
{
// no beginning quote found. file path is up to the first space character found
if((szEndOfFilePath = GetFirstSpace(szFirstNonSpace)) != NULL)
{
// found the first space char
*szEndOfFilePath = '\0';
MozCopyStr(szFirstNonSpace, szFile, dwFileBufSize);
// get the params substring now
if((szBeginParamStr = GetFirstNonSpace(++szEndOfFilePath)) != NULL)
{
// the params string should be the first non space char after the
// quoted file path string to the end of the string.
MozCopyStr(szBeginParamStr, szParam, dwParamBufSize);
}
}
else
{
// no space char found. assume the _entire_ string is the file path
MozCopyStr(szFirstNonSpace, szFile, dwFileBufSize);
}
}
}
}
void ParseForFile(LPSTR szString, LPSTR szKeyStr, LPSTR szFile, DWORD dwShortFilenameBufSize)
{
int iLen;
@ -498,6 +568,7 @@ DWORD Uninstall(sil* silInstallLogHead)
char szRootKey[MAX_BUF];
char szName[MAX_BUF];
char szFile[MAX_BUF];
char szParams[MAX_BUF];
HKEY hkRootKey;
if(silInstallLogHead != NULL)
@ -613,6 +684,14 @@ DWORD Uninstall(sil* silInstallLogHead)
ParseForCopyFile(szSubStr, KEY_COPY_FILE, szFile, sizeof(szFile));
DeleteOrDelayUntilReboot(szFile);
}
else if(((szSubStr = strstr(szLCLine, KEY_UNINSTALL_COMMAND)) != NULL) &&
(strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL))
{
ParseForUninstallCommand(szSubStr, KEY_UNINSTALL_COMMAND, szFile, sizeof(szFile), szParams, sizeof(szParams));
//execute szFile with szParams here!
if(FileExists(szFile))
WinSpawn(szFile, szParams, NULL, SW_HIDE, TRUE);
}
ProcessWindowsMessages();
} while(silInstallLogTemp != silInstallLogHead);

Просмотреть файл

@ -33,6 +33,7 @@ DWORD Uninstall(sil* silFile);
void ParseForFile(LPSTR szString, LPSTR szKey, LPSTR szFile, DWORD dwShortFilenameBufSize);
void ParseForCopyFile(LPSTR szString, LPSTR szKeyStr, LPSTR szFile, DWORD dwShortFilenameBufSize);
void ParseForWinRegInfo(LPSTR szString, LPSTR szKeyStr, LPSTR szRootKey, DWORD dwRootKeyBufSize, LPSTR szKey, DWORD dwKeyBufSize, LPSTR szName, DWORD dwNameBufSize);
void ParseForUninstallCommand(LPSTR szString, LPSTR szKeyStr, LPSTR szFile, DWORD dwFileBufSize, LPSTR szParam, DWORD dwParamBufSize);
void DeleteWinRegKey(HKEY hkRootKey, LPSTR szKey, BOOL bAbsoluteDelete);
void DeleteWinRegValue(HKEY hkRootKey, LPSTR szKey, LPSTR szName);
DWORD GetLogFile(LPSTR szTargetPath, LPSTR szInFilename, LPSTR szOutBuf, DWORD dwOutBufSize);