Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkg/etw/newprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package etw
import (
"bytes"
"encoding/binary"
"unsafe"

"github.com/Microsoft/go-winio/pkg/guid"
"golang.org/x/sys/windows"
Expand Down Expand Up @@ -62,8 +61,7 @@ func NewProviderWithOptions(name string, options ...ProviderOpt) (provider *Prov
if err := eventSetInformation(
provider.handle,
eventInfoClassProviderSetTraits,
uintptr(unsafe.Pointer(&provider.metadata[0])),
uint32(len(provider.metadata)),
provider.metadata,
); err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/etw/syscall.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ package etw

//sys eventUnregister_64(providerHandle providerHandle) (win32err error) = advapi32.EventUnregister
//sys eventWriteTransfer_64(providerHandle providerHandle, descriptor *eventDescriptor, activityID *windows.GUID, relatedActivityID *windows.GUID, dataDescriptorCount uint32, dataDescriptors *eventDataDescriptor) (win32err error) = advapi32.EventWriteTransfer
//sys eventSetInformation_64(providerHandle providerHandle, class eventInfoClass, information uintptr, length uint32) (win32err error) = advapi32.EventSetInformation
//sys eventSetInformation_64(providerHandle providerHandle, class eventInfoClass, information []byte) (win32err error) = advapi32.EventSetInformation

//sys eventUnregister_32(providerHandle_low uint32, providerHandle_high uint32) (win32err error) = advapi32.EventUnregister
//sys eventWriteTransfer_32(providerHandle_low uint32, providerHandle_high uint32, descriptor *eventDescriptor, activityID *windows.GUID, relatedActivityID *windows.GUID, dataDescriptorCount uint32, dataDescriptors *eventDataDescriptor) (win32err error) = advapi32.EventWriteTransfer
//sys eventSetInformation_32(providerHandle_low uint32, providerHandle_high uint32, class eventInfoClass, information uintptr, length uint32) (win32err error) = advapi32.EventSetInformation
//sys eventSetInformation_32(providerHandle_low uint32, providerHandle_high uint32, class eventInfoClass, information []byte) (win32err error) = advapi32.EventSetInformation
6 changes: 2 additions & 4 deletions pkg/etw/wrapper_32.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ func eventWriteTransfer(
func eventSetInformation(
providerHandle providerHandle,
class eventInfoClass,
information uintptr,
length uint32) (win32err error) {
information []byte) (win32err error) {

return eventSetInformation_32(
low(providerHandle),
high(providerHandle),
class,
information,
length)
information)
}

// providerCallbackAdapter acts as the first-level callback from the C/ETW side
Expand Down
6 changes: 2 additions & 4 deletions pkg/etw/wrapper_64.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ func eventWriteTransfer(
func eventSetInformation(
providerHandle providerHandle,
class eventInfoClass,
information uintptr,
length uint32) (win32err error) {
information []byte) (win32err error) {
return eventSetInformation_64(
providerHandle,
class,
information,
length)
information)
}

// providerCallbackAdapter acts as the first-level callback from the C/ETW side
Expand Down
16 changes: 12 additions & 4 deletions pkg/etw/zsyscall_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions pkg/security/grantvmgroupaccess.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package security
import (
"fmt"
"os"
"unsafe"

"golang.org/x/sys/windows"
)
Expand Down Expand Up @@ -33,7 +32,7 @@ type (
multipleTrusteeOperation int32
trusteeForm trusteeForm
trusteeType trusteeType
name uintptr
name *windows.SID
}
)

Expand Down Expand Up @@ -153,13 +152,13 @@ func generateDACLWithAcesAdded(name string, isDir bool, origDACL uintptr) (uintp
trustee: trustee{
trusteeForm: trusteeFormIsSID,
trusteeType: trusteeTypeWellKnownGroup,
name: uintptr(unsafe.Pointer(sid)),
name: sid,
},
},
}

modifiedDACL := uintptr(0)
if err := setEntriesInAcl(uintptr(uint32(1)), uintptr(unsafe.Pointer(&eaArray[0])), origDACL, &modifiedDACL); err != nil {
if err := setEntriesInAcl(uintptr(uint32(1)), &eaArray[0], origDACL, &modifiedDACL); err != nil {
return 0, fmt.Errorf("%s SetEntriesInAcl %s: %w", gvmga, name, err)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/security/syscall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ package security

//sys getSecurityInfo(handle windows.Handle, objectType uint32, si uint32, ppsidOwner **uintptr, ppsidGroup **uintptr, ppDacl *uintptr, ppSacl *uintptr, ppSecurityDescriptor *uintptr) (win32err error) = advapi32.GetSecurityInfo
//sys setSecurityInfo(handle windows.Handle, objectType uint32, si uint32, psidOwner uintptr, psidGroup uintptr, pDacl uintptr, pSacl uintptr) (win32err error) = advapi32.SetSecurityInfo
//sys setEntriesInAcl(count uintptr, pListOfEEs uintptr, oldAcl uintptr, newAcl *uintptr) (win32err error) = advapi32.SetEntriesInAclW
//sys setEntriesInAcl(count uintptr, pListOfEEs *explicitAccess, oldAcl uintptr, newAcl *uintptr) (win32err error) = advapi32.SetEntriesInAclW
4 changes: 2 additions & 2 deletions pkg/security/zsyscall_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.