From d4ac05dc8c4c953ec29cae3df56c0833f4010763 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 24 Dec 2024 20:44:42 +0000 Subject: [PATCH] windows: update NewLazyDLL, LoadDLL docs to point to NewLazySystemDLL Point users to the NewLazySystemDLL utility that was added in CL 21592. Change-Id: I5fddd927fe6628f06a6266b225949c4227fb79f1 GitHub-Last-Rev: 1fe36ed335f040797ae2c778188e40c29604f135 GitHub-Pull-Request: golang/sys#240 Reviewed-on: https://go-review.googlesource.com/c/sys/+/638715 Reviewed-by: Jorropo Auto-Submit: Ian Lance Taylor Auto-Submit: Jorropo LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Reviewed-by: Ian Lance Taylor --- 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 04eb45771..3ca814f54 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], +// 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} }