wrapper_64.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //go:build windows && (amd64 || arm64)
  2. // +build windows
  3. // +build amd64 arm64
  4. package etw
  5. import (
  6. "github.com/Microsoft/go-winio/pkg/guid"
  7. "golang.org/x/sys/windows"
  8. )
  9. func eventUnregister(providerHandle providerHandle) (win32err error) {
  10. return eventUnregister_64(providerHandle)
  11. }
  12. func eventWriteTransfer(
  13. providerHandle providerHandle,
  14. descriptor *eventDescriptor,
  15. activityID *windows.GUID,
  16. relatedActivityID *windows.GUID,
  17. dataDescriptorCount uint32,
  18. dataDescriptors *eventDataDescriptor) (win32err error) {
  19. return eventWriteTransfer_64(
  20. providerHandle,
  21. descriptor,
  22. activityID,
  23. relatedActivityID,
  24. dataDescriptorCount,
  25. dataDescriptors)
  26. }
  27. func eventSetInformation(
  28. providerHandle providerHandle,
  29. class eventInfoClass,
  30. information uintptr,
  31. length uint32) (win32err error) {
  32. return eventSetInformation_64(
  33. providerHandle,
  34. class,
  35. information,
  36. length)
  37. }
  38. // providerCallbackAdapter acts as the first-level callback from the C/ETW side
  39. // for provider notifications. Because Go has trouble with callback arguments of
  40. // different size, it has only pointer-sized arguments, which are then cast to
  41. // the appropriate types when calling providerCallback.
  42. func providerCallbackAdapter(
  43. sourceID *guid.GUID,
  44. state uintptr,
  45. level uintptr,
  46. matchAnyKeyword uintptr,
  47. matchAllKeyword uintptr,
  48. filterData uintptr,
  49. i uintptr,
  50. ) uintptr {
  51. providerCallback(*sourceID,
  52. ProviderState(state),
  53. Level(level),
  54. uint64(matchAnyKeyword),
  55. uint64(matchAllKeyword),
  56. filterData,
  57. i)
  58. return 0
  59. }