How can I programmatically shutdown a Win2K box
You just need to alter your security privilege and shoute=down the computer as normal.
Here is some sample code that does just that.
HANDLE hdlProcessHandle = GetCurrentProcess();
HANDLE hdlTokenHandle;
OpenProcessToken( hdlProcessHandle
, (TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY)
, &hdlTokenHandle );
TOKEN_PRIVILEGES tp;
tp.PrivilegeCount = 1;
VAPI( LookupPrivilegeValue( ""
, "SeShutdownPrivilege"
, &tp.Privileges[0].Luid ) );
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
VAPI( AdjustTokenPrivileges( hdlTokenHandle
, FALSE
, &tp
, 0
, NULL
, NULL ) );
ExitWindowsEx( EWX_POWEROFF, 0 );