return 0 if the uninstaller was successfully copied and executed, not -1

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3671 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-09-25 14:56:16 +00:00
parent 5e960e1fd3
commit 010dd61226

View file

@ -70,7 +70,7 @@ char *ValidateTempDir()
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow)
{ {
int ret; int ret = 0;
const char *m_Err = _LANG_ERRORWRITINGTEMP; const char *m_Err = _LANG_ERRORWRITINGTEMP;
int cl_flags = 0; int cl_flags = 0;
@ -81,8 +81,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
InitCommonControls(); InitCommonControls();
g_exec_flags.errlvl=-1;
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
{ {
extern HRESULT g_hres; extern HRESULT g_hres;
@ -195,7 +193,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
for (x = 0; x < 26; x ++) for (x = 0; x < 26; x ++)
{ {
// File name need slash before because temp dir was changed by validate_filename
static char s[]="A~NSISu_.exe"; static char s[]="A~NSISu_.exe";
static char buf2[NSIS_MAX_STRLEN*2]; static char buf2[NSIS_MAX_STRLEN*2];
static char ibuf[NSIS_MAX_STRLEN]; static char ibuf[NSIS_MAX_STRLEN];
@ -244,9 +241,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
} }
#endif//NSIS_CONFIG_UNINSTALL_SUPPORT #endif//NSIS_CONFIG_UNINSTALL_SUPPORT
g_exec_flags.errlvl = -1;
ret = ui_doinstall(); ret = ui_doinstall();
if (g_exec_flags.errlvl == -1) if (g_exec_flags.errlvl != -1)
g_exec_flags.errlvl = ret; ret = g_exec_flags.errlvl;
#ifdef NSIS_CONFIG_LOG #ifdef NSIS_CONFIG_LOG
#ifndef NSIS_CONFIG_LOG_ODS #ifndef NSIS_CONFIG_LOG_ODS
@ -260,14 +258,14 @@ end:
if (m_Err) if (m_Err)
{ {
my_MessageBox(m_Err, MB_OK | MB_ICONSTOP | (IDOK << 20)); my_MessageBox(m_Err, MB_OK | MB_ICONSTOP | (IDOK << 20));
g_exec_flags.errlvl = 2; ret = 2;
} }
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
OleUninitialize(); OleUninitialize();
#endif #endif
ExitProcess(g_exec_flags.errlvl); ExitProcess(ret);
} }
void NSISCALL CleanUp() void NSISCALL CleanUp()