Closed jdu2600 closed 4 years ago
Looking okay to me. Just thinking that it would be great to also add the defines WINVER=0x0601;_WIN32_WINNT=0x601; to make it a bit harder to use unavailable APIs going forward.
On second thought I am wondering on whether this would actually work on Windows 7. According to https://geoffchappell.com/studies/windows/km/ntoskrnl/api/etw/tracesup/groupmask.htm :
Note that although EventTraceGroupMaskInformation is valid for querying in version 6.0 and higher, versions before 6.2 reject it for setting. The returned error code is ERROR_NOT_IMPLEMENTED.
Would that not mean that kt::enable_providers
would always throw an exception on Windows 7, meaning you could not create any kernel trace providers on Windows 7. Or am I misunderstanding something here?
No. I missed something. The call is now only made if a group_mask has been supplied.
Thanks. I think the updated code has a chance of working.
@jrave - let me know if anything isn't behaving as expected (on Windows 7).
This is an alternate fix using the native API.