1. Make a call from your C code to the Operating System API for shutdown. Which API call, what permissions you need and what options you have depends on the Operating System.
2. Break out the books and learn to make ACPI BIOS calls, probably more assembler than C. This will do it fast and sure but you may corrupt your OS and will certianly loose any unsaved data if you go this way.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
First of all, without synchronisation objects, you can't rely on anything having happened in another thread.
Second, CAsynchSocket has some inherent design problems (see CSocket considered harmful). You might want to consider rolling your own using the Win32 SDK if you're going to keep it running in a separate thread.
Third, you shouldn't create your CWinThread object directly. Use AfxBeginThread instead.
well first hello :
i would like to know how to learn kernel programming ?
Does any one know where should i start what books should i read ,if any one know books , websites,forums ,let me know them ,and i know C++ ,Java ,i have been programming since 1 year and half
Book wise you need Walter Oneys book on kernel programming.
Other than that you need 2 machines, the WDK, windbg, a firewire or serial x over cable and start putting code into the kernel.
PS, I have been doing windows kernel for about 16 years. It is fun, but complex, very very complex, but if you can stick at it for about 2 years you should know enough to be able to write useful code. (And use Verifier, a lot)
You'll probably want to get really familiar and comfortable with C. It may also be helpful to experiment with Linux drivers since you can browse all the existent code to see what other people are doing (although that may confuse you at first, specially if you're not comfortable with C). A lot of people try to dive right in without reading documentation, I'd recommend going over the documentation first, it might not make sense while you're reading it but when you finally dive in, things will start to make sense.
One thing you can do is take an existent driver from Linux and see if you can modify it to do something different. That should get you comfortable with it.
Yes, the same as I told you before. You are not checking that you have read all the data from the client so you have no way of being sure that you have a valid image. You are using sizeof and lstrlen to find the length of the data, neither of which will give you a valid answer.