Download these three tools with source (ZIP)
The requirements were clear – in the late 1990s, I needed to make utilities for Windows that would simply perform the basic actions such as log off, shut down, or reboot when called. This was to be created in Microsoft Visual C++ and compiled as a Windows 32bit Portable Executable (PE). The results would be the Reboot, Log Off and Shut Down.
The essence of each of these tools is using the Windows API to simply perform the operation quickly and efficiently. One example is the source code for ShutDown, which looks like the image below. The API call occurs at line 30.
Each program’s ExitWindowsEx () call corresponds to the action taken. The following lists each of the tool’s function calls:
logout: ExitWindowsEx( EWX_FORCE,EWX_FORCE);
All of the above executable files have been scanned using VirusTotal’s service current as of August 28, 2012. For available reports, click on any of the following links: shutdown.exe, reboot.exe, logout.exe