internal static T QueryInformation <T>(this Process process, ProcessInformationType informationType) where T : unmanaged { Span <byte> informationBytes = stackalloc byte[Unsafe.SizeOf <T>()]; var status = Ntdll.NtQueryInformationProcess(process.SafeHandle, informationType, out informationBytes[0], informationBytes.Length, IntPtr.Zero); if (status != NtStatus.Success) { throw new Win32Exception(Ntdll.RtlNtStatusToDosError(status)); } return(MemoryMarshal.Read <T>(informationBytes)); }
internal static extern NtStatus NtQueryInformationProcess(SafeProcessHandle processHandle, ProcessInformationType informationType, out byte information, int informationSize, IntPtr returnLength);
public static extern int NtQueryInformationProcess(SafeProcessHandle processHandle, ProcessInformationType informationType, out byte information, int informationSize, out int returnLength);