Commit Graph

96 Commits

Author SHA1 Message Date
Alex Brainman
b6889370fb windows/svc: align ctlHandler parameters
ctlHandler is passed to RegisterServiceCtrlHandlerEx as a callback
function. But all ctlHandler parameters have to be uintptr aligned
regardless of their type.

Adjust ctlHandler parameters, so they are aligned accordingly.

Also uncomment part of TestExample that verifies passing of
ChangeRequest.Context.

Fixes golang/go#25660

Change-Id: Ie96fa5c78b911ad9df6775f5c49e7f6d56464f6b
Reviewed-on: https://go-review.googlesource.com/c/158698
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-02 02:57:03 +00:00
Alex Brainman
12036c158a windows/svc: add Context to ChangeRequest
New Context field will be used in the following CL to test
ctlHandler parameter alignments.

Also adjust TestExample to pass hard coded Context value of 123456
to test service, and verify that correct value is logged. Final
part of the test is commented out, and will be adjusted in the next
CL.

Updates golang/go#25660

Change-Id: Iad2896ae497ee1edc0d62655eaf08671ec2651c5
Reviewed-on: https://go-review.googlesource.com/c/158697
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-02 02:54:30 +00:00
Bryan C. Mills
629670e5ac windows: gofmt -w windows/security_windows.go
x/sys/unix is vendored into the standard library, and the commit hook
for the standard library requires files to be gofmt-clean.

Updates golang/go#26924

Change-Id: I22a994062bcdbebe8a1fe1ae0ed4606837f03079
Reviewed-on: https://go-review.googlesource.com/c/162990
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-20 15:41:26 +00:00
Jason A. Donenfeld
980327fe3c windows: Implement WaitForMultipleObjects
This is a very classic and highly useful Windows API that I'm surprised
it's still not here.

Change-Id: If54319099cd94dd727126c579dd5a681979321cd
Reviewed-on: https://go-review.googlesource.com/c/160937
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-02-04 10:32:48 +00:00
Jordan Rhee
074acd46bc windows/svc: use wevtutil.exe instead of powershell for windows/arm
Use wevtutil.exe to query event log instead of powershell's Get-EventLog
command, which is not available on Windows IoT Core.

Updates golang/go#26148

Change-Id: Idc16d0b18d2826730d2b4062388b2a764c4886c6
Reviewed-on: https://go-review.googlesource.com/c/154817
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-18 19:26:12 +00:00
Jordan Rhee
dcdaa6325b windows: use netevent.dll in TestFormatMessage for windows/arm
pdh.dll is not available on Windows IoT core. Use netevent.dll instead.

Update golang/go#26148

Change-Id: I80c299ad030944954d5d7d182d91dc15e71341f9
Reviewed-on: https://go-review.googlesource.com/c/154560
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-17 22:35:16 +00:00
Jordan Rhee
90868a75fe windows: add support for windows/arm
Updates golang/go#26148

Change-Id: I0425244bfb0c8f600a6f02d9d7b228e175a720a4
Reviewed-on: https://go-review.googlesource.com/127665
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-24 17:59:46 +00:00
Leigh McCulloch
4526dd3c8b windows: correct misspelling in comment
The comment for ConsoleScreenBufferInfo uses the word 'retreive' that
is a misspelling of 'retrieve'.

Change-Id: Idd9fb0c5082b6a2b10badbbb162e312710bfe68b
GitHub-Last-Rev: 08d62a57df
GitHub-Pull-Request: golang/sys#18
Reviewed-on: https://go-review.googlesource.com/134221
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-09 07:10:14 +00:00
Tobias Klauser
fa5fdf94c7 windows: add support for AF_UNIX sockets
CL 125456 added the implementation of AF_UNIX to the syscall package.
Add the same implementation to golang.org/x/sys/windows as well.

This works only on Windows 10.

https://blogs.msdn.microsoft.com/commandline/2017/12/19/af_unix-comes-to-windows/

Updates golang/go#26072

Change-Id: Ibd4a17342ed4f9f4f2b16b82c7b02834e681b7b4
Reviewed-on: https://go-review.googlesource.com/132555
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-08-31 09:46:39 +00:00
Joe Richey joerichey@google.com
14742f9018 windows: add Wincrypt.h Cert related values
Values cross-referenced between Visual Studio 2017's "Wincrypt.h",
https://github.com/wine-mirror/wine/blob/master/include/wincrypt.h,
and the MSDN documentation at:

CertOpenStore:
    https://msdn.microsoft.com/en-us/library/windows/desktop/aa376559.aspx
CertAddCertificateContextToStore:
    https://msdn.microsoft.com/en-us/library/windows/desktop/aa376009.aspx
CertTrustStatus:
    https://msdn.microsoft.com/en-us/library/windows/desktop/aa377590.aspx
CertVerifyCertificateChainPolicy:
    https://msdn.microsoft.com/en-us/library/windows/desktop/aa377163.aspx
SSLExtraCertChainPolicyPara:
    https://msdn.microsoft.com/en-us/library/windows/desktop/aa387784.aspx

Change-Id: I143e10c4f47caa2550fb93cd10bdec00bbb2b32d
GitHub-Last-Rev: b4b8c6c419
GitHub-Pull-Request: golang/sys#15
Reviewed-on: https://go-review.googlesource.com/129275
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-08-15 09:31:51 +00:00
Brad Fitzpatrick
0ffbfd41fb unix, windows: add type aliases to std syscall for Signal, Errno, SysProcAttr
To simplify the pkg syscall docs.

Change-Id: I3ed0bfc59564ada280141c4662a56e141d197e1f
Reviewed-on: https://go-review.googlesource.com/127656
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-02 20:32:16 +00:00
Jeet Parekh
10b189e7aa x/sys: improve NewCallback documentation
Keeps the documentation in sync with syscall package. Copies the changes from CL https://golang.org/cl/126035.

Change-Id: I778725fd7d5e96ddf839d33e1d220e5a12e2d24f
GitHub-Last-Rev: 4b30513126
GitHub-Pull-Request: golang/sys#12
Reviewed-on: https://go-review.googlesource.com/126435
Reviewed-by: Austin Clements <austin@google.com>
2018-07-27 19:38:14 +00:00
madiganz
ac767d655b windows/svc/mgr: add ability to set a reboot message and command when a service fails
Added configuration options for a windows service recovery settings.
New configurations include modifying the reboot message, or command
to be run when a service fails, and getting the current reboot message
or command.

Fixes golang/go#23239

Change-Id: I3e501d66e97745b7536fd654aee2bba488083e6d
Reviewed-on: https://go-review.googlesource.com/122579
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-07-15 08:55:29 +00:00
Kropekk
3c6ecd8f22 windows: add missing file attributes
Added all remaining file attributes constants present on Windows OS.
According to: https://docs.microsoft.com/en-gb/windows/desktop/FileIO/file-attribute-constants

Fixes golang/go#25979

Change-Id: Ie8cb9edfbd37b3121066b291e4e2a01573c63087
Reviewed-on: https://go-review.googlesource.com/122236
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-07-07 00:20:01 +00:00
Zachary Madigan
151529c776 windows, windows/svc/mgr: add ability to modify service recovery settings.
Added configuration options for a windows service recovery settings.
Current configurations include modifying actions taken when a service
fails, setting the reset period, and getting the current recovery
settings.

Updates golang/go#23239

Change-Id: I4e91b2068122731e6eba3332afb0fe300b298c97
Reviewed-on: https://go-review.googlesource.com/104635
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-07-04 09:49:41 +00:00
Alex Brainman
6c888cc515 windows: replace uintptr in crypto structs
This CL is a copy of CL 106275 (see CL 106275 for details).

It introduces CertInfo, CertTrustListInfo and CertRevocationCrlInfo
types. It uses pointers to new types instead of uintptr in CertContext,
CertSimpleChain and CertRevocationInfo.

CertRevocationInfo, CertChainPolicyPara and CertChainPolicyStatus types
have uintptr field that can be pointer to many different things
(according to Windows API). So this CL introduces Pointer type to be
used for those cases.

Fixes golang/go#25797

Change-Id: I7797ddc6daf3e67b7eab69ab9fbf4d51650f8b6a
Reviewed-on: https://go-review.googlesource.com/118797
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-16 03:02:59 +00:00
Tobias Klauser
8014b7b116 windows: follow convention for generated code comment
Regenerated with go tip to get the generated code comment following the
convention (https://golang.org/s/generatedcode).

Change-Id: Ie1365ecfa532b940bf7cfc8579c4cbda71cf7f76
Reviewed-on: https://go-review.googlesource.com/118817
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-06-15 09:36:15 +00:00
Thanabodee Charoenpiriyakij
bff228c7b6 windows: update TOKEN_ALL_ACCESS according to WinNT.h
TOKEN_ALL_ACCESS was changed at some stage by Microsoft.

Fixes golang/go#25775

Change-Id: I002200ad4c5188d19ac3c500f571dd13ea1fbafc
Reviewed-on: https://go-review.googlesource.com/117815
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-06-11 08:04:25 +00:00
pytimer
56ad15cc21 windows: add QueryServiceStatusEx function
Fixes golang/go#25485

Change-Id: Ic00df1f86591c00fa88cddcb03c7ced0c6bdb0c1
Reviewed-on: https://go-review.googlesource.com/114215
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-05-24 10:43:36 +00:00
Hana Kim
dc67e5b82c windows: address error reported by vet
https://storage.googleapis.com/go-build-log/489a6b5c/misc-vet-vetall_c1e51035.log
cmd/vendor/golang.org/x/sys/windows/asm_windows_amd64.s:12: [amd64] loadlibrary: wrong argument size 8; expected $...-24

Change-Id: I02e7c53216e2c55d0d062e50f72984228c214e23
Reviewed-on: https://go-review.googlesource.com/114082
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-22 22:16:54 +00:00
Hana (Hyang-Ah) Kim
7dfd1290c7 windows: address vet reports
Found in https://storage.googleapis.com/go-build-log/300ed876/misc-vet-vetall_dd96a388.log

cmd/vendor/golang.org/x/sys/windows/asm_windows_386.s:9: [386] getprocaddress: wrong argument size 8; expected $...-16
cmd/vendor/golang.org/x/sys/windows/asm_windows_386.s:12: [386] loadlibrary: wrong argument size 4; expected $...-12
cmd/vendor/golang.org/x/sys/windows/svc/service.go:337: cmd/vendor/golang.org/x/sys/windows.SERVICE_TABLE_ENTRY composite literal uses unkeyed fields
cmd/vendor/golang.org/x/sys/windows/svc/service.go:338: cmd/vendor/golang.org/x/sys/windows.SERVICE_TABLE_ENTRY composite literal uses unkeyed fields
cmd/vendor/golang.org/x/sys/windows/svc/debug/service.go:34: cmd/vendor/golang.org/x/sys/windows/svc.ChangeRequest composite literal uses unkeyed fields
cmd/vendor/golang.org/x/sys/windows/svc/mgr/config.go:124: cmd/vendor/golang.org/x/sys/windows.SERVICE_DESCRIPTION composite literal uses unkeyed fields

Change-Id: Ic08cfcc802aac89cfa1eb98661ec556c844e8013
Reviewed-on: https://go-review.googlesource.com/112557
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-10 03:28:50 +00:00
Alex Brainman
78d5f264b4 windows/svc: correct MOVL instruction in sys_amd64.s
Second argument of servicemain is a pointer. See

https://msdn.microsoft.com/en-us/library/windows/desktop/ms685138(v=vs.85).aspx

So amd64 assembler code should use MOVQ to read that value.
I probably copied 386 assembler code into amd64 and did not
adjust the code.

Broken code was used to pass parameters to the service, so
add some tests to verify that parameter passing works.

Fixes golang/go#24575

Change-Id: I89f8cad026ea13f8a5d78ff3e24b7236e27fc91f
Reviewed-on: https://go-review.googlesource.com/110160
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-01 09:27:40 +00:00
Kevin Burke
01acb38716 plan9, unix, windows: add paragraph breaks in docs
Currently the doc string forms one run-on sentence when viewed in
a browser. Add an additional newline so the text is presented in
a browser the same way it is in the source code.

Change-Id: If93e45c5aec9edd195c6bf36cb757c5146368507
Reviewed-on: https://go-review.googlesource.com/101284
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-18 19:08:47 +00:00
Shamil Garatuev
f6cff0780e windows/registry: improve ReadSubKeyNames permissions
The existing implementation requires QUERY_VALUE and ENUMERATE_SUB_KEYS permissions to enumerate
subkeys, so, using registry key name limits, Stat function could be excluded
from methods body and improved method requires only ENUMERATE_SUB_KEYS permission

Registry elements size limits described there:
https://msdn.microsoft.com/library/windows/desktop/ms724872.aspx

Fixes golang/go#23869

Change-Id: Id96beb9b0b294f01cc6eb1bb53bee5f50d02ea7e
Reviewed-on: https://go-review.googlesource.com/95655
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-24 23:21:35 +00:00
Tobias Klauser
3ca7571cef windows: move Unsetenv into env_windows.go
Unsetenv was in its own file for Go 1.4 compatibility. This version is
no longer supported, so move Unsetenv with the other environment
specific functions.

Change-Id: I63d67e2a9e4d7651be79c2e72a7f27fe0fac68c4
Reviewed-on: https://go-review.googlesource.com/86539
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-08 22:11:41 +00:00
Brad Fitzpatrick
0131e684e8 windows: make GetDriveType use GetDriveTypeW
Fixes golang/go#23121

Change-Id: I71495b82a573e9f492a52dde325522a6203c06eb
Reviewed-on: https://go-review.googlesource.com/83855
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-12-13 21:08:10 +00:00
Scott Crunkleton
1006bb3484 windows: add DOMAIN_ALIAS_RID* values and Token.IsMember(*SID) (bool, error)
Change-Id: Ib5eead82c8571a4becd4ddf6b1b87f8dcb2eb23e
Reviewed-on: https://go-review.googlesource.com/80155
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-28 21:08:31 +00:00
Awn
0ac51a24ef windows: add process creation flags
Fixes golang/go#22801

Change-Id: I1f466e26bcdf52bdd0df09bd81e31dde10347862
Reviewed-on: https://go-review.googlesource.com/78618
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-11-19 03:26:26 +00:00
Scott Crunkleton
0dd5e194bb windows: add Volume Management functions
Change-Id: I6e587cf1b7e8532f45df03bf94e209aafe8f81fd
Reviewed-on: https://go-review.googlesource.com/78235
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-11-17 07:10:00 +00:00
Aman Gupta
4b45465282 windows: add WSA{Send,Recv}Msg
Change-Id: Id71df85e55e586b33fac66c5494291e11db8ed14
Reviewed-on: https://go-review.googlesource.com/76471
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-09 00:15:38 +00:00
Tobias Klauser
8eb05f94d4 windows: fix go vet warning
Now that go tip runs vet during go test	(CL 74356), the x/sys/windows
test fails due to the following vet error:

  syscall_windows_test.go:84: Fatal call has possible formatting directive %x

Fix it by using Fatalf instead.

Change-Id: I02536312c00bc9002400b29b5b5acef879a0e51a
Reviewed-on: https://go-review.googlesource.com/75973
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-04 19:33:50 +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
Hilko Bengen
8dbc5d05d6 windows: add GetProcAddressByOrdinal
The current GetProcAddress implementation only resolves functions in
DLLs by name. Add GetProcAddressByOrdinal that allows resolving
functions by ordinal number, using the same GetProcAddress call from
kernel32.dll in the background.

This is particularly useful for some functions (e.g. IsOS from
shlwapi.dll in some older versions of Windows) that cannot be found by
name.

Fixes golang/go#16507

Change-Id: Ib5fba7568c365a0aa2491c1261876b3a3929ec3d
Reviewed-on: https://go-review.googlesource.com/70690
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-17 06:39:10 +00:00
Jeet Parekh
062cd7e4e6 windows: fix NewCallback function
It has been suggested to migrate from syscall to golang.org/x/sys
The NewCallback function works in syscall. But the golang.org/x/sys/windows NewCallback function did not work.

Since golang.org/x/sys/windows already imports syscall, the NewCallback function now calls syscall.NewCallback.

Fixes golang/go#21831

Change-Id: I5cabd8540777b398a288308a66ae20896ed4a1db
Reviewed-on: https://go-review.googlesource.com/63250
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-09-12 23:54:04 +00:00
Tobias Klauser
07c182904d windows: add missing event functions
Add CreateEventEx, OpenEvent, ResetEvent and PulseEvent.

Also change eventAttrs to use the local definition of the
SecurityAttributes type, not the one from syscall.

GetConsoleScreenBufferInfo is also changed by re-running 'go generate'
to pass a pointer to ConsoleScreenBufferInfo (instead of a pointer to
pointer).

Change-Id: I08dff4360186b04c55fd0362e31920f38206157b
Reviewed-on: https://go-review.googlesource.com/56110
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-21 09:33:53 +00:00
Tobias Klauser
d8f5ea21b9 windows: rename ztypes_* to types_*
The ztypes_* file names indicate that these are auto-generated while in
fact they aren't. Rename them to types_* to avoid this confusion.

Noticed by Brad Fitzpatrick in https://golang.org/cl/52670.

Change-Id: I75c8d0f4116dfb3a24ae9444509daf31524c35d6
Reviewed-on: https://go-review.googlesource.com/52950
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-03 14:03:59 +00:00
Tobias Klauser
d6c3f2be45 windows: add SetConsoleMode and GetConsoleScreenBufferInfo
Add the SetConsoleMode and GetConsoleScreenBufferInfo functions, as well
as the corresponding types and constants. For details see:

  https://docs.microsoft.com/en-us/windows/console/setconsolemode
  https://docs.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo
  https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str

Change-Id: I17dcd62ffde12b5c94e1245b6836d067aea3dc6e
Reviewed-on: https://go-review.googlesource.com/52670
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-08-03 08:12:02 +00:00
Francesc Campoy
6faef541c7 golang.org/x/sys: fix typo in test
Change-Id: I5709137db7308934e627d866da1cc8aa5abca7db
Reviewed-on: https://go-review.googlesource.com/47310
Reviewed-by: Rob Pike <r@golang.org>
2017-07-05 19:55:40 +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
Awn
0e01648653 windows: move memory protection constants so that they are all together
Change-Id: I0dee287567bdbf882e804bcd5ed7dcd6f748b30c
Reviewed-on: https://go-review.googlesource.com/47340
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-07-02 23:23:31 +00:00
Awn
d18155cb60 windows: add memory-related VirtualX calls and associated constants
Fixes golang/go#20086

Change-Id: Ifdc2561fe6cc125fa45a57bad9750f3f3f055e66
Reviewed-on: https://go-review.googlesource.com/47335
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-07-02 07:53:53 +00:00
Tyler Treat
f7928cfef4 windows/svc: add missing Accept commands
Add the remaining AcceptX commands (AcceptParamChange,
AcceptNetBindChange, AcceptHardwareProfileChange, AcceptPowerEvent, and
AcceptSessionChange) to the windows/svc package. Also add support for
these to updateStatus such that a service can actually accept these
commands.

Change-Id: I11191e7798489b3222a3e76ba55129f10fd202ab
Reviewed-on: https://go-review.googlesource.com/46722
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-06-27 01:25:38 +00:00
Alex Brainman
fb4cac33e3 windows/svc/mgr: add Mgr.ListServices
Add API to list services installed on the system.

Fixes golang/go#20596

Change-Id: Ifa2f20ef15ccb962bd21d03788ce931dd45f2630
Reviewed-on: https://go-review.googlesource.com/45711
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-06-15 05:32:24 +00:00
helloPiers
dbc2be9168 windows/svc/mgr: correct documentation for args parameter of Mgr.CreateService
The args passed to Mgr.CreateService end up as the command-line
arguments (available via os.Args), not as the args passed to
Svc.Handler.Execute.

Fixes golang/go#20440

Change-Id: I55a1ec3432b377082c018fe960114c96350e8978
Reviewed-on: https://go-review.googlesource.com/43714
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-05-21 16:21:43 +00:00
Julian Pastarmov
e62c3de784 windows: use RegisterServiceCtrlHandlerEx to allow for advanced notifications
This allows services written with this library to register for more
advanced notifications like SERVICE_CONTROL_DEVICEEVENT for example.

Also the code now exposes the service status handle through a new
api call, because the handle is needed to register for such
notifications and can not be obtained by any other means.

Change-Id: I80796e1dd9d94ec9d6c236d0413b17288c67fe1f
Reviewed-on: https://go-review.googlesource.com/42812
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-05-18 05:52:01 +00:00
Mikio Hara
98b5b1e7e8 windows/svc/mgr: gofmt -w -s
Change-Id: I4ef179aacaf0694cd7661b4d9972ce85abeee8df
Reviewed-on: https://go-review.googlesource.com/43470
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-05-17 08:38:02 +00:00
Tamir Duberstein
1e4778a9a1 windows: add LoadGetSystemTimePreciseAsFileTime
Useful since GetSystemTimePreciseAsFileTime is Windows 8+.

Change-Id: I736bd0668aaf6ad086f6465b8b9a17f1943f0570
Reviewed-on: https://go-review.googlesource.com/43312
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-05-12 16:22:00 +00:00
Tamir Duberstein
f3918c30c5 windows: add SetStdHandle
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686244(v=vs.85).aspx

Change-Id: If7d460a9fb43767c0a3ee55e86faf3356162c81d
Reviewed-on: https://go-review.googlesource.com/39609
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-07 05:08:50 +00:00