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

This commit is contained in:
mkaply%us.ibm.com 2002-09-24 22:54:48 +00:00
Родитель 3c13940ad7
Коммит 7854e59e92
8 изменённых файлов: 87 добавлений и 184 удалений

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

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

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

@ -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);
}

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

@ -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);

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

@ -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);

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

@ -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
}

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

@ -1,49 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by uninstall.rc
//
#ifndef WINVER
#define WINVER 0x0400
#endif
#define IDS_ERROR_DLL_LOAD 1
#define IDS_ERROR_STRING_LOAD 2
#define IDS_ERROR_STRING_NULL 4
#define IDS_ERROR_GLOBALALLOC 5
#define IDS_ERROR_FAILED 6
#define IDI_SETUP 105
#define IDI_UNINSTALL 105
#define DLG_MESSAGE 110
#define IDC_LIST_PRODUCTS 1000
#define ID_NO 1001
#define IDC_GAUGE_FILE 1002
#define ID_NO_TO_ALL 1002
#define IDC_STATUS0 1004
#define ID_YES 1004
#define IDC_STATUS3 1005
#define ID_YES_TO_ALL 1005
#define IDC_GAUGE_ARCHIVE 1006
#define IDC_STATIC_SHARED_FILENAME 1006
#define IDC_EDIT_CURRENT_SETTINGS 1026
#define IDC_MESSAGE0 1042
#define IDC_MESSAGE1 1043
#define IDC_MESSAGE 1049
#define DLG_UNINSTALL 2008
#define DLG_EXTRACTING 2009
#define DLG_PRODUCT_LIST 2009
#define DLG_WHAT_TO_DO 2009
#define IDWIZBACK 11013
#define IDWIZNEXT 11014
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1007
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

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

@ -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 );

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

@ -1,73 +0,0 @@
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
ICON IDI_UNINSTALL DISCARDABLE "uninstall.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
DLGTEMPLATE DLG_UNINSTALL DISCARDABLE
BEGIN
DIALOG "", DLG_UNINSTALL, 64, 172, 282, 79,
WS_VISIBLE | FS_BORDER | FS_SCREENALIGN,
FCF_TITLEBAR | FCF_SYSMENU | FCF_MINBUTTON | FCF_NOMOVEWITHOWNER
BEGIN
DEFPUSHBUTTON "", IDWIZNEXT, 68, 10, 67, 14
PUSHBUTTON "", DID_CANCEL, 148, 10, 67, 14
LTEXT "", IDC_MESSAGE0, 22, 36, 239, 32, NOT WS_GROUP | SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
END
END
DLGTEMPLATE DLG_MESSAGE DISCARDABLE
BEGIN
DIALOG "", DLG_MESSAGE, 0, 273, 295, 34,
WS_VISIBLE | FS_DLGBORDER | FS_SCREENALIGN,
FCF_NOMOVEWITHOWNER
BEGIN
CTEXT "", IDC_MESSAGE, 0, 0, 295, 34, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
END
END
DLGTEMPLATE DLG_WHAT_TO_DO DISCARDABLE
BEGIN
DIALOG "", DLG_WHAT_TO_DO, 64, 111, 417, 140,
WS_VISIBLE | FS_DLGBORDER | FS_SCREENALIGN,
FCF_TITLEBAR | FCF_SYSMENU | FCF_MINBUTTON | FCF_NOMOVEWITHOWNER
BEGIN
DEFPUSHBUTTON "", ID_NO, 50, 18, 67, 14
PUSHBUTTON "", ID_NO_TO_ALL, 134, 18, 67, 14
PUSHBUTTON "", ID_YES, 218, 18, 67, 14
PUSHBUTTON "", ID_YES_TO_ALL, 302, 18, 67, 14
LTEXT "", IDC_MESSAGE0, 20, 94, 377, 33, NOT WS_GROUP | SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
LTEXT "", IDC_MESSAGE1, 20, 71, 377, 19, NOT WS_GROUP | SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
RTEXT "", IDC_STATIC, 23, 51, 52, 8, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
LTEXT "Static",IDC_STATIC_SHARED_FILENAME,83,47,314,14, SS_TEXT | DT_WORDBREAK | DT_MNEMONIC
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ERROR_DLL_LOAD "Could not load %s"
IDS_ERROR_STRING_LOAD "Could not load string resource ID %d"
IDS_ERROR_STRING_NULL "Null pointer encountered."
IDS_ERROR_GLOBALALLOC "Memory allocation error."
END
/////////////////////////////////////////////////////////////////////////////