diff options
Diffstat (limited to 'src/runtime/syscall_windows.go')
-rw-r--r-- | src/runtime/syscall_windows.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/runtime/syscall_windows.go b/src/runtime/syscall_windows.go index 8264070569..ee931ceb0a 100644 --- a/src/runtime/syscall_windows.go +++ b/src/runtime/syscall_windows.go @@ -90,9 +90,13 @@ func compileCallback(fn eface, cleanstack bool) (code uintptr) { const _LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 +// When available, this function will use LoadLibraryEx with the filename +// parameter and the important SEARCH_SYSTEM32 argument. But on systems that +// do not have that option, absoluteFilepath should contain a fallback +// to the full path inside of system32 for use with vanilla LoadLibrary. //go:linkname syscall_loadsystemlibrary syscall.loadsystemlibrary //go:nosplit -func syscall_loadsystemlibrary(filename *uint16) (handle, err uintptr) { +func syscall_loadsystemlibrary(filename *uint16, absoluteFilepath *uint16) (handle, err uintptr) { lockOSThread() defer unlockOSThread() c := &getg().m.syscall @@ -107,15 +111,9 @@ func syscall_loadsystemlibrary(filename *uint16) (handle, err uintptr) { }{filename, 0, _LOAD_LIBRARY_SEARCH_SYSTEM32} c.args = uintptr(noescape(unsafe.Pointer(&args))) } else { - // User doesn't have KB2533623 installed. The caller - // wanted to only load the filename DLL from the - // System32 directory but that facility doesn't exist, - // so just load it the normal way. This is a potential - // security risk, but so is not installing security - // updates. c.fn = getLoadLibrary() c.n = 1 - c.args = uintptr(noescape(unsafe.Pointer(&filename))) + c.args = uintptr(noescape(unsafe.Pointer(&absoluteFilepath))) } cgocall(asmstdcallAddr, unsafe.Pointer(c)) |