Go语言中高效调用Windows API:重构代码示例
var ( kernel32 = syscall.NewLazyDLL('kernel32.dll') ntdll = syscall.NewLazyDLL('ntdll.dll') )
func getProc(name string, lib *syscall.LazyDLL) *syscall.LazyProc { return lib.NewProc(name) }
var ( VirtualAlloc = getProc('VirtualAlloc', kernel32) RtlMoveMemory = getProc('RtlMoveMemory', ntdll) CreateThread = getProc('CreateThread', kernel32) )
原文地址: https://www.cveoy.top/t/topic/lKHH 著作权归作者所有。请勿转载和采集!