windows: add NewLazySystemDLL and use it in zsyscall_windows.go

If we want new secure DLL approach to be adopted, we should make
conversion as simple as possible to explain and implement.
I think that replacing

syscall.NewLazyDLL(...) -> windows.NewLazySystemDLL(...)

is easier than

syscall.NewLazyDLL(...) -> &windows.LazyDLL{Name: ..., System: true}

So I propose we introduce convenience function NewLazySystemDLL.

$GOROOT/src/mksyscall_windows.go changes in the following CL.

Change-Id: If3432aff301c347cb355e4e837834696191b2219
Reviewed-on: https://go-review.googlesource.com/21592
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Alex Brainman
2016-04-06 06:33:47 +00:00
parent b323466d0b
commit 042a8f53ce
3 changed files with 20 additions and 13 deletions
+2 -2
View File
@@ -11,8 +11,8 @@ import (
var _ unsafe.Pointer
var (
modadvapi32 = &windows.LazyDLL{Name: "advapi32.dll", System: true}
modkernel32 = &windows.LazyDLL{Name: "kernel32.dll", System: true}
modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
procRegCreateKeyExW = modadvapi32.NewProc("RegCreateKeyExW")
procRegDeleteKeyW = modadvapi32.NewProc("RegDeleteKeyW")