General Questions for WDM

hi,
I am a newbie of WDM and finding it very hard.I have some basic questions
about WDM.
1)Is drivers much more faster than user mode application?
2)let i am using a function in my driver which only exist in XP,and then i
run the driver in windows98,what will happen?BSOD?
3)Memory leaks are there in drivers?If yes,how to detect them?
4)if i made a buggy driver and run it as a boot driver and after opening xp
always a BSOD,then i to remove that driver??
5)if it is possible to not get BSOD if the driver is buggy or any settings
in Windows for it?I am sick of BSOD.

these are some of the questions i cant find answer on net.please give the
answers??
thanks.

-Dheeraj Patni
Live and let Live

  1. No
  2. It won’t load
  3. Yes. The answer is complicated, but basically you use a combination of
    prefast, verifier and windbg.
  4. I’m not entirely sure what you’re asking, but I think that the answer is
    either boot to last known good or safe mode.
  5. Either fix your driver or uninstall it.

Good luck,

Mm

On Sep 8, 2010 11:25 PM, “Dheeraj Patni” wrote:
> hi,
> I am a newbie of WDM and finding it very hard.I have some basic questions
> about WDM.
> 1)Is drivers much more faster than user mode application?
> 2)let i am using a function in my driver which only exist in XP,and then i
> run the driver in windows98,what will happen?BSOD?
> 3)Memory leaks are there in drivers?If yes,how to detect them?
> 4)if i made a buggy driver and run it as a boot driver and after opening
xp
> always a BSOD,then i to remove that driver??
> 5)if it is possible to not get BSOD if the driver is buggy or any settings
> in Windows for it?I am sick of BSOD.
>
> these are some of the questions i cant find answer on net.please give the
> answers??
> thanks.
> –
> -Dheeraj Patni
> Live and let Live
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

3 if the function only exists inXP, it will not load on win98. Why do you care about win98 though? It has almost no market share and is very obsolete.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of MARTIN OBRIEN
Sent: Wednesday, September 08, 2010 8:33 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] General Questions for WDM

  1. No
  2. It won’t load
  3. Yes. The answer is complicated, but basically you use a combination of prefast, verifier and windbg.
  4. I’m not entirely sure what you’re asking, but I think that the answer is either boot to last known good or safe mode.
  5. Either fix your driver or uninstall it.

Good luck,

Mm

On Sep 8, 2010 11:25 PM, “Dheeraj Patni” > wrote:
> hi,
> I am a newbie of WDM and finding it very hard.I have some basic questions
> about WDM.
> 1)Is drivers much more faster than user mode application?
> 2)let i am using a function in my driver which only exist in XP,and then i
> run the driver in windows98,what will happen?BSOD?
> 3)Memory leaks are there in drivers?If yes,how to detect them?
> 4)if i made a buggy driver and run it as a boot driver and after opening xp
> always a BSOD,then i to remove that driver??
> 5)if it is possible to not get BSOD if the driver is buggy or any settings
> in Windows for it?I am sick of BSOD.
>
> these are some of the questions i cant find answer on net.please give the
> answers??
> thanks.
> –
> -Dheeraj Patni
> Live and let Live
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

> Why do you care about win98 though? It has almost no market share

and is very obsolete.

Chip and OS developers tend to forget there are a lot of “in-device
black box” applications for their stuff. This could be one reason.

When our company drops support for Win98SE and WinME, we might be able
to use WinUSB or KMDF. Looking forward to it.

By the way, will there be “transparent” USB3 support in Windows soon?

What do you mean by transparent (not that I can answer your question about a usb3 timeline since that would come from official channels, not me)?

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Hagen Patzke
Sent: Thursday, September 09, 2010 12:09 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] General Questions for WDM

Why do you care about win98 though? It has almost no market share
and is very obsolete.

Chip and OS developers tend to forget there are a lot of “in-device
black box” applications for their stuff. This could be one reason.

When our company drops support for Win98SE and WinME, we might be able
to use WinUSB or KMDF. Looking forward to it.

By the way, will there be “transparent” USB3 support in Windows soon?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

[Transparent Windows USB3 support anytime soon?]

What do you mean by transparent ?

Microsoft provides an abstraction for USB1.x and 2.0. I.e. for our (WDM)
driver we don’t need to care which USB bus type the device is currently
using. (Actually it required some extra work to find out.)

From your answer to an OP post I recall that for querying USB3
descriptors OP has to use some method provided by the third party USB3
host interface card driver. (We use vendor-specific string descriptors,
that’s why this caught my attention, and made me worry.)

=> “Transparent USB3 support” to me means we would not need to change
our (BulkUSB derived) driver once our devices get an USB3 interface.
(At least not as long as no other special USB3 feature is used.)

Many thanks for your time, Doron!

(not that I can answer your question about a usb3 timeline since that
would come from official channels, not me)

(Possibly an official answer is already out but I overlooked it. Then
many thanks for a pointer to it or for filling me in.)

>1)Is drivers much more faster than user mode application?

Not at all. The CPU has the same speed.

2)let i am using a function in my driver which only exist in XP,and then i run the driver in
windows98,what will happen?BSOD?

Driver load failure.

I don’t know how Win98 handles this (I think this OS is 6 years dead and thus several years not interesting as a commercial development target), but, in NT, this all depends on Start and ErrorControl SC database values.

Can be anything from boot failure (even with automatic boot of the recovery console as 2008 R2 does) down to a small error message.

PnP devices serviced by the driver will be shown as “having problems” in the device manager, and not actually work.

3)Memory leaks are there in drivers?If yes,how to detect them?

Yes, there can be ones.

poolmon.exe tool from the WDK, or !poolused command in WinDbg are used to track memory leaks. The Tag parameter for ExAllocatePoolWithTag serves the same purpose, and Verifier also can check for leaks on driver unload (if the driver is unloadable).

4)if i made a buggy driver and run it as a boot driver and after opening xp always a BSOD,then i to
remove that driver??

Yes.

5)if it is possible to not get BSOD if the driver is buggy or any settings in Windows for it?

No. You can only change the BSOD to automatic reboot, and become sick of automatic reboots.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

4)if i made a buggy driver and run it as a boot driver and after opening xp
always a BSOD,then i to remove that driver??

You should always create a restoration point if u are playing around with boot driver. There is another approach, you can boot the XP disk and repair or use a WinPE and boot from USB pen driver or CD and mount the system drive and delete the driver binary maunally in %system drive%\WINDOWS\system32\drivers.

>> 2)let i am using a function in my driver which only exist in XP,and

> then i run the driver in windows98,what will happen? BSOD?

On 09/09/2010 02:03 PM, Maxim S. Shatskih wrote:

Driver load failure.

I don’t know how Win98 handles this […]

If a driver has imports that can not all be matched (to kernel exports),
driver load fails. Unfortunately (on W9x) without telling you why

To solve this problem, Walter Oney (a) made WDMSTUB.SYS that adds stubs
for the missing WDM calls to the W95/W98SE kernel tables, and (b)
made WdmCheck to check the import table of your driver.

WDMSTUB.SYS and WdmCheck(?) are distributed on the CD that is part of
“the Oney book”[1], updates are available on http://www.oneysoft.com/.

Note that any re-distribution of WDMSTUB.SYS requires his permission.

From WinME on the WDM system is in place. In all my tests, however,
WDMSTUB.SYS was also installed for WinME: looks like it is not possible
to distinguish between Win95/Win98SE and WinME in an INF file (and get
this actually honored by the installer).

[ExAllocatePoolWithTag]

From WinXP, there is also “deallocation with tag”.
This, however, is not available on W95/W98SE and WinME.

=> To make a BulkUSB-derived driver that works on everything from W98SE
up to Win7, I needed to replace the deallocation with tag call (only
this one) with the non-tag-using one (which was used in earlier WDKs).


[1] Walter Oney: “Programming the Microsoft Windows Driver Model”.

>> [ExAllocatePoolWithTag]

From WinXP, there is also “deallocation with tag”.

I think this was before XP, just not documented, and is only used if the senior bit in the tag is set.

The allocation with such a tag mandate ExFreePoolWithTag with the same tag, and will BSOD otherwise.

I think Ob allocates its objects this way.

For other allocations, the usual ExFreePool is OK.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com