5597904: [Windows] Remove ConvertToLongPath from Sandbox Utilities.

https://chromium-review.googlesource.com/c/chromium/src/+/5597904

ResolveNTFunctionPtr was removed in this CL.
testing-nan-patch
John Kleinschmidt 2024-06-10 14:38:39 -05:00
parent a77116a0fa
commit d9f9004ec3
No known key found for this signature in database
GPG Key ID: F72AD38D2E4E8F27
1 changed files with 5 additions and 15 deletions
shell/browser

View File

@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/process/launch.h"
#include "base/process/process_handle.h"
#include "base/strings/strcat_win.h"
#include "base/strings/string_number_conversions_win.h"
#include "base/strings/utf_string_conversions.h"
@ -44,24 +45,13 @@ struct PROCESS_BASIC_INFORMATION {
};
HANDLE GetParentProcessHandle(base::ProcessHandle handle) {
NtQueryInformationProcessFunction NtQueryInformationProcess = nullptr;
ResolveNTFunctionPtr("NtQueryInformationProcess", &NtQueryInformationProcess);
if (!NtQueryInformationProcess) {
LOG(ERROR) << "Unable to get NtQueryInformationProcess";
base::ProcessId ppid = base::GetParentProcessId(handle);
if (ppid == 0u) {
LOG(ERROR) << "Could not get parent process handle";
return nullptr;
}
PROCESS_BASIC_INFORMATION pbi;
LONG status =
NtQueryInformationProcess(handle, ProcessBasicInformation, &pbi,
sizeof(PROCESS_BASIC_INFORMATION), nullptr);
if (!NT_SUCCESS(status)) {
LOG(ERROR) << "NtQueryInformationProcess failed";
return nullptr;
}
return ::OpenProcess(PROCESS_ALL_ACCESS, TRUE,
pbi.InheritedFromUniqueProcessId);
return ::OpenProcess(PROCESS_ALL_ACCESS, TRUE, ppid);
}
StringType AddQuoteForArg(const StringType& arg) {