windows: revert breaking API changes from CL 196798, add new accessor funcs

CL 196798 changed API and broke a number of projects.

Revert the signature changes but add new convenience functions instead.

Change-Id: I49e389204f4756ec054ba8fd7555e235ef6370e8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/197597
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Brad Fitzpatrick
2019-09-26 18:03:25 +00:00
parent 2837fb4f24
commit 855e68c859
3 changed files with 23 additions and 7 deletions
+2 -2
View File
@@ -650,12 +650,12 @@ type Token Handle
// OpenCurrentProcessToken opens an access token associated with current
// process with TOKEN_QUERY access. It is a real token that needs to be closed.
//
// Deprecated: Explicitly call OpenProcessToken(GetCurrentProcess(), ...)
// Deprecated: Explicitly call OpenProcessToken(CurrentProcess(), ...)
// with the desired access instead, or use GetCurrentProcessToken for a
// TOKEN_QUERY token.
func OpenCurrentProcessToken() (Token, error) {
var token Token
err := OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)
err := OpenProcessToken(CurrentProcess(), TOKEN_QUERY, &token)
return token, err
}