Browse Source

5597904: [Windows] Remove ConvertToLongPath from Sandbox Utilities.

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

ResolveNTFunctionPtr was removed in this CL.
John Kleinschmidt 10 months ago
parent
commit
d9f9004ec3
1 changed files with 5 additions and 15 deletions
  1. 5 15
      shell/browser/relauncher_win.cc

+ 5 - 15
shell/browser/relauncher_win.cc

@@ -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) {