Q&A

  • nt 종료시키는 방법은?
예전에 구창민님이 누군가에게 답변한 내용입니다.



여기서



AdjustTokenPrivileges()에서 에러가 납니다.



에러 내용은



there is no overloaded version of 'AdjustTokenPrivileges' that can be called with there arguments



어려운 내용이군....



해결을 해주시면 고맙겠군요...



그럼.



소스의 내용..........

var

PreviosPrivileges : ^TTokenPrivileges;

TokenPrivileges : TTokenPrivileges;

ProcessHandle : THandle;

tmp : Integer;



if not OpenProcessToken( GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES+TOKEN_QUERY,ProcessHandle ) then

Exit;



LookupPrivilegeValue( '', 'SeShutdownPrivilege', TokenPrivileges.Privileges[0].Luid );

TokenPrivileges.PrivilegeCount := 1;

TokenPrivileges.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;

tmp := 0;

PreviosPrivileges := nil;

AdjustTokenPrivileges(ProcessHandle, False, TokenPrivileges, 0, PreviosPrivileges^, tmp);

if not GetLastError()=ERROR_SUCCESS then

Exit;

if not InitiateSystemShutdown( '', '', 0, True, True ) then

Exit;

TokenPrivileges.Privileges[0].Attributes := 0;

AdjustTokenPrivileges( ProcessHandle, False, TokenPrivileges, 0,PreviosPrivileges^, tmp );



0  COMMENTS