aboutsummaryrefslogtreecommitdiffstats
path: root/api/api.vcxproj (follow)
Commit message (Collapse)AuthorAgeFilesLines
* props: unify import .lib of DLLsSimon Rozman2021-08-101-1/+0
| | | | | | | This moves downlevelshim.lib and those .lib from any future DLLs in this repo to the matching IntDir. Signed-off-by: Simon Rozman <simon@rozman.si>
* proj: clean up loose endsJason A. Donenfeld2021-08-021-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: remove authenticode supportJason A. Donenfeld2021-08-021-5/+3
| | | | | | Certificates are no longer valid. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: upgradeSimon Rozman2021-07-281-3/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* vs: move shared configuration to wintun.props and upgradeSimon Rozman2021-07-281-147/+20
| | | | | | | Remember to rename wintun.vcxproj.user file in your local working folder to wintun.props.user manually. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: build with WDKJason A. Donenfeld2021-07-231-2/+15
| | | | | | | Makes builds more reproducable, as we can do our next release using the EWDK, an all-in-one ISO of build tools from Microsoft. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: use SuggestedInstanceId instead of NetSetupAnticipatedInstanceIdJason A. Donenfeld2021-07-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All was well with NetSetupAnticipatedInstanceId, until a bug crept into recent Windows builds that caused old GUIDs not to be properly removed, resulting in subsequent adapter creations to fail, because NetSetup AnticipatedInstanceId considers it fatal when the target GUID already exists, even if in diminished form. The initial solution was to detect cruft, and then steal a TrustedInstaller token and sleuth around the registry cleaning things up. The horror! Uncomfortable with this, I reopened IDA and had a look around with fresh eyes, three years after the original discovery of NetSetupAnticipated InstanceId. There, I found some interesting behavior in NetSetupSvcDeviceManager::InstallNetworkInterfaces, which amounts to something like: if (IsSet("RetiredNetCfgInstanceId") { if (IsSet("NetSetupAnticipatedInstanceId") DeleteAdapter(GetValue("RetiredNetCfgInstanceId")); else Set("NetSetupAnticipatedInstanceId", GetValue("RetiredNetCfgInstanceId")); Delete("RetiredNetCfgInstanceId"); } CreateAdapter = TRUE; if (IsSet("NetSetupAnticipatedInstanceId")) { Guid = GetValue("NetSetupAnticipatedInstanceId"); if (AdapterAlreadyExists(Guid)) CreateAdapter = FALSE; else SetGuidOfNewAdapter(Guid); Delete("NetSetupAnticipatedInstanceId"); } else if (IsSet("SuggestedInstanceId")) { Guid = GetValue("SuggestedInstanceId"); if (!AdapterAlreadyExists(Guid)) SetGuidOfNewAdapter(Guid); Delete("SuggestedInstanceId"); } Thus, one appealing strategy would be to set both NetSetupAnticipated InstanceId and RetiredInstanceId to the same value, and let the service handle deleting the old one for us before creating the new one. However, the cleanup of the old adapter winds up being quasi- asynchronous, and thus we still wind up in the CreateAdapter = FALSE case. So, the remaining strategy is to simply use SuggestedInstanceId instead. This has the behavior that if there's an adapter already in use, it'll use a new random GUID. The result is that adapter creation won't fail. That's not great, but the docs have always made it clear that "requested" is a best-effort sort of thing. Plus, hopefully the creation of the new adapter will help nudge the bug a bit and cleanup the old cruft. In some ways, transitioning from our old strategy of "cudgel the registry until we get the GUID we want" to "ask politely and accept no for an answer" is a disappointing regression in functionality. But it also means we don't need to keep crazy token stealing code around, or fish around in the registry dangerously. This probably also increases the likelihood that an adapter will be created during edge cases, which means fewer errors for users, which could be a good thing. On the downside, we have the perpetual tensions caused by a system that now "fails open" instead of "fails closed". But so it goes in Windows land. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: delay load remaining dlls to work around forwarder gotchas0.9.2Jason A. Donenfeld2020-11-271-2/+2
| | | | | | | | | RtlGenRandom forwards to cryptbase.dll, which is not in KnownDlls. Therefore it's not a good idea to link to advapi32.dll at link time. How many other gotchas of unusual forwarded functions are there? I don't really want to find out. Therefore, delay load everything else. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: do not call UpdateDriverForPlugAndPlayDevicesWJason A. Donenfeld2020-11-091-3/+3
| | | | | | | This seems to reset a number of device properties, and our update flow seems to update old adapters without needing to call this. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: add cfgmgr32.dll to delayed load listJason A. Donenfeld2020-11-051-2/+2
| | | | | | It's in the registry but not in the NT object key. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: upgrade nci.lib and wintun-inf.h buildingSimon Rozman2020-11-041-9/+15
| | | | | | | The additional build steps performed are now attached to the build process using BeforeTargets/AfterTargets. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: include the rundll32 helpers the MSVC-typical waySimon Rozman2020-11-041-2/+4
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: extract inf driverver at compile time into C headerJason A. Donenfeld2020-11-031-0/+1
| | | | | | | | | | | | This requires us to make some insane conversions between INF date, JavaScript time, and finally Windows file time. The point is to mimic SystemTimeToFileTime, which is what SpInf.dll's pSetupStringToDriverDate does on the YYYY-MM-DD from the INF. The result is that we no longer have to parse an ancient text format in C at runtime. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: move nci.lib generation to custom stepJason A. Donenfeld2020-11-031-4/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: move undocumented ntdll symbols to ntdll.hJason A. Donenfeld2020-11-031-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: conditionalize quasi expensive prelinkeventJason A. Donenfeld2020-11-031-1/+1
| | | | | | | It would be better to do this only if either nci.def or nci.h are newer than nci.lib, but who knows if msbuild is expressive enough for this. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: begin to separate rundll32 jumpsJason A. Donenfeld2020-11-031-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* example: rewrite and replace api's debug rundll32 functionalityJason A. Donenfeld2020-11-021-6/+0
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: make nci.lib work on x86Jason A. Donenfeld2020-11-021-2/+3
| | | | | | | | | | This is an appalling hack. We need the lib tool to generate a coff lib with the "undecorate" parameter. And apparently the only way to do this with the MSVC tools is by making a stub object, and then rewriting the symbols using the def file. See Q131313 for Microsoft-sanctioned details. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* test: introduce a demo clientSimon Rozman2020-11-011-0/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add debugging rundll32 entry pointJason A. Donenfeld2020-10-311-1/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: link to nci.dll at compile timeJason A. Donenfeld2020-10-311-3/+6
| | | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Simon Rozman <simon@rozman.si>
* api: get rid of pch and make headers saneJason A. Donenfeld2020-10-311-9/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: simplify build settingsJason A. Donenfeld2020-10-311-44/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: use NT api directly for enumerating kernel modulesJason A. Donenfeld2020-10-311-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: attempt to upgrade currently running adaptersJason A. Donenfeld2020-10-311-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: use proper iso atomic semanticsJason A. Donenfeld2020-10-311-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: elevate only when needed for system operationsJason A. Donenfeld2020-10-311-0/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: simplify driver selection by always including EV driverSimon Rozman2020-10-311-2/+0
| | | | | | | | When Windows 7-8.1 support is sunset, there will be no more EV driver deployment at all. Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Simon Rozman <simon@rozman.si>
* api: fix dll hijacking vulnsJason A. Donenfeld2020-10-311-1/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: simplify driver removalSimon Rozman2020-10-311-2/+0
| | | | | | | | | | | | | | | | | When we install the Wintun driver to the store, we get exact oem<nn>.inf filename of the driver in the store we just installed. Since the installation should be only temporarily, we should uninstall only the driver we installed. This also eliminates the need for iterating driver store speeding up things. The code we removed was inherited from the installer.dll, where it made perfect sense to remove all installed Wintun drivers in the update process. Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Simon Rozman <simon@rozman.si>
* Add ARM driver compilationSimon Rozman2020-10-311-2/+2
| | | | | | | | | This adds the ARM driver to the list of Wintun drivers we compile for future deployment. Since we're not in position to test it in the real world, any feedback is greatly appreciated. Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add ring managementSimon Rozman2020-10-301-0/+2
| | | | | | | | Rather than every client reinvent the art of using the Wintun and its ring buffers, we offer helper structs and functions to unify and simplify Wintun usage. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: introduce wintun.hSimon Rozman2020-10-301-0/+1
| | | | | | | | | | | The SDK header for deployment containing datatype and function declarations for use by C/C++ clients. As we shall not distribute MSVC wintun.lib files, making clients need to use GetProcAddress(), this file contains function type declarations rather then __declspec(dllimport) function declarations. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: build the bridge from WoW64 to native inSimon Rozman2020-10-301-1/+5
| | | | | | | | SetupAPI fails to create a device in WoW64 processes. x86 (and arm) wintun.dll pack the amd64 and arm64 wintun.dll now, and use rundll32 to create a native process to do the job where required. Signed-off-by: Simon Rozman <simon@rozman.si>
* vcxproj: swap configuration and platform subfolder hierarchySimon Rozman2020-10-301-5/+5
| | | | | | | This should allow wintun.dll to simplify referencing same configuration but different platform wintun.dll for WoW64 support. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: internal reorganizationSimon Rozman2020-10-301-2/+2
| | | | | | | | | | | Gather adapter management in adapter.h/.c (formerly devmgmt.h/.c) and unify HwID tests. Use "Namespace" namespace in all functions from namespace.h/.c. Fix char strings in LOG_... Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add driver managementSimon Rozman2020-10-301-1/+7
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: introduce loggingSimon Rozman2020-10-301-0/+4
| | | | | | And other unifications with installer before merging. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: split api.hSimon Rozman2020-10-301-0/+4
| | | | | | As the project grew, api.h got bloated. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add support for WoW64Simon Rozman2020-10-301-0/+29
| | | | | | | | 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: add pre-compiled header supportSimon Rozman2020-10-301-0/+6
| | | | | | ...for super-fast compilation. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: finish porting from wireguard-goSimon Rozman2020-10-301-1/+2
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: port GetInterface member from wireguard-goSimon Rozman2020-10-301-1/+2
| | | | | | | | | | | 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-301-0/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: port tun\wintun\namespace_windows.go from wireguard-goSimon Rozman2020-10-301-0/+2
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add skeleton for wintun.dllSimon Rozman2020-10-301-0/+179
Signed-off-by: Simon Rozman <simon@rozman.si>