mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-08-28 04:46:50 -04:00
The ETW registration handle is defined to be 64-bits on all platforms. The Go type previously used a uintptr which created problems on 32-bit systems. This change adds a new wrapper file which receives a 64-bit handle for the functions defined in it, and correctly passes it to the native ETW functions either as-is (on 64-bit) or as two 32-bit values (on 32-bit). This required a minor change in mksyscall_windows.go, to allow multiple syscalls that map to the same underlying function without causing a duplicate definition error in the generated file.
52 lines
1009 B
Go
52 lines
1009 B
Go
// +build 386 arm
|
|
|
|
package etw
|
|
|
|
import (
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func low(v providerHandle) uint32 {
|
|
return uint32(v & 0xffffffff)
|
|
}
|
|
|
|
func high(v providerHandle) uint32 {
|
|
return low(v >> 32)
|
|
}
|
|
|
|
func eventUnregister(providerHandle providerHandle) (win32err error) {
|
|
return eventUnregister_32(low(providerHandle), high(providerHandle))
|
|
}
|
|
|
|
func eventWriteTransfer(
|
|
providerHandle providerHandle,
|
|
descriptor *eventDescriptor,
|
|
activityID *windows.GUID,
|
|
relatedActivityID *windows.GUID,
|
|
dataDescriptorCount uint32,
|
|
dataDescriptors *eventDataDescriptor) (win32err error) {
|
|
|
|
return eventWriteTransfer_32(
|
|
low(providerHandle),
|
|
high(providerHandle),
|
|
descriptor,
|
|
activityID,
|
|
relatedActivityID,
|
|
dataDescriptorCount,
|
|
dataDescriptors)
|
|
}
|
|
|
|
func eventSetInformation(
|
|
providerHandle providerHandle,
|
|
class eventInfoClass,
|
|
information uintptr,
|
|
length uint32) (win32err error) {
|
|
|
|
return eventSetInformation_32(
|
|
low(providerHandle),
|
|
high(providerHandle),
|
|
class,
|
|
information,
|
|
length)
|
|
}
|