Skip to content

Commit 4503567

Browse files
authored
Merge pull request #73 from whereswaldon/patch-1
[Windows] harden system DLL loading
2 parents 603fb50 + 40e70a5 commit 4503567

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

colorable_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"strconv"
1212
"strings"
1313
"sync"
14-
"syscall"
14+
syscall "golang.org/x/sys/windows"
1515
"unsafe"
1616

1717
"github.com/mattn/go-isatty"
@@ -73,7 +73,7 @@ type consoleCursorInfo struct {
7373
}
7474

7575
var (
76-
kernel32 = syscall.NewLazyDLL("kernel32.dll")
76+
kernel32 = syscall.NewLazySystemDLL("kernel32.dll")
7777
procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
7878
procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute")
7979
procSetConsoleCursorPosition = kernel32.NewProc("SetConsoleCursorPosition")

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
module github.com/mattn/go-colorable
22

3-
require github.com/mattn/go-isatty v0.0.16
3+
require (
4+
github.com/mattn/go-isatty v0.0.16
5+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab
6+
)
47

58
go 1.15

0 commit comments

Comments
 (0)