- added GetErrorLevel and SetErrorLevl

- fixed some inconsistencies in the error levels the installer/uninstaller set


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3668 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-09-25 10:49:08 +00:00
parent f4089b9d60
commit e82748702c
8 changed files with 45 additions and 14 deletions

View file

@ -70,7 +70,7 @@ char *ValidateTempDir()
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow)
{
static int ret;
int ret;
const char *m_Err = _LANG_ERRORWRITINGTEMP;
int cl_flags = 0;
@ -81,6 +81,8 @@ 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;
@ -243,6 +245,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
#endif//NSIS_CONFIG_UNINSTALL_SUPPORT
ret = ui_doinstall();
if (g_exec_flags.errlvl == -1)
g_exec_flags.errlvl = ret;
#ifdef NSIS_CONFIG_LOG
#ifndef NSIS_CONFIG_LOG_ODS
@ -254,13 +258,16 @@ end:
CleanUp();
if (m_Err)
{
my_MessageBox(m_Err, MB_OK | MB_ICONSTOP | (IDOK << 20));
g_exec_flags.errlvl = 2;
}
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
OleUninitialize();
#endif
ExitProcess(ret);
ExitProcess(g_exec_flags.errlvl);
}
void NSISCALL CleanUp()

View file

@ -302,7 +302,7 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
#ifdef NSIS_SUPPORT_CODECALLBACKS
// Select language
if (ExecuteCallbackFunction(CB_ONINIT)) return 1;
if (ExecuteCallbackFunction(CB_ONINIT)) return 2;
set_language();
#endif
@ -363,7 +363,7 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
#ifdef NSIS_SUPPORT_CODECALLBACKS
if (!g_quit_flag) ExecuteCallbackFunction(CB_ONINSTFAILED);
#endif//NSIS_SUPPORT_CODECALLBACKS
return 1;
return 2;
}
#ifdef NSIS_SUPPORT_CODECALLBACKS
ExecuteCallbackFunction(CB_ONINSTSUCCESS);
@ -1596,7 +1596,7 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
if (g_quit_flag)
{
m_retcode=1;
m_retcode=2;
outernotify(NOTIFY_BYE_BYE);
}
else

View file

@ -467,6 +467,7 @@ typedef struct
#endif
int instdir_error;
int rtl;
int errlvl;
} exec_flags;
#define FIELDN(x, y) (((int *)&x)[y])