database64128
ea436ef09d
windows: add iphlpapi routing functions
...
NotifyRouteChange2 registers to be notified for changes to IP route
entries. Call GetIpForwardEntry2 on received row to retrieve complete
information.
GetIpForwardTable2 retrieves the full routing table.
FreeMibTable frees the buffer allocated by the functions that return
tables of network interfaces, addresses, and routes.
Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/695195
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-10-21 11:10:28 -07:00
qmuntal
5e63aa5e0f
windows: export O_FILE_FLAG_* to be used in os.OpenFile on windows
...
These file flags are supported by os.OpenFile since CL 699415.
Closes golang/go#73676
Change-Id: Iaf846c9cb98c1458bbc30d05ad8a331ef1f332df
Reviewed-on: https://go-review.googlesource.com/c/sys/+/700975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Damien Neil <dneil@google.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
2025-09-26 11:36:48 -07:00
Ayman Bagabas
6be6c584a2
windows: add FlushConsoleInputBuffer and GetNumberOfConsoleInputEvents
...
This adds syscall wrappers for FlushConsoleInputBuffer and GetNumberOfConsoleInputEvents on Windows.
Change-Id: I2365aebc42a57f83cfc951e10520270e1f3e0606
GitHub-Last-Rev: 1f711a5f3c
GitHub-Pull-Request: golang/sys#264
Reviewed-on: https://go-review.googlesource.com/c/sys/+/704715
Reviewed-by: Mark Freeman <markfreeman@google.com >
Auto-Submit: Sean Liao <sean@liao.dev >
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 >
2025-09-18 15:33:41 -07:00
Thomas Gibson-Robinson
b06ce0514e
windows: add FILE_ZERO_DATA_INFORMATION
...
This is needed for invoking windows.DeviceIoControl with
windows.FSCTL_SET_ZERO_DATA.
Change-Id: I20f93a40a86b92e6bdeeec096ffc0245e8184672
GitHub-Last-Rev: 01d299ab84
GitHub-Pull-Request: golang/sys#261
Reviewed-on: https://go-review.googlesource.com/c/sys/+/698436
Auto-Submit: Michael Pratt <mpratt@google.com >
Reviewed-by: 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: Cherry Mui <cherryyz@google.com >
2025-09-05 08:44:06 -07:00
mertakman
899c23279d
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: Iaf01c7bddd7ad6a80ee462879e382b0066f35b4d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/691715
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Sean Liao <sean@liao.dev >
Reviewed-by: Carlos Amedee <carlos@golang.org >
Reviewed-by: David Chase <drchase@google.com >
2025-08-22 12:22:44 -07:00
qmuntal
3d9a6b8079
windows: add WSADuplicateSocket
...
WSADuplicateSocket is useful to pass sockets between processes on
Windows.
For golang/go#10350 .
Change-Id: I6563184fe4d4477d402a6af81b254bd8aa992d2e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/668215
Reviewed-by: Damien Neil <dneil@google.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Carlos Amedee <carlos@golang.org >
2025-05-02 09:05:10 -07:00
Ayman Bagabas
8e9e04625d
windows: add virtual key codes and console input consts
...
This adds console input related key codes and consts
Change-Id: I8ebd76995a2c9ddd150cf04890a9e5053841fcab
GitHub-Last-Rev: 8e534f4589
GitHub-Pull-Request: golang/sys#226
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621495
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Auto-Submit: Michael Pratt <mpratt@google.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-04-22 10:17:31 -07:00
Keith Randall
7138967c19
windows: fix slicing of NTUnicodeString values
...
We were slicing using a count of bytes, not a count of uint16s.
Fixes golang/go#73460
Change-Id: If0fd19e795078c01fda5b976e3c34af115b25dcc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/667235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Auto-Submit: Keith Randall <khr@google.com >
Reviewed-by: Keith Randall <khr@google.com >
2025-04-22 08:26:09 -07:00
thepudds
6a85559a3f
windows: fix dangling pointers in (*SECURITY_DESCRIPTOR).ToAbsolute
...
Prior to this CL, a byte slice was allocated via make to use as the
absoluteSD argument passed to the Windows API MakeAbsoluteSD.
MakeAbsoluteSD then sets pointers outside the view of the GC, including
pointers within absoluteSD that point to other chunks of memory
we pass into MakeAbsoluteSD.
CL 653856 recently allowed more make results to be stack allocated,
which worsened the problems here and made it easier for those
pointers in absoluteSD to become dangling pointers, though the
core problems here existed before.
This CL instead allocates absoluteSD as a proper SECURITY_DESCRIPTOR
struct so that the GC can be aware of its pointers. We also verify the
pointers are as we expect, and then set them explicitly
in view of the GC.
Updates golang/go#73199
Change-Id: Id8038d38a887bb8ff3ffc6eae603589b97e92cdc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/663355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Keith Randall <khr@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
Reviewed-by: Keith Randall <khr@golang.org >
2025-04-09 11:19:55 -07:00
Douglas Danger Manley
1b2bd6bb49
windows: replace all StringToUTF16 calls with UTF16FromString
...
`StringToUTF16` is deprecated and will panic if given an "invalid"
string (in particular, one that has a null byte in it). The replacement
function is `UTF16FromString`, and it returns an error if there was
a problem.
This change replaces all uses of `StringToUTF16` with `UTF16FromString`.
The `service` struct now no longer stores a `string` name but rather
a `*uint16` pointer to the name.
It should not be possible to panic due to UTF16 string conversion
at this point.
Fixes golang/go#73006
Change-Id: Idce9cdbb4651fef8481f0cad19b5df0314fd4277
Reviewed-on: https://go-review.googlesource.com/c/sys/+/659936
Reviewed-by: Carlos Amedee <carlos@golang.org >
Auto-Submit: Carlos Amedee <carlos@golang.org >
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 >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2025-04-02 11:32:38 -07:00
database64128
c175b6ba67
windows: add cmsghdr and pktinfo structures
...
- CMSGHDR from ws2def.h, corresponds to Cmsghdr in unix
- IN_PKTINFO from ws2ipdef.h, corresponds to InetPktinfo in unix
- IN6_PKTINFO from ws2ipdef.h, corresponds to Inet6Pktinfo in unix
Change-Id: I74f6812588859c3a6080e6675df28998fc435965
GitHub-Last-Rev: 7377c793c6
GitHub-Pull-Request: golang/sys#246
Reviewed-on: https://go-review.googlesource.com/c/sys/+/658175
Reviewed-by: Cherry Mui <cherryyz@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 >
2025-03-26 01:10:13 -07:00
database64128
f2ce62c21a
windows: add constants for PMTUD socket options
...
Related documentation:
- https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options
- https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
Change-Id: I21b23ca815d1d8135ce5724115b9ca23819ea10a
GitHub-Last-Rev: 9054c5c790
GitHub-Pull-Request: golang/sys#245
Reviewed-on: https://go-review.googlesource.com/c/sys/+/654495
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
2025-03-05 07:56:48 -08:00
Sebastiaan van Stijn
d4ac05dc8c
windows: update NewLazyDLL, LoadDLL docs to point to NewLazySystemDLL
...
Point users to the NewLazySystemDLL utility that was added in CL 21592.
Change-Id: I5fddd927fe6628f06a6266b225949c4227fb79f1
GitHub-Last-Rev: 1fe36ed335
GitHub-Pull-Request: golang/sys#240
Reviewed-on: https://go-review.googlesource.com/c/sys/+/638715
Reviewed-by: Jorropo <jorropo.pgm@gmail.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Auto-Submit: Jorropo <jorropo.pgm@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
2024-12-26 08:00:01 -08:00
Sebastiaan van Stijn
680bd24a5f
windows: remove unused errString type
...
It's no longer used since CL 165759.
Change-Id: Ie8c834a6dd1147889ec47bf92a5d4cce08bbf4fd
GitHub-Last-Rev: 3f0c460db1
GitHub-Pull-Request: golang/sys#241
Reviewed-on: https://go-review.googlesource.com/c/sys/+/638716
Reviewed-by: Ian Lance Taylor <iant@google.com >
Auto-Submit: Jorropo <jorropo.pgm@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Jorropo <jorropo.pgm@gmail.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
2024-12-26 07:58:30 -08:00
MOHAN KUMAR R
d2cea7095f
windows: add functions to get named pipe process IDs
...
Fixes https://github.com/golang/go/issues/70086
Change-Id: I0cd188f075490b1ea630b26b74aa201796d60d3a
GitHub-Last-Rev: 498fe730f2
GitHub-Pull-Request: golang/sys#235
Reviewed-on: https://go-review.googlesource.com/c/sys/+/626215
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
2024-11-13 05:11:24 +00:00
MOHAN KUMAR R
a13946c675
windows: regenerate zsyscall_windows.go
...
Change-Id: I714d13f534520a444dd9601d280d32c4427a8e69
GitHub-Last-Rev: 861daf25d8
GitHub-Pull-Request: golang/sys#236
Reviewed-on: https://go-review.googlesource.com/c/sys/+/626379
Commit-Queue: Ian Lance Taylor <iant@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2024-11-12 17:28:48 +00:00
Quim Muntal
e0753d4694
Revert "windows/mkwinsyscall: use syscall.SyscallN instead of syscall.Syscall{6,9,12,15}"
...
This reverts CL 614082.
Reason for revert: syscall.SyscallN allocates more than its syscall.SyscallX counterparts, producing perf-related test failures across the board.
Updates #70197
Change-Id: I51107d909fcdbef4e65ee3f84932b2a0e7804f1b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/625375
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 >
2024-11-05 15:28:52 +00:00
database64128
c29efe38de
windows: add iphlpapi functions for change notifications
...
The NotifyIpInterfaceChange and NotifyUnicastIpAddressChange functions
register a user-defined callback function for receiving network
interface and IP address change notifications. The GetIfEntry2Ex and
GetUnicastIpAddressEntry functions can be called to retrieve complete
information about the changed interface or address.
The CancelMibChangeNotify2 function deregisters for change
notifications.
Change-Id: Iee29405ffa135c6aa0120f9aa046e3706e2bac47
GitHub-Last-Rev: a8309cd81a
GitHub-Pull-Request: golang/sys#211
Reviewed-on: https://go-review.googlesource.com/c/sys/+/603755
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: David Chase <drchase@google.com >
2024-11-05 07:10:30 +00:00
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