Fast shutdown shutdown, including the source code.
The company's public laptop is too bad, I do not know from when the shutdown will never shut down, has been stuck in the "shut down the system ...". Under the unbearable, I wrote a quick shutdown program.
Download:
Shutdown_for_winxp.rar
Shutdown_for_win7-32bit.rar
Source:
BOOL ntexitwindows (UINT uflags, DWORD dwreason) {HANDLE htoken; Token_privileges TKP; if(!OpenProcessToken (GetCurrentProcess (), Token_adjust_privileges| Token_query, &htoken)) returnFALSE; if(!Lookupprivilegevalue (NULL, Se_shutdown_name,&TKP. privileges[0]. Luid)) {CloseHandle (htoken); returnFALSE; } TKP. Privilegecount=1;//One privilege to setTkp. privileges[0]. Attributes =se_privilege_enabled; if(! AdjustTokenPrivileges (Htoken, FALSE, &TKP,sizeof(Token_privileges), (ptoken_privileges) null, (Pdword) null)) {CloseHandle (htoken); returnFALSE; } closehandle (Htoken); returnExitWindowsEx (uflags, Dwreason);}
Download:
Shutdown_for_winxp.rar
Shutdown_for_win7-32bit.rar
Simple series of original software-tool software-quick shutdown shutdown