microsoft / microsoft/win32metadata

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

Open
#2,164 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
1.5k
Forks
149
Avg merge
5d 16h
Merged PRs (30d)
4

Description

## Actual behavior

The friendly overload for these functions is:
```C#
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
```C#
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` buffer instead:
```C#
internal static unsafe global::Windows.Win32.Foundation.NTSTATUS NtQueryObject(global::Windows.Win32.Foundation.HANDLE Handle, winmdroot.Foundation.OBJECT_INFORMATION_CLASS ObjectInformationClass, Span 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
```

2. `NativeMethods.json` content (if present): N.A

3. 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

Contributor guide

Open the contributing guide

Research direction

Start with the NativeMethods.txt entries for NtQueryInformationProcess, NtQuerySystemInformation, and NtQueryObject, then trace how their friendly overloads are produced. Compare the generated signatures and update the relevant generation logic so the first two use Span consistently with NtQueryObject; done means the overloads expose the expected buffer type.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.