diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-27 13:13:45 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-27 13:13:45 +0100 |
commit | b6303091fc8c11cf86b92e9c4287c0ba74e77e87 (patch) | |
tree | 349499c7c01fd63e80e4bc01b2f196c67f567abc /tun/wintun/memmod/zsyscall_windows.go | |
parent | c9fabbd5bf12b7abae6f00fe666edec3a8af7106 (diff) |
memmod: fix import loading function usage
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tun/wintun/memmod/zsyscall_windows.go')
-rw-r--r-- | tun/wintun/memmod/zsyscall_windows.go | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/tun/wintun/memmod/zsyscall_windows.go b/tun/wintun/memmod/zsyscall_windows.go index c56b650..6a5b76f 100644 --- a/tun/wintun/memmod/zsyscall_windows.go +++ b/tun/wintun/memmod/zsyscall_windows.go @@ -40,31 +40,11 @@ func errnoErr(e syscall.Errno) error { var ( modkernel32 = windows.NewLazySystemDLL("kernel32.dll") - procGetProcAddress = modkernel32.NewProc("GetProcAddress") - procIsBadReadPtr = modkernel32.NewProc("IsBadReadPtr") - procLoadLibraryA = modkernel32.NewProc("LoadLibraryA") + procIsBadReadPtr = modkernel32.NewProc("IsBadReadPtr") ) -func getProcAddress(module windows.Handle, procName *byte) (addr uintptr, err error) { - r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procName)), 0) - addr = uintptr(r0) - if addr == 0 { - err = errnoErr(e1) - } - return -} - func isBadReadPtr(addr uintptr, ucb uintptr) (ret bool) { r0, _, _ := syscall.Syscall(procIsBadReadPtr.Addr(), 2, uintptr(addr), uintptr(ucb), 0) ret = r0 != 0 return } - -func loadLibraryA(libFileName *byte) (module windows.Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadLibraryA.Addr(), 1, uintptr(unsafe.Pointer(libFileName)), 0, 0) - module = windows.Handle(r0) - if module == 0 { - err = errnoErr(e1) - } - return -} |