1. Windows Shutdown
- Posted by Christopher B <exceptionalgreatness at hotmail.com> Oct 18, 2003
- 518 views
Hello to all, I have been using the following code at the end of this message to try and shutdown windows, but unfortunately it only logs the user off, and not completely shutdown the PC. I did some research on the MSN website, and I found out to shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege. The problem is I do not have a clue on how to do that. Can anyone help out with this? constant USER32 = open_dll("user32") constant SHUTDOWNEX = define_c_func(USER32, "ExitWindowsEx", {C_UINT, C_LONG}, C_INT) global constant EWX_FORCE = 4, EWX_LOGOFF = 0, EWX_POWEROFF = 8, EWX_REBOOT = 2, EWX_SHUTDOWN = 1 global procedure win32_shutdown(integer shutdown_type) integer x x = c_func(SHUTDOWNEX, {shutdown_type, 0}) end procedure Thanks in advance, Chris
2. Re: Windows Shutdown
- Posted by "Louis Puster" <Louis at cwshop.com> Oct 19, 2003
- 492 views
The Windows shutdown process is very buggy. It works differently from one computer to the next. A small assembly language program that will shutdown, logoff, play sounds, open and close a CDROM, an entertaining and educational screensaver, and much more is called WIZMO and can be found at GRC.COM. (This guy does EVERYTHING in assembly language, even his own Web server and TCP/IP drivers.) Louis. *********** REPLY SEPARATOR *********** On 10/18/2003 at 1:16 PM Christopher B wrote: > > >Hello to all, > >I have been using the following code at the end of this message to try >and shutdown windows, but unfortunately it only logs the user off, and >not completely shutdown the PC. I did some research on the MSN website, >and I found out to shut down or restart the system, the calling process >must use the AdjustTokenPrivileges function to enable the >SE_SHUTDOWN_NAME privilege. The problem is I do not have a clue on how >to do that. Can anyone help out with this? > >constant USER32 = open_dll("user32") > >constant SHUTDOWNEX = define_c_func(USER32, "ExitWindowsEx", {C_UINT, >C_LONG}, C_INT) >global constant > > EWX_FORCE = 4, > EWX_LOGOFF = 0, > EWX_POWEROFF = 8, > EWX_REBOOT = 2, > EWX_SHUTDOWN = 1 > > >global procedure win32_shutdown(integer shutdown_type) > integer x > x = c_func(SHUTDOWNEX, {shutdown_type, 0}) >end procedure > >Thanks in advance, >Chris
3. Re: Windows Shutdown
- Posted by "Juergen Luethje" <j.lue at gmx.de> Oct 20, 2003
- 533 views
Louis wrote: > The Windows shutdown process is very buggy. It works differently from > one computer to the next. Yes ... Or at least differently from one Windows flavor to the next. > A small assembly language program that will shutdown, logoff, play > sounds, open and close a CDROM, an entertaining and educational > screensaver, and much more is called WIZMO and can be found at GRC.COM. I agree that WIZMO is a nice program, but even WIZMO does not reliably shut down all PCs. > (This guy does EVERYTHING in assembly language, even his own Web > server and TCP/IP drivers.) > > Louis. [snipped old text] Regards, Juergen -- /"\ ASCII ribbon campain | \ / against HTML in | This message has been ROT-13 encrypted X e-mail and news, | twice for higher security. / \ and unneeded MIME |
4. Re: Windows Shutdown
- Posted by "Louis Puster" <Louis at cwshop.com> Oct 20, 2003
- 515 views
One of my points was that if Steve Gibson (WIZMO) couldn't get Windows to behave, nobody else could either. By the way, an earlier post mentioned using the FORCE parameter when calling for a shutdown. Although sometimes necessary to overcome the Win98 shutdown problem, I believe this can shut down programs before they are ready, before they have written their buffers to the HD, resulting in data loss. It helps to wait a while after closing all applications before forcing a shutdown. Louis. *********** REPLY SEPARATOR *********** On 10/20/2003 at 8:01 AM Juergen Luethje wrote: > > >Louis wrote: > >> The Windows shutdown process is very buggy. It works differently from >> one computer to the next. > >Yes ... Or at least differently from one Windows flavor to the next. > >> A small assembly language program that will shutdown, logoff, play >> sounds, open and close a CDROM, an entertaining and educational >> screensaver, and much more is called WIZMO and can be found at GRC.COM. > >I agree that WIZMO is a nice program, but even WIZMO does not reliably >shut down all PCs. > >> (This guy does EVERYTHING in assembly language, even his own Web >> server and TCP/IP drivers.) >> >> Louis. > >[snipped old text] > >Regards, > Juergen
5. Re: Windows Shutdown
- Posted by "Juergen Luethje" <j.lue at gmx.de> Oct 21, 2003
- 499 views
Louis wrote: > One of my points was that if Steve Gibson (WIZMO) couldn't get Windows > to behave, nobody else could either. Oops, it seems that I misunderstood you. Sorry. Now I see that we have the same opinion. > By the way, an earlier post mentioned using the FORCE parameter when > calling for a shutdown. Although sometimes necessary to overcome the > Win98 shutdown problem, I believe this can shut down programs before > they are ready, before they have written their buffers to the HD, > resulting in data loss. It helps to wait a while after closing all > applications before forcing a shutdown. > > Louis. > > *********** REPLY SEPARATOR *********** > > On 10/20/2003 at 8:01 AM Juergen Luethje wrote: > >> Louis wrote: >> >>> The Windows shutdown process is very buggy. It works differently from >>> one computer to the next. >> >> Yes ... Or at least differently from one Windows flavor to the next. >> >>> A small assembly language program that will shutdown, logoff, play >>> sounds, open and close a CDROM, an entertaining and educational >>> screensaver, and much more is called WIZMO and can be found at GRC.COM. >> >> I agree that WIZMO is a nice program, but even WIZMO does not reliably >> shut down all PCs. >> >>> (This guy does EVERYTHING in assembly language, even his own Web >>> server and TCP/IP drivers.) >>> >>> Louis. >> >> [snipped old text] >> >> Regards, >> Juergen Regards, Juergen