From 085734aabae9c407026a83b980707ce1973a6910 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 13 Aug 2015 15:18:48 -0700 Subject: Windows driver (NDIS6) rebuild using earlier DDK revision to allow driver to load in Windows 2008 Server and Windows Vista. Still issues with those platforms, but driver loads -- and shouldn't hurt newer versions (will test). --- .../tap-windows-ndis6/x64/WdfCoinstaller01011.dll | Bin 1795952 -> 0 bytes .../x64/ZeroTierOne_NDIS6_x64.msi | Bin 1454080 -> 1453056 bytes ext/bin/tap-windows-ndis6/x64/zttap300.cat | Bin 9941 -> 10017 bytes ext/bin/tap-windows-ndis6/x64/zttap300.inf | 2 +- ext/bin/tap-windows-ndis6/x64/zttap300.sys | Bin 30488 -> 30488 bytes .../tap-windows-ndis6/x86/WdfCoinstaller01011.dll | Bin 1629040 -> 0 bytes .../x86/ZeroTierOne_NDIS6_x86.msi | Bin 1070592 -> 1070080 bytes ext/bin/tap-windows-ndis6/x86/zttap300.cat | Bin 9941 -> 10017 bytes ext/bin/tap-windows-ndis6/x86/zttap300.inf | 8 ++++++-- ext/bin/tap-windows-ndis6/x86/zttap300.sys | Bin 27928 -> 27928 bytes ...roTier One Virtual Network Port (NDIS6_x64).aip | 4 ++-- ...roTier One Virtual Network Port (NDIS6_x86).aip | 4 ++-- ext/installfiles/windows/ZeroTier One.aip | 12 ++++-------- windows/TapDriver6/TapDriver6.vcxproj | 4 ++++ windows/TapDriver6/resource.h | 2 +- 15 files changed, 20 insertions(+), 16 deletions(-) delete mode 100644 ext/bin/tap-windows-ndis6/x64/WdfCoinstaller01011.dll delete mode 100644 ext/bin/tap-windows-ndis6/x86/WdfCoinstaller01011.dll diff --git a/ext/bin/tap-windows-ndis6/x64/WdfCoinstaller01011.dll b/ext/bin/tap-windows-ndis6/x64/WdfCoinstaller01011.dll deleted file mode 100644 index d49d2913..00000000 Binary files a/ext/bin/tap-windows-ndis6/x64/WdfCoinstaller01011.dll and /dev/null differ diff --git a/ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi b/ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi index 7e6fc426..818796f4 100644 Binary files a/ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi and b/ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi differ diff --git a/ext/bin/tap-windows-ndis6/x64/zttap300.cat b/ext/bin/tap-windows-ndis6/x64/zttap300.cat index f1f878a3..8b9114c7 100644 Binary files a/ext/bin/tap-windows-ndis6/x64/zttap300.cat and b/ext/bin/tap-windows-ndis6/x64/zttap300.cat differ diff --git a/ext/bin/tap-windows-ndis6/x64/zttap300.inf b/ext/bin/tap-windows-ndis6/x64/zttap300.inf index 9cc9ffc7..453797b3 100644 --- a/ext/bin/tap-windows-ndis6/x64/zttap300.inf +++ b/ext/bin/tap-windows-ndis6/x64/zttap300.inf @@ -30,7 +30,7 @@ CatalogFile = zttap300.cat ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} Provider = %Provider% Class = Net -DriverVer=04/25/2015,6.2.9200.20557 +DriverVer=08/13/2015,6.2.9200.20557 [Strings] DeviceDescription = "ZeroTier One Virtual Port" diff --git a/ext/bin/tap-windows-ndis6/x64/zttap300.sys b/ext/bin/tap-windows-ndis6/x64/zttap300.sys index 060916f9..3d846a53 100644 Binary files a/ext/bin/tap-windows-ndis6/x64/zttap300.sys and b/ext/bin/tap-windows-ndis6/x64/zttap300.sys differ diff --git a/ext/bin/tap-windows-ndis6/x86/WdfCoinstaller01011.dll b/ext/bin/tap-windows-ndis6/x86/WdfCoinstaller01011.dll deleted file mode 100644 index e943ea45..00000000 Binary files a/ext/bin/tap-windows-ndis6/x86/WdfCoinstaller01011.dll and /dev/null differ diff --git a/ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi b/ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi index 80b330a8..b9e2d7ea 100644 Binary files a/ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi and b/ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi differ diff --git a/ext/bin/tap-windows-ndis6/x86/zttap300.cat b/ext/bin/tap-windows-ndis6/x86/zttap300.cat index d899961e..44347f54 100644 Binary files a/ext/bin/tap-windows-ndis6/x86/zttap300.cat and b/ext/bin/tap-windows-ndis6/x86/zttap300.cat differ diff --git a/ext/bin/tap-windows-ndis6/x86/zttap300.inf b/ext/bin/tap-windows-ndis6/x86/zttap300.inf index 5f46dbfd..453797b3 100644 --- a/ext/bin/tap-windows-ndis6/x86/zttap300.inf +++ b/ext/bin/tap-windows-ndis6/x86/zttap300.inf @@ -30,7 +30,7 @@ CatalogFile = zttap300.cat ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} Provider = %Provider% Class = Net -DriverVer=04/25/2015,6.2.9200.20557 +DriverVer=08/13/2015,6.2.9200.20557 [Strings] DeviceDescription = "ZeroTier One Virtual Port" @@ -38,12 +38,16 @@ Provider = "ZeroTier Networks LLC" ; We're ZeroTier, Inc. now but kernel mode ce ; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back! [Manufacturer] -%Provider%=zttap300 +%Provider%=zttap300,NTamd64 [zttap300] %DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated %DeviceDescription% = zttap300.ndi, zttap300 ; Legacy +[zttap300.NTamd64] +%DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated +%DeviceDescription% = zttap300.ndi, zttap300 ; Legacy + ;----------------- Characteristics ------------ ; NCF_PHYSICAL = 0x04 ; NCF_VIRTUAL = 0x01 diff --git a/ext/bin/tap-windows-ndis6/x86/zttap300.sys b/ext/bin/tap-windows-ndis6/x86/zttap300.sys index 29933e3e..664398e9 100644 Binary files a/ext/bin/tap-windows-ndis6/x86/zttap300.sys and b/ext/bin/tap-windows-ndis6/x86/zttap300.sys differ diff --git a/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x64).aip b/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x64).aip index 744a32c5..a10cb1e5 100644 --- a/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x64).aip +++ b/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x64).aip @@ -1,5 +1,5 @@ - + @@ -15,7 +15,7 @@ - + diff --git a/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x86).aip b/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x86).aip index 5936875a..831516d9 100644 --- a/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x86).aip +++ b/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x86).aip @@ -1,5 +1,5 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index 6f98c32a..236e2559 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -1,5 +1,5 @@ - + @@ -23,7 +23,7 @@ - + @@ -59,8 +59,6 @@ - - @@ -71,13 +69,11 @@ - + - - - + diff --git a/windows/TapDriver6/TapDriver6.vcxproj b/windows/TapDriver6/TapDriver6.vcxproj index ffe9441c..b1f9ae18 100644 --- a/windows/TapDriver6/TapDriver6.vcxproj +++ b/windows/TapDriver6/TapDriver6.vcxproj @@ -91,6 +91,8 @@ Vista false + 1 + 7 Windows8 @@ -115,6 +117,8 @@ Vista false + 1 + 7 diff --git a/windows/TapDriver6/resource.h b/windows/TapDriver6/resource.h index d609f17c..e7364084 100644 --- a/windows/TapDriver6/resource.h +++ b/windows/TapDriver6/resource.h @@ -1395,7 +1395,7 @@ #define MULTIFILEOPENORD 1537 #define _WIN32_WINNT_WIN8 0x0602 #define _WIN32_IE_WS03 0x0602 -#define _WIN32_WINNT 0x0602 +#define _WIN32_WINNT 0x0600 #define PRINTDLGORD 1538 #define VER_PRODUCTVERSION_W 0x0602 #define _WIN32_IE_IE60SP2 0x0603 -- cgit v1.2.3 From b75bdedaee753684f7b811a294fc1f8bd268517f Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 13 Aug 2015 15:52:54 -0700 Subject: Manually set DeviceInstanceID since this registry key is missing on Windows Vista and Server 2008. --- osdep/WindowsEthernetTap.cpp | 22 ++++++++++++++++++++-- osdep/WindowsEthernetTap.hpp | 3 ++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/osdep/WindowsEthernetTap.cpp b/osdep/WindowsEthernetTap.cpp index c6b434e1..f327009d 100644 --- a/osdep/WindowsEthernetTap.cpp +++ b/osdep/WindowsEthernetTap.cpp @@ -75,6 +75,8 @@ typedef BOOL (WINAPI *SetupDiOpenDeviceInfoA_t)(_In_ HDEVINFO DeviceInfoSet,_In_ typedef BOOL (WINAPI *SetupDiEnumDeviceInfo_t)(_In_ HDEVINFO DeviceInfoSet,_In_ DWORD MemberIndex,_Out_ PSP_DEVINFO_DATA DeviceInfoData); typedef BOOL (WINAPI *SetupDiSetClassInstallParamsA_t)(_In_ HDEVINFO DeviceInfoSet,_In_opt_ PSP_DEVINFO_DATA DeviceInfoData,_In_reads_bytes_opt_(ClassInstallParamsSize) PSP_CLASSINSTALL_HEADER ClassInstallParams,_In_ DWORD ClassInstallParamsSize); typedef CONFIGRET (WINAPI *CM_Get_Device_ID_ExA_t)(_In_ DEVINST dnDevInst,_Out_writes_(BufferLen) PSTR Buffer,_In_ ULONG BufferLen,_In_ ULONG ulFlags,_In_opt_ HMACHINE hMachine); +typedef BOOL (WINAPI *SetupDiGetDeviceInstanceIdA_t)(_In_ HDEVINFO DeviceInfoSet,_In_ PSP_DEVINFO_DATA DeviceInfoData,_Out_writes_opt_(DeviceInstanceIdSize) PSTR DeviceInstanceId,_In_ DWORD DeviceInstanceIdSize,_Out_opt_ PDWORD RequiredSize); + namespace ZeroTier { @@ -145,6 +147,10 @@ public: fprintf(stderr,"FATAL: SetupDiSetClassInstallParamsA not found in setupapi.dll\r\n"); _exit(1); } + if (!(this->SetupDiGetDeviceInstanceIdA = (SetupDiGetDeviceInstanceIdA_t)GetProcAddress(setupApiMod,"SetupDiGetDeviceInstanceIdA"))) { + fprintf(stderr,"FATAL: SetupDiGetDeviceInstanceIdA not found in setupapi.dll\r\n"); + _exit(1); + } newDevMod = LoadLibraryA("newdev.dll"); if (!newDevMod) { @@ -183,6 +189,7 @@ public: SetupDiOpenDeviceInfoA_t SetupDiOpenDeviceInfoA; SetupDiEnumDeviceInfo_t SetupDiEnumDeviceInfo; SetupDiSetClassInstallParamsA_t SetupDiSetClassInstallParamsA; + SetupDiGetDeviceInstanceIdA_t SetupDiGetDeviceInstanceIdA; CM_Get_Device_ID_ExA_t CM_Get_Device_ID_ExA; @@ -201,7 +208,7 @@ static Mutex _systemDeviceManagementLock; } // anonymous namespace -std::string WindowsEthernetTap::addNewPersistentTapDevice(const char *pathToInf) +std::string WindowsEthernetTap::addNewPersistentTapDevice(const char *pathToInf,std::string &deviceInstanceId) { Mutex::Lock _l(_systemDeviceManagementLock); @@ -249,6 +256,12 @@ std::string WindowsEthernetTap::addNewPersistentTapDevice(const char *pathToInf) return std::string("UpdateDriverForPlugAndPlayDevices() failed (made 60 attempts)"); } + char iidbuf[1024]; + DWORD iidReqSize = sizeof(iidbuf); + if (WINENV.SetupDiGetDeviceInstanceIdA(deviceInfoSet,&deviceInfoData,iidbuf,sizeof(iidbuf),&iidReqSize)) { + deviceInstanceId = iidbuf; + } // failure here is not fatal since we only need this on Vista and 2008 -- other versions fill it into the registry automatically + WINENV.SetupDiDestroyDeviceInfoList(deviceInfoSet); return std::string(); @@ -531,6 +544,7 @@ WindowsEthernetTap::WindowsEthernetTap( // If there is no device, try to create one bool creatingNewDevice = (_netCfgInstanceId.length() == 0); + std::string newDeviceInstanceId; if (creatingNewDevice) { for(int getNewAttemptCounter=0;getNewAttemptCounter<2;++getNewAttemptCounter) { for(DWORD subkeyIndex=0;;++subkeyIndex) { @@ -583,7 +597,7 @@ WindowsEthernetTap::WindowsEthernetTap( break; // found an unused zttap device } else { // no unused zttap devices, so create one - std::string errm = addNewPersistentTapDevice((std::string(_pathToHelpers) + WINENV.tapDriverPath).c_str()); + std::string errm = addNewPersistentTapDevice((std::string(_pathToHelpers) + WINENV.tapDriverPath).c_str(),newDeviceInstanceId); if (errm.length() > 0) throw std::runtime_error(std::string("unable to create new device instance: ")+errm); } @@ -604,6 +618,10 @@ WindowsEthernetTap::WindowsEthernetTap( RegSetKeyValueA(nwAdapters,mySubkeyName.c_str(),"*IfType",REG_DWORD,(LPCVOID)&tmp,sizeof(tmp)); if (creatingNewDevice) { + // Vista/2008 does not set this + if (newDeviceInstanceId.length() > 0) + RegSetKeyValueA(nwAdapters,mySubkeyName.c_str(),"DeviceInstanceID",REG_SZ,newDeviceInstanceId.c_str(),(DWORD)newDeviceInstanceId.length()); + // Set EnableDHCP to 0 by default on new devices tmp = 0; RegSetKeyValueA(nwAdapters,mySubkeyName.c_str(),"EnableDHCP",REG_DWORD,(LPCVOID)&tmp,sizeof(tmp)); diff --git a/osdep/WindowsEthernetTap.hpp b/osdep/WindowsEthernetTap.hpp index dd60c0bf..dec513f4 100644 --- a/osdep/WindowsEthernetTap.hpp +++ b/osdep/WindowsEthernetTap.hpp @@ -53,9 +53,10 @@ public: * Installs a new instance of the ZT tap driver * * @param pathToInf Path to zttap driver .inf file + * @param deviceInstanceId Buffer to fill with device instance ID on success (and if SetupDiGetDeviceInstanceIdA succeeds, which it should) * @return Empty string on success, otherwise an error message */ - static std::string addNewPersistentTapDevice(const char *pathToInf); + static std::string addNewPersistentTapDevice(const char *pathToInf,std::string &deviceInstanceId); /** * Uninstalls all persistent tap devices that have legacy drivers -- cgit v1.2.3