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 d49d29132..000000000 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 7e6fc4267..818796f4d 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 f1f878a31..8b9114c71 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 9cc9ffc72..453797b38 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 060916f95..3d846a53a 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 e943ea45e..000000000 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 80b330a8a..b9e2d7eac 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 d899961e3..44347f54f 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 5f46dbfdc..453797b38 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 29933e3e2..664398e93 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 744a32c58..a10cb1e55 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 5936875ad..831516d93 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 6f98c32ad..236e25594 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/osdep/WindowsEthernetTap.cpp b/osdep/WindowsEthernetTap.cpp index c6b434e12..f327009d3 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 dd60c0bf6..dec513f47 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 diff --git a/windows/TapDriver6/TapDriver6.vcxproj b/windows/TapDriver6/TapDriver6.vcxproj index ffe9441ce..b1f9ae189 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 d609f17c3..e73640840 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