mirror of
https://github.com/rclone/rclone.git
synced 2026-01-06 02:23:24 +00:00
Replace Windows-specific NewLazyDLL with NewLazySystemDLL
This will only search Windows System directory for the DLL if name is a base name (like "advapi32.dll"), which prevents DLL preloading attacks. To get access to NewLazySystemDLL imports of syscall needs to be swapped with golang.org/x/sys/windows.
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
package terminal
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// HideConsole hides the console window and activates another window
|
||||
func HideConsole() {
|
||||
getConsoleWindow := syscall.NewLazyDLL("kernel32.dll").NewProc("GetConsoleWindow")
|
||||
showWindow := syscall.NewLazyDLL("user32.dll").NewProc("ShowWindow")
|
||||
getConsoleWindow := windows.NewLazySystemDLL("kernel32.dll").NewProc("GetConsoleWindow")
|
||||
showWindow := windows.NewLazySystemDLL("user32.dll").NewProc("ShowWindow")
|
||||
if getConsoleWindow.Find() == nil && showWindow.Find() == nil {
|
||||
hwnd, _, _ := getConsoleWindow.Call()
|
||||
if hwnd != 0 {
|
||||
|
||||
Reference in New Issue
Block a user