只是尝试做一些需要管理权限的事情:
uses
WinSvc;
function IsAdmin(Host : string = '') : Boolean;
var
H: SC_HANDLE;
begin
if Win32Platform <> VER_PLATFORM_WIN32_NT then
Result := True
else begin
H := OpenSCManager(PChar(Host), nil, SC_MANAGER_ALL_ACCESS);
Result := H <> 0;
if Result then
CloseServiceHandle(H);
end;
end;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4303 次 |
| 最近记录: |