| 1 |
|
| 2 |
|
| 3 |
package efw |
| 4 |
|
| 5 |
import ( |
| 6 |
"syscall" |
| 7 |
"unsafe" |
| 8 |
|
| 9 |
"golang.org/x/sys/windows" |
| 10 |
) |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
var ebpfGetEbpfAttachTypeProc = newProc("ebpf_get_ebpf_attach_type") |
| 20 |
|
| 21 |
func EbpfGetEbpfAttachType(attachType uint32) (windows.GUID, error) { |
| 22 |
addr, err := ebpfGetEbpfAttachTypeProc.Find() |
| 23 |
if err != nil { |
| 24 |
return windows.GUID{}, err |
| 25 |
} |
| 26 |
|
| 27 |
var attachTypeGUID windows.GUID |
| 28 |
err = errorResult(syscall.SyscallN(addr, |
| 29 |
uintptr(attachType), |
| 30 |
uintptr(unsafe.Pointer(&attachTypeGUID)), |
| 31 |
)) |
| 32 |
return attachTypeGUID, err |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
var ebpfGetBpfProgramTypeProc = newProc("ebpf_get_bpf_program_type") |
| 41 |
|
| 42 |
func EbpfGetBpfProgramType(programType windows.GUID) (uint32, error) { |
| 43 |
addr, err := ebpfGetBpfProgramTypeProc.Find() |
| 44 |
if err != nil { |
| 45 |
return 0, err |
| 46 |
} |
| 47 |
|
| 48 |
return uint32Result(syscall.SyscallN(addr, uintptr(unsafe.Pointer(&programType)))), nil |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
var ebpfGetBpfAttachTypeProc = newProc("ebpf_get_bpf_attach_type") |
| 57 |
|
| 58 |
func EbpfGetBpfAttachType(attachType windows.GUID) (uint32, error) { |
| 59 |
addr, err := ebpfGetBpfAttachTypeProc.Find() |
| 60 |
if err != nil { |
| 61 |
return 0, err |
| 62 |
} |
| 63 |
|
| 64 |
return uint32Result(syscall.SyscallN(addr, uintptr(unsafe.Pointer(&attachType)))), nil |
| 65 |
} |