microsoft / microsoft/win32metadata
Not all types are from authif.h are generated as expected
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.5k
- Forks
- 149
- Avg merge
- 5d 16h
- Merged PRs (30d)
- 4
Description
## Actual behavior
I found that not all types are from authif.h are generated as expected.
## Expected behavior
Metadata for RADIUS_ATTRIBUTE_ARRAY:
```
[Documentation("https://learn.microsoft.com/windows/win32/api/authif/ns-authif-radius_attribute_array")]
[StructSizeField("cbSize")]
public struct RADIUS_ATTRIBUTE_ARRAY
{
public uint cbSize;
public IntPtr Add;
[Const]
public IntPtr AttributeAt;
public IntPtr GetSize;
public IntPtr InsertAt;
public IntPtr RemoveAt;
public IntPtr SetAt;
}
```
Generated code:
```c#
internal partial struct RADIUS_ATTRIBUTE_ARRAY
{
internal uint cbSize;
internal nint Add;
internal nint AttributeAt;
internal nint GetSize;
internal nint InsertAt;
internal nint RemoveAt;
internal nint SetAt;
}
```
Expected code:
```c#
internal unsafe partial struct RADIUS_ATTRIBUTE_ARRAY
{
internal uint cbSize;
internal delegate* Add;
internal delegate* AttributeAt;
internal delegate* GetSize;
internal delegate* InsertAt;
internal delegate* RemoveAt;
internal delegate* SetAt;
}
```
The same for RADIUS_EXTENSION_CONTROL_BLOCK (GetRequest, GetResponse, SetResponseType).
Expected code:
```c#
internal delegate* unmanaged GetRequest;
internal delegate* unmanaged GetResponse;
internal delegate* unmanaged SetResponseType;
```
Also I would expect to be generated entry points for callbacks (now there are only delegate types corresponding to them):
(although this may not be what this project is for, it could nevertheless be commented out code as a sample.)
```c#
[UnmanagedCallersOnly(EntryPoint = "RadiusExtensionProcess2")]
public unsafe static uint RadiusExtensionProcess2(IntPtr arg)
{
}
[UnmanagedCallersOnly(EntryPoint = "RadiusExtensionInit")]
public static uint RadiusExtensionInit()
{
}
[UnmanagedCallersOnly(EntryPoint = "RadiusExtensionTerm")]
public static void RadiusExtensionTerm()
{
}
```
## Repro steps
1. `NativeMethods.txt` content:
```
Windows.Win32.NetworkManagement.NetworkPolicyServer.PRADIUS_EXTENSION_PROCESS
RADIUS_*
PRADIUS_EXTENSION_PROCESS_2
```
2. `NativeMethods.json` content (if present):
```json
```
3. Any of your own code that should be shared?
### Context
- CsWin32 version: 0.3.49-beta
- Win32Metadata version (if explicitly set by project): 58.0.18-preview
- Target Framework: net8.0
- `LangVersion` (if explicitly set by project): [e.g. `9`]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the NativeMethods.txt repro and inspect how metadata for authif.h types, especially RADIUS_ATTRIBUTE_ARRAY and RADIUS_EXTENSION_CONTROL_BLOCK, becomes generated C# output. Compare the generated members with the expected function-pointer signatures and verify the callback examples against the requested symbols; done means the repro produces the expected declarations or the unsupported behavior is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100