microsoft / CsWin32

A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.
MIT License
2.07k stars 87 forks source link

IPolicyConfig and PolicyConfigClient not created #1105

Closed DerMagereStudent closed 9 months ago

DerMagereStudent commented 9 months ago

I want to set the default audio endpoint. I need both IPolicyConfig and PolicyConfigClient. I added both into the NativeMethods.txt along with some other classes and interfaces:

IMMDeviceEnumerator
MMDeviceEnumerator
IAudioEndpointVolume
IPropertyStore
IPolicyConfig
PolicyConfigClient

Actual behavior

Both IPolicyConfig and PolicyConfigClient are not created

Expected behavior

I would expect them to be created and usable.

Repro steps

  1. NativeMethods.txt content:

    IPolicyConfig
    PolicyConfigClient
  2. NativeMethods.json content (if present): no json

  3. Any of your own code that should be shared? Not needed the issue is about the source generator only

Context

AArnott commented 9 months ago

I can't find documentation for IPolicyConfig. Where do you see these APIs that you expect CsWin32 to be able to generate? They aren't in the metadata, so if they are indeed in the win32 SDK, we can move this issue to the win32metadata repo to get it added.

DerMagereStudent commented 9 months ago

I'm currently rewriting an application I wrote back in 2021. So I can't recall where I saw these APIs. But I can tell you the COM CLSIDs are:

IPolicyConfig:       F8679F50-850A-41CF-9C72-430F290290C8
PolicyConfigClient:  870AF99C-171D-4F9E-AF0D-E63DF40C2BC9

I thought they are part of the Windows Core Audio APIs

AArnott commented 9 months ago

If you can provide a doc link or the header file they come from, I'll forward to the win32metadata repo for consideration. But without that, we may not be able to do anything.

DerMagereStudent commented 9 months ago

Unfortunately, everywhere I look for it, it's only said it's an undocumented COM interface. In this issue it looks like the header file is called PolicyConfig.h. But I can only find custom header files like these. Back in 2021 I also defined it on my own. See here

AArnott commented 9 months ago

We don't generated undocumented APIs. Looks like you'll have to keep your own declarations for them.