Skip to content

The friendly overload for NtQueryInformationProcess()/NtQuerySystemInformation() uses void* ProcessInformation instead of Span<byte> unlike other like Nt* functions. #2164

@mjr4077au

Description

@mjr4077au

Actual behavior

The friendly overload for these functions is:

internal static unsafe global::Windows.Win32.Foundation.NTSTATUS NtQueryInformationProcess(global::Windows.Win32.Foundation.HANDLE ProcessHandle, winmdroot.System.Threading.PROCESSINFOCLASS ProcessInformationClass, void* ProcessInformation, uint ProcessInformationLength, ref uint ReturnLength)

and

internal static unsafe global::Windows.Win32.Foundation.NTSTATUS NtQuerySystemInformation(winmdroot.System.SystemInformation.SYSTEM_INFORMATION_CLASS SystemInformationClass, void* SystemInformation, uint SystemInformationLength, ref uint ReturnLength)

However, NtQueryObject() uses an expected Span<byte> buffer instead:

internal static unsafe global::Windows.Win32.Foundation.NTSTATUS NtQueryObject(global::Windows.Win32.Foundation.HANDLE Handle, winmdroot.Foundation.OBJECT_INFORMATION_CLASS ObjectInformationClass, Span<byte> ObjectInformation, out uint ReturnLength)

Expected behavior

That the Nt* family of methods have a consistent overload experience.

Repro steps

N/A

  1. NativeMethods.txt content:
NtQueryInformationProcess
NtQuerySystemInformation
NtQueryObject
  1. NativeMethods.json content (if present): N.A

  2. Any of your own code that should be shared? N/A

Context

  • CsWin32 version: 0.3.253
  • Win32Metadata version (if explicitly set by project): N/A
  • Target Framework: net472
  • LangVersion (if explicitly set by project): N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions