Archive: Reboot crash?


Reboot crash?
Hi Everyone,

Has anyone run into problems with the Reboot command in NSIS 1.98? I'm basically doing the following at the end of my Uninstall section for a product we'll be shipping soon:

IfRebootFlag lbl_reboot lbl_noboot
MessageBox MB_OK $0
Return
lbl_reboot:
MessageBox MB_YESNO $0 IDNO lbl_noboot
Reboot
lbl_noboot:

Thanks for any input, or maybe comments on side effects of other things I may be doing that would cause problems with this. I am using DLLs fairly extensively, but have not had any problems with them.

Thanks,

Jim


OpenProcessToken()
More details:

I used the NSIS template generator and made a minimal uninstaller which does a Reboot at the end and it works fine, so it's something about my customization.

I compiled up a debug version of NSIS with VC7 and am debugging the exehead of my generated uninstaller. I'm crashing in the EW_REBOOT switch of ExecuteEntry() at the indirected call to OpenProcessToken().

I get an "ESP not restored" error. The args look good. More details coming if I find anything...

Jim


WINAPI
Okay, I appear to have fixed it with the following changes to exehead\exec.c, on or near line 928:


BOOL (*OPT)(HANDLE, DWORD,PHANDLE);
BOOL (*LPV)(LPCTSTR,LPCTSTR,PLUID);
BOOL (*ATP)(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);

those declarations get WINAPI added to them:

BOOL (WINAPI *OPT)(HANDLE, DWORD,PHANDLE);
BOOL (WINAPI *LPV)(LPCTSTR,LPCTSTR,PLUID);
BOOL (WINAPI *ATP)(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);

I don't know why this isn't causing a problem all the time, maybe in the way the stack gets cleaned up in this particular context.

VC7 will open and convert the .dsw file included in the 1.98 source just fine and build it with no problems, it flags the problem with a runtime check in the debugger.

Doh!
Okay, beat me with a wet noodle:

http://sourceforge.net/tracker/index...49&atid=373085


Please check wheather the latest NSIS 2 development version gives the same problem.

Another question:

Can you try to compile the NSIS 2 using VC7 and check wheather the VC7 compiler can make the installer smaller?

Thanks


Does this happen with the pre-built NSIS or only with a version built by VC7?


Hmm... Beat me with a wet noodle? It is __stdcall... =/
That's weird... I was sure it was __cdecl... It does work when I add WINAPI which is __stdcall.

I have changed this in the CVS, god knows why it worked up until now even though the default calling convention is __cdecl.


Confirmed
I'm not on 2.0 yet, we're pulling our hair out trying to get our next Beta release out the door, but I will soon after that, in the next few weeks.

The crash I was seeing was with the pre-built, released version of 1.98, and reproduced after I compiled and built it in VC6. Originally, all I wanted was to turn logging on, but it got me comfortable with where things were, and so was able to track the problem down.

It was working for me on '98 too, just not on '2K/XP, and I couldn't explain that. But I guess I'm always surprised by what things are strict/lenient on all the flavors of Windows. I pulled out VC7 because it has the easy interface to the remote/attached debugging, which helps with the way the uninstaller spawns itself.

Thank you for all the work you've done on this installer, it's made our downloads leaner, and its transparency has made my life easier. I'll be looking to do the MUI update in 2.0 soon, and getting the updated DLL interface (I've got a half-dozen).

Jim - http://www.cerience.com


It was working for me on '98 too, just not on '2K/XP, and I couldn't explain that.
Windows 9x doesn't use those functions, that's why.