microsoft / win32metadata

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

`EventRegister` returns handle wrong type #1940

Closed kennykerr closed 5 months ago

kennykerr commented 5 months ago

In the evntprov.h header we see the APIs using the REGHANDLE type:

ULONG
EVNTAPI
EventRegister(
    _In_ LPCGUID ProviderId,
    _In_opt_ PENABLECALLBACK EnableCallback,
    _In_opt_ PVOID CallbackContext,
    _Out_ PREGHANDLE RegHandle
    );
#endif

#if (WINVER >= _WIN32_WINNT_VISTA)
/*
Closes the RegHandle that was opened by EventRegister.
*/
ULONG
EVNTAPI
EventUnregister(
    _In_ REGHANDLE RegHandle
    );
#endif

#if (WINVER >= _WIN32_WINNT_WIN8)
/*
Used to provide the ETW runtime with additional information about your provider
or to configure how the ETW runtime handles your provider's events.
Refer to the documentation of the EVENT_INFO_CLASS for more information.
*/
ULONG
EVNTAPI
EventSetInformation(
    _In_ REGHANDLE RegHandle,
    _In_ EVENT_INFO_CLASS InformationClass,
    _In_reads_bytes_(InformationLength) PVOID EventInformation,
    _In_ ULONG InformationLength
    );
#endif

Most of these functions in the Win32 metadata also use the REGHANDLE type except the EventRegister which returns a ulong* instead of a REGHANDLE* as the trailing parameter:

public unsafe static extern uint EventRegister([In][Const] Guid* ProviderId, [Optional][In] PENABLECALLBACK EnableCallback, [Optional][In] void* CallbackContext, [Out] ulong* RegHandle);