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