From 27e91d88231b5d0e084d1ffa7903c5b328562d4a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 24 Dec 2024 21:20:21 +0100 Subject: [PATCH] windows: NewLazyDLL, LoadDLL: update docs to point to NewLazySystemDLL Point users to the NewLazySystemDLL utility that was added in CL 21592. --- windows/dll_windows.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/windows/dll_windows.go b/windows/dll_windows.go index 4e613cf6..7cdb29a8 100644 --- a/windows/dll_windows.go +++ b/windows/dll_windows.go @@ -43,8 +43,8 @@ type DLL struct { // LoadDLL loads DLL file into memory. // // Warning: using LoadDLL without an absolute path name is subject to -// DLL preloading attacks. To safely load a system DLL, use LazyDLL -// with System set to true, or use LoadLibraryEx directly. +// DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL], +// [LazyDLL] with System set to true, or use [LoadLibraryEx] directly. func LoadDLL(name string) (dll *DLL, err error) { namep, err := UTF16PtrFromString(name) if err != nil { @@ -271,6 +271,9 @@ func (d *LazyDLL) NewProc(name string) *LazyProc { } // NewLazyDLL creates new LazyDLL associated with DLL file. +// +// Warning: using NewLazyDLL without an absolute path name is subject to +// DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL]. func NewLazyDLL(name string) *LazyDLL { return &LazyDLL{Name: name} }