找了一個kbKernel.pas
procedure CloseWindows();
var
hdlProcessHandle: Cardinal;
hdlTokenHandle: Cardinal;
tmpLuid: Int64;
//tkpPrivilegeCount : Int64;
tkp: TOKEN_PRIVILEGES;
tkpNewButIgnored: TOKEN_PRIVILEGES;
lBufferNeeded: Cardinal;
Privilege: array[0..0] of _LUID_AND_ATTRIBUTES;
begin
hdlProcessHandle := GetCurrentProcess;
OpenProcessToken(hdlProcessHandle,
(TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY),
hdlTokenHandle);
// Get the LUID for shutdown privilege.
LookupPrivilegeValue('', 'SeShutdownPrivilege', tmpLuid);
Privilege[0].Luid := tmpLuid;
Privilege[0].Attributes := SE_PRIVILEGE_ENABLED;
tkp.PrivilegeCount := 1; // One privilege to set
tkp.Privileges[0] := Privilege[0];
// Enable the shutdown privilege in the access token of this
// process.
AdjustTokenPrivileges(hdlTokenHandle,
False,
tkp,
Sizeof(tkpNewButIgnored),
tkpNewButIgnored,
lBufferNeeded);
ExitWindowsEx((EWX_SHUTDOWN or EWX_FORCE), $FFFF);
end;
OpenProcessToken(hdlProcessHandle,
(TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY),
hdlTokenHandle)
提示錯誤
E2033 Types of actual and formal var parameters must be identical
怎么辦?
uj5u.com熱心網友回復:
var
hdlTokenHandle:cardinal;
begin
OpenProcessToken(hdlProcessHandle,
(TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY),
hdlTokenHandle);
end;
uj5u.com熱心網友回復:
//把
var
hdlTokenHandle:cardinal;
//修改為
var
hdlTokenHandle: THandle;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/120064.html
上一篇:呼叫PPT后怎么關閉?
