#include <windows.h>

void Reboot(void)
{
   HANDLE privtok ;
   TOKEN_PRIVILEGES newt ;
   DWORD len ;
   LUID_AND_ATTRIBUTES attribs;

                                              
   OpenProcessToken(GetCurrentProcess(),TOKEN_ALL_ACCESS, &privtok) ;

   newt.PrivilegeCount = 1;
   LookupPrivilegeValue(0,SE_SHUTDOWN_NAME,&newt.Privileges[0].Luid) ;
   newt.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED ;

   AdjustTokenPrivileges(privtok,FALSE,&newt,0,0,0);

   CloseHandle(privtok) ;
   
   if (!ExitWindowsEx(EWX_REBOOT,0))
      MessageBox(0,"Reboot failed","Error",0) ;
}
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine,
                    int nCmdShow )
{
      Reboot() ;
      ExitProcess(0) ;
}