Hi,

I am writing an upper layer function driver, this driver should be
compatible with WinXP and with Win2K ( No service pack ), the driver is
created as exclusive and is loaded and unloaded dynamically by a custom
user-mode app ( the app loads it upon startup and unloads it during
termination ), running the driver on WinXP works smoothly BUT running it on
Win2K ( No SP ) result problems:

On first run every thing works fine, BUT, on the second run, driver startup
( StartService ) fails with "The system cannot find the specified file"
although the file wasn't deleted or changed and it's corresponding registry
entry is valid: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\%My Driver
Name%
ImagePath = \??\C:\SETSDriver.sys
I have used SoftIce to verify the on the initial run the driver unloads
successfuly, I have set a break point at the drivers Unload callback, and
indeed, the driver was successfuly unloaded...

I have also tried using NuMegas DriverMonitor to load and re-load my driver
and go the same results, first run succeeds, the second failâ?¦.

What may cause this problem?

Why does it works fine with WinXP while it fail with Win2K? What WinXP does
differently then Win2k [???]

Any help pointer or remark would be appreciated.

--
Nadav
http://www.sophin.com

Re: Win2K Driver re-loading problem... by Eliyas

Eliyas
Sun Sep 11 11:50:52 CDT 2005

Try the cancel sample from the DDK and see if you see the same problem. If
that sample works fine on Win2K and XP, then study the app and see how it
loads and unloads the driver. The key is that you should close the handle to
device before you make an attempt to stop the service.

--
--
-Eliyas
This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.microsoft.com/whdc/driver/default.mspx
http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx



Re: Win2K Driver re-loading problem... by Nadav

Nadav
Mon Sep 12 00:49:01 CDT 2005

Hi Eliyas,

Thanks for your immediate response, Indeed the cancel DDK sample works fine
on Win2K, this imply that the problem is with my driver, Still, it seem
strange that my driver unloads ( it's DriverUnload callback is being executed
) and cannot be re-loaded, I have used SoftIce to browse the loaded modules
list AND, apparently, AFTER the driver was unloaded the module doesn't get
unloaded, hence, the module table still reference it, I guess 'someone' still
reference the FILE_OBJECT of the module... I wonder, are there any tools
methodologies other then reviewing the code that I can use to find out
'why'/'who' is holding a reference to the drivers module?

Any help would be appreciated.
--
Nadav
http://www.sophin.com


"Eliyas Yakub [MSFT]" wrote:

> Try the cancel sample from the DDK and see if you see the same problem. If
> that sample works fine on Win2K and XP, then study the app and see how it
> loads and unloads the driver. The key is that you should close the handle to
> device before you make an attempt to stop the service.
>
> --
> --
> -Eliyas
> This posting is provided "AS IS" with no warranties, and confers no rights.
> http://www.microsoft.com/whdc/driver/default.mspx
> http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx
>
>
>

Re: Win2K Driver re-loading problem... by Nadav

Nadav
Mon Sep 12 01:02:05 CDT 2005

Problem resolved, I had a name mismatch while deleting the symbolic-link of
the driver during driver unload ( lower-case letter instade of an upper case
letter ), this apparently caused the module to stay referenced...
--
Nadav
http://www.sophin.com


"Eliyas Yakub [MSFT]" wrote:

> Try the cancel sample from the DDK and see if you see the same problem. If
> that sample works fine on Win2K and XP, then study the app and see how it
> loads and unloads the driver. The key is that you should close the handle to
> device before you make an attempt to stop the service.
>
> --
> --
> -Eliyas
> This posting is provided "AS IS" with no warranties, and confers no rights.
> http://www.microsoft.com/whdc/driver/default.mspx
> http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx
>
>
>