Commit Graph

363 Commits

Author SHA1 Message Date
Jason A. Donenfeld
ea59177f1c wintun: Introduce new package for obscuring Windows bits 2019-02-07 04:39:59 +01:00
Jason A. Donenfeld
306d08e692 tun_windows: Style 2019-02-07 04:08:05 +01:00
Jason A. Donenfeld
3b7a4fa3ef setupapi: Lower case params 2019-02-07 03:46:31 +01:00
Jason A. Donenfeld
223685875f setupapi: Do not export the toGo/toWindows functions 2019-02-07 02:56:31 +01:00
Jason A. Donenfeld
652158ec3c setupapi: Pass pointers instead of values 2019-02-07 02:37:19 +01:00
Simon Rozman
cb2bc4b34c tun_windows: Introduce preliminary TUN interface creation
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 22:30:14 +01:00
Simon Rozman
46279ad0f9 tun_windows: Stop checking minimum size of received TUN packets
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 20:22:04 +01:00
Simon Rozman
73df1c0871 setupapi: Add DrvInfoDetailData.IsCompatible() to simplify HID detection
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 20:18:44 +01:00
Simon Rozman
069016bbc4 setupapi: Add SP_DRVINFO_DATA.IsNewer() method to simplify comparison
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 20:17:47 +01:00
Simon Rozman
3c29434a79 setupapi: Make toUTF16() public and add UTF16ToBuf() counterpart
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 20:15:40 +01:00
Jason A. Donenfeld
c599bf9497 Fix up errors and paths 2019-02-05 22:06:25 +09:00
Jason A. Donenfeld
f7f63765d1 conn: close ipv4 socket when ipv6 socket fails 2019-02-05 21:55:33 +09:00
Simon Rozman
3e8f2e3fa5 setupapi: Add support for driver info lists
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 16:29:17 +01:00
Simon Rozman
7b636380e5 setupapi: Move Go<>Windows struct marshaling to types_windows.go
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 14:03:28 +01:00
Simon Rozman
99a3b628e9 setupapi: Add support for SetupDi(Get|Set)DeviceRegistryProperty()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
e7ffce0d21 setupapi: Introduce DevInfo methods for cleaner code
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
35f72239ac Add support for setupapi.SetupDi(Get|Set)SelectedDevice()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
c15cbefc12 Reorder data-types and functions to match SetupAPI.h
Adding functions with non-consistent order made setupapi package a mess.
While we could reorder data-types and functions by alphabet - it would
make searching easier - it would put ...Get... and ...Set... functions
quite apart.

Therefore, the SetupAPI.h order was adopted.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
dd998ca86a Add support for setupapi.SetupDiCreateDeviceInfo()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
024a4916c2 Add support for setupapi.setupDiCreateDeviceInfoListEx()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
963be8e993 Stop accessing SetupDiGetDeviceInfoListDetail() output on error
The data returned by SetupDiGetDeviceInfoListDetail() is nil on error
which will cause the test to crash should the function fail.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
e821cdabd2 Unify certain variable names
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
38c7acd70f Simplify SetupDiEnumDeviceInfo() synopsis
The SetupDiEnumDeviceInfo() now returns a SP_DEVINFO_DATA rather than
taking it on input to fill it on return.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
20f1512b7c Change generic local variable names with meaningful replacements
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
348b4e9f7c Add support for setupapi.SetupDiClassGuidsFromNameEx()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
f81882ee8b Clean an unused constant
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
3e0e61dd26 Replace SetupDiClassNameFromGuid() with SetupDiClassNameFromGuidEx()
The former is only a subset of the later. To minimize future
maintenance, we'll provide support for extended version only.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
9635a0b3a6 Add support for setupapi.SetupDiClassNameFromGuid()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
90b6938ca0 Stop checking for valid handle in DevInfo.Close()
User should not have called or deferred the Close() method should
SetupDiGetClassDevsEx() return an error (and invalid handle). And even
if user does that, a SetupDiDestroyDeviceInfoList(INVALID_HANDLE_VALUE)
is harmless. It just returns ERROR_INVALID_HANDLE - we have a unit test
for this in TestSetupDiDestroyDeviceInfoList().

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
269944002f Add support for setupapi.SetupDiCallClassInstaller()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
a5a1ece32f Add support for setupapi.SetupDi(Get|Set)ClassInstallParams()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
f1d5db6547 Add support for setupapi.SetupDi(Get|Set)DeviceInstallParams()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
dce5192d86 Add support for setupapi.SetupDiOpenDevRegKey()
Furthermore setupapi.DevInfoData has been obsoleted.
SetupDiEnumDeviceInfo() fills existing SP_DEVINFO_DATA structure now.
As other functions of SetupAPI use SP_DEVINFO_DATA, converting it to
DevInfoData and back would hurt performance.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
955d8dfe04 Add support for setupapi.SetupDiEnumDeviceInfo()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
25e18d01e6 Update exported types and functions annotations
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
45959c116a Add support for setupapi.SetupDiGetDeviceInfoListDetail()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
d41bc015cc Finish support for setupapi.SetupDiGetClassDevsEx()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman
31949136df Introduce SetupAPI - Windows device and driver management API
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
6f76edd045 Import windows scafolding 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
3af9aa88a3 noise: store clamped key instead of raw key 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
a5ca02d79a tai64n: whiten nano seconds
Avoid being too precise of a time oracle.
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
2b7562abbb uapi: Simpler function signature 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
89d2c5ed7a Extend structs rather than embed, when possible 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
dff424baf8 Update copyright 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
6e61c369e8 Properly bubble up setsockopt error from closure 2018-12-25 22:56:36 +01:00
Jason A. Donenfeld
8fde8334dc version: bump snapshot 2018-12-22 17:34:23 +01:00
Jason A. Donenfeld
a8326ae753 Make error messages consistent 2018-12-19 00:35:53 +01:00
Jason A. Donenfeld
05cc0c8298 Freebsd is finally normal in sys/unix 2018-12-11 18:33:13 +01:00
Jason A. Donenfeld
c967f15e44 Separate out mark setting for Windows 2018-12-11 18:29:46 +01:00
Jason A. Donenfeld
5ace0fdfe2 Use upstream's xchacha20poly1305 2018-12-10 04:23:17 +01:00