MCPcopy Index your code
hub / github.com/google/gopacket / initLoadedDllPath

Function initLoadedDllPath

pcap/pcap_windows.go:54–67  ·  view source on GitHub ↗
(kernel32 syscall.Handle)

Source from the content-addressed store, hash-verified

52var loadedDllPath = "wpcap.dll"
53
54func 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
69func mustLoad(fun string) uintptr {
70 addr, err := windows.GetProcAddress(wpcapHandle, fun)

Callers 1

LoadWinPCAPFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…