...

Source file src/github.com/Microsoft/go-winio/pkg/etw/wrapper_32.go

Documentation: github.com/Microsoft/go-winio/pkg/etw

     1  //go:build windows && (386 || arm)
     2  // +build windows
     3  // +build 386 arm
     4  
     5  package etw
     6  
     7  import (
     8  	"github.com/Microsoft/go-winio/pkg/guid"
     9  	"golang.org/x/sys/windows"
    10  )
    11  
    12  func low(v providerHandle) uint32 {
    13  	return uint32(v & 0xffffffff)
    14  }
    15  
    16  func high(v providerHandle) uint32 {
    17  	return low(v >> 32)
    18  }
    19  
    20  func eventUnregister(providerHandle providerHandle) (win32err error) {
    21  	return eventUnregister_32(low(providerHandle), high(providerHandle))
    22  }
    23  
    24  func eventWriteTransfer(
    25  	providerHandle providerHandle,
    26  	descriptor *eventDescriptor,
    27  	activityID *windows.GUID,
    28  	relatedActivityID *windows.GUID,
    29  	dataDescriptorCount uint32,
    30  	dataDescriptors *eventDataDescriptor) (win32err error) {
    31  
    32  	return eventWriteTransfer_32(
    33  		low(providerHandle),
    34  		high(providerHandle),
    35  		descriptor,
    36  		activityID,
    37  		relatedActivityID,
    38  		dataDescriptorCount,
    39  		dataDescriptors)
    40  }
    41  
    42  func eventSetInformation(
    43  	providerHandle providerHandle,
    44  	class eventInfoClass,
    45  	information uintptr,
    46  	length uint32) (win32err error) {
    47  
    48  	return eventSetInformation_32(
    49  		low(providerHandle),
    50  		high(providerHandle),
    51  		class,
    52  		information,
    53  		length)
    54  }
    55  
    56  // providerCallbackAdapter acts as the first-level callback from the C/ETW side
    57  // for provider notifications. Because Go has trouble with callback arguments of
    58  // different size, it has only pointer-sized arguments, which are then cast to
    59  // the appropriate types when calling providerCallback.
    60  // For x86, the matchAny and matchAll keywords need to be assembled from two
    61  // 32-bit integers, because the max size of an argument is uintptr, but those
    62  // two arguments are actually 64-bit integers.
    63  func providerCallbackAdapter(sourceID *guid.GUID, state uint32, level uint32, matchAnyKeyword_low uint32, matchAnyKeyword_high uint32, matchAllKeyword_low uint32, matchAllKeyword_high uint32, filterData uintptr, i uintptr) uintptr {
    64  	matchAnyKeyword := uint64(matchAnyKeyword_high)<<32 | uint64(matchAnyKeyword_low)
    65  	matchAllKeyword := uint64(matchAllKeyword_high)<<32 | uint64(matchAllKeyword_low)
    66  	providerCallback(*sourceID, ProviderState(state), Level(level), uint64(matchAnyKeyword), uint64(matchAllKeyword), filterData, i)
    67  	return 0
    68  }
    69  

View as plain text