internal static unsafe JetArchitecture OpenProcess()

in JetBrains.HabitatDetector/src/Impl/Windows/WindowsHelper.cs [21:34]


    internal static unsafe JetArchitecture OpenProcess(int processId, OpenProcessDelegate<JetArchitecture> action)
    {
      var hProcess = Kernel32Dll.OpenProcess((uint)ProcessAccessRights.PROCESS_QUERY_LIMITED_INFORMATION, 0, unchecked((uint)processId));
      if (hProcess == null)
        throw new Win32Exception();
      try
      {
        return action(hProcess);
      }
      finally
      {
        Kernel32Dll.CloseHandle(hProcess);
      }
    }