;---------- ---------- ---------- ---------- ---------- ; 作成者のURL ---> http://www.setsuki.com/ ;---------- ---------- ---------- ---------- ---------- #include "advapi32.as" #ifdef __hsp30__ #ifndef __KERNEL32__ #define global __KERNEL32__ #uselib "KERNEL32.DLL" #func global GetVersionEx "GetVersionExA" sptr #func global GetCurrentProcess "GetCurrentProcess" #endif #ifndef __USER32__ #define global __USER32__ #uselib "USER32.DLL" #func global ExitWindowsEx "ExitWindowsEx" sptr, sptr #endif #endif #module ;---------- ---------- ---------- ---------- ---------- #deffunc sysexit int p1 ewx=-1 if p1 == 0 : ewx=0x00000000 ;EWX_LOGOFF if p1 == 1 : ewx=0x00000002 ;EWX_REBOOT if p1 == 2 : ewx=0x00000001 ;EWX_SHUTDOWN if p1 == 3 : ewx=0x00000004 ;EWX_FORCE if ewx = -1 : return dim info_ver,148/4 : info_ver.0=148 GetVersionEx varptr(info_ver) if info_ver.3 == 2 { SetPrivileges = "SeShutdownPrivilege" ; カレントプロセスを取得 GetCurrentProcess : hProcess = stat ; プロセスのトークンを取得する OpenProcessToken hProcess, $28, varptr(hToken) ; シャットダウン特権のLUID取得する LookupPrivilegeValue 0, varptr(SetPrivileges), varptr(Luid) ; シャットダウン特権をこのアプリケーションに持たせる TokenNew=1,Luid,0,2 AdjustTokenPrivileges hToken,0,varptr(TokenNew),0,0,0 } ExitWindowsEx ewx, 0 return ;---------- ---------- ---------- ---------- ---------- #global