aboutsummaryrefslogtreecommitdiffstats
path: root/api (follow)
Commit message (Collapse)AuthorAgeFilesLines
* api: simplify logger macros namesSimon Rozman2020-10-306-143/+143
| | | | | | | | | | | WINTUN_LOGGER_... => LOGGER_... => LOG_... Those macros are internal, so they don/t need to start with WINTUN_... Replacing the noun LOGGER_... with the verb LOG_... makes the code more natural to read now. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: implement driver version extraction from .inf fileSimon Rozman2020-10-302-23/+175
| | | | | | | | | | | | | With installer.dll the installer did the decision whether to install or upgrade the driver according to installer.dll version and hash stored in registry by MSM. With wintun.dll we need to know, which version of Wintun driver we are packing in the resources to decide about driver upgrade. The most accurate source of the driver version is the DriverVer directive in [Version] section of the driver's .inf file. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: disable driver management for wintun.dll that don't have a driverSimon Rozman2020-10-302-96/+102
| | | | | | | Namely the 32-bit ARM platform, which we will ship wintun.dll for ARM on ARM64 clients exclusively. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: unify and document resource loadingSimon Rozman2020-10-303-30/+54
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: unify hardware ID stringSimon Rozman2020-10-303-10/+6
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: unify callback function type namesSimon Rozman2020-10-302-3/+3
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add driver managementSimon Rozman2020-10-308-1/+659
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: introduce loggingSimon Rozman2020-10-3012-217/+502
| | | | | | And other unifications with installer before merging. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: split api.hSimon Rozman2020-10-308-116/+172
| | | | | | As the project grew, api.h got bloated. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: revise str/memcpySimon Rozman2020-10-301-3/+3
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: make adapter name searching more efficientSimon Rozman2020-10-301-4/+7
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: honor locale when comparing case-insensitiveSimon Rozman2020-10-304-3/+26
| | | | | | | | | Quote from MSDN: > You will need to call setlocale for _wcsicmp to work with Latin 1 > characters. The C locale is in effect by default, so, for example, ä > will not compare equal to Ä. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: fix trailing number detection in RemoveNumberedSuffix()Simon Rozman2020-10-301-1/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add support for WoW64Simon Rozman2020-10-303-0/+94
| | | | | | | | Some functions of SetupAPI only work when invoked from a native process. Registry and filesystem reflection makes them fail on WoW64. For WoW64 processes, a minimum set of rundll32 functions are provided. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: tighten source code annotationSimon Rozman2020-10-302-4/+7
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: update documentationSimon Rozman2020-10-303-99/+106
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: simplify workflowSimon Rozman2020-10-301-54/+32
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: revise and unify error codesSimon Rozman2020-10-301-7/+7
| | | | | | | | | | | | | | | GetDevInfoData: Some functions returned ERROR_OBJECT_NOT_FOUND, others ERROR_FILE_NOT_FOUND when the needle was not found in the haystack. GetTcpipInterfaceRegPath: When IpConfig is an empty REG_MULTI_SZ, it is actually ERROR_INVALID_DATA - like other unexpected registry values - rather than a misleading ERROR_NETWORK_NOT_AVAILABLE. Failure in TakeNameMutex result in ERROR_INVALID_HANDLE rather than the ERROR_GEN_FAILURE with a misleading message: "A device attached to the system is not functioning." Signed-off-by: Simon Rozman <simon@rozman.si>
* api: tighten maximum registry key path lengthSimon Rozman2020-10-303-15/+19
| | | | | | | Maximum registry key path length is not 260 (MAX_PATH), but 255 (256 incl. zero terminator). Signed-off-by: Simon Rozman <simon@rozman.si>
* api: fix SPDRP_DEVICEDESC zero-terminationSimon Rozman2020-10-301-1/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: do the set-quiet-install laterSimon Rozman2020-10-301-8/+4
| | | | | | | Rather than setting the "quiet" flag to each and every device in the process of iterating, set it when actually creating/deleting it. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: cleanupSimon Rozman2020-10-306-280/+293
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add pre-compiled header supportSimon Rozman2020-10-309-14/+40
| | | | | | ...for super-fast compilation. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: rename WINSTATUS to WINTUN_STATUSSimon Rozman2020-10-305-52/+52
| | | | | | ...to reduce name collision probability. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: finish porting from wireguard-goSimon Rozman2020-10-306-285/+1293
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: unify Win32 error typeSimon Rozman2020-10-303-32/+40
| | | | | | | This makes the code more readable and works around the clang-format.exe issues with _Return_type_success_ source annotation. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: port GetInterface member from wireguard-goSimon Rozman2020-10-305-1/+776
| | | | | | | | | | | Mind that this also fixes the order of adapter detection checks. A fast test to eliminate non-Wintun adapters from iteration to speed things up rendered the method incapable of detecting a non-Wintun adapter with the name we are looking for. ERROR_OBJECT_NOT_FOUND was replaced with ERROR_FILE_NOT_FOUND. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: port nci package from wireguard-goSimon Rozman2020-10-305-0/+54
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: port tun\wintun\namespace_windows.go from wireguard-goSimon Rozman2020-10-305-2/+222
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add skeleton for wintun.dllSimon Rozman2020-10-306-0/+289
Signed-off-by: Simon Rozman <simon@rozman.si>