Processing (Windows): prefers NT APIs

This commit is contained in:
李通洲
2026-03-16 14:41:52 +08:00
parent 8c72792e31
commit cc3595c3a4
3 changed files with 19 additions and 8 deletions
+8 -6
View File
@@ -216,12 +216,14 @@ exit:
bool ffProcessGetInfoWindows(uint32_t pid, uint32_t* ppid, FFstrbuf* pname, FFstrbuf* exe, const char** exeName, FFstrbuf* exePath, bool* gui)
{
FF_AUTO_CLOSE_FD HANDLE hProcess = pid == 0
? NtCurrentProcess()
: OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid);
if (hProcess == NULL)
return false;
FF_AUTO_CLOSE_FD HANDLE hProcess = NtCurrentProcess();
if(pid != 0)
{
if (!NT_SUCCESS(NtOpenProcess(&hProcess, PROCESS_QUERY_LIMITED_INFORMATION, &(OBJECT_ATTRIBUTES) {
.Length = sizeof(OBJECT_ATTRIBUTES),
}, &(CLIENT_ID) { .UniqueProcess = (HANDLE)(uintptr_t) pid })))
return false;
}
if(ppid)
{