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
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
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
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
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
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
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
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
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
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
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
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
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
Sebastian Soto
dbd8f99a5e
windows: add Service.ListDependentServices
...
This method allows a user to list all Windows services which are
dependent upon a given service.
This commit makes use of the EnumDependentServices Windows API call.
Without this, a user would have to iterate through each service on the
system, and check if the given service is listed in each service's
dependencies list.
The implementation of ListDependentServices is mostly the same as
Mgr.ListServices, as the API calls behave in the same way.
Fixes golang/go#56766
Change-Id: I9ec18c97afd02f48deef691ccdd5c26d6501add1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/451363
Reviewed-by: Than McIntosh <thanm@google.com >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Benny Siegert <bsiegert@gmail.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2023-04-14 09:16:30 +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
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
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
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
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
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
Jason A. Donenfeld
6e7872819d
windows/svc: allow querying service start reason
...
The QueryServiceDynamicInformation API makes it possible to determine
why a service started. This is declared as an optional function because
the API is Win8+.
Reference:
https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-queryservicedynamicinformation
Change-Id: I18e9a95b35f8c37d94c9900626c1785f425701dc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/358394
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-29 16:52:21 +00:00
Takuto Ikuta
c1bf0bb051
windows: regen zsyscall_windows.go
...
It seems mksyscall sorts Windows APIs bit differently now.
Change-Id: I2703b12addefbbac00ab06f62500bc7db2b8cba6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/359657
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
2021-10-29 16:29:42 +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
Jason A. Donenfeld
0ec99a608a
windows/svc: rewrite in Go
...
The old service management code was written in assembly and communicated
over Windows events, which resulted in non-obvious control flow.
NewCallback makes it possible to rewrite all of this in vanilla Go. This
also enables the service test on the Go builders, as modifying system
services shouldn't be an issue there.
Change-Id: I8003b57d11d4469f762058c648a4b7733530eeb8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/330010
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Trust: Brad Fitzpatrick <bradfitz@golang.org >
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 06:40:51 +00:00
Weilu Jia
d3039528d8
windows: add low level memory related syscalls
...
Adds VirtualQuery, VirtualQueryEx, VirtualProtectEx, ReadProcessMemory, and WriteProcessMemory.
VirtualProtect already exists.
https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualquery
https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualqueryex
https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualprotectex
https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-readprocessmemory
https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-writeprocessmemory
Change-Id: I609a09641c502d8d3802036123e0784b7c76e99b
GitHub-Last-Rev: 368f8c7b62
GitHub-Pull-Request: golang/sys#117
Reviewed-on: https://go-review.googlesource.com/c/sys/+/352249
Trust: Alex Brainman <alex.brainman@gmail.com >
Trust: Emmanuel Odeke <emmanuel@orijtech.com >
Trust: Benny Siegert <bsiegert@gmail.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-07 07:53:35 +00:00
Weilu Jia
92d5a993a6
windows: add process module related syscalls
...
Add EnumProcessModules, EnumProcessModulesEx, GetModuleInformation, GetModuleFileNameEx and GetModuleBaseName.
https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-enumprocessmodules
https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-enumprocessmodulesex
https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-getmoduleinformation
https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-getmodulefilenameexw
https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-getmodulebasenamew
Change-Id: I75b062daec7a2cc9685e803dfa851825acee32b6
GitHub-Last-Rev: 7c208d6d3e
GitHub-Pull-Request: golang/sys#116
Reviewed-on: https://go-review.googlesource.com/c/sys/+/350870
Trust: Alex Brainman <alex.brainman@gmail.com >
Trust: Minux Ma <minux@golang.org >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2021-09-25 03:26:02 +00:00
David Crawshaw
44f02d92fd
windows: add WTSGetActiveConsoleSessionId
...
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-wtsgetactiveconsolesessionid
Change-Id: I3c180bbb3a768beac6633e78514fac4e3837b69d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/331909
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Trust: Brad Fitzpatrick <bradfitz@golang.org >
Trust: Dmitri Shuralyov <dmitshur@golang.org >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
2021-08-19 07:20:04 +00:00
Jason A. Donenfeld
7ecdf8ef09
windows: change CreateProcessAsUser from kernel32 to advapi32
...
While kernel32.dll works as a target, the documentation says advapi32,
so go with that to be safe:
https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessasuserw
Change-Id: I8e4a3693dad3759c3a094fa2476b89fb3d38b6bd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/323789
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Trust: Alex Brainman <alex.brainman@gmail.com >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2021-06-01 08:02:50 +00:00
Jason A. Donenfeld
35b2ab0089
windows: add CreateProcessAsUser
...
The syscall package already has this, but this one does not, so add this
simple companion to CreateProcess.
Change-Id: I8533f91245630dcf39705ae56a22c1217871f968
Reviewed-on: https://go-review.googlesource.com/c/sys/+/322489
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Trust: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-05-25 14:32:21 +00:00
Jason A. Donenfeld
94ec62e081
windows: add SetNamedPipeHandleState
...
I added GetNamedPipeHandleState before but forgot the setter function,
which winds up being useful for namedpipe's tests.
Change-Id: Iefeabb2ac9584ec15e18e2ae7e4a72fbb46cbe7c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/299209
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-03-09 04:02:21 +00:00
Jason A. Donenfeld
8fe3ee5dd7
windows: return ERROR_ALREADY_EXIST for non-nil handle in Create* functions
...
These functions sometimes return a non-nil value, while indicating
ERROR_ALREADY_EXISTS through GetLastError. In this case, return the
error along with the handle, to indicate the case.
Fixes golang/go#44539 .
Change-Id: Id18e64724e57f62a34d6562511d9eafa8e6f9a3e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/297332
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2021-03-05 23:01:14 +00:00
Jason A. Donenfeld
5cdee2b1b5
windows: correct NT definitions and add more resolution
...
Alex pointed out that some of these original types were incomplete, so
this commit fills things out a bit more. We also add more to the test
case.
Change-Id: Iff7bd9ea6e0d021ba997c6d7351fe7c4a46187a9
Reviewed-on: https://go-review.googlesource.com/c/sys/+/299189
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-03-05 21:54:15 +00:00
Jason A. Donenfeld
61f932b4c6
windows: add QueryFullProcessImageName
...
This will be useful for reworking the IsWindowsService function in
svc/.
Change-Id: Ie1f7a560d7e81ee4ac3055e04748b6f9c8234edb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/298829
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-03-05 03:01:59 +00:00