1
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3
* The contents of this file are subject to the Netscape Public
4
* License Version 1.1 (the "License"); you may not use this file
5
* except in compliance with the License. You may obtain a copy of
6
* the License at http://www.mozilla.org/NPL/
8
* Software distributed under the License is distributed on an "AS
9
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
* implied. See the License for the specific language governing
11
* rights and limitations under the License.
13
* The Original Code is Mozilla Communicator client code,
14
* released March 31, 1998.
16
* The Initial Developer of the Original Code is Netscape Communications
17
* Corporation. Portions created by Netscape are
18
* Copyright (C) 1998 Netscape Communications Corporation. All
22
* Sean Su <ssu@netscape.com>
25
#include "uninstall.h"
30
/* global variables */
48
LPSTR szFileIniUninstall;
49
LPSTR szFileIniDefaultsInfo;
50
LPSTR gszSharedFilename;
58
BOOL gbAllowMultipleInstalls = FALSE;
60
uninstallGen ugUninstall;
63
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
65
/***********************************************************************/
66
/* HANDLE hInstance; handle for this instance */
67
/* HANDLE hPrevInstance; handle for possible previous instances */
68
/* LPSTR lpszCmdLine; long pointer to exec command line */
69
/* int nCmdShow; Show code for main window display */
70
/***********************************************************************/
79
hInst = GetModuleHandle(NULL);
80
if(InitUninstallGeneral())
82
else if(ParseCommandLine(lpszCmdLine))
84
else if((hwndFW = FindWindow(CLASS_NAME_UNINSTALL_DLG, NULL)) != NULL && !gbAllowMultipleInstalls)
86
/* Allow only one instance of setup to run.
87
* Detect a previous instance of setup, bring it to the
88
* foreground, and quit current instance */
90
ShowWindow(hwndFW, SW_RESTORE);
91
SetForegroundWindow(hwndFW);
92
iRv = WIZ_SETUP_ALREADY_RUNNING;
95
else if(Initialize(hInst))
99
else if(!InitApplication(hInst))
101
char szEFailed[MAX_BUF];
103
if(NS_LoadString(hInst, IDS_ERROR_FAILED, szEFailed, MAX_BUF) == WIZ_OK)
105
wsprintf(szBuf, szEFailed, "InitApplication().");
106
PrintError(szBuf, ERROR_CODE_SHOW);
110
else if(ParseUninstallIni())
114
else if(ugUninstall.bUninstallFiles == TRUE)
116
if(diUninstall.bShowDialog == TRUE)
117
hDlgUninstall = InstantiateDialog(hWndMain, DLG_UNINSTALL, diUninstall.szTitle, DlgProcUninstall);
118
// Assumes that SHOWICONS, HIDEICONS, and SETDEFAULT never show dialogs
119
else if((ugUninstall.mode == SHOWICONS) || (ugUninstall.mode == HIDEICONS))
121
else if(ugUninstall.mode == SETDEFAULT)
124
ParseAllUninstallLogs();
128
if((ugUninstall.bUninstallFiles == TRUE) && (diUninstall.bShowDialog == TRUE))
130
while(GetMessage(&msg, NULL, 0, 0))
132
if((!IsDialogMessage(hDlgUninstall, &msg)) && (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)))
134
TranslateMessage(&msg);
135
DispatchMessage(&msg);
140
/* garbage collection */
141
DeInitUninstallGeneral();
142
if(iRv != WIZ_SETUP_ALREADY_RUNNING)
143
/* Do clean up before exiting from the application */
147
} /* End of WinMain */