[Compuware Corporation] [Compuware NuMega home page] [NuMega Lab] [teal] [DriverStudio] [Image][Image] · Home [Driver Products] Driver Technical Tips · DriverStudio Automatic Unloading of VxDs · DriverBundle · Previews Many applications load VxDs with a call to the Win32 · Compatibility API CreateFile. The system recognizes the special [Downloads] · string \\.\ at the start of a pathname as an indication of that the call refers to a device, and Wizards loads the corresponding VxD if it is not already · Utilities loaded. However, developers often find that the VxD · NT source fails to unload when the file handle is closed. There examples are four common mistakes cause this: · VxD source examples 1. The call to CreateFile must specify · WDM source FILE_FLAG_DELETE_ON_CLOSE in the flags examples parameter. This tells the operating system that [Resources] · it should attempt to unload the VxD when the Technical papers file handle is closed. · Useful links 2. The name specified in the call to CreateFile · Technical tips must match the name that appears in the VxDs [Support] · DDB. Occasionally, the file name of a VxD does not match the name given in the macro that Support declares the DDB (Declare_Virtual_Device). · Knowledge base Without this correspondence, the system fails to · Problem unload the VxD. Note that the name is case submission sensitive. It is safest to always use upper case · Product in the DDB declaration and in the call to registration CreateFile. · Release notes 3. All handles to the VxD must be closed. The [Shop NuMega] · system maintains reference counts, so the VxD Buy it! does not unload until all handles are closed. · Price list 4. The VxD must handle control messsage · How to buy W32_DEVICEIOCONTROL, and must return · Sales offices DEVIOCTL_NOERROR (== 0) when the passed control code is DIOC_CLOSEHANDLE ( == -1). Failure to do this indicates to the operating system that the [Y2K Compliance] VxD did not expect to be closed, so it does not proceed with the unload. [More information] If you avoid the above errors, then a VxD that your application loads by calling CreateFile should automatically unload when you call CloseHandle, or when your application terminates. Back to technical tip start page. DriverCentral · DriverStudio · Free downloads · Resources · Support and Services · Shop NuMega Compuware NuMega · Tel: +1 603 578-8400 · Updated: 9 August 1999 · Problems? Contact our webmaster.