This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- How to reboot machine?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2008
04:06 AM
How to reboot machine?
I have customize a SdFinishReboot dialog, and use DefineDialog to show it like the following code:
function RunSdFinishReboot()
string szDialogName, szString;
HWND hMain;
number nResult, nControl, retVal, ctrlState;
BOOL bDone;
begin
szDialogName = "SdFinishReboot";
// see if the installer window already exists
hMain = GetWindowHandle( HWND_INSTALL );
nResult = DefineDialog(szDialogName, NULL, "", SDFINISHREBOOT_DIALOGID, "", NULL, HWND_INSTALL, DLG_MSG_STANDARD | DLG_CENTERED);
// Check to see if dialog creation failed
if (nResult < 0) then
if (hMain < 0 ) then
abort;
endif;
endif;
// show it
SetForegroundWindow(hMain);
bDone = FALSE;
while (!bDone)
nControl = WaitOnDialog(szDialogName);
switch (nControl)
case DLG_INIT:
SetDialogFont(szDialogName,"",0,0);
// finish btn
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_1",szString);
CtrlSetText(szDialogName,1,szString);
// IS complete
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_50",szString);
CtrlSetText(szDialogName,50,szString);
// description
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_711",szString);
// replace the %P
TextSub.Value("PRODUCTNAME") = IFX_PRODUCT_NAME;
TextSub.Substitute(szString);
CtrlSetText(szDialogName,711,szString);
// remove disks and press finish text
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_712",szString);
CtrlSetText(szDialogName,712,szString);
// yes reboot
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_502",szString);
CtrlSetText(szDialogName,502,szString);
// no dont reboot
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_503",szString);
CtrlSetText(szDialogName,503,szString);
case 1: // finish button
// get "yes reboot now" state
ctrlState = CtrlGetState(szDialogName,502);
if (ctrlState == BUTTON_CHECKED) then
retVal = WILL_REBOOT;
else
retVal = NEXT;
endif;
bDone = TRUE;
endswitch;
endwhile;
EndDialog(szDialogName);
ReleaseDialog(szDialogName);
return retVal;
end;
Note that the bold code above, I can detect the user check to reboot checkbox, But I don't know how to reboot the system, should I use the following function?
system(SYS_BOOTMACHINE);
function RunSdFinishReboot()
string szDialogName, szString;
HWND hMain;
number nResult, nControl, retVal, ctrlState;
BOOL bDone;
begin
szDialogName = "SdFinishReboot";
// see if the installer window already exists
hMain = GetWindowHandle( HWND_INSTALL );
nResult = DefineDialog(szDialogName, NULL, "", SDFINISHREBOOT_DIALOGID, "", NULL, HWND_INSTALL, DLG_MSG_STANDARD | DLG_CENTERED);
// Check to see if dialog creation failed
if (nResult < 0) then
if (hMain < 0 ) then
abort;
endif;
endif;
// show it
SetForegroundWindow(hMain);
bDone = FALSE;
while (!bDone)
nControl = WaitOnDialog(szDialogName);
switch (nControl)
case DLG_INIT:
SetDialogFont(szDialogName,"",0,0);
// finish btn
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_1",szString);
CtrlSetText(szDialogName,1,szString);
// IS complete
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_50",szString);
CtrlSetText(szDialogName,50,szString);
// description
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_711",szString);
// replace the %P
TextSub.Value("PRODUCTNAME") = IFX_PRODUCT_NAME;
TextSub.Substitute(szString);
CtrlSetText(szDialogName,711,szString);
// remove disks and press finish text
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_712",szString);
CtrlSetText(szDialogName,712,szString);
// yes reboot
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_502",szString);
CtrlSetText(szDialogName,502,szString);
// no dont reboot
LoadStringFromStringTable("IDS__DialogId_12031_ControlId_503",szString);
CtrlSetText(szDialogName,503,szString);
case 1: // finish button
// get "yes reboot now" state
ctrlState = CtrlGetState(szDialogName,502);
if (ctrlState == BUTTON_CHECKED) then
retVal = WILL_REBOOT;
else
retVal = NEXT;
endif;
bDone = TRUE;
endswitch;
endwhile;
EndDialog(szDialogName);
ReleaseDialog(szDialogName);
return retVal;
end;
Note that the bold code above, I can detect the user check to reboot checkbox, But I don't know how to reboot the system, should I use the following function?
system(SYS_BOOTMACHINE);
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2008
08:00 AM
Set the REBOOT Property to "force"
See the MS documentation on the REBOOT Property for more information.
See the MS documentation on the REBOOT Property for more information.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 13, 2008
10:48 PM
Hi,Kelter
I've added the following code into the function OnFirstUIAfter()
function OnFirstUIAfter()
...
begin
...
//MsiDoAction(ISMSI_HANDLE, "ForeceReboot");
//MsiSetMode(ISMSI_HANDLE, MSIRUNMODE_REBOOTNOW, TRUE);
MsiSetProperty(ISMSI_HANDLE, "REBOOT", "Force");
end;
But it didn't work, no reboot happened.
I also used the MsiDoAction(ISMSI_HANDLE, "ForeceReboot") to replace MsiSetProperty(ISMSI_HANDLE, "REBOOT", "Force"), but this function returns ERROR_FUNCTION_NOT_CALLED
I also use MsiSetMode(ISMSI_HANDLE, MSIRUNMODE_REBOOTNOW, TRUE), and then a dialog prompted, which says:
The installer must restart your system before configuration of [2] can continue. Click Yes to restart now or No if you plan to restart later.
But after clicking Yes, no reboot happened.
Did I do something wrong?
Any advice would be appreciated.
I've added the following code into the function OnFirstUIAfter()
function OnFirstUIAfter()
...
begin
...
//MsiDoAction(ISMSI_HANDLE, "ForeceReboot");
//MsiSetMode(ISMSI_HANDLE, MSIRUNMODE_REBOOTNOW, TRUE);
MsiSetProperty(ISMSI_HANDLE, "REBOOT", "Force");
end;
But it didn't work, no reboot happened.
I also used the MsiDoAction(ISMSI_HANDLE, "ForeceReboot") to replace MsiSetProperty(ISMSI_HANDLE, "REBOOT", "Force"), but this function returns ERROR_FUNCTION_NOT_CALLED
I also use MsiSetMode(ISMSI_HANDLE, MSIRUNMODE_REBOOTNOW, TRUE), and then a dialog prompted, which says:
The installer must restart your system before configuration of [2] can continue. Click Yes to restart now or No if you plan to restart later.
But after clicking Yes, no reboot happened.
Did I do something wrong?
Any advice would be appreciated.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 14, 2008
06:50 AM
You would probably want to use ScheduleReboot instead of ForceReboot. (See topic: "System Reboots")
Otherwise, I'm confused. Have you checked out the log to see what might have gone wrong?
Otherwise, I'm confused. Have you checked out the log to see what might have gone wrong?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 15, 2008
07:18 AM
Hi, Kelter!
I've used MsiDoAction(ISMSI_HANDLE, "ScheduleReboot"); in then function
OnFirstUIAfter().
And the log file as follows:
...
Action ended 19:57:32: CostFinalize. Return value 1.
MSI (c) (BC:B8) [19:57:32:270]: Note: 1: 2205 2: 3: ISAlias
MSI (c) (BC:B8) [19:57:32:270]: Note: 1: 2228 2: 3: ISAlias 4: SELECT * FROM ISAlias
MSI (c) (BC:6C) [19:57:32:286]: Entering MsiProvideComponentFromDescriptor. Descriptor: NocEDITzn?0exBp'6!7bCore>M5KDYSUnf(HA*L[xeX)y, PathBuf: 1DFEEA4, pcchPathBuf: 1DFEEA0, pcchArgsOffset: 1DFEE00
MSI (c) (BC:6C) [19:57:32:286]: MsiProvideComponentFromDescriptor called for component {997FA962-E067-11D1-9396-00A0C90F27F9}: returning harcoded oleaut32.dll value
MSI (c) (BC:6C) [19:57:32:286]: MsiProvideComponentFromDescriptor is returning: 0
MSI (c) (BC:B8) [19:57:33:161]: Doing action: ScheduleReboot
Action 19:57:33: ScheduleReboot.
Action start 19:57:33: ScheduleReboot.
Action ended 19:57:33: ScheduleReboot. Return value 1.
=== Verbose logging stopped: 2008-4-15 19:57:33 ===
You can see that the ScheduleReboot run,and return value 1. Does value 1 mean success? If it mean success, why did reboot not happen?
I've used MsiDoAction(ISMSI_HANDLE, "ScheduleReboot"); in then function
OnFirstUIAfter().
And the log file as follows:
...
Action ended 19:57:32: CostFinalize. Return value 1.
MSI (c) (BC:B8) [19:57:32:270]: Note: 1: 2205 2: 3: ISAlias
MSI (c) (BC:B8) [19:57:32:270]: Note: 1: 2228 2: 3: ISAlias 4: SELECT * FROM ISAlias
MSI (c) (BC:6C) [19:57:32:286]: Entering MsiProvideComponentFromDescriptor. Descriptor: NocEDITzn?0exBp'6!7bCore>M5KDYSUnf(HA*L[xeX)y, PathBuf: 1DFEEA4, pcchPathBuf: 1DFEEA0, pcchArgsOffset: 1DFEE00
MSI (c) (BC:6C) [19:57:32:286]: MsiProvideComponentFromDescriptor called for component {997FA962-E067-11D1-9396-00A0C90F27F9}: returning harcoded oleaut32.dll value
MSI (c) (BC:6C) [19:57:32:286]: MsiProvideComponentFromDescriptor is returning: 0
MSI (c) (BC:B8) [19:57:33:161]: Doing action: ScheduleReboot
Action 19:57:33: ScheduleReboot.
Action start 19:57:33: ScheduleReboot.
Action ended 19:57:33: ScheduleReboot. Return value 1.
=== Verbose logging stopped: 2008-4-15 19:57:33 ===
You can see that the ScheduleReboot run,and return value 1. Does value 1 mean success? If it mean success, why did reboot not happen?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 15, 2008
07:45 AM
I'm befuddled. I haven't spent a whole lot of time debugging InstallScript MSI projects, but as far as any rebooting is concerned, that's all i've ever really needed to do (or the equivalent in Basic MSI...)
I'm baffled as well. Anybody else?
Sorry, I'd set up a text project and try to figure it out, but things are extremely busy this week.
I'm baffled as well. Anybody else?
Sorry, I'd set up a text project and try to figure it out, but things are extremely busy this week.