BrdGuest
RomanTim
Спасибо, господа!
Я написал так:
Код: var
Form1: TForm1;
tokenhandle: THandle;
tp: TTokenPrivileges;
X: cardinal;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenProcessToken(GetCurrentProcess, TOKEN_ALL_ACCESS, tokenhandle) then
if LookupPrivilegeValue(nil, 'SeShutdownPrivilege', tp.Privileges[0].Luid) then
begin
tp.PrivilegeCount:=1;
tp.Privileges[0].Attributes:=SE_PRIVILEGE_ENABLED;
If AdjustTokenPrivileges(TokenHandle, false, tp, 0, nil, X) then
ExitWindowsEx(EWX_SHUTDOWN,0)
end
end;
end.
RomanTim
Спасибо, господа!
Я написал так:
Код: var
Form1: TForm1;
tokenhandle: THandle;
tp: TTokenPrivileges;
X: cardinal;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenProcessToken(GetCurrentProcess, TOKEN_ALL_ACCESS, tokenhandle) then
if LookupPrivilegeValue(nil, 'SeShutdownPrivilege', tp.Privileges[0].Luid) then
begin
tp.PrivilegeCount:=1;
tp.Privileges[0].Attributes:=SE_PRIVILEGE_ENABLED;
If AdjustTokenPrivileges(TokenHandle, false, tp, 0, nil, X) then
ExitWindowsEx(EWX_SHUTDOWN,0)
end
end;
end.