zsyscall_windows.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //go:build windows
  2. // Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT.
  3. package etw
  4. import (
  5. "syscall"
  6. "unsafe"
  7. "golang.org/x/sys/windows"
  8. )
  9. var _ unsafe.Pointer
  10. // Do the interface allocations only once for common
  11. // Errno values.
  12. const (
  13. errnoERROR_IO_PENDING = 997
  14. )
  15. var (
  16. errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
  17. errERROR_EINVAL error = syscall.EINVAL
  18. )
  19. // errnoErr returns common boxed Errno values, to prevent
  20. // allocations at runtime.
  21. func errnoErr(e syscall.Errno) error {
  22. switch e {
  23. case 0:
  24. return errERROR_EINVAL
  25. case errnoERROR_IO_PENDING:
  26. return errERROR_IO_PENDING
  27. }
  28. // TODO: add more here, after collecting data on the common
  29. // error values see on Windows. (perhaps when running
  30. // all.bat?)
  31. return e
  32. }
  33. var (
  34. modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
  35. procEventRegister = modadvapi32.NewProc("EventRegister")
  36. procEventSetInformation = modadvapi32.NewProc("EventSetInformation")
  37. procEventUnregister = modadvapi32.NewProc("EventUnregister")
  38. procEventWriteTransfer = modadvapi32.NewProc("EventWriteTransfer")
  39. )
  40. func eventRegister(providerId *windows.GUID, callback uintptr, callbackContext uintptr, providerHandle *providerHandle) (win32err error) {
  41. r0, _, _ := syscall.Syscall6(procEventRegister.Addr(), 4, uintptr(unsafe.Pointer(providerId)), uintptr(callback), uintptr(callbackContext), uintptr(unsafe.Pointer(providerHandle)), 0, 0)
  42. if r0 != 0 {
  43. win32err = syscall.Errno(r0)
  44. }
  45. return
  46. }
  47. func eventSetInformation_64(providerHandle providerHandle, class eventInfoClass, information uintptr, length uint32) (win32err error) {
  48. r0, _, _ := syscall.Syscall6(procEventSetInformation.Addr(), 4, uintptr(providerHandle), uintptr(class), uintptr(information), uintptr(length), 0, 0)
  49. if r0 != 0 {
  50. win32err = syscall.Errno(r0)
  51. }
  52. return
  53. }
  54. func eventSetInformation_32(providerHandle_low uint32, providerHandle_high uint32, class eventInfoClass, information uintptr, length uint32) (win32err error) {
  55. r0, _, _ := syscall.Syscall6(procEventSetInformation.Addr(), 5, uintptr(providerHandle_low), uintptr(providerHandle_high), uintptr(class), uintptr(information), uintptr(length), 0)
  56. if r0 != 0 {
  57. win32err = syscall.Errno(r0)
  58. }
  59. return
  60. }
  61. func eventUnregister_64(providerHandle providerHandle) (win32err error) {
  62. r0, _, _ := syscall.Syscall(procEventUnregister.Addr(), 1, uintptr(providerHandle), 0, 0)
  63. if r0 != 0 {
  64. win32err = syscall.Errno(r0)
  65. }
  66. return
  67. }
  68. func eventUnregister_32(providerHandle_low uint32, providerHandle_high uint32) (win32err error) {
  69. r0, _, _ := syscall.Syscall(procEventUnregister.Addr(), 2, uintptr(providerHandle_low), uintptr(providerHandle_high), 0)
  70. if r0 != 0 {
  71. win32err = syscall.Errno(r0)
  72. }
  73. return
  74. }
  75. func eventWriteTransfer_64(providerHandle providerHandle, descriptor *eventDescriptor, activityID *windows.GUID, relatedActivityID *windows.GUID, dataDescriptorCount uint32, dataDescriptors *eventDataDescriptor) (win32err error) {
  76. r0, _, _ := syscall.Syscall6(procEventWriteTransfer.Addr(), 6, uintptr(providerHandle), uintptr(unsafe.Pointer(descriptor)), uintptr(unsafe.Pointer(activityID)), uintptr(unsafe.Pointer(relatedActivityID)), uintptr(dataDescriptorCount), uintptr(unsafe.Pointer(dataDescriptors)))
  77. if r0 != 0 {
  78. win32err = syscall.Errno(r0)
  79. }
  80. return
  81. }
  82. func eventWriteTransfer_32(providerHandle_low uint32, providerHandle_high uint32, descriptor *eventDescriptor, activityID *windows.GUID, relatedActivityID *windows.GUID, dataDescriptorCount uint32, dataDescriptors *eventDataDescriptor) (win32err error) {
  83. r0, _, _ := syscall.Syscall9(procEventWriteTransfer.Addr(), 7, uintptr(providerHandle_low), uintptr(providerHandle_high), uintptr(unsafe.Pointer(descriptor)), uintptr(unsafe.Pointer(activityID)), uintptr(unsafe.Pointer(relatedActivityID)), uintptr(dataDescriptorCount), uintptr(unsafe.Pointer(dataDescriptors)), 0, 0)
  84. if r0 != 0 {
  85. win32err = syscall.Errno(r0)
  86. }
  87. return
  88. }