qmuntal
d045236a8d
windows: implement Ftruncate using a single syscall on Windows
...
Ftruncate can be implemented on Windows using a single syscall. This
makes the implementation more efficient and less prone to races when
used in combination with other Seek calls.
Note that this is the x/sys counterpart for CL 618835.
Change-Id: Ie9be356bd953ccce85c0dd87a5dcc6ccf4fec464
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621935
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Auto-Submit: Quim Muntal <quimmuntal@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
Reviewed-by: Damien Neil <dneil@google.com >
2024-10-28 14:49:53 +00:00
mertakman
adbb8bbcaf
windows/mkwinsyscall: use syscall.SyscallN instead of syscall.Syscall{6,9,12,15}
...
Replace syscall.Syscall6, Syscall9, Syscall12, and Syscall15 with syscall.SyscallN for Go 1.18+. This simplifies system calls by allowing the exact number of arguments needed, eliminating zero padding and reducing potential errors.
Updated TestSyscallXGeneration to TestSyscallNGeneration to verify correct SyscallN generation for different argument counts.
Change-Id: Icd6662b591d7548e367b88f34243f5529e177eab
GitHub-Last-Rev: c06fca1aa4
GitHub-Pull-Request: golang/sys#219
Reviewed-on: https://go-review.googlesource.com/c/sys/+/614082
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
2024-10-21 13:42:39 +00:00
qmuntal
7143f4a4e1
windows: manually initialize NewNTUnicodeString
...
The `RtlInitUnicodeString` syscall can be avoided by manually
initializing the `NTUnicodeString`.
The process is described in [WdmlibRtlInitUnicodeStringEx](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdmsec/nf-wdmsec-wdmlibrtlinitunicodestringex ).
The less syscalls, the better. It also makes the function faster:
```
goos: windows
goarch: amd64
pkg: golang.org/x/sys/windows
cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
NewNTUnicodeString-12 181.05n ± 15% 96.32n ± 11% -46.80% (p=0.000 n=10)
```
Change-Id: Iaf079acdcc2024cdca6b6b649a711f6be99c5b87
Reviewed-on: https://go-review.googlesource.com/c/sys/+/618175
Reviewed-by: Damien Neil <dneil@google.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2024-10-07 19:17:02 +00:00
cuishuang
d58f986c89
all: fix some typos in comment
...
Change-Id: I40f9866661bad30ee2f4be2e9d0beee54db860b3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/611775
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Commit-Queue: Ian Lance Taylor <iant@google.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2024-09-09 19:33:19 +00:00
Dmitri Shuralyov
68ed59b20b
windows/svc: fix printf(var) mistake detected by latest printf checker
...
For golang/go#69267 .
Change-Id: Ie240b5c826bb96c0e2021a7e99a3c0f973f0a0e1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/610940
Reviewed-by: Tim King <taking@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2024-09-06 16:31:18 +00:00
James Tucker
a43b625d3c
windows: add SIO_UDP_NETRESET constant
...
In order to get BSD like behavior with regard to ICMP, it is necessary
to set SIO_UDP_NETRESET as well as SIO_UDP_CONNRESET.
Updates golang/go#68614
Change-Id: Ibdf5b6ea6bc08a9d3a0aeac9037864670cf765c0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/609295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Funda Secgin <fundasecgin38@gmail.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
2024-09-04 13:19:09 +00:00
Ayman Bagabas
ed67b1566a
windows: add console codepage api
...
Add setter/getter for console input/output codepages. This is useful to set the console expected codepage instead of converting it to UTF-16 before writing.
Change-Id: Ie0465708e7cf68d776e23dbbeeca7bcb4db7d2bf
GitHub-Last-Rev: 93c06e27a0
GitHub-Pull-Request: golang/sys#206
Reviewed-on: https://go-review.googlesource.com/c/sys/+/599395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
2024-08-28 07:55:29 +00:00
database64128
4c7077ec60
windows: add enums for IpAdapterUnicastAddress
...
These are for the enum fields in IpAdapterUnicastAddress.
Change-Id: Ibcb6ce674ab41a94dbe46d394f035208a94b6dae
GitHub-Last-Rev: 1837ff9c32
GitHub-Pull-Request: golang/sys#204
Reviewed-on: https://go-review.googlesource.com/c/sys/+/598895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: David Chase <drchase@google.com >
2024-08-07 08:50:18 +00:00
Alex Brainman
29298aaa6a
windows: delete TestGetKeyboardLayout
...
According to
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getforegroundwindow
GetForegroundWindow can return nil in some circumstances. So
GetForegroundWindow cannot be used in the TestGetKeyboardLayout.
Just delete the test for now.
Fixes golang/go#68671
Change-Id: I7e05ac2f19b1a6310a3f7f690c6d02b0d1f5571e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/602335
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: David Chase <drchase@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Ayman Bagabas <ayman.bagabas@gmail.com >
2024-08-05 20:31:40 +00:00
Ayman Bagabas
beb594982d
windows: correctly generate GetAce syscall
...
GetAce expects a failretval==0, and we shouldn't call GetLastError on
error.
For golang/go#66850
Change-Id: I812d71b066d56e8285324e70b8b5b5fb42b5ce35
GitHub-Last-Rev: 40cf7508de
GitHub-Pull-Request: golang/sys#205
Reviewed-on: https://go-review.googlesource.com/c/sys/+/599295
Reviewed-by: Ian Lance Taylor <iant@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com >
2024-07-22 20:52:27 +00:00
Ayman Bagabas
bce4cf76d8
windows: add GetKeyboardLayout & ToUnicodeEx
...
These are used along with GetForegroundWindow and GetWindowThreadProcessId to determine the current user layout and translate the base key the user has pressed.
Change-Id: Ib833ba7ab54213d83e889ff74c5bc0ace5edbe95
GitHub-Last-Rev: 2afe9976a2
GitHub-Pull-Request: golang/sys#188
Reviewed-on: https://go-review.googlesource.com/c/sys/+/574755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Than McIntosh <thanm@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Ayman Bagabas <ayman.bagabas@gmail.com >
2024-07-17 07:58:31 +00:00
database64128
0eac9b5475
windows: add flags for GetAdaptersAddresses
...
This commit adds all missing flags for GetAdaptersAddresses.
Change-Id: I874623b6ac77af4ced49205493258e118a4f1b26
GitHub-Last-Rev: 384c92a280
GitHub-Pull-Request: golang/sys#203
Reviewed-on: https://go-review.googlesource.com/c/sys/+/597915
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Than McIntosh <thanm@google.com >
2024-07-17 07:47:25 +00:00
Claudiu Belu
76700875df
windows: add GetAce Windows API
...
GetAce obtains a pointer to an access control entry (ACE) in an
discretionary access control list (DACL), which controls access to
an object.
Adds the ACE_HEADER and ACCESS_ALLOWED_ACE structs.
Adds GetEntriesFromACL function which returns an array of ACEs from the
given ACL if no errors have been encountered.
References:
- https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header
- https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-access_allowed_ace
- https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-getace
Fixes golang/go#66850
Change-Id: I98306ff7e947e586a58d563d364169a2555492f4
GitHub-Last-Rev: d14ca7fb0b
GitHub-Pull-Request: golang/sys#191
Reviewed-on: https://go-review.googlesource.com/c/sys/+/578976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Damien Neil <dneil@google.com >
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2024-06-24 03:00:31 +00:00
Alex Brainman
348425aa18
windows/svc: do not pass theService to windows.RegisterServiceCtrlHandlerEx
...
windows.RegisterServiceCtrlHandlerEx context parameter is uintptr, so it
is unsafe to pass pointers in that parameter. Use theService global
variable in ctlHandler function instead.
Fixes golang/go#67437
Change-Id: I84c910eaa354603c2a5114421cd61788cb40b86f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/591475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: David Chase <drchase@google.com >
2024-06-13 07:32:15 +00:00
JoeyShapiro
f34bb9fccc
windows: add net user enum
...
In the go windows package, you can get user information by using
`NetUserGetInfo` along with a specified level. However, there is
no way to get a list of the users.
The only options are to
1. know the users,
2. brute force users, or
3. use an external tool or command (`net users`).
I suggest adding a function that implements the windows api for
`NetUserEnum`. This will allow a built in way to enumerate
users and follow the standard.
A side note is that I used `buf **byte` because
it is how the others are done, but using `buf *byte`
works just as well.
Change-Id: Ifcc916659eb1d796175cd18acd2e81f2661bfcd2
GitHub-Last-Rev: 3d01bca920
GitHub-Pull-Request: golang/sys#190
Reviewed-on: https://go-review.googlesource.com/c/sys/+/578475
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Auto-Submit: Cherry Mui <cherryyz@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2024-05-09 17:46:52 +00:00
Tobias Klauser
9a28524796
windows: drop go version tags for unsupported versions
...
go.mod specifies go 1.18. Drop go1.n version tags for older, unsupported
versions.
Change-Id: I7a23a9f4ba558999ac417b7b4647fa1061d69c06
Reviewed-on: https://go-review.googlesource.com/c/sys/+/566038
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2024-04-16 22:18:47 +00:00
Tom Payne
cabba82f75
windows: use uint32 for serial comm flags for consistency
...
This is a follow-up to https://go-review.googlesource.com/c/sys/+/572295
and specifically the comment
https://go-review.googlesource.com/c/sys/+/572295/comment/a00e1a2e_e3b01666/ .
All other structs and methods us uint32 in golang.org/x/sys/windows
for flag bitmasks, so make the serial communication structs use uint32
to be consistent with the rest of the package.
As a side effect the DTR_CONTROL_* and RTS_CONTROL_* constants are
updated to reflect the positions of the bits in the 32-bit flags.
Change-Id: Ie19774a8ef5411d7df1e5b0d36806aa1d401fa86
GitHub-Last-Rev: bc93d94a45
GitHub-Pull-Request: golang/sys#189
Reviewed-on: https://go-review.googlesource.com/c/sys/+/575635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Than McIntosh <thanm@google.com >
2024-04-04 14:40:38 +00:00
Tom Payne
1a50d9738b
windows: add serial comm functions
...
Serial ports are still widely used to communicate with a large range of
devices.
This change adds the remaining functions described in "Serial
Communications in Win32", enabling Go applications and libraries to be
written that support the full set of serial port functionality on
Windows.
x/sys/unix already has equivalent functionality through termios.
See https://learn.microsoft.com/en-us/previous-versions/ms810467(v=msdn.10) .
Change-Id: I57f9ed6b7dbcc2331f740bd95b6483f141b0ad6f
GitHub-Last-Rev: 0a5a7441ce
GitHub-Pull-Request: golang/sys#187
Reviewed-on: https://go-review.googlesource.com/c/sys/+/572295
Reviewed-by: David Chase <drchase@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Than McIntosh <thanm@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2024-04-02 01:45:51 +00:00
Peter Hoogendijk
95f07eca87
x/sys/windows: add func windows.DisconnectNamedPipe(handle Handle) (err error)
...
Fixes golang/go#66234
Change-Id: I1e4a94e1ca8c01a29bab18e0bf12238c511fe1c6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/570435
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2024-03-12 20:49:51 +00:00
qmuntal
914b96c1bd
windows: support ill-formed UTF-16 in UTF16PtrToString
...
UTF16PtrToString does not support ill-formed UTF-16 because it uses
utf16.Decode, which expects well-formed UTF-16.
This CL updates the UTF16PtrToString implementation to use
UTF16ToString instead of utf16.Decode, which supports ill-formed
UTF-16 since go1.21 via syscall.UTF16ToString.
Change-Id: Ifb72b6d38a8c08ad90ec6a47eed05fc3739500a1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/560355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Bryan Mills <bcmills@google.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
2024-02-01 17:02:20 +00:00
Bryan Mills
511ec846b6
Revert "windows: support nil done parameter in ReadFile and WriteFile"
...
This reverts CL 559375.
Reason for revert: introduced a different regression (golang/go#65378 ).
Fixes golang/go#65378 .
Updates golang/go#65365 .
Change-Id: Ie2a602415913b04b9d9b65fee5c6a54c0267b35e
Cq-Include-Trybots: luci.golang.try:x_sys-gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/sys/+/559502
Auto-Submit: Bryan Mills <bcmills@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
2024-01-30 20:43:58 +00:00
qmuntal
628365db92
windows: support nil done parameter in ReadFile and WriteFile
...
Win32 defines the `done` param as optional for ReadFile and WriteFile
functions. We should support this case too.
Fixes golang/go#65365 .
Change-Id: I961ff66a63d3a8ffa5560b6dab21fbd4ac9817ae
Reviewed-on: https://go-review.googlesource.com/c/sys/+/559375
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com >
Reviewed-by: Bryan Mills <bcmills@google.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2024-01-30 17:14:39 +00:00
Bryan C. Mills
b3ce6a356e
windows: build env_windows_test.go only go Go 1.21 and above
...
This test imports the "slices" package, which did not exist in Go 1.20.
The test passes on Go 1.21 and above, and the behavior of the function
under test is unlikely to vary by platform, so it doesn't seem worth
refactoring the test to work with older releases.
Updates golang/go#65055 .
Fixes golang/go#65223 .
Change-Id: I5f32106d6057b779579a87750633bc57f97fe152
Cq-Include-Trybots: luci.golang.try:x_sys-go1.20-windows-386,x_sys-go1.20-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/sys/+/557975
Auto-Submit: Bryan Mills <bcmills@google.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2024-01-23 20:45:08 +00:00
Kamyar Mirzavaziri
c3fa2b8b41
windows: fix parsing of non-ASCII entries in token.Environ
...
Fixes golang/go#65055 , the unexpected behavior of token.Environ in parsing entries containing runes larger than 2 bytes in size
Change-Id: I753d2c605e3a2d7a1d90cd18601d6b918f0d3f7a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/556895
Auto-Submit: Bryan Mills <bcmills@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Bryan Mills <bcmills@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
2024-01-23 00:04:46 +00:00
Kanak Agrawal
0829ab15b6
windows: add SetFileValidData
...
Fixes golang/go#61834
Change-Id: Iaff01f5662aa2309e8ac41b346e0d3a42d28af91
Reviewed-on: https://go-review.googlesource.com/c/sys/+/517575
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Run-TryBot: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Keith Randall <khr@google.com >
2024-01-03 06:57:32 +00:00
Roland Shoemaker
11eadc05e9
windows: add AddDllDirectory and RemoveDllDirectory
...
Per https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-adddlldirectory
and https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-removedlldirectory .
Change-Id: If44a3758720345d1bbd9af96ec2481fbe9398a08
Reviewed-on: https://go-review.googlesource.com/c/sys/+/537755
Reviewed-by: Tatiana Bradley <tatianabradley@google.com >
Auto-Submit: Roland Shoemaker <roland@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2023-11-13 16:23:13 +00:00
F Y
1e638101df
unix: stop counting trailing NUL for abstract addresses starting with NUL
...
Changes trailing-NUL-counting behavior for abstract addresses
starting with the NUL character to be the same as abstract
addresses starting with the @ character.
For golang/go#63579 .
Change-Id: I2f26de4bcf614c4635ad188b1afa3d14ebd9a95f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/535955
Reviewed-by: Ian Lance Taylor <iant@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Reviewed-by: Benny Siegert <bsiegert@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2023-10-23 09:05:11 +00:00
Dmitri Shuralyov
1bfbee0e20
all: update go directive to 1.18
...
Done with:
go get go@1.18
go mod tidy
go fix ./...
Using go1.21.3.
Also update code generators to use only the new go:build lines,
not the old +build ones.
For golang/go#60268 .
Change-Id: I6aabc42efb6ab3329981100e1db2263aac5e92a6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/534222
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2023-10-11 21:54:30 +00:00
AN Long
8ccaaf02a4
windows: add GetFileTime
...
Add a simple Windows API GetFileTime.
The document is https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfiletime
Fixes golang/go#21541
Change-Id: Ia7b8385d27348b2abc0ee560c5bd7e66cb6d13f2
GitHub-Last-Rev: 6700dccbad
GitHub-Pull-Request: golang/sys#174
Reviewed-on: https://go-review.googlesource.com/c/sys/+/528015
Reviewed-by: Michael Pratt <mpratt@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
Auto-Submit: Michael Pratt <mpratt@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
2023-10-06 20:50:44 +00:00
database64128
6ee6208a59
windows: add missing TCP and UDP socket options and control message types
...
Source: ws2ipdef.h
Change-Id: Ie9c6e2cec839a09b7e59239f1d5b50664a310f1d
GitHub-Last-Rev: 14b916938b
GitHub-Pull-Request: golang/sys#173
Reviewed-on: https://go-review.googlesource.com/c/sys/+/525256
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
2023-10-06 20:48:55 +00:00
Bryan C. Mills
3186bae2c3
windows: remove the 8192-codepoint arg limit in FuzzComposeCommandLine
...
It just occurred to me that the observed limit was almost certainly a
side effect of the Go wrapper for CommandLineToArgv (golang/go#63236 )
rather than a behavior of the system call itself.
Updates golang/go#63236 .
Updates golang/go#58817 .
Change-Id: Icc9db01f201f54a78044d1c48e0883e098cfb5e5
Cq-Include-Trybots: luci.golang.try:x_sys-gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/sys/+/531176
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Bryan Mills <bcmills@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Than McIntosh <thanm@google.com >
2023-09-27 14:34:16 +00:00
Bryan C. Mills
01c413d3ff
windows: document the return type mismatch for CommandLineToArgv
...
For golang/go#63236 .
Change-Id: Id6c458e2ee2291e28685d24e86c05702d9fd132a
Cq-Include-Trybots: luci.golang.try:x_sys-gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/sys/+/531175
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Auto-Submit: Bryan Mills <bcmills@google.com >
Reviewed-by: Than McIntosh <thanm@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2023-09-26 17:41:44 +00:00
Bryan C. Mills
e6494535b9
windows: convert TestCommandLineRecomposition to a fuzz test and fix discrepancies
...
Notably, this fixes the escaping of the first argument when it
contains quoted spaces, and fixes a panic in DecomposeCommandLine
when it contains more than 8192 arguments.
Fixes golang/go#58817 .
For golang/go#17149 .
For golang/go#63236 .
Change-Id: Ib72913b8182998adc1420d73ee0f9dc017dfbf32
Reviewed-on: https://go-review.googlesource.com/c/sys/+/530275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Than McIntosh <thanm@google.com >
Auto-Submit: Bryan Mills <bcmills@google.com >
2023-09-26 17:41:41 +00:00
Ayman Bagabas
71c9d8730f
windows: add console ConPTY API
...
Add Windows ConPTY API, specifically CreatePseudoConsole, ClosePseudoConsole, and ResizePseudoConsole.
See https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
See https://learn.microsoft.com/en-us/windows/console/creating-a-pseudoconsole-session
Updates #62708
Change-Id: I433c4d9d8716dd75fa44291ab0cf6ef3c5f6a913
GitHub-Last-Rev: 21cda7e648
GitHub-Pull-Request: golang/sys#175
Reviewed-on: https://go-review.googlesource.com/c/sys/+/528915
Run-TryBot: Quim Muntal <quimmuntal@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Bryan Mills <bcmills@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Than McIntosh <thanm@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2023-09-26 16:33:30 +00:00
Kir Kolyshkin
fdc7ef4071
all: remove ioutil usage from tests
...
This removes the remaining (and trivial) use of deprecated ioutil
package from test files.
Replacements are easy:
ioutil.ReadAll -> io.ReadAll
ioutil.ReadDir -> os.ReadDir
ioutil.ReadFile -> os.ReadFile
ioutil.WriteFile -> os.WriteFile
While at it, simplify some error reporting.
Change-Id: I60a242fd3c08d8fe571a18f16716439a9acdd59d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/526299
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Heschi Kreinick <heschi@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
2023-09-12 16:41:27 +00:00
qmuntal
4848eb0479
windows,windows\svc,windows\svc\mgr: use unsafe.Slice instead of unsafeheader.Slice
...
unsafe.Slice is available since Go 1.17, which is already the minimum
version supported by this package.
This change removes the dependency on the internal unsafeheader package,
which can be removed from the module.
Change-Id: I6c34cb152f2336ea04c5f9c7e88797ed8914f9cc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/526635
Run-TryBot: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Bryan Mills <bcmills@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2023-09-08 18:06:11 +00:00
Kir Kolyshkin
0e97d69659
all: use t.TempDir in tests
...
This removes all usage of ioutil.TempDir in tests (and a few cases of
os.TempDir as well, while we're at it), which simplifies test cleanup a
lot.
Compile tested (go test -c) for most platforms (except zos).
Change-Id: I9178f5ec615c0a6cfef36e8de78c6b72e055b7cb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/526297
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: qiulaidongfeng <2645477756@qq.com >
Auto-Submit: Ian Lance Taylor <iant@golang.org >
2023-09-08 15:25:11 +00:00
Dmitri Shuralyov
81cb935067
unix, windows: use ^TestName$ regular pattern for invoking a single test
...
For reasons motivated in the commit message of CL 524948.
Change-Id: I0085411f30a77634962239ee36d15e7b6ef893ef
Reviewed-on: https://go-review.googlesource.com/c/sys/+/525618
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
2023-09-06 00:53:53 +00:00
Tobias Klauser
e8190d9965
windows: don't check non-existent return code in GetStartupInfo
...
Same as CL 520275 did in package syscall.
For golang/go#31316
Change-Id: Ie9d8fed7f40b9e562534d5e91488b4ba1ac44f34
Reviewed-on: https://go-review.googlesource.com/c/sys/+/520295
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
2023-08-17 16:34:40 +00:00
Mauri de Souza Meneguzzo
ad02017442
windows: use SyscallN in mkwinsyscall
...
The mkwinsyscall command has a hard limit of 15 on the
number of syscall arguments. Windows has several system
calls with more than 15 arguments, for example CreateFontPackage
has 18 arguments.
If the number of arguments is higher than 15 we use SyscallN.
Fixes golang/go#57914
Change-Id: I4205e779a960ae10c0778de7876154e0d7ec00a1
GitHub-Last-Rev: 1f1e96fab7
GitHub-Pull-Request: golang/sys#171
Reviewed-on: https://go-review.googlesource.com/c/sys/+/518995
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Run-TryBot: Ian Lance Taylor <iant@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
2023-08-17 16:18:12 +00:00
qmuntal
60ecf13377
windows: add TimeBeginPeriod and TimeEndPeriod syscalls
...
Updates golang/go#44343
Fixes golang/go#61723
Change-Id: I920f2fad6b3a2a9ba67ff2fafea4319644a0bc8c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/515915
Reviewed-by: qiulaidongfeng <2645477756@qq.com >
Run-TryBot: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
2023-08-07 06:21:27 +00:00
cui fliter
c406141231
all: fix some typos
...
Change-Id: Id4bf4ce8aee8b98baa2f1a9c62a72a9554f7d557
Reviewed-on: https://go-review.googlesource.com/c/sys/+/510595
TryBot-Result: Gopher Robot <gobot@golang.org >
Run-TryBot: Ian Lance Taylor <iant@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Run-TryBot: shuang cui <imcusg@gmail.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Heschi Kreinick <heschi@google.com >
2023-07-19 19:13:37 +00:00
cui fliter
706fa9866a
windows: remove repetitive words
...
Change-Id: I9c944eca6117b1039f0c5287706cb447b75c8cbd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/509835
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Heschi Kreinick <heschi@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Run-TryBot: Ian Lance Taylor <iant@google.com >
2023-07-17 14:37:11 +00:00
Heschi Kreinick
0a92922092
windows: make TestSystemModuleVersions more tolerant
...
One file can't be read on LUCI's Windows image:
syscall_windows_test.go:892: CimFS.SYS: The specified resource type cannot be found in the image file.
That doesn't seem like a good enough reason to fail the test. Skip the
file if this error is encountered.
Change-Id: Id9a65b3ff748bbf7ef7fac37d3741c16e001a4b0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/505220
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Carlos Amedee <carlos@golang.org >
Run-TryBot: Heschi Kreinick <heschi@google.com >
Auto-Submit: Heschi Kreinick <heschi@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
2023-06-27 15:54:37 +00:00
Craig Davison
2b751ddc66
windows/svc/mgr: add Service.RecoveryActionsOnNonCrashFailures
...
Fixes golang/go#59016
Change-Id: I5e16f61ea2fc384052565342c6517687562260a1
GitHub-Last-Rev: 3626b01fcf
GitHub-Pull-Request: golang/sys#157
Reviewed-on: https://go-review.googlesource.com/c/sys/+/484896
Run-TryBot: Bryan Mills <bcmills@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Bryan Mills <bcmills@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
2023-06-24 00:31:25 +00:00
Roman Mazur
c8ea6b0cbc
windows: fix EnumProcesses to pass the correct array size
...
Implementation generated directly with mkwinsyscall has a wrong
assumption about the expected value for PIDs buffer size.
This change adds some small manual code that converts the input
slice length to the number of bytes of the array backing the slice.
A test is also added. It fails with the previous implementation.
Fixes golang/go#60223
Change-Id: I5e2414acb29c6c949e5e6acd328043f8a8883887
Reviewed-on: https://go-review.googlesource.com/c/sys/+/495995
Commit-Queue: Quim Muntal <quimmuntal@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Bryan Mills <bcmills@google.com >
Run-TryBot: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Heschi Kreinick <heschi@google.com >
2023-05-19 20:19:27 +00:00
Bryan C. Mills
1911637744
windows/svc: use separate (and more descriptive) service names in tests
...
Notably, the DisplayName field was set to the same thing in both
sys.TestExample and mrg.TestMyService, which may explain the collision
reported in golang/go#59298 .
Moreover, the adjective ”my” conveys no information whatsoever — we
shouldn't use it in tests or examples.
Also skip the tests that install services if GO_BUILDER_NAME is not
set, to reduce the likelihood of 'go test all' in a user's working
directory being mistaken for a malicious or compromised program.
Fixes golang/go#59298 .
Change-Id: Ib00bf7400bfaa34e1a1d49125c43b97019b53c82
Reviewed-on: https://go-review.googlesource.com/c/sys/+/481015
Reviewed-by: Carlos Amedee <carlos@golang.org >
Run-TryBot: Bryan Mills <bcmills@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Auto-Submit: Bryan Mills <bcmills@google.com >
2023-05-04 17:52:42 +00:00
Bryan C. Mills
ca59edaa5a
windows: use unsafe.Add instead of pointer arithmetic on a uintptr
...
The existing uintptr arithmetic is arguably valid because the
environment block is not located within the Go heap
(see golang/go#58625 ).
However, unsafe.Add (added in Go 1.17) expresses the same logic with
fewer conversions, and in addition avoids triggering the unsafeptr
vet check.
For golang/go#41205 .
Change-Id: Ifc509279a13fd707be570908ec779d8518b4f75b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/492415
Reviewed-by: Ian Lance Taylor <iant@google.com >
Run-TryBot: Bryan Mills <bcmills@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Auto-Submit: Bryan Mills <bcmills@google.com >
2023-05-03 21:21:24 +00:00
Alex Brainman
6c5289959c
windows: return error if DecomposeCommandLine parameter contains NUL
...
DecomposeCommandLine is documented to use CommandLineToArgv, and the
CommandLineToArgvW system call inherently does not support strings with
internal NUL bytes. This CL changes DecomposeCommandLine to reject those
strings with an error instead of panicking.
Fixes golang/go#58817
Change-Id: I22a026bf2e69344a21f04849c50ba19b6e7b2007
Reviewed-on: https://go-review.googlesource.com/c/sys/+/487695
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
2023-04-25 08:07:06 +00:00
Craig Davison
9524d496ef
windows/svc/mgr: Service.Control: populate Status when returning certain errors
...
Fixes golang/go#59015
Change-Id: I45f22049f3a05f807f78d20c9ed67c6c79e3d3c1
GitHub-Last-Rev: 929aeb4acb
GitHub-Pull-Request: golang/sys#156
Reviewed-on: https://go-review.googlesource.com/c/sys/+/484895
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Bryan Mills <bcmills@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
2023-04-25 08:02:03 +00:00