- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何确定我自己的进程是否启用了 SeDebugPrivilege?
最佳答案
如果有人需要的话,这里是解决方案。
type
TPrivilegesArray = array [0..1024] of TLuidAndAttributes;
PPrivilegesArray = ^TPrivilegesArray;
var
luid : TLargeInteger;
LuidSDP : TLargeInteger;
hToken : THandle;
Size : Cardinal;
Privileges : PTokenPrivileges;
I : Integer;
Name : string;
Attr : Longword;
function AttrToString: string;
begin
Result := 'Disabled';
if (Attr and SE_PRIVILEGE_ENABLED) <> 0 then Result := 'Enabled';
if (Attr and SE_PRIVILEGE_ENABLED_BY_DEFAULT) <> 0 then Result := 'Enabled By Default';
Result := Result;
end;
begin
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, hToken);
GetTokenInformation(hToken, TokenPrivileges, nil, 0, Size);
Privileges := AllocMem(Size);
GetTokenInformation(hToken, TokenPrivileges, Privileges, Size, Size);
LookupPrivilegeValue(nil, 'SeDebugPrivilege', LuidSDP);
for I := 0 to Privileges.PrivilegeCount - 1 do
begin
if LuidSDP <> PPrivilegesArray(@Privileges^.Privileges)^[I].Luid then Continue;
Luid := PPrivilegesArray(@Privileges^.Privileges)^[I].Luid;
Attr := PPrivilegesArray(@Privileges^.Privileges)^[I].Attributes;
Size := 0;
LookupPrivilegeName(nil, Luid, nil, Size);
SetLength(Name, Size);
LookupPrivilegeName(nil, Luid, PChar(Name), Size);
Form1.Memo2.Lines.Add(Format('[%d][%s][%s]', [Luid, PChar(Name), AttrToString]));
end;
FreeMem(Privileges);
CloseHandle(hToken);
此代码列出了所有权限以及是否禁用、默认启用或启用的权限。经过一些搜索和修改后,此代码可以完美运行。
如果需要列出所有权限,只需注释该行
if LuidSDP <> PPrivilegesArray(@Privileges^.Privileges)^[I].Luid then Continue;
关于delphi - 检索我自己的进程是否启用了 SeDebugPrivilege,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53805494/
如何确定我自己的进程是否启用了 SeDebugPrivilege? 最佳答案 如果有人需要的话,这里是解决方案。 type TPrivilegesArray = array [0..1024] o
此程序枚举所有句柄并获取它们的名称。 对于 pID 4,OpenProcess 使用 SeDebugPrivilege 获得错误 5。 UAC 关闭。从管理员运行。 启用 SeDebugPrivile
我有一个例程,当我“遍历”列表时(工作正常),我会遍历进程以获取每个进程的 HANDLE,但我的问题在于: HANDLE h = OpenProcess(PROCESS_ALL_ACCESS, FAL
我所能找到的关于根据我的需要升级到适当权限的所有内容都与我当前的方法一致,但问题仍然存在。我希望也许有人有一些 Windows Vista/Windows 7 内部体验,可能会在只有黑暗的地方发光。我
标题说的是什么。它们相同吗?我注意到第一个确实有参数等等,但它们会给出相同的最终结果吗? 最佳答案 为了清楚起见,SeDebugPrivilege 不是一个 API 函数,它是一个权限常量。 此外,P
我有兴趣将 DLL 注入(inject)到我的 Vista 机器上的 SYSTEM 拥有的进程中。我将使用传统方法 VirtualAllocEx、WriteProcessMemory 和 Create
我是一名优秀的程序员,十分优秀!