mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
5597904: [Windows] Remove ConvertToLongPath from Sandbox Utilities.
https://chromium-review.googlesource.com/c/chromium/src/+/5597904 ResolveNTFunctionPtr was removed in this CL.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user