public static int GetProcessIdFromHandle(SafeProcessHandle processHandle) { Interop.NtProcessBasicInfo info = new Interop.NtProcessBasicInfo(); int status = Interop.mincore.NtQueryInformationProcess(processHandle, Interop.NtQueryProcessBasicInfo, info, (int)Marshal.SizeOf(info), null); if (status != 0) { throw new InvalidOperationException(SR.CantGetProcessId, new Win32Exception(status)); } // We should change the signature of this function and ID property in process class. return(info.UniqueProcessId.ToInt32()); }
public static int GetProcessIdFromHandle(SafeProcessHandle processHandle) { Interop.NtProcessBasicInfo info = new Interop.NtProcessBasicInfo(); int status = Interop.mincore.NtQueryInformationProcess(processHandle, Interop.NtQueryProcessBasicInfo, info, (int)Marshal.SizeOf(info), null); if (status != 0) { throw new InvalidOperationException(SR.CantGetProcessId, new Win32Exception(status)); } // We should change the signature of this function and ID property in process class. return info.UniqueProcessId.ToInt32(); }