Re: HELP! Registry Corruption on Driver Uninstall w/devcon.exe

From: James Yonan (jim2004_at_yonan.net)
Date: 03/08/04


Date: 7 Mar 2004 21:19:03 -0800


"Thomas F. Divine [DDK MVP]" <tdivine@NOpcausaSPAM.com> wrote in message news:<exW$DQGBEHA.1028@TK2MSFTNGP11.phx.gbl>...

> I'm not sure that his driver installation requires a reboot.
>
> However, the scenario install, uninstall (without interveening reboot)
> leaves Winsock broken.
>
> I think his goal is really to prevent install without an interveening
> reboot.

Actually my larger goal is to not require a reboot for install or
uninstall.

I did a bit more research to try to understand why this driver
requires a reboot after install, even though devcon install always
returns 0 meaning that no reboot should be required. On XP, the
driver will install and run fine without a reboot, but on Win2K a
reboot is always required, even though devcon also returns 0.

Let me give a bit more background.

This driver is a virtual miniport driver, which exports two
interfaces. The first is a miniport, whose upper edge is NDIS5 and
whose lower edge is ethernet. This interface seems to come up fine
without a reboot.

The second interface is a device object, created with
IoCreateDeviceSecure in the miniport's InitializeHandler function.
This interface has a problem working correctly without a reboot on
Win2K -- more specifically, IoCreateDeviceSecure succeeds but
userspace cannot open the symbolic link to the device.

IoCreateDeviceSecure creates a named device that looks something like
this:

\Device\{9D1C6ED9-42F6-4A24-8D0E-DA5AC5D76087}.tap

The DEVICE_TYPE parm passed to IoCreateDeviceSecure is custom, i.e. >=
32768, and the DeviceCharacteristics parm is 0. The security setting
is SDDL_DEVOBJ_SYS_ALL_ADM_ALL.

Then I make a symbolic link so that user-space apps can access the
device. The symbolic link looks like this:

\??\{9D1C6ED9-42F6-4A24-8D0E-DA5AC5D76087}.tap

User space should now be able to call CreateFile on

\\.\{9D1C6ED9-42F6-4A24-8D0E-DA5AC5D76087}.tap

and open the device.

This all works perfectly on XP. However on Win2K, immediately after
install, the miniport virtual NIC appears to come up correctly, the
IoCreateDeviceSecure call succeeds, however any attempt to open the
device from userspace fails. Only after rebooting will a CreateFile
on the device's symbolic link succeed.

Is this the correct approach? Is there a better way of doing this so
that Win2K will work immediately without requiring a reboot?

Thanks in advance for any information and guidance.

James

> "Pavel A." <pavel_a@geeklife.com> wrote in message
> news:uoxSPbDBEHA.1604@TK2MSFTNGP11.phx.gbl...
> > Why reboot is required after installing this driver?
> >
> > --PA
> >
> > "James Yonan" <jim2004@yonan.net> wrote in message
> news:4b2b7f04.0403061746.7a191be1@posting.google.com...
> > > I'm the developer of the TAP-Win32 driver, an NDIS 5 miniport virtual
> > > NIC driver, and I'm seeing cases of Winsock registry corruption that
> > > renders Win2K machines unusable without registry surgery.
> > >
> > > The driver is generally installed and uninstalled using the devcon.exe
> > > sample distributed with the DDK (version 2600.1106).
> > >
> > > The problem is that sometimes people install on Win2K, and ignore the
> > > reboot dialog.
> > >
> > > The driver install is done internally with the command:
> > >
> > > devcon install OemWin2k.inf TAP
> > >
> > > Users then try to get the TAP adapter to work, which of course fails
> > > because they didn't reboot. Then they get frustrated and uninstall
> > > the driver.
> > >
> > > The internal driver uninstall operation is:
> > >
> > > devcon remove TAP
> > >
> > > So essentially they have installed the driver, ignored the reboot
> > > dialog, and uninstalled the driver.
> > >
> > > What happens next in a small number of cases (only on Win2K, usually
> > > SP4) is that registry entries for WinSock get corrupted. Basically
> > > WinSock is now in a permanently broken state, cannot be fixed by
> > > rebooting, and generally needs to be fixed with something like
> > > WinsockFix ( http://members.shaw.ca/installations/WinsockFix.zip )
> > > which basically restores the Winsock registry entries to a known good
> > > state.
> > >
> > > Any help on this issue would be greatly appreciated. I've pasted the
> > > INF file used in the install to the end of this message. Is there a
> > > bug in the INF file, or devcon, or is there anything I can do protect
> > > against this kind of corruption occurring?
> > >
> > > Thanks,
> > > James
> > >
> > > ; ******************************************
> > > ; * OemWin2k.inf, for Win2K and higher
> > > ; ******************************************
> > >
> > > [Version]
> > > Signature = "$Windows NT$"
> > > CatalogFile = tap.cat
> > > ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318}
> > > Provider = %l_Provider%
> > > Class = Net
> > > DriverVer=02/22/2004,5.00.00.0002
> > >
> > > [Strings]
> > > l_DeviceDescription = "TAP-Win32 Adapter"
> > > l_Provider = "TapWin32Project"
> > >
> > > ;----------------------------------------------------------------
> > > ; Manufacturer + Product Section (Done)
> > > ;----------------------------------------------------------------
> > > [Manufacturer]
> > > %l_Provider% = TapWin32Project
> > >
> > > [TapWin32Project]
> > > %l_DeviceDescription% = TAP.ndi, TAP
> > >
> > > ;---------------------------------------------------------------
> > > ; Driver Section (Done)
> > > ;---------------------------------------------------------------
> > >
> > > ;----------------- Characteristics ------------
> > > ; NCF_PHYSICAL = 0x04
> > > ; NCF_VIRTUAL = 0x01
> > > ; NCF_SOFTWARE_ENUMERATED = 0x02
> > > ; NCF_HIDDEN = 0x08
> > > ; NCF_NO_SERVICE = 0x10
> > > ; NCF_HAS_UI = 0x80
> > > ;----------------- Characteristics ------------
> > >
> > > [TAP.ndi]
> > > CopyFiles = TAP.driver, TAP.files
> > > AddReg = TAP.reg
> > > AddReg = TAP.params.reg
> > > Characteristics = 0x81
> > >
> > > [TAP.ndi.Services]
> > > AddService = TAP, 2, TAP.service
> > >
> > > [TAP.reg]
> > > HKR, Ndi, Service, 0, "TAP"
> > > HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
> > > HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
> > > HKR, , Manufacturer, 0, "%l_Provider%"
> > > HKR, , ProductName, 0, "TAP"
> > >
> > > [TAP.params.reg]
> > > HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
> > > HKR, Ndi\params\MTU, Type, 0, "int"
> > > HKR, Ndi\params\MTU, Default, 0, "1500"
> > > HKR, Ndi\params\MTU, Optional, 0, "0"
> > > HKR, Ndi\params\MTU, Min, 0, "100"
> > > HKR, Ndi\params\MTU, Max, 0, "1500"
> > > HKR, Ndi\params\MTU, Step, 0, "1"
> > > HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status"
> > > HKR, Ndi\params\MediaStatus, Type, 0, "enum"
> > > HKR, Ndi\params\MediaStatus, Default, 0, "0"
> > > HKR, Ndi\params\MediaStatus, Optional, 0, "0"
> > > HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application
> > > Controlled"
> > > HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always
> > > Connected"
> > >
> > > ;----------------------------------------------------------------
> > > ; Service Section
> > > ;----------------------------------------------------------------
> > >
> > > ;---------- Service Type -------------
> > > ; SERVICE_KERNEL_DRIVER = 0x01
> > > ; SERVICE_WIN32_OWN_PROCESS = 0x10
> > > ;---------- Service Type -------------
> > >
> > > ;---------- Start Mode ---------------
> > > ; SERVICE_BOOT_START = 0x0
> > > ; SERVICE_SYSTEM_START = 0x1
> > > ; SERVICE_AUTO_START = 0x2
> > > ; SERVICE_DEMAND_START = 0x3
> > > ; SERVICE_DISABLED = 0x4
> > > ;---------- Start Mode ---------------
> > >
> > > [TAP.service]
> > > DisplayName = %l_DeviceDescription%
> > > ServiceType = 1
> > > StartType = 3
> > > ErrorControl = 1
> > > LoadOrderGroup = NDIS
> > > ServiceBinary = %12%\tapdrvr.sys
> > >
> > > ;-----------------------------------------------------------------
> > > ; File Installation
> > > ;-----------------------------------------------------------------
> > >
> > > ;----------------- Copy Flags ------------
> > > ; COPYFLG_NOSKIP = 0x02
> > > ; COPYFLG_NOVERSIONCHECK = 0x04
> > > ;----------------- Copy Flags ------------
> > >
> > > [SourceDisksNames]
> > > 1 = %l_DeviceDescription%, tapdrvr.sys
> > >
> > > [SourceDisksFiles]
> > > tapdrvr.sys = 1
> > >
> > > [DestinationDirs]
> > > TAP.files = 11
> > > TAP.driver = 12
> > >
> > > [TAP.files]
> > >
> > > [TAP.driver]
> > > tapdrvr.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
> > >
> > > ;---------------------------------------------------------------
> > > ; End
> > > ;---------------------------------------------------------------
> >
> >



Relevant Pages

  • Re: cant get to some sites
    ... Make sure Windows is set to show hidden files and folders and is NOT set ... Reboot an try again. ... If you install Windows XP SP2, it may DOWNgrade your driver to ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: cant get to some sites
    ... Reboot an try again. ... If you install Windows XP SP2, it may DOWNgrade your driver to ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: HELP! Registry Corruption on Driver Uninstall w/devcon.exe
    ... > I'm not sure that his driver installation requires a reboot. ... > However, the scenario install, uninstall (without interveening reboot) ... A lot of people are actively using this driver, ...
    (microsoft.public.development.device.drivers)
  • Re: Mac OS X Leopard still not ready for prime time
    ... Since installing Leopard, I've had to ... Install OS X three times? ... Nobody can mess or race with the Windows reboot, ... you reboot to unload most driver classes on windows. ...
    (comp.sys.mac.advocacy)
  • Re: HELP! Registry Corruption on Driver Uninstall w/devcon.exe
    ... I'm not sure that his driver installation requires a reboot. ... However, the scenario install, uninstall ... leaves Winsock broken. ...
    (microsoft.public.development.device.drivers)

Loading