Fix OpenProcessToken pseudo-handle regression

This commit is contained in:
2025-10-05 18:16:15 -06:00
parent 0d76e541c1
commit ff04eb9f41
6 changed files with 31 additions and 25 deletions

View File

@@ -5,6 +5,7 @@
#include "errors.h"
#include "handles.h"
#include "internal.h"
#include "kernel32/internal.h"
#include "processes.h"
namespace advapi32 {
@@ -16,7 +17,12 @@ BOOL WIN_FUNC OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDL
wibo::lastError = ERROR_INVALID_PARAMETER;
return FALSE;
}
auto obj = wibo::handles().getAs<ProcessObject>(ProcessHandle);
Pin<ProcessObject> obj;
if (kernel32::isPseudoCurrentProcessHandle(ProcessHandle)) {
obj = make_pin<ProcessObject>(getpid(), -1);
} else {
obj = wibo::handles().getAs<ProcessObject>(ProcessHandle);
}
if (!obj) {
wibo::lastError = ERROR_INVALID_HANDLE;
return FALSE;