From 010dd61226f564364442958e2084c1725eadfe97 Mon Sep 17 00:00:00 2001 From: kichik Date: Sat, 25 Sep 2004 14:56:16 +0000 Subject: [PATCH] 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 --- Source/exehead/Main.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/exehead/Main.c b/Source/exehead/Main.c index d2fbb256..eb9f2098 100644 --- a/Source/exehead/Main.c +++ b/Source/exehead/Main.c @@ -70,7 +70,7 @@ char *ValidateTempDir() int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) { - int ret; + int ret = 0; const char *m_Err = _LANG_ERRORWRITINGTEMP; int cl_flags = 0; @@ -81,8 +81,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, InitCommonControls(); - g_exec_flags.errlvl=-1; - #if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT) { extern HRESULT g_hres; @@ -195,7 +193,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, 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 buf2[NSIS_MAX_STRLEN*2]; static char ibuf[NSIS_MAX_STRLEN]; @@ -244,9 +241,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, } #endif//NSIS_CONFIG_UNINSTALL_SUPPORT + g_exec_flags.errlvl = -1; ret = ui_doinstall(); - if (g_exec_flags.errlvl == -1) - g_exec_flags.errlvl = ret; + if (g_exec_flags.errlvl != -1) + ret = g_exec_flags.errlvl; #ifdef NSIS_CONFIG_LOG #ifndef NSIS_CONFIG_LOG_ODS @@ -260,14 +258,14 @@ end: if (m_Err) { 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) OleUninitialize(); #endif - ExitProcess(g_exec_flags.errlvl); + ExitProcess(ret); } void NSISCALL CleanUp()