View Full Version : Shutdown code
Swimmer
September 13th, 2007, 23:20
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
September 14th, 2007, 00:07
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
September 14th, 2007, 00:58
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
September 14th, 2007, 15:36
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
September 14th, 2007, 18:06
I think I'll use 0006 and blame it on lightning. :-)
Powered by vBulletin® Version 4.2.2 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.