Commit Graph

13 Commits

Author SHA1 Message Date
Jason A. Donenfeld
ef33b2fb2c windows: use go:linkname instead of assembly
This is a bit cleaner and makes it more explicit what's happening, along
with a documenting comment.

Change-Id: I30c92f8576c72b05ebdb4634c68023237bde3cbf
Reviewed-on: https://go-review.googlesource.com/c/sys/+/199519
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-07 15:44:56 +00:00
Jason A. Donenfeld
10058d7d4f windows: use proper system directory path in fallback loader
The %WINDIR% variable is an odd choice and not even entirely reliable.
Since Windows 2000, there has been a specific function for determining
this information, so let's use it. It's also a useful function in its
own right for folks who want to launch system tools in a somewhat safe
way, like netsh.exe.

Updates golang/go#14959
Updates golang/go#30642

Change-Id: Ic24baf37d14f2daced0c1db2771b5a673d2c8852
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165759
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-03-10 05:46:46 +00:00
Alex Brainman
176de74134 windows: change 'more then' to 'more than'
Copy CL 17488 into golang.org/x/sys/windows.

Change-Id: I4c6bf14982dd1fc2b8aa70ec16ad7b7c18e76bae
Reviewed-on: https://go-review.googlesource.com/73353
Reviewed-by: Tim Cooper <tim.cooper@layeh.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-26 00:44:44 +00:00
Kieran Colford
5d0dd06d1c windows: document panics in LazyProc
Some of LazyProc's methods will panic if the procedure cannot be
found. This patch documents that fact.

Change-Id: If446a61e001ae04eaba0ff08b512df4def8a00b7
Reviewed-on: https://go-review.googlesource.com/73450
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-10-25 22:41:41 +00:00
Tobias Klauser
9e4fff1f4d all: single space after period
Follow CL 20022 and consistently use single space after a period in
documentation.

Generated with:

$ perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')

Change-Id: Ia29ad823668f060e81293e848a79fc4b4857d94b
Reviewed-on: https://go-review.googlesource.com/73530
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-25 20:39:07 +00:00
Awn
94b76065f2 windows: remove unreachable return statement in Proc.Call
Change-Id: I5bb10469bab144f5e42c7bcf6ee8717d3fd0d4e4
Reviewed-on: https://go-review.googlesource.com/47337
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-03 21:01:55 +00:00
Alex Brainman
b518c298ac windows: use //go:uintptrescapes comment
CL 24551 introduced //go:uintptrescapes comment to make
syscall.Proc.Call and syscall.LazyProc.Call parameters escape.
Use new comment in this package too.

Updates golang/go#16035.

Change-Id: I57ec3b4778195ca4a1ce9a8eec331f0f69285926
Reviewed-on: https://go-review.googlesource.com/24870
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-12 23:56:41 +00:00
Alex Brainman
042a8f53ce 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>
2016-04-06 06:33:47 +00:00
Brad Fitzpatrick
3dff6e19a5 windows: add LoadLibraryEx, add LazyDLL.System
Updates golang/go#14959

Change-Id: Ib91c359c3df919df0b30e584d38e56f79f3e3dc9
Reviewed-on: https://go-review.googlesource.com/21388
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-02 00:33:28 +00:00
Alex Brainman
70c4b52aa0 go.sys/windows: delete errors_windows.go (except APPLICATION_ERROR) and Errno
All consts in errors_windows.go (except APPLICATION_ERROR) were
"invented" at the start of windows port to have minimal impact on
existing Go packages. No point keeping them around.
Also remove Errno, since we will be using syscall.Errno everywhere anyway.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/128290044
2014-08-15 13:37:15 +10:00
Rob Pike
7118195da3 go.sys/windows: grab Syscall interface from the standard syscall package
Also provide stubs to call loadlibrary and getprocaddress, which are implemented
for package syscall by runtime/syscall_windows.goc.
Should get the windows go.sys build closer to green.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/126170043
2014-08-13 14:08:39 -07:00
Rob Pike
8442dd2c63 go.sys: update package names
Semi-automatic migration from package syscall to package {plan9,windows,unix}.
No builds attempted yet, but this gets a lot of noise behind us so subsequent
CLs will be more concise and easier to follow.
Subsequent CLs will have semantic content.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/121520043
2014-08-11 15:58:26 -07:00
Rob Pike
20acc5cf31 go.sys: copy files from syscall package to go.sys/{plan9,windows,unix}
This CL copies to each package of go.sys the files from syscall it will need.
Different directories have different files, but these:
        mkall.sh
        str.go
        syscall.go
        mksyscall.pl
        race.go
        race0.go
        syscall_test.go
are copied to all three.
No changes yet, these are just copies. They are not ready to use yet:
package names are wrong, for starters. But this clean copy will make
it easier to follow the changes as the packages are enabled.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/126960043
2014-08-11 14:48:46 -07:00