Alex Brainman
f11c7bb268
windows: add IsProcessorFeaturePresent and processor feature consts
...
For golang/go#76791
Change-Id: I1594c4868262c78d40e1ebd883a01a71236e4981
Reviewed-on: https://go-review.googlesource.com/c/sys/+/740500
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2026-01-31 15:25:24 -08:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Tobias Klauser
c10701f35e
windows: use unsafe.Slice in (*RawSockaddrAny).Sockaddr on windows
...
Same as CL 472035 did in package syscall.
Change-Id: I153dfaa19933a2707848e4183d6ca704c2800a0e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/472016
Reviewed-by: Ian Lance Taylor <iant@google.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
2023-02-28 18:47:45 +00:00
PumpkinSeed
4fee21c923
windows: Add WSALookupService syscall wrappers
...
Create WSAQUERYSET struct, add LUP_XX constants,
implement wrappers around WSALookupService functions.
Fixes golang/go#54232
Change-Id: I26624df1b2b44cd8750350fe4526b806513913fe
Reviewed-on: https://go-review.googlesource.com/c/sys/+/461296
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Auto-Submit: Bryan Mills <bcmills@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Bryan Mills <bcmills@google.com >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Than McIntosh <thanm@google.com >
2023-02-08 14:13:08 +00:00
qmuntal
a6f4650873
windows: use UTF16FromString and UTF16ToString from syscall
...
This CL updates the windows.UTF16FromString and windows.UTF16ToString
implementation so they forward to their syscall counterparts.
The standard library uses these particular syscall functions across
the board as it can't depend on x/sys. This means that even if the
syscall API is frozen, the implementation still receives improvements
and bug fixes, such as CL 425054.
Porting CL 425054 to x/sys is possible, but for this particular case
I think it's better to just call the syscall package. This way both
repos will benefit from future improvements (which I plan to do soon).
Change-Id: I305c4409142d79a57008d7e6d0717fb8986fe906
Reviewed-on: https://go-review.googlesource.com/c/sys/+/462875
Run-TryBot: Ian Lance Taylor <iant@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Run-TryBot: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Bryan Mills <bcmills@google.com >
2023-01-20 18:56:19 +00:00
Johan Jansson
3ca3b18c8b
windows: add GetLargePageMinimum
...
https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-getlargepageminimum
Fixes golang/go#53900
Change-Id: If460e926af0cfa3fcf0d01422411abd01dae791c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/444975
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Jenny Rakoczy <jenny@golang.org >
Reviewed-by: Cherry Mui <cherryyz@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2022-12-03 00:43:30 +00:00
Sebastiaan van Stijn
abe0a0adba
windows: replace uses of Close() with CloseHandle()
...
Since https://golang.org/cl/4600042 , Close is a straight wrapper of CloseHandle.
Change-Id: I45067e3cc649ea40deb88a8d9d223d7ca882ee7f
GitHub-Last-Rev: 076621a25c
GitHub-Pull-Request: golang/sys#139
Reviewed-on: https://go-review.googlesource.com/c/sys/+/441436
TryBot-Result: Gopher Robot <gobot@golang.org >
Run-TryBot: Ian Lance Taylor <iant@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Bryan Mills <bcmills@google.com >
2022-10-10 16:03:19 +00:00
Tobias Klauser
6fa7a7ca2b
windows: allow calling WSASendto with nil Sockaddr
...
Same as CL 434535 did for the syscall package.
For golang/go#55845
Change-Id: I17f30152ae973b64ac65e08cefd5442e9bf19e2c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/435777
TryBot-Result: Gopher Robot <gobot@golang.org >
Run-TryBot: Benny Siegert <bsiegert@gmail.com >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Benny Siegert <bsiegert@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2022-09-28 14:00:15 +00:00
Michael Lelli
fb04ddd9f9
windows: add DWM window attribute related syscalls
...
https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmgetwindowattribute
https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute
Change-Id: I96a68f91f745601e93c0cc21cc4f1f4c5e7d8b9e
GitHub-Last-Rev: bdbe2ccb22
GitHub-Pull-Request: golang/sys#123
Reviewed-on: https://go-review.googlesource.com/c/sys/+/399135
Reviewed-by: Bryan Mills <bcmills@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Benny Siegert <bsiegert@gmail.com >
Run-TryBot: Benny Siegert <bsiegert@gmail.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2022-09-19 09:18:48 +00:00
Tobias Klauser
76c7481b51
all: simplify unsafe.Slice usage in {Byte,UTF16}PtrToString
...
On windows, use unsafe.Slice instead of unsafeheader as already the case
for unix and plan9.
The pointers are already *byte/*uint16, so the type conversion can be
omitted as well.
Change-Id: Ida7264cc0c1948bf563ed91d51e637edcdafb77a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/430515
Reviewed-by: Ian Lance Taylor <iant@google.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Bryan Mills <bcmills@google.com >
2022-09-13 15:31:01 +00:00
Michael Lelli
3275c407ce
windows: add window handle related system calls
...
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumwindows
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumchildwindows
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getclassnamew
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdesktopwindow
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getforegroundwindow
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-iswindow
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-iswindowunicode
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-iswindowvisible
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getguithreadinfo
Change-Id: I21fbf47e1f459e86503e0e876b44cf47c98b2aa0
GitHub-Last-Rev: 242b79ffb8
GitHub-Pull-Request: golang/sys#122
Reviewed-on: https://go-review.googlesource.com/c/sys/+/399134
Auto-Submit: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Benny Siegert <bsiegert@gmail.com >
Reviewed-by: Than McIntosh <thanm@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
2022-09-13 12:03:20 +00:00
PumpkinSeed
66a0560e4e
windows: support Windows SOCKADDR_BTH structure
...
Implements the Windows SOCKADDR_BTH structure so
it can be used as a parameter in windows.Connect.
Fixes : golang/go#53929
Change-Id: Ibe54071897b60ecd91f44c7c0c894d831e56fe56
Reviewed-on: https://go-review.googlesource.com/c/sys/+/419394
Reviewed-by: Than McIntosh <thanm@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
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: Alex Brainman <alex.brainman@gmail.com >
2022-07-31 17:38:59 +00:00
awaw fumin
1609e554cd
windows: add QueryWorkingSetEx
...
This change adds the QueryWorkingSetEx function for inspecting
the virtual memory details of pointers.
https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-queryworkingsetex
Change-Id: I2bc92bb0b65d34ed1caf88e4d368d64946dfcc5c
GitHub-Last-Rev: c5ac004352
GitHub-Pull-Request: golang/sys#124
Reviewed-on: https://go-review.googlesource.com/c/sys/+/402494
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Than McIntosh <thanm@google.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2022-07-30 10:01:32 +00:00
Dan Kortschak
179beb0bd1
windows: add GetBestInterfaceEx
...
Change-Id: I56f9212420f96a0f275e79b4a9766b09b175254d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/413495
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Damien Neil <dneil@google.com >
Run-TryBot: Dan Kortschak <dan@kortschak.io >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2022-07-01 22:57:01 +00:00
Aayush Agrawal
84afa8d3f7
windows: do not change stdio handle inheritance
...
This CL stops changing inheritance flag of stdint, stdout and stderr handles.
Fixes golang/go#52498
Change-Id: Ic786f660b457af99a0a975b357c35c36bc7f2b48
Reviewed-on: https://go-review.googlesource.com/c/sys/+/402714
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Than McIntosh <thanm@google.com >
Reviewed-by: Peter Weinberger <pjw@google.com >
Run-TryBot: Than McIntosh <thanm@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
2022-04-29 12:10:18 +00:00
Tobias Klauser
2edf467146
windows: optimize UTF16{,Ptr}FromString
...
Use strings.IndexByte in UTF16FromString instead of an open-coded loop.
Change-Id: Iac4374d9a58e40659147d35c9ab21bb89f5da629
Reviewed-on: https://go-review.googlesource.com/c/sys/+/393594
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2022-03-18 05:55:25 +00:00
Tobias Klauser
27bbf83dae
windows: add race annotations to Windows ReadFile and WriteFile
...
Follow CL 392774 which changed Windows ReadFile and WriteFile in package
syscall.
For golang/go#51618
Change-Id: I0f8046adb0f8145bd0775a3b5399647897cf19ce
Reviewed-on: https://go-review.googlesource.com/c/sys/+/392814
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2022-03-15 18:05:22 +00:00
Tobias Klauser
5a964db013
windows: add Get{Active,Maximum}ProcesorCount
...
Reference:
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getactiveprocessorcount
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getmaximumprocessorcount
Change-Id: Ifca711b82f112b395eac3b96266f63b5623881fc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/374435
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Patrik Nyblom <pnyb@google.com >
Trust: Patrik Nyblom <pnyb@google.com >
Run-TryBot: Patrik Nyblom <pnyb@google.com >
2022-01-11 09:28:08 +00:00
Tobias Klauser
94396e4217
windows: add ModuleEntry32 type and Module32{First,Next} wrappers
...
Reference:
https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/ns-tlhelp32-moduleentry32w
https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-module32firstw
https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-module32nextw
Change-Id: I5455cabdbaa8e7e25490f869ca349e3c6f67a0cf
Reviewed-on: https://go-review.googlesource.com/c/sys/+/369174
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Trust: Patrik Nyblom <pnyb@google.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Patrik Nyblom <pnyb@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Patrik Nyblom <pnyb@google.com >
2021-12-04 12:00:58 +00:00
Jason A. Donenfeld
fe61309f88
windows: add SetupAPI and CfgMgr32 functions
...
Simon and I have worked on these on and off for a number of projects
over the last 3 years and by now it's quite stable and mature. Rather
than carrying this around privately, these have now been updated to be
in the style of x/sys/windows, in this case matching how the
security_windows.go file does things. Specifically, because these APIs
are kind of hard to work with, and quite lengthy, we split them off into
a setupapi_windows.go file, just like security_windows.go. We already
had the setupapierrors_windows.go file, so that's been folded into the
new one that contains the additional definitions nad functions.
These APIs are among the most obtuse to work with in all of Win32, so
considerable attention has been spent trying to make these wrappers both
quite "raw" so that they match the win32, but also accessible from Go.
The fact that they're so old in Windows history makes for a few tricky
things, like struct padding that doesn't quite match Go's rules, but
we've been able to accommodate basically everything after quite a bit of
work.
Change-Id: I0c2dd85e4bb40eee10186ffc92558a858bdf8c6a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/366654
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Trust: Patrik Nyblom <pnyb@google.com >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Simon Rozman <simon@rozman.si >
Reviewed-by: Patrik Nyblom <pnyb@google.com >
2021-11-24 21:15:45 +00:00
Tobias Klauser
c75c47738b
unix, windows: copy arrays by assignment instead of looping
...
Follow CL 360602 which did the same in package syscall.
Change-Id: Ibf6d86dea1cb118e869618c66da72da281adb2d7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/361574
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-11-05 18:34:46 +00:00
Hao Mou
d6a326fbbf
windows: add NtSetInformationFile
...
Added NtSetInformationFile and some const values related to it.
The doc for the function and the values of the file information class
can be found here:
https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-ntsetinformationfile
The values of the flags in the individual FILE_INFORMATION_CLASS can be
found here:
FILE_RENAME_INFORMATION - https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_rename_information
FILE_DISPOSITION_INFORMATION_EX - https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_disposition_information_ex
FILE_CASE_SENSITIVE_INFORMATION - https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_case_sensitive_information
FILE_LINK_INFORMATION - https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_link_information
The other file information classes do not have flag values.
Fixes golang/go#48933
Change-Id: I917ff4c8df132f8584fd6d924cf5a9626a065092
Reviewed-on: https://go-review.googlesource.com/c/sys/+/355495
Trust: Alex Brainman <alex.brainman@gmail.com >
Trust: Emmanuel Odeke <emmanuel@orijtech.com >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2021-10-23 08:55:30 +00:00
Jason A. Donenfeld
9d61738499
windows: add dynamic exception function table manipulators
...
These are useful for loading new code into the address space at runtime
and having exceptions be handled.
https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-rtladdfunctiontable
https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-rtldeletefunctiontable
Change-Id: I4fce4d7003d87cf48486d6e09d8543c2f1325554
Reviewed-on: https://go-review.googlesource.com/c/sys/+/357409
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-10-20 17:42:00 +00:00
Jason A. Donenfeld
153b154469
windows: add system info and version related functions
...
This adds various version and system info functions and adds a test that
prints the version of all installed drivers.
Change-Id: I73a2b0a35dcedf88206979ec6f1a56552dc80899
Reviewed-on: https://go-review.googlesource.com/c/sys/+/357149
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Trust: Brad Fitzpatrick <bradfitz@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-10-20 17:18:05 +00:00