View Full Version : Shutdown code
Swimmer
09-13-2007, 11:20 PM
What is the logic involved for the first statement in regards to the ORing. In particular, what is the 1 for. There was nothing in the Programmers Reference that talks about it.
Thanks.
invoke ExitWindowsEx,EWX_SHUTDOWN or EWX_FORCE,1 ; all apps open are forced closed
;invoke ExitWindowsEx, EWX_SHUTDOWN, 0 ; more "gentile" shutdown
invoke ExitProcess,NULL
Kayaker
09-14-2007, 12:07 AM
Not sure there's much beyond what the definition of ExitWindowsEx describes.
http://msdn2.microsoft.com/en-us/library/aa376868.aspx
Code:
BOOL WINAPI ExitWindowsEx(
__in UINT uFlags,
__in DWORD dwReason
);
It's suggested by MSDN not to use 0 for the dwReason flag at all as it may delay shutdown. I don't see any logic for using 1 (which looks like SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_MAINTENANCE) in the EWX_FORCE case, and 0 in the other case. If anything, a default dwReason (whether it's accurate or not) should be used in both cases.
Swimmer
09-14-2007, 12:58 AM
My default API showed the 1 as undefined. After your response, I found the reason in the SDK help file.
Need to find a way to have that pop up when I highlight the API in my source.
It's nice that you can give a reason code. Is there a way to test for that code. :-)
The Force can be with you.
Hope you have a great weekend.
disavowed
09-14-2007, 03:36 PM
Quote:
| [Originally Posted by Swimmer;68489];invoke ExitWindowsEx, EWX_SHUTDOWN, 0 ; more "gentile" shutdown |
Ah, if you're a gentile then you have to use 0

(http://en.wikipedia.org/wiki/Gentile)
Swimmer
09-14-2007, 06:06 PM
I think I'll use 0006 and blame it on lightning. :-)
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.