下面是该2段代码
procedure GetDebugPrivs;
var
h : THandle;
tkp: TTokenPrivileges;
retval: dword;
begin
OpenProcessToken (GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, h);
LookupPrivilegeValue(nil, 'SeDebugPrivilege', tkp.Privileges[0].Luid);
tkp.PrivilegeCount := 1;
tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(h, false, tkp, 0, nil, retval);
CloseHandle(h);
end;
procedure Getprocrss;
var
lppe: tprocessentry32;
sshandle: thandle;
found:boolean;
begin
form1.listbox1.Clear;
sshandle := createtoolhelp32snapshot (TH32CS_SNAPALL, 0);
found := process32first (sshandle, lppe);
while found do
begin
form1.listbox1.Items.Add (lppe.szExeFile);
found := process32next(sshandle, lppe);
end;
CloseHandle(sshandle);
end;