cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gerico_one
Level 3

how to send a return code OUT from my setup.exe

i need a return Code my setup.exe file.

I need to send out from my setup.rul a return code for my customer.
Labels (1)
0 Kudos
(6) Replies
Gvarma
Level 7

gerico.one wrote:
i need a return Code my setup.exe file.

I need to send out from my setup.rul a return code for my customer.


Setup.exe does not return any code (success or failure) , if you have to return a value based on what you situation then your best bet is perhaps writing a value to a temp file (which your programmer can read) or setting up an environement variable.


HTH
0 Kudos
RobertDickau
Flexera Alumni

Actually, setup.exe does have some predefined return values [please see "Setup.exe Return Values and Run-Time Errors (InstallScript Projects)" and "Setup.exe Return Values and Run-Time Errors (Basic MSI and InstallScript MSI Projects)"]; but I'm not aware of a way to specify a custom return value, so a log file of some sort might be useful.
0 Kudos
gerico_one
Level 3

i'm trying to change the variable ERRORLEVEL in the registry..i have found in the help this function..
but with a refresh (F5) in my REGISTRY EDITOR i can see this change only for few seconds..

I AM NOT SURE this is the correct way... at this moment.. i don't think so :confused:


#define WM_WININICHANGE 0x001A
#define HWND_BROADCAST 0xffff
//#define WM_WININICHANGE 0x001A
//#define HWND_BROADCAST 0xffff

prototype SetVariabile1(string);

function SetVariabile1(value)


NUMBER nResult;
STRING szKey, szEnv;
POINTER pEnv;

begin

szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
nResult = RegDBSetKeyValueEx(szKey, "ERRORLEVEL", REGDB_STRING, value, -1);
if (nResult < 0) then
//MessageBox("Failed to Set Environment Variable", WARNING);
else
//MessageBox("Successfully Set Environment Variable", INFORMATION);
// Flush the NT registry to all applications.
szEnv = "Environment";
pEnv = &szEnv;
SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, pEnv );
endif;
// RebootDialog("", "", SYS_BOOTMACHINE);
end;



prototype SetVariabile2(string);

function SetVariabile2(value)

NUMBER nResult;
STRING szKey, szEnv;
POINTER pEnv;

begin
szKey="Environment";
RegDBSetDefaultRoot(HKEY_CURRENT_USER);
nResult=RegDBSetKeyValueEx(szKey,"ERRORLEVEL",REGDB_STRING,value,-1);
if (nResult < 0) then
//MessageBox("Failed to Set Environment Variable",WARNING);
else
//MessageBox("Successfully Set Environment Variable",INFORMATION);
// Flush the NT registry to all applications.
szEnv = "Environment";
pEnv = &szEnv;
SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, pEnv );
endif;
//RebootDialog("","",SYS_BOOTMACHINE);
end;
0 Kudos
RobertDickau
Flexera Alumni

The issue might be that setup.exe is re-setting ERRORLEVEL to its normal exit code when it exits.

(To test, perhaps put a message box after your SendMessage call, then open a new command prompt window and see if ERRORLEVEL is set? Or perhaps try a different environment variable, such as MYERRORLEVEL?)
0 Kudos
Gvarma
Level 7

RobertDickau wrote:
The issue might be that setup.exe is re-setting ERRORLEVEL to its normal exit code when it exits.

(To test, perhaps put a message box after your SendMessage call, then open a new command prompt window and see if ERRORLEVEL is set? Or perhaps try a different environment variable, such as MYERRORLEVEL?)


I would NOT use environment variable ERRORLEVEL as this var is being used by zillions of processes and it is likely the between you setting the value of ErrorLevel to something and your programmer reading it, some other process could reset it to something that your programmer does not want,,,,, with this being said I would create and use a some NEW environment variable (in line with what Robert suggested) and obviously record the reserved value and env var so it cant be used for any other purposes.

HTH
0 Kudos
gerico_one
Level 3

0 Kudos