|
@@ -72,20 +72,21 @@ public:
|
|
#ifdef _WIN64
|
|
#ifdef _WIN64
|
|
is64Bit = TRUE;
|
|
is64Bit = TRUE;
|
|
devcon = "\\devcon_x64.exe";
|
|
devcon = "\\devcon_x64.exe";
|
|
- tapDriver = "\\tap-windows\\x64\\zttap200.inf";
|
|
|
|
|
|
+ tapDriverNdis5 = "\\tap-windows\\x64\\zttap200.inf";
|
|
|
|
+ tapDriverNdis6 = "\\tap-windows\\x64\\zttap300.inf";
|
|
#else
|
|
#else
|
|
is64Bit = FALSE;
|
|
is64Bit = FALSE;
|
|
IsWow64Process(GetCurrentProcess(),&is64Bit);
|
|
IsWow64Process(GetCurrentProcess(),&is64Bit);
|
|
devcon = ((is64Bit == TRUE) ? "\\devcon_x64.exe" : "\\devcon_x86.exe");
|
|
devcon = ((is64Bit == TRUE) ? "\\devcon_x64.exe" : "\\devcon_x86.exe");
|
|
- tapDriver = ((is64Bit == TRUE) ? "\\tap-windows\\x64\\zttap200.inf" : "\\tap-windows\\x86\\zttap200.inf");
|
|
|
|
|
|
+ tapDriverNdis5 = ((is64Bit == TRUE) ? "\\tap-windows\\x64\\zttap200.inf" : "\\tap-windows\\x86\\zttap200.inf");
|
|
|
|
+ tapDriverNdis6 = ((is64Bit == TRUE) ? "\\tap-windows\\x64\\zttap300.inf" : "\\tap-windows\\x86\\zttap300.inf");
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
-
|
|
|
|
BOOL is64Bit;
|
|
BOOL is64Bit;
|
|
- std::string devcon;
|
|
|
|
- std::string tapDriver;
|
|
|
|
|
|
+ const char *devcon;
|
|
|
|
+ const char *tapDriverNdis5;
|
|
|
|
+ const char *tapDriverNdis6;
|
|
};
|
|
};
|
|
-
|
|
|
|
static const WindowsEthernetTapEnv WINENV;
|
|
static const WindowsEthernetTapEnv WINENV;
|
|
|
|
|
|
} // anonymous namespace
|
|
} // anonymous namespace
|
|
@@ -123,6 +124,16 @@ WindowsEthernetTap::WindowsEthernetTap(
|
|
|
|
|
|
Mutex::Lock _l(_systemTapInitLock);
|
|
Mutex::Lock _l(_systemTapInitLock);
|
|
|
|
|
|
|
|
+ std::string tapDriverPath(_pathToHelpers + WINENV.tapDriverNdis6);
|
|
|
|
+ const char *tapDriverName = "zttap300";
|
|
|
|
+ if (::PathFileExistsA(tapDriverPath.c_str()) == FALSE) {
|
|
|
|
+ tapDriverPath = _pathToHelpers + WINENV.tapDriverNdis5;
|
|
|
|
+ tapDriverName = "zttap200";
|
|
|
|
+ if (::PathFileExistsA(tapDriverPath.c_str()) == FALSE) {
|
|
|
|
+ throw std::runtime_error("no tap driver available: cannot find zttap300.inf (NDIS6) or zttap200.inf (NDIS5) under home path");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
HKEY nwAdapters;
|
|
HKEY nwAdapters;
|
|
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}",0,KEY_READ|KEY_WRITE,&nwAdapters) != ERROR_SUCCESS)
|
|
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}",0,KEY_READ|KEY_WRITE,&nwAdapters) != ERROR_SUCCESS)
|
|
throw std::runtime_error("unable to open registry key for network adapter enumeration");
|
|
throw std::runtime_error("unable to open registry key for network adapter enumeration");
|
|
@@ -198,7 +209,7 @@ WindowsEthernetTap::WindowsEthernetTap(
|
|
PROCESS_INFORMATION processInfo;
|
|
PROCESS_INFORMATION processInfo;
|
|
memset(&startupInfo,0,sizeof(STARTUPINFOA));
|
|
memset(&startupInfo,0,sizeof(STARTUPINFOA));
|
|
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
|
|
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
|
|
- if (!CreateProcessA(NULL,(LPSTR)(std::string("\"") + _pathToHelpers + WINENV.devcon + "\" install \"" + _pathToHelpers + WINENV.tapDriver + "\" zttap200").c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
|
|
|
|
|
|
+ if (!CreateProcessA(NULL,(LPSTR)(std::string("\"") + _pathToHelpers + WINENV.devcon + "\" install \"" + tapDriverPath + "\" " + tapDriverName).c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
|
|
RegCloseKey(nwAdapters);
|
|
RegCloseKey(nwAdapters);
|
|
if (devconLog != INVALID_HANDLE_VALUE)
|
|
if (devconLog != INVALID_HANDLE_VALUE)
|
|
CloseHandle(devconLog);
|
|
CloseHandle(devconLog);
|