Added real support for tapv9 windows driver

This commit is contained in:
Nikolay Borodin 2024-03-27 23:11:39 +02:00
parent 5abeeff54f
commit fdc2532aee
4 changed files with 13 additions and 4 deletions

View file

@ -39,7 +39,7 @@ OBJECTFILES= \
# C Compiler Flags
CFLAGS=-m32 $(shell pkg-config --cflags jdk)
CFLAGS=-m32 $(shell pkg-config --cflags jdk) ${EXTRA_CFLAGS}
# CC Compiler Flags
CCFLAGS=

View file

@ -39,7 +39,7 @@ OBJECTFILES= \
# C Compiler Flags
CFLAGS=-m64 $(shell pkg-config --cflags jdk)
CFLAGS=-m64 $(shell pkg-config --cflags jdk) ${EXTRA_CFLAGS}
# CC Compiler Flags
CCFLAGS=

View file

@ -34,7 +34,7 @@
<developmentMode>5</developmentMode>
<architecture>1</architecture>
<commandlineTool>i686-w64-mingw32-gcc</commandlineTool>
<commandLine>$(shell pkg-config --cflags jdk)</commandLine>
<commandLine>$(shell pkg-config --cflags jdk) ${EXTRA_CFLAGS}</commandLine>
</cTool>
<linkerTool>
<output>dist/Release/libTunTapWindows.dll</output>
@ -56,7 +56,7 @@
<developmentMode>5</developmentMode>
<architecture>2</architecture>
<commandlineTool>x86_64-w64-mingw32-gcc</commandlineTool>
<commandLine>$(shell pkg-config --cflags jdk)</commandLine>
<commandLine>$(shell pkg-config --cflags jdk) ${EXTRA_CFLAGS}</commandLine>
</cTool>
<linkerTool>
<output>dist/Release/libTunTapWindows64.dll</output>

View file

@ -30,7 +30,11 @@
#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
#ifdef USE_TAPV9
#define TAP_COMPONENT_ID_PREFIX "root\\tap0901"
#else
#define TAP_COMPONENT_ID_PREFIX "tap"
#endif
#define USERMODEDEVICEDIR "\\\\.\\Global\\"
#define TAPSUFFIX ".tap"
@ -78,6 +82,11 @@ int findTapDevice(char *deviceID, int deviceIDLen, char *deviceName, int deviceN
deviceID[0] == '\0' &&
ERROR_SUCCESS == RegEnumKey(adapterKey, i, keyI, sizeof(keyI));
i++) {
// skip registry entries that are not related to devices
if (strcmp(keyI, "Configuration") == 0 || strcmp(keyI, "Properties") == 0) {
continue;
}
char componentId[256];
snprintf(keyName, sizeof(keyName), "%s\\%s", ADAPTER_KEY, keyI);