(kernel32 syscall.Handle)
| 52 | var loadedDllPath = "wpcap.dll" |
| 53 | |
| 54 | func initLoadedDllPath(kernel32 syscall.Handle) { |
| 55 | getModuleFileName, err := syscall.GetProcAddress(kernel32, "GetModuleFileNameA") |
| 56 | if err != nil { |
| 57 | // we can't get the filename of the loaded module in this case - just leave default of wpcap.dll |
| 58 | return |
| 59 | } |
| 60 | buf := make([]byte, 4096) |
| 61 | r, _, _ := syscall.Syscall(getModuleFileName, 3, uintptr(wpcapHandle), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf))) |
| 62 | if r == 0 { |
| 63 | // we can't get the filename of the loaded module in this case - just leave default of wpcap.dll |
| 64 | return |
| 65 | } |
| 66 | loadedDllPath = string(buf[:int(r)]) |
| 67 | } |
| 68 | |
| 69 | func mustLoad(fun string) uintptr { |
| 70 | addr, err := windows.GetProcAddress(wpcapHandle, fun) |
no outgoing calls
no test coverage detected
searching dependent graphs…