OS/2 only - not part of build - continuing OS/2 uninstall work

git-svn-id: svn://10.0.0.236/trunk@130387 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mkaply%us.ibm.com 2002-09-24 22:54:48 +00:00
parent 1c54e53dc3
commit ff37d3d554
8 changed files with 89 additions and 62 deletions

View File

@ -29,11 +29,10 @@ include $(DEPTH)/config/autoconf.mk
DIRS = nsinstall
DIRS += \
uninstall \
setuprsc \
setup \
$(NULL)
# uninstall \
include $(topsrcdir)/config/rules.mk

View File

@ -68,13 +68,6 @@ void ParseAllUninstallLogs()
}
}
/* clean up the uninstall windows registry key */
strcpy(szKey, "Software\\Microsoft\\Windows\\CurrentVersion\\uninstall\\");
strcat(szKey, ugUninstall.szUninstallKeyDescription);
#ifdef OLDCODE
RegDeleteKey(HKEY_LOCAL_MACHINE, szKey);
#endif
/* update Wininit.ini to remove itself at reboot */
RemoveUninstaller(ugUninstall.szUninstallFilename);
}
@ -297,6 +290,7 @@ HWND InstantiateDialog(HWND hParent, ULONG ulDlgID, PSZ szTitle, PFNWP pfnwpDlgP
{
char szBuf[MAX_BUF];
HWND hDlg = NULL;
ATOM atom;
hDlg = WinLoadDlg(HWND_DESKTOP, hParent, pfnwpDlgProc, 0, ulDlgID, NULL);
@ -313,5 +307,8 @@ HWND InstantiateDialog(HWND hParent, ULONG ulDlgID, PSZ szTitle, PFNWP pfnwpDlgP
WinPostQueueMsg(NULL, WM_QUIT, 1, 0);
}
atom = WinFindAtom(WinQuerySystemAtomTable(), CLASS_NAME);
WinSetWindowULong(hDlg, QWL_USER, atom);
return(hDlg);
}

View File

@ -138,9 +138,12 @@ HRESULT Initialize(HMODULE hInstance, PSZ szAppName)
char szBuf[MAX_BUF];
HWND hwndFW;
char *tempEnvVar = NULL;
hDlgMessage = NULL;
gulWhatToDo = WTD_ASK;
/* load strings from setup.exe */
if(NS_LoadStringAlloc(0, IDS_ERROR_GLOBALALLOC, &szEGlobalAlloc, MAX_BUF))
return(1);
@ -195,26 +198,53 @@ HRESULT Initialize(HMODULE hInstance, PSZ szAppName)
GetPrivateProfileString("General", "Defaults Info Filename", "", szBuf, MAX_BUF, szFileIniUninstall);
strcat(szFileIniDefaultsInfo, szBuf);
#ifdef OLDCODE
// determine the system's TEMP path
if(GetTempPath(MAX_BUF, szTempDir) == 0)
{
if(GetWindowsDirectory(szTempDir, MAX_BUF) == 0)
{
char szEGetWinDirFailed[MAX_BUF];
if(GetPrivateProfileString("Messages", "ERROR_GET_WINDOWS_DIRECTORY_FAILED", "",
szEGetWinDirFailed, sizeof(szEGetWinDirFailed),
szFileIniUninstall))
PrintError(szEGetWinDirFailed, ERROR_CODE_SHOW);
return(1);
}
AppendBackSlash(szTempDir, MAX_BUF);
strcat(szTempDir, "TEMP");
tempEnvVar = getenv("TMP");
if ((tempEnvVar) && (!(isFAT(tempEnvVar)))) {
strcpy(szOSTempDir, tempEnvVar);
}
else
{
tempEnvVar = getenv("TEMP");
if (tempEnvVar)
strcpy(szOSTempDir, tempEnvVar);
}
if ((!tempEnvVar) || (isFAT(tempEnvVar)))
{
ULONG ulBootDrive = 0;
APIRET rc;
char buffer[] = " :\\OS2\\";
DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE,
&ulBootDrive, sizeof(ulBootDrive));
buffer[0] = 'A' - 1 + ulBootDrive;
if (isFAT(buffer)) {
/* Try current disk if boot drive is FAT */
ULONG ulDriveNum;
ULONG ulDriveMap;
strcpy(buffer, " :\\");
DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
buffer[0] = 'A' - 1 + ulDriveNum;
if (isFAT(buffer)) {
int i;
for (i = 2; i < 26; i++) {
if ((ulDriveMap<<(31-i)) >> 31) {
buffer[0] = 'A' + i;
if (!(isFAT(buffer))) {
break;
}
}
}
if (i == 26) {
char szBuf[MAX_BUF];
WinLoadString(0, NULLHANDLE, IDS_ERROR_NO_LONG_FILENAMES, sizeof(szBuf), szBuf);
WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szBuf, NULL, 0, MB_ICONEXCLAMATION);
return(1);
}
}
}
strcpy(szOSTempDir, buffer);
strcat(szOSTempDir, "TEMP");
}
#endif
strcpy(szOSTempDir, szTempDir);
AppendBackSlash(szTempDir, MAX_BUF);
strcat(szTempDir, WIZ_TEMP_DIR);
@ -936,7 +966,7 @@ HRESULT GetAppPath()
}
else
{
strcpy(szApp, ugUninstall.szOIKey); /* OLDCODE */
strcpy(szApp, ugUninstall.szOIKey);
}
PrfQueryProfileString(HINI_USERPROFILE, szApp, "PathToExe", "", szTmpAppPath, sizeof(szTmpAppPath));
@ -965,9 +995,7 @@ HRESULT GetUninstallLogPath()
}
else
{
#ifdef OLDCODE
strcpy(szApp, ugUninstall.szOIKey);
#endif
}
PrfQueryProfileString(HINI_USERPROFILE, szApp, "Uninstall Log Folder", "", szLogFolder, sizeof(szLogFolder));
@ -1025,8 +1053,8 @@ HRESULT ParseUninstallIni(int argc, char *argv[])
GetPrivateProfileString("General", "Company Name", "", ugUninstall.szCompanyName, MAX_BUF, szFileIniUninstall);
GetPrivateProfileString("General", "Product Name", "", ugUninstall.szProductName, MAX_BUF, szFileIniUninstall);
GetPrivateProfileString("General", "Key", "", szKeyCrypted, MAX_BUF, szFileIniUninstall);
GetPrivateProfileString("General", "Decrypt Key", "", szBuf, MAX_BUF, szFileIniUninstall);
GetPrivateProfileString("General", "App", "", szKeyCrypted, MAX_BUF, szFileIniUninstall);
GetPrivateProfileString("General", "Decrypt App", "", szBuf, MAX_BUF, szFileIniUninstall);
if(strcmpi(szBuf, "TRUE") == 0)
{
DecryptString(ugUninstall.szOIKey, szKeyCrypted);
@ -1300,6 +1328,31 @@ HRESULT FileExists(PSZ szFile)
return (FALSE);
}
BOOL isFAT(char* szPath)
{
APIRET rc;
ULONG ulSize;
PFSQBUFFER2 pfsqbuf2;
CHAR szDrive[3];
ulSize = sizeof(FSQBUFFER2) + 3 * CCHMAXPATH;
pfsqbuf2 = (PFSQBUFFER2)malloc(ulSize);
strncpy(szDrive, szPath, 2);
szDrive[2] = '\0';
DosError(FERR_DISABLEHARDERR);
rc = DosQueryFSAttach(szDrive, 0, FSAIL_QUERYNAME,
pfsqbuf2, &ulSize);
DosError(FERR_ENABLEHARDERR);
if (rc == NO_ERROR) {
if (strcmp(pfsqbuf2->szFSDName + pfsqbuf2->cbName, "FAT") != 0)
return FALSE;
}
return TRUE;
}
void DeInitialize()
{
DeInitDlgUninstall(&diUninstall);

View File

@ -81,6 +81,7 @@ void AppendBackSlash(PSZ szInput, ULONG dwInputSize);
void RemoveSlash(PSZ szInput);
void AppendSlash(PSZ szInput, ULONG dwInputSize);
HRESULT FileExists(PSZ szFile);
BOOL isFAT(char* szPath);
HRESULT CheckInstances();
void RemoveQuotes(PSZ lpszSrc, PSZ lpszDest, int iDestSize);
PSZ GetFirstNonSpace(PSZ lpszString);

View File

@ -120,33 +120,3 @@ BOOL UndoDesktopIntegration(void)
return(0);
}
/* Function that retrieves the app name (including path) that is going to be
* uninstalled. The return string is in upper case. */
int GetUninstallAppPathName(char *szAppPathName, ULONG ulAppPathNameSize)
{
#ifdef OLDCODE
char szKey[MAX_BUF];
HKEY hkRoot;
if(*ugUninstall.szUserAgent != '\0')
{
hkRoot = ugUninstall.hWrMainRoot;
strcpy(szKey, ugUninstall.szWrMainKey);
AppendBackSlash(szKey, sizeof(szKey));
strcat(szKey, ugUninstall.szUserAgent);
AppendBackSlash(szKey, sizeof(szKey));
strcat(szKey, "Main");
}
else
{
return(CMI_APP_PATHNAME_NOT_FOUND);
}
GetWinReg(hkRoot, szKey, "PathToExe", szAppPathName, dwAppPathNameSize);
strupr(szAppPathName);
return(CMI_OK);
#endif
}

View File

@ -11,6 +11,7 @@
#define IDS_ERROR_STRING_NULL 4
#define IDS_ERROR_GLOBALALLOC 5
#define IDS_ERROR_FAILED 6
#define IDS_ERROR_NO_LONG_FILENAMES 7
#define IDI_SETUP 105
#define IDI_UNINSTALL 105
#define DLG_MESSAGE 110

View File

@ -64,10 +64,13 @@ main(int argc, char *argv[], char *envp[])
HMQ hmq;
QMSG qmsg;
char szBuf[MAX_BUF];
ATOM atom;
hab = WinInitialize( 0 );
hmq = WinCreateMsgQueue( hab, 0 );
atom = WinAddAtom(WinQuerySystemAtomTable(), CLASS_NAME);
if(Initialize(0, argv[0]))
{
WinPostQueueMsg(0, WM_QUIT, 1, 0);
@ -104,6 +107,8 @@ main(int argc, char *argv[], char *envp[])
/* Do clean up before exiting from the application */
DeInitialize();
WinDeleteAtom(WinQuerySystemAtomTable(), atom);
WinDestroyMsgQueue( hmq );
WinTerminate( hab );

View File

@ -67,6 +67,7 @@ BEGIN
IDS_ERROR_STRING_LOAD "Could not load string resource ID %d"
IDS_ERROR_STRING_NULL "Null pointer encountered."
IDS_ERROR_GLOBALALLOC "Memory allocation error."
IDS_ERROR_NO_LONG_FILENAMES "You must have at least one drive that supports long filenames to install this product."
END
/////////////////////////////////////////////////////////////////////////////