From: Frank K. <fbk...@co...> - 2003-11-29 18:28:42
|
nmt wrote: > > I've seen here some codes to logoff from windows, but any source code > to shutdown any windows version platform; so that I wrote theses codes > that work in 9x, NT, 2000, XP (and suposse that run in 2003). > > http://mipagina.cantv.net/porrasgarcia/shutdown.zip > > Sorry by this style to write NASM codes, but is the easiest way that I > found to assemble programs using only NASM, without any linker. Very cool! But there's a bug in it! Being a die-hard dos-head, I actually *tried* the dos stub, and I got garbage before the "this program requires win32!" message. Stepping through it, I also noticed that the "call @w" generates the wrong address! We're executing the "!$" at the end of the data!!! I did this to it: stub: bits 16 ; <- call .@W db "This program only runs in win32!$" .@W pop dx push cs ; <- pop ds ; <- mov ah, 9 int 21h mov ah, 4ch int 21h ... ...and it seemed to work a little better. If anyone cares whether the dos stub works, these days... This particular program could benefit from a custom stub which actually reboots, instead of whining about not finding 'doze. I guess the "safest" way to reboot from dos is to emulate control-alt-delete(?). I can't lay my hands on an example of that code right at the moment, but I'm sure I can figure it out. I *did* come across a three-byte reboot example: pop sp inc sp push sp I don't think that's so safe, and it may not work on all systems, but it reboots my machine, and it sure is short :) Anyway, thanks for posting that, Numa (and for the Xwindows examples! - and gigathanks to Yeoh for the steady stream of examples!). This is really turning into a goldmine! Best, Frank |