microsoft / win32metadata

Tooling to generate metadata for Win32 APIs in the Windows SDK.
Other
1.32k stars 113 forks source link

Where is InitPropVariantFromString? #1946

Closed AArnott closed 1 month ago

AArnott commented 1 month ago

Discussed in https://github.com/microsoft/CsWin32/discussions/1234

Originally posted by **optsing** July 10, 2024 If I add `InitPropVariantFromString` to `NativeMethods.txt`, I get the warning message > Method, type or constant "InitPropVariantFromString" not found. Did you mean or "InitPropVariantFromStringVector" or "InitPropVariantFromStringAsVector"? Why is this method missing? What is the correct way to create PROPVARIANT without it?

It's missing from the metadata, but it is a documented function.

ChrisDenton commented 1 month ago

From the "Requirements" section of the documentation page, it looks like it's a header-only function. So it's not actually exposed by any Windows DLLs.

ChrisDenton commented 1 month ago

If I look at the mentioned propvarutil.h I see: https://github.com/microsoft/win32metadata/blob/f1c1df8f7787d1394da86ef6bb8b2d814a2e0b6a/generation/WinSDK/RecompiledIdlHeaders/um/propvarutil.h#L497-L517

AArnott commented 1 month ago

Interesting observation about being an inline function. I suspect that's why the clang scanner missed it. The metadata doesn't expect to include macros most of the time, but I don't know about these inline functions.

riverar commented 1 month ago

InitPropVariantFromString is a header-only helper function. It's not available for use outside of C++.