зеркало из https://github.com/mozilla/pjs.git
Continuing OS/2 wizard work - we are so close
This commit is contained in:
Родитель
1ab67af193
Коммит
ae152de16b
|
@ -61,7 +61,7 @@ BOOL AskCancelDlg(HWND hDlg)
|
|||
{
|
||||
GetPrivateProfileString("Strings", "Message Cancel Setup AUTO mode", "", szMsg, sizeof(szMsg), szFileIniConfig);
|
||||
ShowMessage(szMsg, TRUE);
|
||||
Delay(5);
|
||||
DosSleep(5000);
|
||||
ShowMessage(szMsg, FALSE);
|
||||
bRv = TRUE;
|
||||
}
|
||||
|
@ -735,20 +735,10 @@ MRESULT EXPENTRY DlgProcSetupType(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|||
break;
|
||||
|
||||
case IDC_README:
|
||||
if(*diSetupType.szReadmeApp != '\0') {
|
||||
STARTDATA startdata;
|
||||
PID pid;
|
||||
ULONG ulSessID;
|
||||
|
||||
memset(&startdata, 0, sizeof(STARTDATA));
|
||||
startdata.Length = sizeof(STARTDATA);
|
||||
startdata.PgmName = diSetupType.szReadmeApp;
|
||||
strcpy(szBuf, szSetupDir);
|
||||
AppendBackSlash(szBuf, sizeof(szBuf));
|
||||
strcat(szBuf, diSetupType.szReadmeFilename);
|
||||
startdata.PgmInputs = szBuf;
|
||||
DosStartSession(&startdata, &ulSessID, &pid); /* Start the session */
|
||||
}
|
||||
if(*diSetupType.szReadmeApp == '\0')
|
||||
WinSpawn(diSetupType.szReadmeFilename, NULL, szSetupDir, FALSE);
|
||||
else
|
||||
WinSpawn(diSetupType.szReadmeApp, diSetupType.szReadmeFilename, szSetupDir, FALSE);
|
||||
return (MRESULT)TRUE;
|
||||
break;
|
||||
|
||||
|
@ -2411,11 +2401,9 @@ void CommitInstall(void)
|
|||
|
||||
if(RetrieveArchives() == WIZ_OK)
|
||||
{
|
||||
#ifdef OLDCODE
|
||||
/* Check to see if Turbo is required. If so, set the
|
||||
* appropriate Windows registry keys */
|
||||
SetTurboArgs();
|
||||
#endif
|
||||
|
||||
if(gbDownloadTriggered || gbPreviousUnfinishedDownload)
|
||||
SetSetupState(SETUP_STATE_UNPACK_XPCOM);
|
||||
|
@ -2486,7 +2474,7 @@ void CommitInstall(void)
|
|||
ProcessProgramFolderShowCmd();
|
||||
|
||||
CleanupArgsRegistry();
|
||||
// CleanupPreviousVersionRegKeys();
|
||||
CleanupPreviousVersionINIKeys();
|
||||
if(NeedReboot())
|
||||
{
|
||||
CleanupXpcomFile();
|
||||
|
|
|
@ -79,7 +79,7 @@ void PrintError(PSZ szMsg, ULONG ulErrorCodeSH)
|
|||
else if(sgProduct.ulMode == AUTO)
|
||||
{
|
||||
ShowMessage(szErrorString, TRUE);
|
||||
Delay(5);
|
||||
DosSleep(5000);
|
||||
ShowMessage(szErrorString, FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -167,11 +167,6 @@ HRESULT NS_LoadString(HMODULE hInstance, ULONG ulID, PSZ szStringBuf, ULONG ulSt
|
|||
return(WIZ_OK);
|
||||
}
|
||||
|
||||
void Delay(ULONG ulSeconds)
|
||||
{
|
||||
DosSleep(ulSeconds * 1000);
|
||||
}
|
||||
|
||||
void UnsetSetupState(void)
|
||||
{
|
||||
char szApp[MAX_BUF_TINY];
|
||||
|
@ -1758,9 +1753,7 @@ HRESULT LaunchApps()
|
|||
}
|
||||
|
||||
LogISLaunchAppsComponent(siCObject->szDescriptionShort);
|
||||
#ifdef OLDCODE
|
||||
WinSpawn(szSpawnFile, szParameterBuf, szTempDir, SW_SHOWNORMAL, TRUE);
|
||||
#endif
|
||||
WinSpawn(szSpawnFile, szParameterBuf, szTempDir, TRUE);
|
||||
|
||||
if(siCObject->dwAttributes & SIC_UNCOMPRESS)
|
||||
FileDelete(szSpawnFile);
|
||||
|
@ -1798,14 +1791,6 @@ HRESULT ProcessOS2Integration()
|
|||
"DefaultWorkingDir",
|
||||
sgProduct.szPath);
|
||||
|
||||
#ifdef OLDCODE
|
||||
strcat(szSetupString, ";PARAMETERS=");
|
||||
strcat(szSetupString, pszDefaultParms);
|
||||
PrfWriteProfileString(HINI_USER,
|
||||
"WPURLDEFAULTSETTINGS",
|
||||
"DefaultParameters",
|
||||
pszDefaultParms);
|
||||
#endif
|
||||
if (hObjURL = WinCreateObject("WPUrl",
|
||||
"Temporary URL",
|
||||
szSetupString,
|
||||
|
@ -1884,44 +1869,40 @@ void DetermineOSVersionEx()
|
|||
UpdateInstallStatusLog(szBuf);
|
||||
}
|
||||
|
||||
#ifdef OLDCODE
|
||||
HRESULT WinSpawn(LPSTR szClientName, LPSTR szParameters, LPSTR szCurrentDir, int iShowCmd, BOOL bWait)
|
||||
HRESULT WinSpawn(LPSTR szClientName, LPSTR szParameters, LPSTR szCurrentDir, BOOL bWait)
|
||||
{
|
||||
SHELLEXECUTEINFO seInfo;
|
||||
|
||||
seInfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||
seInfo.fMask = SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_DDEWAIT | SEE_MASK_NOCLOSEPROCESS;
|
||||
seInfo.hwnd = hWndMain;
|
||||
seInfo.lpVerb = NULL;
|
||||
seInfo.lpFile = szClientName;
|
||||
seInfo.lpParameters = szParameters;
|
||||
seInfo.lpDirectory = szCurrentDir;
|
||||
seInfo.nShow = SW_SHOWNORMAL;
|
||||
seInfo.hInstApp = 0;
|
||||
seInfo.lpIDList = NULL;
|
||||
seInfo.lpClass = NULL;
|
||||
seInfo.hkeyClass = 0;
|
||||
seInfo.dwHotKey = 0;
|
||||
seInfo.hIcon = 0;
|
||||
seInfo.hProcess = 0;
|
||||
|
||||
if((ShellExecuteEx(&seInfo) != 0) && (seInfo.hProcess != NULL))
|
||||
{
|
||||
if(bWait)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
if(WaitForSingleObject(seInfo.hProcess, 200) == WAIT_OBJECT_0)
|
||||
break;
|
||||
|
||||
ProcessWindowsMessages();
|
||||
STARTDATA startdata;
|
||||
PID pid, endpid;
|
||||
ULONG ulSessID;
|
||||
APIRET rc;
|
||||
RESULTCODES resultcodes;
|
||||
ULONG ulFlags;
|
||||
|
||||
rc = DosQueryAppType(szClientName, &ulFlags);
|
||||
if (rc == NO_ERROR) {
|
||||
memset(&startdata, 0, sizeof(STARTDATA));
|
||||
startdata.Length = sizeof(STARTDATA);
|
||||
startdata.PgmName = szClientName;
|
||||
startdata.PgmInputs = szParameters;
|
||||
rc = DosStartSession(&startdata, &ulSessID, &pid);
|
||||
if (rc == NO_ERROR) {
|
||||
if (bWait) {
|
||||
DosWaitChild(DCWA_PROCESS, DCWW_NOWAIT, &resultcodes, &endpid, pid);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
return(TRUE);
|
||||
} else {
|
||||
CHAR szBuf[CCHMAXPATH];
|
||||
HOBJECT hobject;
|
||||
strcpy(szBuf, szCurrentDir);
|
||||
strcat(szBuf, szClientName);
|
||||
hobject = WinQueryObject(szBuf);
|
||||
WinSetFocus(HWND_DESKTOP, HWND_DESKTOP);
|
||||
WinOpenObject(hobject, 0, TRUE); // 0 = OPEN_DEFAULT
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT InitDlgWelcome(diW *diDialog)
|
||||
{
|
||||
|
@ -2867,7 +2848,7 @@ char *SiCNodeGetDescriptionLong(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwA
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
ULONGLONG SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag)
|
||||
unsigned long long SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag)
|
||||
{
|
||||
DWORD dwCount = 0;
|
||||
siC *siCTemp = siComponents;
|
||||
|
@ -2905,7 +2886,7 @@ ULONGLONG SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwA
|
|||
return(0L);
|
||||
}
|
||||
|
||||
ULONGLONG SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag)
|
||||
unsigned long long SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag)
|
||||
{
|
||||
DWORD dwCount = 0;
|
||||
siC *siCTemp = siComponents;
|
||||
|
@ -2943,7 +2924,7 @@ ULONGLONG SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisible, DWO
|
|||
return(0L);
|
||||
}
|
||||
|
||||
ULONGLONG SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag)
|
||||
unsigned long long SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag)
|
||||
{
|
||||
DWORD dwCount = 0;
|
||||
siC *siCTemp = siComponents;
|
||||
|
@ -3158,9 +3139,9 @@ void DsNodeDelete(dsN **dsNTemp)
|
|||
}
|
||||
|
||||
/* returns the value in kilobytes */
|
||||
ULONGLONG GetDiskSpaceRequired(DWORD dwType)
|
||||
unsigned long long GetDiskSpaceRequired(DWORD dwType)
|
||||
{
|
||||
ULONGLONG ullTotalSize = 0;
|
||||
unsigned long long ullTotalSize = 0;
|
||||
siC *siCTemp = siComponents;
|
||||
|
||||
if(siCTemp != NULL)
|
||||
|
@ -3239,12 +3220,12 @@ int LocateExistingPath(char *szPath, char *szExistingPath, DWORD dwExistingPathS
|
|||
}
|
||||
|
||||
/* returns the value in bytes */
|
||||
ULONGLONG GetDiskSpaceAvailable(LPSTR szPath)
|
||||
unsigned long long GetDiskSpaceAvailable(LPSTR szPath)
|
||||
{
|
||||
char szBuf[MAX_BUF];
|
||||
char szBuf2[MAX_BUF];
|
||||
FSALLOCATE fsAllocate;
|
||||
ULONGLONG nBytes = 0;
|
||||
unsigned long long nBytes = 0;
|
||||
APIRET rc;
|
||||
ULONG ulDriveNo;
|
||||
|
||||
|
@ -3277,7 +3258,7 @@ ULONGLONG GetDiskSpaceAvailable(LPSTR szPath)
|
|||
return nBytes;
|
||||
}
|
||||
|
||||
HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPSTR szPath, BOOL bCrutialMsg)
|
||||
HRESULT ErrorMsgDiskSpace(unsigned long long ullDSAvailable, unsigned long long ullDSRequired, LPSTR szPath, BOOL bCrutialMsg)
|
||||
{
|
||||
char szBuf0[MAX_BUF];
|
||||
char szBuf1[MAX_BUF];
|
||||
|
@ -3327,7 +3308,7 @@ HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPS
|
|||
else if(sgProduct.ulMode == AUTO)
|
||||
{
|
||||
ShowMessage(szBufMsg, TRUE);
|
||||
Delay(5);
|
||||
DosSleep(5000);
|
||||
ShowMessage(szBufMsg, FALSE);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -3335,7 +3316,7 @@ HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPS
|
|||
return(MBID_CANCEL);
|
||||
}
|
||||
|
||||
void UpdatePathDiskSpaceRequired(LPSTR szPath, ULONGLONG ullSize, dsN **dsnComponentDSRequirement)
|
||||
void UpdatePathDiskSpaceRequired(LPSTR szPath, unsigned long long ullSize, dsN **dsnComponentDSRequirement)
|
||||
{
|
||||
BOOL bFound = FALSE;
|
||||
dsN *dsnTemp = *dsnComponentDSRequirement;
|
||||
|
@ -3438,7 +3419,7 @@ HRESULT InitComponentDiskSpaceInfo(dsN **dsnComponentDSRequirement)
|
|||
|
||||
HRESULT VerifyDiskSpace()
|
||||
{
|
||||
ULONGLONG ullDSAvailable;
|
||||
unsigned long long ullDSAvailable;
|
||||
HRESULT hRetValue = FALSE;
|
||||
dsN *dsnTemp = NULL;
|
||||
|
||||
|
@ -4564,113 +4545,121 @@ void GetAlternateArchiveSearchPath(LPSTR lpszCmdLine)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL CheckForProcess(LPSTR szProcessName, DWORD dwProcessName)
|
||||
#define BUFMIN 8*1024
|
||||
#define BUFMAX 256*1024
|
||||
#define BUFDEFAULT 32*1024
|
||||
|
||||
BOOL CheckForProcess(PID pid, LPSTR szProcessName, DWORD dwProcessName, PSZ szFQProcessName, DWORD dwFQProcessName)
|
||||
{
|
||||
/* Only compile this code if we have the new toolkit */
|
||||
#ifdef QS_PROCESS
|
||||
ULONG bufsize = BUFDEFAULT;
|
||||
QSPTRREC* pbh;
|
||||
APIRET rc = 0;
|
||||
CHAR szUpperAppName[CCHMAXPATH] = {0};
|
||||
|
||||
/* Can't call with both - only one or the other */
|
||||
if (pid && szProcessName) {
|
||||
return FALSE;
|
||||
}
|
||||
if (szProcessName) {
|
||||
strcpy(szUpperAppName, szProcessName);
|
||||
strupr(szUpperAppName);
|
||||
}
|
||||
do {
|
||||
pbh = (QSPTRREC*) malloc(bufsize);
|
||||
if(!pbh) {
|
||||
if(bufsize <= BUFMIN)
|
||||
rc = ERROR_NOT_ENOUGH_MEMORY;
|
||||
else if(rc != ERROR_BUFFER_OVERFLOW)
|
||||
bufsize /= 2;
|
||||
} else {
|
||||
rc = DosQuerySysState(QS_PROCESS | QS_MTE, 0, 0, 0, pbh, bufsize);
|
||||
if(rc == ERROR_BUFFER_OVERFLOW) {
|
||||
if(bufsize < BUFMAX) {
|
||||
free(pbh);
|
||||
bufsize *= 2;
|
||||
} else {
|
||||
rc = ERROR_TOO_MANY_NAMES; // give up.
|
||||
}
|
||||
}
|
||||
}
|
||||
} while(rc == ERROR_BUFFER_OVERFLOW);
|
||||
|
||||
if(rc == NO_ERROR) {
|
||||
QSPREC* ppiLocal = pbh->pProcRec;
|
||||
while(ppiLocal->RecType == QS_PROCESS) {
|
||||
QSLREC* pmi = pbh->pLibRec;
|
||||
while (pmi && pmi->hmte != ppiLocal->hMte)
|
||||
pmi = (QSLREC*)pmi->pNextRec;
|
||||
if(pmi) {
|
||||
if ((szUpperAppName[0] && strstr((char*)pmi->pName, szUpperAppName)) ||
|
||||
(ppiLocal->pid == pid)) {
|
||||
if (szFQProcessName)
|
||||
strcpy(szFQProcessName, (char*)pmi->pName);
|
||||
if (pbh)
|
||||
free(pbh);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
ppiLocal=(QSPREC*)(ppiLocal->pThrdRec+ppiLocal->cTCB);
|
||||
}
|
||||
}
|
||||
if(pbh)
|
||||
free(pbh);
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int PreCheckInstance(char *szSection, char *szIniFile)
|
||||
int PreCheckInstance(char *szSection, char *szIniFile, char *szFQProcessName)
|
||||
{
|
||||
/* @MAK this function appears to try a -kill to get rid of turbo */
|
||||
/* We don't have a good way to do this */
|
||||
#ifdef OLDCODE
|
||||
char szBuf[MAX_BUF];
|
||||
char szKey[MAX_BUF];
|
||||
char szName[MAX_BUF];
|
||||
char szParameter[MAX_BUF];
|
||||
char szPath[MAX_BUF];
|
||||
char szFile[MAX_BUF];
|
||||
char *ptrName = NULL;
|
||||
// HKEY hkeyRoot;
|
||||
int iRv = WIZ_OK;
|
||||
DWORD dwCounter = 0;
|
||||
ULONG ulCounter = 0;
|
||||
BOOL bContinue = TRUE;
|
||||
char szExtraCmd[] = "Extra Cmd";
|
||||
char szExtraCmdKey[MAX_BUF];
|
||||
char szExtraCmdParameter[MAX_BUF];
|
||||
|
||||
do
|
||||
{
|
||||
/* Read the win reg key path */
|
||||
sprintf(szExtraCmdKey, "%s%d Reg Key", szExtraCmd, dwCounter);
|
||||
sprintf(szExtraCmdParameter, "%s%d Parameter", szExtraCmd, ulCounter);
|
||||
GetPrivateProfileString(szSection,
|
||||
szExtraCmdKey,
|
||||
"",
|
||||
szKey,
|
||||
sizeof(szKey),
|
||||
szIniFile);
|
||||
if(*szKey == '\0')
|
||||
{
|
||||
bContinue = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Read the win reg root key */
|
||||
sprintf(szExtraCmdKey, "%s%d Reg Key Root", szExtraCmd, dwCounter);
|
||||
GetPrivateProfileString(szSection,
|
||||
szExtraCmdKey,
|
||||
"",
|
||||
szBuf,
|
||||
sizeof(szBuf),
|
||||
szIniFile);
|
||||
if(*szBuf == '\0')
|
||||
{
|
||||
bContinue = FALSE;
|
||||
continue;
|
||||
}
|
||||
// hkeyRoot = ParseRootKey(szBuf);
|
||||
|
||||
/* Read the win reg name value */
|
||||
sprintf(szExtraCmdKey, "%s%d Reg Name", szExtraCmd, dwCounter);
|
||||
GetPrivateProfileString(szSection,
|
||||
szExtraCmdKey,
|
||||
"",
|
||||
szName,
|
||||
sizeof(szName),
|
||||
szIniFile);
|
||||
if(*szName == '\0')
|
||||
ptrName = NULL;
|
||||
else
|
||||
ptrName = szName;
|
||||
|
||||
/* Read the parameter to use for quitting the browser's turbo mode */
|
||||
sprintf(szExtraCmdKey, "%s%d Parameter", szExtraCmd, dwCounter);
|
||||
GetPrivateProfileString(szSection,
|
||||
szExtraCmdKey,
|
||||
szExtraCmdParameter,
|
||||
"",
|
||||
szParameter,
|
||||
sizeof(szParameter),
|
||||
szIniFile);
|
||||
|
||||
/* Read the win reg key that contains the path to the browser */
|
||||
// GetWinReg(hkeyRoot, szKey, ptrName, szFile, sizeof(szFile));
|
||||
ParsePath(szFile, szPath, sizeof(szPath), FALSE, PP_PATH_ONLY);
|
||||
|
||||
/* Make sure the file exists */
|
||||
if(FileExists(szFile))
|
||||
if(*szParameter == '\0')
|
||||
{
|
||||
// we've found a file, so let's execute it and stop. No need to look
|
||||
// for other keys to parse. We only want to do that if the file is
|
||||
// _not_ found. This is for when we change the name of the browser
|
||||
// app file and still need to deal with locating it and calling
|
||||
// -kill on it. ie.
|
||||
// previous name: netscp6.exe
|
||||
// new name: netscp.exe
|
||||
// We only need to call one of them, not both.
|
||||
bContinue = FALSE;
|
||||
|
||||
/* Run the file */
|
||||
// WinSpawn(szFile, szParameter, szPath, SW_HIDE, TRUE);
|
||||
|
||||
/* Even though WinSpawn is suppose to wait for the app to finish, this
|
||||
* does not really work that way for trying to quit the browser when
|
||||
* it's in turbo mode, so we wait 2 secs for it to complete. */
|
||||
Delay(2);
|
||||
continue;
|
||||
}
|
||||
|
||||
++dwCounter;
|
||||
ParsePath(szFQProcessName, szPath, sizeof(szPath), FALSE, PP_PATH_ONLY);
|
||||
|
||||
// we've found a file, so let's execute it and stop. No need to look
|
||||
// for other keys to parse. We only want to do that if the file is
|
||||
// _not_ found. This is for when we change the name of the browser
|
||||
// app file and still need to deal with locating it and calling
|
||||
// -kill on it. ie.
|
||||
// previous name: netscp6.exe
|
||||
// new name: netscp.exe
|
||||
// We only need to call one of them, not both.
|
||||
bContinue = FALSE;
|
||||
|
||||
/* Run the file */
|
||||
WinSpawn(szFQProcessName, szParameter, szPath, TRUE);
|
||||
|
||||
/* Even though WinSpawn is suppose to wait for the app to finish, this
|
||||
* does not really work that way for trying to quit the browser when
|
||||
* it's in turbo mode, so we wait 2 secs for it to complete. */
|
||||
DosSleep(2000);
|
||||
|
||||
++ulCounter;
|
||||
} while(bContinue);
|
||||
|
||||
return(iRv);
|
||||
#endif
|
||||
return(WIZ_OK);
|
||||
}
|
||||
|
||||
ULONG CloseAllWindowsOfWindowHandle(HWND hwndWindow)
|
||||
|
@ -4685,14 +4674,17 @@ ULONG CloseAllWindowsOfWindowHandle(HWND hwndWindow)
|
|||
henum = WinBeginEnumWindows(HWND_DESKTOP);
|
||||
while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
|
||||
{
|
||||
WinQueryWindowProcess(hwndWindow, &pid, &tid);
|
||||
WinQueryWindowProcess(hwnd, &pid, &tid);
|
||||
if (pid == mainpid) {
|
||||
if (WinIsWindowVisible(hwnd)) {
|
||||
WinSendMsg(hwnd, WM_CLOSE, 0, 0);
|
||||
MRESULT rc = WinSendMsg(hwnd, WM_CLOSE, 0, 0);
|
||||
printf("rc = %x\n", rc);
|
||||
}
|
||||
}
|
||||
}
|
||||
WinEndEnumWindows(henum);
|
||||
/* The windows don't close quick enough, so we need to wait a bit */
|
||||
DosSleep(2500);
|
||||
|
||||
return(WIZ_OK);
|
||||
}
|
||||
|
@ -4700,7 +4692,8 @@ ULONG CloseAllWindowsOfWindowHandle(HWND hwndWindow)
|
|||
HRESULT CheckInstances()
|
||||
{
|
||||
char szSection[MAX_BUF];
|
||||
char szProcessName[MAX_BUF];
|
||||
char szProcessName[CCHMAXPATH];
|
||||
char szFQProcessName[CCHMAXPATH];
|
||||
char szClassName[MAX_BUF];
|
||||
char szCloseAllWindows[MAX_BUF];
|
||||
char szAttention[MAX_BUF];
|
||||
|
@ -4715,7 +4708,6 @@ HRESULT CheckInstances()
|
|||
DWORD dwRv0;
|
||||
DWORD dwRv1;
|
||||
|
||||
return (FALSE); /* @MAK */
|
||||
bContinue = TRUE;
|
||||
iIndex = -1;
|
||||
while(bContinue)
|
||||
|
@ -4740,17 +4732,17 @@ HRESULT CheckInstances()
|
|||
if(*szProcessName != '\0')
|
||||
{
|
||||
/* If an instance is found, call PreCheckInstance first */
|
||||
if(CheckForProcess(szProcessName, sizeof(szProcessName)) == TRUE)
|
||||
PreCheckInstance(szSection, szFileIniConfig);
|
||||
if(CheckForProcess(0, szProcessName, sizeof(szProcessName), szFQProcessName, sizeof(szFQProcessName)) == TRUE)
|
||||
PreCheckInstance(szSection, szFileIniConfig, szFQProcessName);
|
||||
|
||||
if(CheckForProcess(szProcessName, sizeof(szProcessName)) == TRUE)
|
||||
if(CheckForProcess(0, szProcessName, sizeof(szProcessName), NULL, 0) == TRUE)
|
||||
{
|
||||
if(*szMessage != '\0')
|
||||
{
|
||||
switch(sgProduct.ulMode)
|
||||
{
|
||||
case NORMAL:
|
||||
switch(WinMessageBox(HWND_DESKTOP, hWndMain, szMessage, szAttention, 0, MB_ICONEXCLAMATION))
|
||||
switch(WinMessageBox(HWND_DESKTOP, hWndMain, szMessage, szAttention, 0, MB_ICONEXCLAMATION | MB_OKCANCEL))
|
||||
{
|
||||
case MBID_CANCEL:
|
||||
/* User selected to cancel Setup */
|
||||
|
@ -4766,7 +4758,7 @@ HRESULT CheckInstances()
|
|||
|
||||
case AUTO:
|
||||
ShowMessage(szMessage, TRUE);
|
||||
Delay(5);
|
||||
DosSleep(5000);
|
||||
ShowMessage(szMessage, FALSE);
|
||||
|
||||
/* Setup mode is AUTO. Show message, timeout, then cancel because we can't allow user to continue */
|
||||
|
@ -4809,8 +4801,13 @@ HRESULT CheckInstances()
|
|||
szCN = szClassName;
|
||||
|
||||
/* If an instance is found, call PreCheckInstance first */
|
||||
if((hwndFW = FindWindow(szCN)) != NULL)
|
||||
PreCheckInstance(szSection, szFileIniConfig);
|
||||
if((hwndFW = FindWindow(szCN)) != NULL) {
|
||||
PID pid;
|
||||
TID tid;
|
||||
WinQueryWindowProcess(hwndFW, &pid, &tid);
|
||||
CheckForProcess(pid, NULL, 0, szFQProcessName, sizeof(szFQProcessName));
|
||||
PreCheckInstance(szSection, szFileIniConfig, szFQProcessName);
|
||||
}
|
||||
|
||||
if((hwndFW = FindWindow(szCN)) != NULL)
|
||||
{
|
||||
|
@ -4819,7 +4816,7 @@ HRESULT CheckInstances()
|
|||
switch(sgProduct.ulMode)
|
||||
{
|
||||
case NORMAL:
|
||||
switch(WinMessageBox(HWND_DESKTOP, hWndMain, szMessage, szAttention, 0, MB_ICONEXCLAMATION))
|
||||
switch(WinMessageBox(HWND_DESKTOP, hWndMain, szMessage, szAttention, 0, MB_ICONEXCLAMATION | MB_OKCANCEL))
|
||||
{
|
||||
case MBID_CANCEL:
|
||||
/* User selected to cancel Setup */
|
||||
|
@ -4841,7 +4838,7 @@ HRESULT CheckInstances()
|
|||
* all the windows associated with the process */
|
||||
|
||||
ShowMessage(szMessage, TRUE);
|
||||
Delay(5);
|
||||
DosSleep(5000);
|
||||
ShowMessage(szMessage, FALSE);
|
||||
|
||||
if(bCloseAllWindows)
|
||||
|
@ -4981,7 +4978,7 @@ int StartupCheckArchives(void)
|
|||
case AUTO:
|
||||
GetPrivateProfileString("Strings", "Error Corrupted Archives Detected AUTO mode", "", szBuf, sizeof(szBuf), szFileIniConfig);
|
||||
ShowMessage(szBuf, TRUE);
|
||||
Delay(5);
|
||||
DosSleep(5000);
|
||||
ShowMessage(szBuf, FALSE);
|
||||
break;
|
||||
}
|
||||
|
@ -5565,58 +5562,16 @@ BOOL LocatePreviousPath(PSZ szMainSectionName, PSZ szPath, ULONG ulPathSize)
|
|||
strcpy(szSection, szMainSectionName);
|
||||
strcat(szSection, szIndex);
|
||||
|
||||
GetPrivateProfileString(szSection, "Key", "", szValue, sizeof(szValue), szFileIniConfig);
|
||||
GetPrivateProfileString(szSection, "App", "", szValue, sizeof(szValue), szFileIniConfig);
|
||||
if(*szValue != '\0')
|
||||
bFound = LocatePathNscpReg(szSection, szPath, ulPathSize);
|
||||
bFound = LocatePathOS2INI(szSection, szPath, ulPathSize);
|
||||
else
|
||||
{
|
||||
GetPrivateProfileString(szSection, "App", "", szValue, sizeof(szValue), szFileIniConfig);
|
||||
if(*szValue != '\0')
|
||||
bFound = LocatePathOS2INI(szSection, szPath, ulPathSize);
|
||||
else
|
||||
{
|
||||
GetPrivateProfileString(szSection, "Path", "", szValue, sizeof(szValue), szFileIniConfig);
|
||||
if(*szValue != '\0')
|
||||
bFound = LocatePath(szSection, szPath, ulPathSize);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return(bFound);
|
||||
}
|
||||
|
||||
BOOL LocatePathNscpReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize)
|
||||
{
|
||||
char szKey[MAX_BUF];
|
||||
char szContainsFilename[MAX_BUF];
|
||||
char szBuf[MAX_BUF];
|
||||
BOOL bReturn;
|
||||
|
||||
bReturn = FALSE;
|
||||
GetPrivateProfileString(szSection, "Key", "", szKey, sizeof(szKey), szFileIniConfig);
|
||||
if(*szKey != '\0')
|
||||
{
|
||||
bReturn = FALSE;
|
||||
memset(szPath, 0, dwPathSize);
|
||||
|
||||
VR_GetPath(szKey, MAX_BUF, szBuf);
|
||||
if(*szBuf != '\0')
|
||||
{
|
||||
GetPrivateProfileString(szSection, "Contains Filename", "", szContainsFilename, sizeof(szContainsFilename), szFileIniConfig);
|
||||
if(strcmpi(szContainsFilename, "TRUE") == 0)
|
||||
ParsePath(szBuf, szPath, dwPathSize, FALSE, PP_PATH_ONLY);
|
||||
else
|
||||
strcpy(szPath, szBuf);
|
||||
|
||||
bReturn = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return(bReturn);
|
||||
}
|
||||
|
||||
DWORD GetTotalArchivesToDownload()
|
||||
{
|
||||
DWORD dwIndex0;
|
||||
|
@ -5732,25 +5687,6 @@ BOOL LocatePathOS2INI(PSZ szSection, PSZ szPath, ULONG ulPathSize)
|
|||
return(bReturn);
|
||||
}
|
||||
|
||||
BOOL LocatePath(LPSTR szSection, LPSTR szPath, DWORD dwPathSize)
|
||||
{
|
||||
char szPathKey[MAX_BUF];
|
||||
BOOL bReturn;
|
||||
|
||||
bReturn = FALSE;
|
||||
GetPrivateProfileString(szSection, "Path", "", szPathKey, sizeof(szPathKey), szFileIniConfig);
|
||||
if(*szPathKey != '\0')
|
||||
{
|
||||
bReturn = FALSE;
|
||||
memset(szPath, 0, dwPathSize);
|
||||
|
||||
DecryptString(szPath, szPathKey);
|
||||
bReturn = TRUE;
|
||||
}
|
||||
|
||||
return(bReturn);
|
||||
}
|
||||
|
||||
void SetCustomType()
|
||||
{
|
||||
if(diSetupType.stSetupType3.bVisible == TRUE)
|
||||
|
@ -5903,7 +5839,7 @@ HRESULT DecryptVariable(PSZ szVariable, ULONG ulVariableSize)
|
|||
if(*szBuf == '\0')
|
||||
return(FALSE);
|
||||
|
||||
sprintf(szVariable, "%s %s", sgProduct.szProductNameInternal, szBuf);
|
||||
strcpy(szVariable, szBuf);
|
||||
}
|
||||
else if(strcmpi(szVariable, "Product PreviousVersion") == 0)
|
||||
{
|
||||
|
@ -6654,12 +6590,37 @@ HWND FindWindow(PCSZ pszAtomString)
|
|||
while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
|
||||
{
|
||||
ULONG ulWindowWord;
|
||||
ulWindowWord = WinQueryWindowULong(hwnd, QWL_USER);
|
||||
if (ulWindowWord == atom) {
|
||||
break;
|
||||
ulWindowWord = WinQueryWindowULong(hwnd, QWL_USER);
|
||||
if (ulWindowWord == atom) {
|
||||
break;
|
||||
} else {
|
||||
/* Try the class name method to support older browsers */
|
||||
HWND hwndClient;
|
||||
CHAR szClassName[MAX_BUF];
|
||||
hwndClient = WinWindowFromID(hwnd, FID_CLIENT);
|
||||
WinQueryClassName(hwndClient ? hwndClient : hwnd, MAX_BUF, szClassName);
|
||||
if (strcmp(szClassName, pszAtomString) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
WinEndEnumWindows(henum);
|
||||
}
|
||||
if (!hwnd) {
|
||||
/* Try the object windows just in case, but only for the classname */
|
||||
henum = WinBeginEnumWindows(HWND_OBJECT);
|
||||
while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
|
||||
{
|
||||
/* Try the class name method to support older browsers */
|
||||
HWND hwndClient;
|
||||
CHAR szClassName[MAX_BUF];
|
||||
hwndClient = WinWindowFromID(hwnd, FID_CLIENT);
|
||||
WinQueryClassName(hwndClient ? hwndClient : hwnd, MAX_BUF, szClassName);
|
||||
if (strcmp(szClassName, pszAtomString) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
WinEndEnumWindows(henum);
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ void *NS_GlobalAlloc(DWORD dwMaxBuf);
|
|||
HRESULT Initialize(HMODULE hInstance, PSZ szAppName);
|
||||
HRESULT NS_LoadStringAlloc(HMODULE hInstance, ULONG ulID, PSZ *szStringBuf, ULONG ulStringBuf);
|
||||
HRESULT NS_LoadString(HMODULE hInstance, ULONG ulID, PSZ szStringBuf, ULONG ulStringBuf);
|
||||
HRESULT WinSpawn(LPSTR szClientName, LPSTR szParameters, LPSTR szCurrentDir, int iShowCmd, BOOL bWait);
|
||||
HRESULT WinSpawn(LPSTR szClientName, LPSTR szParameters, LPSTR szCurrentDir, BOOL bWait);
|
||||
HRESULT ParseConfigIni(int argc, char *argv[]);
|
||||
HRESULT ParseInstallIni();
|
||||
HRESULT DecryptString(LPSTR szOutputStr, LPSTR szInputStr);
|
||||
|
@ -67,9 +67,9 @@ char *SiCNodeGetDescriptionShort(DWORD dwIndex, BOOL bIncludeInvisi
|
|||
char *SiCNodeGetDescriptionLong(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag);
|
||||
char *SiCNodeGetReferenceName(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag);
|
||||
siC *SiCNodeGetObject(DWORD dwIndex, BOOL bIncludeInvisibleObjs, DWORD dwACFlag);
|
||||
ULONGLONG SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag);
|
||||
ULONGLONG SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag);
|
||||
ULONGLONG SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag);
|
||||
unsigned long long SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag);
|
||||
unsigned long long SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag);
|
||||
unsigned long long SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag);
|
||||
siC *SiCNodeFind(siC *siComponents, char *szInReferenceName);
|
||||
void InitSiComponents(char *szFileIni);
|
||||
HRESULT ParseComponentAttributes(char *szBuf, DWORD dwAttributes, BOOL bOverride);
|
||||
|
@ -128,23 +128,20 @@ int SiCNodeGetIndexRN(char *szInReferenceName);
|
|||
void ViewSiComponentsDependency(char *szBuffer, char *szIndentation, siC *siCNode);
|
||||
void ViewSiComponentsDependee(char *szBuffer, char *szIndentation, siC *siCNode);
|
||||
void ViewSiComponents(void);
|
||||
ULONGLONG GetDiskSpaceRequired(DWORD dwType);
|
||||
ULONGLONG GetDiskSpaceAvailable(LPSTR szPath);
|
||||
unsigned long long GetDiskSpaceRequired(DWORD dwType);
|
||||
unsigned long long GetDiskSpaceAvailable(LPSTR szPath);
|
||||
HRESULT VerifyDiskSpace(void);
|
||||
HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPSTR szPath, BOOL bCrutialMsg);
|
||||
HRESULT ErrorMsgDiskSpace(unsigned long long ullDSAvailable, unsigned long long ullDSRequired, LPSTR szPath, BOOL bCrutialMsg);
|
||||
void SetCustomType(void);
|
||||
void GetAlternateArchiveSearchPath(LPSTR lpszCmdLine);
|
||||
BOOL NeedReboot(void);
|
||||
BOOL LocatePreviousPath(LPSTR szMainSectionName, LPSTR szPath, DWORD dwPathSize);
|
||||
BOOL LocatePathNscpReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize);
|
||||
BOOL LocatePathOS2INI(PSZ szSection, PSZ szPath, ULONG ulPathSize);
|
||||
BOOL LocatePath(LPSTR szSection, LPSTR szPath, DWORD dwPathSize);
|
||||
int VR_GetPath(char *component_path, unsigned long sizebuf, char *buf);
|
||||
dsN *CreateDSNode();
|
||||
void DsNodeInsert(dsN **dsNHead, dsN *dsNTemp);
|
||||
void DsNodeDelete(dsN **dsNTemp);
|
||||
void DeInitDSNode(dsN **dsnComponentDSRequirement);
|
||||
void UpdatePathDiskSpaceRequired(LPSTR szPath, ULONGLONG ullInstallSize, dsN **dsnComponentDSRequirement);
|
||||
void UpdatePathDiskSpaceRequired(LPSTR szPath, unsigned long long ullInstallSize, dsN **dsnComponentDSRequirement);
|
||||
HRESULT InitComponentDiskSpaceInfo(dsN **dsnComponentDSRequirement);
|
||||
HRESULT CheckInstances();
|
||||
long RandomSelect(void);
|
||||
|
@ -166,7 +163,6 @@ LPSTR GetArgV(LPSTR lpszCommandLine,
|
|||
int iDestSize);
|
||||
ULONG ParseCommandLine(int argc, char *argv[]);
|
||||
void SetSetupRunMode(LPSTR szMode);
|
||||
void Delay(ULONG ulSeconds);
|
||||
void UnsetSetupState(void);
|
||||
void SetSetupState(char *szState);
|
||||
siCD *InitWinInitNodes(char *szInFile);
|
||||
|
|
|
@ -127,95 +127,19 @@ void GetUserAgentShort(char *szUserAgent, char *szOutUAShort, DWORD dwOutUAShort
|
|||
}
|
||||
}
|
||||
|
||||
/* EXPLANATION
|
||||
Enumerate through a given subkey and check to see if any keys have the exact same install directory
|
||||
If they do, delete them. Very straightforward */
|
||||
DWORD GetWinRegSubKeyProductPath(char *szInKey, char *szReturnSubKey, DWORD dwReturnSubKeySize, char *szInSubSubKey, char *szInName, char *szCompare, char *szInCurrentVersion)
|
||||
void CleanupPreviousVersionINIKeys(void)
|
||||
{
|
||||
char *szRv = NULL;
|
||||
char szKey[MAX_BUF];
|
||||
char szBuf[MAX_BUF];
|
||||
// HKEY hkHandle;
|
||||
DWORD dwIndex;
|
||||
DWORD dwBufSize;
|
||||
DWORD dwTotalSubKeys;
|
||||
DWORD dwTotalValues;
|
||||
// FILETIME ftLastWriteFileTime;
|
||||
BOOL bFoundSubKey;
|
||||
|
||||
bFoundSubKey = FALSE;
|
||||
|
||||
// if(RegOpenKeyEx(hkRootKey, szInKey, 0, KEY_READ, &hkHandle) != ERROR_SUCCESS)
|
||||
{
|
||||
*szReturnSubKey = '\0';
|
||||
return(0);
|
||||
}
|
||||
|
||||
dwTotalSubKeys = 0;
|
||||
dwTotalValues = 0;
|
||||
// RegQueryInfoKey(hkHandle, NULL, NULL, NULL, &dwTotalSubKeys, NULL, NULL, &dwTotalValues, NULL, NULL, NULL, NULL);
|
||||
for(dwIndex = 0; dwIndex < dwTotalSubKeys; dwIndex++)
|
||||
{
|
||||
dwBufSize = dwReturnSubKeySize;
|
||||
// if(RegEnumKeyEx(hkHandle, dwIndex, szReturnSubKey, &dwBufSize, NULL, NULL, NULL, &ftLastWriteFileTime) == ERROR_SUCCESS)
|
||||
{
|
||||
if( (*szInCurrentVersion != '\0') && (strcmpi(szInCurrentVersion, szReturnSubKey) != 0) )
|
||||
{
|
||||
/* The key found is not the CurrentVersion (current UserAgent), so we can return it to be deleted.
|
||||
* We don't want to return the SubKey that is the same as the CurrentVersion because it might
|
||||
* have just been created by the current installation process. So deleting it would be a
|
||||
* "Bad Thing" (TM).
|
||||
*
|
||||
* If it was not created by the current installation process, then it'll be left
|
||||
* around which is better than deleting something we will need later. To make sure this case is
|
||||
* not encountered, CleanupPreviousVersionRegKeys() should be called at the *end* of the
|
||||
* installation process (at least after all the .xpi files have been processed). */
|
||||
if(szInSubSubKey && (*szInSubSubKey != '\0'))
|
||||
sprintf(szKey, "%s\\%s\\%s", szInKey, szReturnSubKey, szInSubSubKey);
|
||||
else
|
||||
sprintf(szKey, "%s\\%s", szInKey, szReturnSubKey);
|
||||
|
||||
// GetWinReg(hkRootKey, szKey, szInName, szBuf, sizeof(szBuf));
|
||||
AppendBackSlash(szBuf, sizeof(szBuf));
|
||||
if(strcmpi(szBuf, szCompare) == 0)
|
||||
{
|
||||
bFoundSubKey = TRUE;
|
||||
/* found one subkey. break out of the for() loop */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RegCloseKey(hkHandle);
|
||||
if(!bFoundSubKey)
|
||||
*szReturnSubKey = '\0';
|
||||
return(dwTotalSubKeys);
|
||||
}
|
||||
|
||||
void CleanupPreviousVersionRegKeys(void)
|
||||
{
|
||||
/* OK, OS/2 things to do here */
|
||||
/* Look at all keys in OS2.INI beginning with Mozilla (Product Reg Key)*/
|
||||
/* If they contain an Install Directory that is the same as what we just installed, remove the app */
|
||||
|
||||
|
||||
|
||||
DWORD dwIndex = 0;
|
||||
DWORD dwSubKeyCount;
|
||||
ULONG ulIndex = 0;
|
||||
char szBufTiny[MAX_BUF_TINY];
|
||||
char szKeyRoot[MAX_BUF_TINY];
|
||||
char szCurrentVersion[MAX_BUF_TINY];
|
||||
char szUAShort[MAX_BUF_TINY];
|
||||
char szRvSubKey[MAX_PATH + 1];
|
||||
char szUserAgent[MAX_BUF];
|
||||
char szPath[MAX_BUF];
|
||||
char szKey[MAX_BUF];
|
||||
char szApp[MAX_BUF];
|
||||
char szCleanupProduct[MAX_BUF];
|
||||
// HKEY hkeyRoot;
|
||||
char szSubSubKey[] = "Main";
|
||||
char szName[] = "Install Directory";
|
||||
char szWRMSUninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
|
||||
char szSection[] = "Cleanup Previous Product RegKeys";
|
||||
char szSection[] = "Cleanup Previous Product INIApps";
|
||||
ULONG ulAppsLength;
|
||||
CHAR* szApps;
|
||||
|
||||
strcpy(szPath, sgProduct.szPath);
|
||||
if(*sgProduct.szSubPath != '\0')
|
||||
|
@ -225,73 +149,44 @@ void CleanupPreviousVersionRegKeys(void)
|
|||
}
|
||||
AppendBackSlash(szPath, sizeof(szPath));
|
||||
|
||||
sprintf(szBufTiny, "Product Reg Key%d", dwIndex);
|
||||
GetPrivateProfileString(szSection, szBufTiny, "", szKey, sizeof(szKey), szFileIniConfig);
|
||||
sprintf(szBufTiny, "Product INI App%d", ulIndex);
|
||||
GetPrivateProfileString(szSection, szBufTiny, "", szApp, sizeof(szApp), szFileIniConfig);
|
||||
|
||||
while(*szKey != '\0')
|
||||
while(*szApp != '\0')
|
||||
{
|
||||
sprintf(szBufTiny, "Reg Key Root%d",dwIndex);
|
||||
GetPrivateProfileString(szSection, szBufTiny, "", szKeyRoot, sizeof(szKeyRoot), szFileIniConfig);
|
||||
// hkeyRoot = ParseRootKey(szKeyRoot);
|
||||
|
||||
sprintf(szBufTiny, "Product Name%d", dwIndex);
|
||||
sprintf(szBufTiny, "Product Name%d", ulIndex);
|
||||
GetPrivateProfileString(szSection, szBufTiny, "", szCleanupProduct, sizeof(szCleanupProduct), szFileIniConfig);
|
||||
// something is wrong, they didn't give a product name.
|
||||
if(*szCleanupProduct == '\0')
|
||||
return;
|
||||
|
||||
sprintf(szBufTiny, "Current Version%d", dwIndex);
|
||||
sprintf(szBufTiny, "Current Version%d", ulIndex);
|
||||
GetPrivateProfileString(szSection, szBufTiny, "", szCurrentVersion, sizeof(szCurrentVersion), szFileIniConfig);
|
||||
|
||||
do
|
||||
{
|
||||
// if the current version is not found, we'll get null in szCurrentVersion and GetWinRegSubKeyProductPath() will do the right thing
|
||||
// dwSubKeyCount = GetWinRegSubKeyProductPath(hkeyRoot, szKey, szRvSubKey, sizeof(szRvSubKey), szSubSubKey, szName, szPath, szCurrentVersion);
|
||||
|
||||
if(*szRvSubKey != '\0')
|
||||
{
|
||||
if(dwSubKeyCount > 1)
|
||||
{
|
||||
AppendBackSlash(szKey, sizeof(szKey));
|
||||
strcat(szKey, szRvSubKey);
|
||||
sprintf(szUserAgent, "%s %s", szApp, szCurrentVersion);
|
||||
|
||||
PrfQueryProfileSize(HINI_USERPROFILE, NULL, NULL, &ulAppsLength);
|
||||
szApps = (char*)malloc(ulAppsLength+1);
|
||||
PrfQueryProfileString(HINI_USERPROFILE, NULL, NULL, NULL, szApps, ulAppsLength);
|
||||
szApps[ulAppsLength] = '\0';
|
||||
while (*szApps) {
|
||||
if (strncmp(szApps, szApp, strlen(szApp)) == 0) {
|
||||
if (strncmp(szApps, szUserAgent, strlen(szUserAgent)) != 0) {
|
||||
char szKey[MAX_BUF];
|
||||
PrfQueryProfileString(HINI_USERPROFILE, szApps, szName, "", szKey, MAX_BUF);
|
||||
if (szKey[0]) {
|
||||
AppendBackSlash(szKey, sizeof(szKey));
|
||||
if (strcmpi(szKey, szPath) == 0) {
|
||||
PrfWriteProfileString(HINI_USER, szApps, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
// DeleteWinRegKey(hkeyRoot, szKey, TRUE);
|
||||
|
||||
GetUserAgentShort(szRvSubKey, szUAShort, sizeof(szUAShort));
|
||||
if(*szUAShort != '\0')
|
||||
{
|
||||
/* delete uninstall key that contains product name and its user agent in parenthesis, for
|
||||
* example:
|
||||
* Mozilla (0.8)
|
||||
*/
|
||||
sprintf(szKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s (%s)", szCleanupProduct, szUAShort);
|
||||
// DeleteWinRegKey(hkeyRoot, szKey, TRUE);
|
||||
|
||||
/* delete uninstall key that contains product name and its user agent not in parenthesis,
|
||||
* for example:
|
||||
* Mozilla 0.8
|
||||
*/
|
||||
sprintf(szKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s %s", szCleanupProduct, szUAShort);
|
||||
// DeleteWinRegKey(hkeyRoot, szKey, TRUE);
|
||||
|
||||
/* We are not looking to delete just the product name key, for example:
|
||||
* Mozilla
|
||||
*
|
||||
* because it might have just been created by the current installation process, so
|
||||
* deleting this would be a "Bad Thing" (TM). Besides, we shouldn't be deleting the
|
||||
* CurrentVersion key that might have just gotten created because GetWinRegSubKeyProductPath()
|
||||
* will not return the CurrentVersion key.
|
||||
*/
|
||||
}
|
||||
// the szKey was stepped on. Reget it.
|
||||
sprintf(szBufTiny, "Product Reg Key%d", dwIndex);
|
||||
GetPrivateProfileString(szSection, szBufTiny, "", szKey, sizeof(szKey), szFileIniConfig);
|
||||
}
|
||||
} while (*szRvSubKey != '\0');
|
||||
sprintf(szBufTiny, "Product Reg Key%d", ++dwIndex);
|
||||
GetPrivateProfileString(szSection, szBufTiny, "", szKey, sizeof(szKey), szFileIniConfig);
|
||||
szApps = strchr(szApps, '\0')+1;
|
||||
}
|
||||
sprintf(szBufTiny, "Product Reg Key%d", ++ulIndex);
|
||||
GetPrivateProfileString(szSection, szBufTiny, "", szApp, sizeof(szApp), szFileIniConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ProcessFileOps(DWORD dwTiming, char *szSectionPrefix)
|
||||
|
@ -579,6 +474,7 @@ HRESULT FileMove(LPSTR szFrom, LPSTR szTo)
|
|||
HDIR hFile;
|
||||
FILEFINDBUF3 fdFile;
|
||||
ULONG ulFindCount;
|
||||
ULONG ulAttrs;
|
||||
char szFromDir[MAX_BUF];
|
||||
char szFromTemp[MAX_BUF];
|
||||
char szToTemp[MAX_BUF];
|
||||
|
@ -621,7 +517,9 @@ HRESULT FileMove(LPSTR szFrom, LPSTR szTo)
|
|||
|
||||
strcat(szFrom, "*.*");
|
||||
ulFindCount = 1;
|
||||
if((DosFindFirst(szFrom, &hFile, 0, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
hFile = HDIR_CREATE;
|
||||
ulAttrs = FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED;
|
||||
if((DosFindFirst(szFrom, &hFile, ulAttrs, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
bFound = FALSE;
|
||||
else
|
||||
bFound = TRUE;
|
||||
|
@ -692,6 +590,7 @@ HRESULT FileCopy(LPSTR szFrom, LPSTR szTo, BOOL bFailIfExists, BOOL bDnu)
|
|||
HDIR hFile;
|
||||
FILEFINDBUF3 fdFile;
|
||||
ULONG ulFindCount;
|
||||
ULONG ulAttrs;
|
||||
char szFromDir[MAX_BUF];
|
||||
char szFromTemp[MAX_BUF];
|
||||
char szToTemp[MAX_BUF];
|
||||
|
@ -721,7 +620,9 @@ HRESULT FileCopy(LPSTR szFrom, LPSTR szTo, BOOL bFailIfExists, BOOL bDnu)
|
|||
ParsePath(szFrom, szFromDir, sizeof(szFromDir), FALSE, PP_PATH_ONLY);
|
||||
|
||||
ulFindCount = 1;
|
||||
if((DosFindFirst(szFrom, &hFile, 0, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
hFile = HDIR_CREATE;
|
||||
ulAttrs = FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED;
|
||||
if((DosFindFirst(szFrom, &hFile, ulAttrs, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
bFound = FALSE;
|
||||
else
|
||||
bFound = TRUE;
|
||||
|
@ -779,6 +680,7 @@ HRESULT FileCopySequential(LPSTR szSourcePath, LPSTR szDestPath, LPSTR szFilenam
|
|||
HDIR hFile;
|
||||
FILEFINDBUF3 fdFile;
|
||||
ULONG ulFindCount;
|
||||
ULONG ulAttrs;
|
||||
BOOL bFound;
|
||||
|
||||
strcpy(szSourceFullFilename, szSourcePath);
|
||||
|
@ -819,7 +721,9 @@ HRESULT FileCopySequential(LPSTR szSourcePath, LPSTR szDestPath, LPSTR szFilenam
|
|||
|
||||
/* find the largest numbered filename in the szDestPath */
|
||||
ulFindCount = 1;
|
||||
if((DosFindFirst(szSearchDestFullFilename, &hFile, 0, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
hFile = HDIR_CREATE;
|
||||
ulAttrs = FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED;
|
||||
if((DosFindFirst(szSearchDestFullFilename, &hFile, ulAttrs, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
bFound = FALSE;
|
||||
else
|
||||
bFound = TRUE;
|
||||
|
@ -1117,6 +1021,7 @@ HRESULT FileDelete(LPSTR szDestination)
|
|||
HDIR hFile;
|
||||
FILEFINDBUF3 fdFile;
|
||||
ULONG ulFindCount;
|
||||
ULONG ulAttrs;
|
||||
char szBuf[MAX_BUF];
|
||||
char szPathOnly[MAX_BUF];
|
||||
BOOL bFound;
|
||||
|
@ -1133,7 +1038,9 @@ HRESULT FileDelete(LPSTR szDestination)
|
|||
ParsePath(szDestination, szPathOnly, sizeof(szPathOnly), FALSE, PP_PATH_ONLY);
|
||||
|
||||
ulFindCount = 1;
|
||||
if((DosFindFirst(szDestination, &hFile, 0, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
hFile = HDIR_CREATE;
|
||||
ulAttrs = FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED;
|
||||
if((DosFindFirst(szDestination, &hFile, ulAttrs, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
bFound = FALSE;
|
||||
else
|
||||
bFound = TRUE;
|
||||
|
@ -1191,6 +1098,7 @@ HRESULT DirectoryRemove(LPSTR szDestination, BOOL bRemoveSubdirs)
|
|||
HDIR hFile;
|
||||
FILEFINDBUF3 fdFile;
|
||||
ULONG ulFindCount;
|
||||
ULONG ulAttrs;
|
||||
char szDestTemp[MAX_BUF];
|
||||
BOOL bFound;
|
||||
|
||||
|
@ -1204,7 +1112,9 @@ HRESULT DirectoryRemove(LPSTR szDestination, BOOL bRemoveSubdirs)
|
|||
strcat(szDestTemp, "*");
|
||||
|
||||
ulFindCount = 1;
|
||||
if((DosFindFirst(szDestTemp, &hFile, 0, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
hFile = HDIR_CREATE;
|
||||
ulAttrs = FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED;
|
||||
if((DosFindFirst(szDestTemp, &hFile, ulAttrs, &fdFile, sizeof(fdFile), &ulFindCount, FIL_STANDARD)) != NO_ERROR)
|
||||
bFound = FALSE;
|
||||
else
|
||||
bFound = TRUE;
|
||||
|
@ -1344,9 +1254,7 @@ HRESULT ProcessRunApp(DWORD dwTiming, char *szSectionPrefix)
|
|||
GetPrivateProfileString(szSection, "Message", "", szBuf, sizeof(szBuf), szFileIniConfig);
|
||||
if ( szBuf[0] != '\0' )
|
||||
ShowMessage(szBuf, TRUE);
|
||||
#ifdef OLDCODE /* @MAK */
|
||||
WinSpawn(szTarget, szParameters, szWorkingDir, SW_SHOWNORMAL, bWait);
|
||||
#endif
|
||||
WinSpawn(szTarget, szParameters, szWorkingDir, bWait);
|
||||
if ( szBuf[0] != '\0' )
|
||||
ShowMessage(szBuf, FALSE);
|
||||
}
|
||||
|
@ -1612,9 +1520,7 @@ HRESULT ProcessProgramFolderShowCmd()
|
|||
|
||||
if(iShowFolder != SW_HIDE)
|
||||
if(sgProduct.dwMode != SILENT)
|
||||
#ifdef OLDCODE
|
||||
WinSpawn(szProgramFolder, NULL, NULL, iShowFolder, TRUE);
|
||||
#endif
|
||||
WinSpawn(szProgramFolder, NULL, NULL, TRUE);
|
||||
|
||||
#endif
|
||||
++dwIndex0;
|
||||
|
|
|
@ -62,7 +62,7 @@ int VerifyArchive(LPSTR szArchive);
|
|||
HRESULT ProcessSetVersionRegistry(DWORD dwTiming, char *szSectionPrefix);
|
||||
char *BuildNumberedString(DWORD dwIndex, char *szInputStringPrefix, char *szInputString, char *szOutBuf, DWORD dwOutBufSize);
|
||||
void GetUserAgentShort(char *szUserAgent, char *szOutUAShort, DWORD dwOutUAShortSize);
|
||||
void CleanupPreviousVersionRegKeys(void);
|
||||
void CleanupPreviousVersionINIKeys(void);
|
||||
HRESULT CleanupArgsRegistry();
|
||||
void ProcessFileOpsForSelectedComponents(DWORD dwTiming);
|
||||
void ProcessFileOpsForAll(DWORD dwTiming);
|
||||
|
|
|
@ -174,16 +174,13 @@ int main(int argc, char *argv[], char *envp[])
|
|||
{
|
||||
DlgSequence(NEXT_DLG);
|
||||
}
|
||||
//#ifdef OLDCODE
|
||||
|
||||
while ( WinGetMsg( hab, &qmsg, NULLHANDLE, 0, 0 ) )
|
||||
WinDispatchMsg( hab, &qmsg );
|
||||
#ifdef OLDCODE
|
||||
while ( WinGetMsg( hab, &qmsg, NULLHANDLE, 0, 0 ) )
|
||||
WinDispatchMsg( hab, &qmsg );
|
||||
|
||||
if(iRv != WIZ_SETUP_ALREADY_RUNNING)
|
||||
/* Do clean up before exiting from the application */
|
||||
DeInitialize();
|
||||
#endif
|
||||
|
||||
WinDeleteAtom(WinQuerySystemAtomTable(), atom);
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
#define INCL_PM
|
||||
#define INCL_GPI
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
typedef ULONG DWORD;
|
||||
typedef unsigned long long ULONGLONG;
|
||||
typedef PSZ LPSTR;
|
||||
typedef PFNWP WNDPROC;
|
||||
typedef long HRESULT;
|
||||
typedef long HFONT;
|
||||
typedef HMODULE HINSTANCE;
|
||||
typedef MPARAM WPARAM;
|
||||
typedef MPARAM LPARAM;
|
||||
typedef void* HGLOBAL;
|
||||
typedef HMODULE HANDLE;
|
||||
typedef long COLORREF;
|
||||
typedef MRESULT LRESULT;
|
||||
#define CALLBACK APIENTRY
|
||||
typedef POWNERITEM LPDRAWITEMSTRUCT;
|
||||
typedef long HKEY;
|
||||
typedef UCHAR *LPBYTE;
|
||||
typedef QMSG MSG;
|
||||
typedef CHAR TCHAR;
|
||||
|
||||
#define WM_INITDIALOG WM_INITDLG
|
||||
#define IDYES MBID_YES
|
||||
#define MF_GRAYED 1
|
||||
#define MF_BYCOMMAND 1
|
||||
#define SWP_NOSIZE 1
|
||||
#define IDCANCEL DID_CANCEL
|
||||
#define LB_SETCURSEL 1
|
||||
#define WM_SETFONT 1
|
||||
#define MAX_PATH CCHMAXPATH
|
||||
#define KEY_CREATE_FOLDER 1
|
||||
|
||||
|
||||
#include "nsINIParser.h"
|
||||
|
||||
#ifndef LIBPATHSTRICT
|
||||
#define LIBPATHSTRICT 3
|
||||
#endif
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче