Upgrade issue on 2012 R1 systems only - TAP 5 to TAP 6 #17

Open
mmacpherson1 opened this Issue Mar 15, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@mmacpherson1

Good day,

I have been looking into a TAP 5 to TAP6 upgrade issue that appears to only impact 2012 R1 systems, and wanted to pass my findings back for your consideration.

So on a 2012 R1 system that has TAP 5 installed, when you attempt to perform the upgrade the process will fail with an event like the following in the setupapi.dev.log:

 dvi:                     {Restarting Devices} 13:50:42.291
 dvi:                          Restart: ROOT\NET\0000

!!! dvi: Device not started: Device has problem: 0x1f: CM_PROB_FAILED_ADD.

When you look within Device Manager you can have one of two possible states:

  • Driver shows that it needs a system restart in Device Manager. Do the restart and now shows Code 31
  • Have driver disabled before you do the upgrade, upon install it goes right into Code 31

The error in Device Manager shows as:

This device is not working properly because Windows cannot load the drivers required for this device. (Code 31)

Doing some review I found that the ‘_MediaType’ and ‘_PhysicalMediaType’ registry keys under the adapter instance for tap0901 are not being written in this upgrade scenario. If you manually add these two missing keys the driver is now able to start without issue.

Working the issue I found two possible solutions:

Option 1 is to manually add the two missing registry keys for the driver before you do your upgrade to TAP 6.

Option 2 is slightly more involved.

If we look within OEMVISTA INF, after the blank Characteristics value (due to issue 15), currently we have the following:

[tap0901.ndi]
   CopyFiles       = tap0901.driver, tap0901.files
   AddReg          = tap0901.reg
   AddReg          = tap0901.params.reg
   Characteristics = 
   *IfType            = 0x6 ; IF_TYPE_ETHERNET_CSMACD
   *MediaType         = 0x0 ; NdisMedium802_3
   *PhysicalMediaType = 14  ; NdisPhysicalMedium802_3

To allow the INF to always lay these three keys down, moving them within the AddReg for tap0901.reg allows the upgrade to proceed without issue, just as a suggestion.

[tap0901.ndi]
   CopyFiles       = tap0901.driver, tap0901.files
   AddReg          = tap0901.reg
   AddReg          = tap0901.params.reg
   Characteristics = 

[tap0901.ndi.Services]
   AddService = tap0901,        2, tap0901.service

[tap0901.reg]
   HKR, Ndi,            Service,      0, "tap0901"
   HKR, Ndi\Interfaces, UpperRange,   0, "ndis5"
   HKR, Ndi\Interfaces, LowerRange,   0, "ethernet"
   HKR, ,               Manufacturer, 0, "%Provider%"
   HKR, ,               ProductName,  0, "%DeviceDescription%"
   HKR, ,               *IfType,  0x00010001, 6
   HKR, ,               *MediaType,  0x00010001, 0
   HKR, ,               *PhysicalMediaType,  0x00010001, 14

Supporting evidence.

If we have a Procmon capture running while the installer does the upgrade from TAP 5 to 6, when the HKLM\System\CurrentControlSet\Control\Network\NDISTempKey\ structure is built we don’t see any events for MediaType or PhysicalMediaType. The only events we see are attempts to query the keys and them reported as not found:

8:05:40.9829317 PM DrvInst.exe 10104 RegQueryValue HKLM\System\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0013MediaType NAME NOT FOUND Length: 144
8:05:40.9829514 PM DrvInst.exe 10104 RegQueryValue HKLM\System\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0013
PhysicalMediaType NAME NOT FOUND Length: 144

When you perform a fresh clean install of TAP 6 on the same system, once again when the NDISTempKey structure is built we don’t see any events for these keys. But we do see rather than a Query call DrvInst Set’s both of these keys:

8:11:06.0012482 PM DrvInst.exe 3024 RegSetValue HKLM\System\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0013MediaType SUCCESS Type: REG_DWORD, Length: 4, Data: 0
8:11:06.0013126 PM DrvInst.exe 3024 RegSetValue HKLM\System\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0013
PhysicalMediaType SUCCESS Type: REG_DWORD, Length: 4, Data: 14

Now for comparison when we move these three keys down into the AddReg call, when the NDISTempKey is built we see all three listed, then added to the adapter instance location, and finally the Query Value call’s succeed.

8:24:59.5386870 PM DrvInst.exe 6304 RegSetValue HKLM\System\CurrentControlSet\Control\Network\NDISTempKeyIfType SUCCESS Type: REG_DWORD, Length: 4, Data: 6
8:24:59.5387484 PM DrvInst.exe 6304 RegSetValue HKLM\System\CurrentControlSet\Control\Network\NDISTempKey
MediaType SUCCESS Type: REG_DWORD, Length: 4, Data: 0
8:24:59.5388187 PM DrvInst.exe 6304 RegSetValue HKLM\System\CurrentControlSet\Control\Network\NDISTempKey*PhysicalMediaType SUCCESS Type: REG_DWORD, Length: 4, Data: 14

8:24:59.8681578 PM DrvInst.exe 6304 RegSetValue HKLM\System\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0013IfType SUCCESS Type: REG_DWORD, Length: 4, Data: 6
8:24:59.8682016 PM DrvInst.exe 6304 RegSetValue HKLM\System\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0013
MediaType SUCCESS Type: REG_DWORD, Length: 4, Data: 0
8:24:59.8683201 PM DrvInst.exe 6304 RegSetValue HKLM\System\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0013*PhysicalMediaType SUCCESS Type: REG_DWORD, Length: 4, Data: 14

8:24:59.8746089 PM DrvInst.exe 6304 RegQueryValue HKLM\System\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0013MediaType SUCCESS Type: REG_DWORD, Length: 4, Data: 0
8:24:59.8746259 PM DrvInst.exe 6304 RegQueryValue HKLM\System\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0013
PhysicalMediaType SUCCESS Type: REG_DWORD, Length: 4, Data: 14

Thanks,

Matthew

@mattock

This comment has been minimized.

Show comment
Hide comment
@mattock

mattock Mar 17, 2016

Member

Hi and thanks for the detailed report!

Did you do a a real upgrade? Or did you uninstall tap-windows first, then install tap-windows6 afterwards?

If a tap-driver is present, then our NSI installers run "devcon.exe upgrade", which can apparently sometimes fail. I suspect that going from tap-windows to tap-windows6 is more prone to breakage than more minor upgrade scenarios.

Member

mattock commented Mar 17, 2016

Hi and thanks for the detailed report!

Did you do a a real upgrade? Or did you uninstall tap-windows first, then install tap-windows6 afterwards?

If a tap-driver is present, then our NSI installers run "devcon.exe upgrade", which can apparently sometimes fail. I suspect that going from tap-windows to tap-windows6 is more prone to breakage than more minor upgrade scenarios.

@mmacpherson1

This comment has been minimized.

Show comment
Hide comment
@mmacpherson1

mmacpherson1 Mar 17, 2016

Good afternoon Mattock, thanks for the quick reply.

We are able to reproduce the issue doing a upgrade using the TAP-windows downloads from the main page: https://openvpn.net/index.php/open-source/downloads.html

Have tap-windows-9.9.2_3.exe installed and working on a 2012 R1 system, then attempt the upgrade to tap-windows-9.21.1.exe. The issue appears to occur 100% on a 2012 R1 system from the testing performed. If you perform a uninstall of the driver and do a clean install of the NDIS 6 version, the issue is not seen and you can see a example of that within my Procmon output.

Let me know if you have any questions.

Matt

Good afternoon Mattock, thanks for the quick reply.

We are able to reproduce the issue doing a upgrade using the TAP-windows downloads from the main page: https://openvpn.net/index.php/open-source/downloads.html

Have tap-windows-9.9.2_3.exe installed and working on a 2012 R1 system, then attempt the upgrade to tap-windows-9.21.1.exe. The issue appears to occur 100% on a 2012 R1 system from the testing performed. If you perform a uninstall of the driver and do a clean install of the NDIS 6 version, the issue is not seen and you can see a example of that within my Procmon output.

Let me know if you have any questions.

Matt

@mattock

This comment has been minimized.

Show comment
Hide comment
@mattock

mattock Mar 21, 2016

Member

For now, I added a warning to the tap-windows downloads section about doing upgrades. As a long-term solution I'll add some code to the NSIS installer to prevent upgrade of tap-windows to tap-windows6, and to do a full uninstall/install instead.

Member

mattock commented Mar 21, 2016

For now, I added a warning to the tap-windows downloads section about doing upgrades. As a long-term solution I'll add some code to the NSIS installer to prevent upgrade of tap-windows to tap-windows6, and to do a full uninstall/install instead.

@mmacpherson1

This comment has been minimized.

Show comment
Hide comment
@mmacpherson1

mmacpherson1 Mar 21, 2016

Thanks, will leave it up to your team to pick the best solution, but please make sure to note my findings that if we simply move the addition of the keys down into the tap0901.reg section, they are correctly written every time and this would avoid needing to do a uninstall. Allowing you to avoid trying to detect.

Thanks, will leave it up to your team to pick the best solution, but please make sure to note my findings that if we simply move the addition of the keys down into the tap0901.reg section, they are correctly written every time and this would avoid needing to do a uninstall. Allowing you to avoid trying to detect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment