microsoft / microsoft/win32metadata
CoClassAttribute for Interfaces
- Dominant language
- C++
- Stars
- 1.5k
- Forks
- 149
- Avg merge
- 5d 16h
- Merged PRs (30d)
- 4
Description
Maybe this is my poor understanding of COM, but I think we need some way to map an IID onto a corresponding class.
For example, take the Network List Manager API:
https://docs.microsoft.com/en-us/windows/win32/nla/about-the-network-list-manager-api
To create an `INetworkListManager`, I need to call `CoCreateInstance` and create the `CLSID_NetworkListManager` COM object, which in turn implements `INetworkListManager`.
From the metadata, I don't think I have a systematic way to identify the matching COM object, do I?
ILSpy just shows:
```
// Windows.Win32.NetworkListManager.NetworkListManager
using System.Runtime.InteropServices;
[Guid("DCB00C01-570F-4A9B-8D69-199FDBA5723B")]
public struct NetworkListManager
{
}
```
which gives me the CLSID, but doesn't tell me what it implements (nor vice versa).
Other attempts to wrap this interface seem to include an attribute that is I think derived from tlbimp. For example:
https://github.com/dahall/Vanara/blob/1fb8a2dc8a116995831730a7d433a07f940cc5ef/PInvoke/NetListMgr/NetListMgr.cs#L629
```csharp
[TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable)]
[ComImport, Guid("DCB00000-570F-4A9B-8D69-199FDBA5723B"), CoClass(typeof(NetworkListManager))]
[PInvokeData("Netlistmgr.h", MSDNShortId = "aa370769")]
public interface INetworkListManager
{
```
Is there missing metadata? Or is there another way to derive this relationship?
Contributor guide
Research direction
The issue names no repository files, tests, or entry points. Start by reviewing how Win32 metadata represents COM interfaces and coclasses, using the Network List Manager API and the cited Vanara declarations as references; done means determining and documenting a systematic IID-to-class relationship or confirming why the metadata cannot provide one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, csharp
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100