Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > help - added IRP_MJ_READ to toaster sample....bluescreen.

Reply
Thread Tools Display Modes

help - added IRP_MJ_READ to toaster sample....bluescreen.

 
 
unclepauly
Guest
Posts: n/a

 
      06-08-2010
hello,

i am making an upper filter for the disk class. i am using the toaster
sample from WDK v7600 found here:

C:\WinDDK\7600.16385.1\src\general\toaster\wdm\fil ter\clasupper


i am using a windows 7 checked build environment. i built the toaster sample
and put the driver on a windows 7 laptop. i added the service in the
registry, and set the UpperFilters reg key on the DiskDrive class. i rebooted
and everything was fine.

then, i added the IRP_MJ_READ to the sample and rebuilt - and now it
bluescreens on startup.

to explain exactly what i have done:

1) in filter.h, where all the declarations for __drv_dispatchType are, i
added:

__drv_dispatchType(IRP_MJ_READ)

2) then in DriverEntry i just added the IRP_MJ_READ bit:

DriverObject->MajorFunction[IRP_MJ_READ] =
DriverObject->MajorFunction[IRP_MJ_CREATE] =
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = FilterDispatchIo;


thats all ive done. FilterDispatchIo is already in the sample, it does this
check:

if (commonData->Type == DEVICE_TYPE_FIDO)
{
return FilterPass(DeviceObject, Irp);
}
else
{
ASSERT(commonData->Type == DEVICE_TYPE_CDO);
//.....do the control object stuff here.....//
}

where FilterPass just does:

IoSkipCurrentIrpStackLocation (Irp);
status = IoCallDriver (deviceExtension->NextLowerDriver, Irp);


the above change works fine on xp, its just windows 7 that bluescreens
(haven't tried vista). but im sure this is some novice mistake. can anyone
tell me what ive done wrong please ?

thank you.
 
Reply With Quote
 
 
 
 
unclepauly
Guest
Posts: n/a

 
      06-08-2010
well i found the problem, purely by luck. i was looking at the diskperf
sample and noticed that the read/write handler was not in the "alloc_text"
section. so i thought it might be something to do with paging...

i was sending IRP_MJ_READ and IRP_MJ_WRITE through FilterDispatchIo, but
FilterDispatchIo has the PAGE_CODE macro at the top. so i wrote another
handler that was the same as FilterDispatchIo (i called it FilterReadWrite)
but did not have this macro. and now it works. so it looks like READ and
WRITE handlers cannot have the PAGED_CODE macro...maybe this will help some
other beginner in the furture...


"unclepauly" wrote:

> hello,
>
> i am making an upper filter for the disk class. i am using the toaster
> sample from WDK v7600 found here:
>
> C:\WinDDK\7600.16385.1\src\general\toaster\wdm\fil ter\clasupper
>
>
> i am using a windows 7 checked build environment. i built the toaster sample
> and put the driver on a windows 7 laptop. i added the service in the
> registry, and set the UpperFilters reg key on the DiskDrive class. i rebooted
> and everything was fine.
>
> then, i added the IRP_MJ_READ to the sample and rebuilt - and now it
> bluescreens on startup.
>
> to explain exactly what i have done:
>
> 1) in filter.h, where all the declarations for __drv_dispatchType are, i
> added:
>
> __drv_dispatchType(IRP_MJ_READ)
>
> 2) then in DriverEntry i just added the IRP_MJ_READ bit:
>
> DriverObject->MajorFunction[IRP_MJ_READ] =
> DriverObject->MajorFunction[IRP_MJ_CREATE] =
> DriverObject->MajorFunction[IRP_MJ_CLOSE] =
> DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
> DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = FilterDispatchIo;
>
>
> thats all ive done. FilterDispatchIo is already in the sample, it does this
> check:
>
> if (commonData->Type == DEVICE_TYPE_FIDO)
> {
> return FilterPass(DeviceObject, Irp);
> }
> else
> {
> ASSERT(commonData->Type == DEVICE_TYPE_CDO);
> //.....do the control object stuff here.....//
> }
>
> where FilterPass just does:
>
> IoSkipCurrentIrpStackLocation (Irp);
> status = IoCallDriver (deviceExtension->NextLowerDriver, Irp);
>
>
> the above change works fine on xp, its just windows 7 that bluescreens
> (haven't tried vista). but im sure this is some novice mistake. can anyone
> tell me what ive done wrong please ?
>
> thank you.

 
Reply With Quote
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      06-08-2010
read/write in the storage stack can come in at dispatch_level, but that is
not a general statement across all driver stacks.

d

"unclepauly" wrote in message
news:7DEF0CE6-FFD2-4E31-967C-...

well i found the problem, purely by luck. i was looking at the diskperf
sample and noticed that the read/write handler was not in the "alloc_text"
section. so i thought it might be something to do with paging...

i was sending IRP_MJ_READ and IRP_MJ_WRITE through FilterDispatchIo, but
FilterDispatchIo has the PAGE_CODE macro at the top. so i wrote another
handler that was the same as FilterDispatchIo (i called it FilterReadWrite)
but did not have this macro. and now it works. so it looks like READ and
WRITE handlers cannot have the PAGED_CODE macro...maybe this will help some
other beginner in the furture...


"unclepauly" wrote:

> hello,
>
> i am making an upper filter for the disk class. i am using the toaster
> sample from WDK v7600 found here:
>
> C:\WinDDK\7600.16385.1\src\general\toaster\wdm\fil ter\clasupper
>
>
> i am using a windows 7 checked build environment. i built the toaster
> sample
> and put the driver on a windows 7 laptop. i added the service in the
> registry, and set the UpperFilters reg key on the DiskDrive class. i
> rebooted
> and everything was fine.
>
> then, i added the IRP_MJ_READ to the sample and rebuilt - and now it
> bluescreens on startup.
>
> to explain exactly what i have done:
>
> 1) in filter.h, where all the declarations for __drv_dispatchType are, i
> added:
>
> __drv_dispatchType(IRP_MJ_READ)
>
> 2) then in DriverEntry i just added the IRP_MJ_READ bit:
>
> DriverObject->MajorFunction[IRP_MJ_READ] =
> DriverObject->MajorFunction[IRP_MJ_CREATE] =
> DriverObject->MajorFunction[IRP_MJ_CLOSE] =
> DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
> DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = FilterDispatchIo;
>
>
> thats all ive done. FilterDispatchIo is already in the sample, it does
> this
> check:
>
> if (commonData->Type == DEVICE_TYPE_FIDO)
> {
> return FilterPass(DeviceObject, Irp);
> }
> else
> {
> ASSERT(commonData->Type == DEVICE_TYPE_CDO);
> //.....do the control object stuff here.....//
> }
>
> where FilterPass just does:
>
> IoSkipCurrentIrpStackLocation (Irp);
> status = IoCallDriver (deviceExtension->NextLowerDriver, Irp);
>
>
> the above change works fine on xp, its just windows 7 that bluescreens
> (haven't tried vista). but im sure this is some novice mistake. can anyone
> tell me what ive done wrong please ?
>
> thank you.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows update problem. Clueless Clueless.MG Windows Update 3 05-28-2010 07:10 PM
Problem in installing sample Toaster Function driver on Windows 7 Vikrant Malushte Windows Vista Drivers 1 05-15-2010 10:39 PM
2nd Domain in a 2 domain forest cannot be contacted David Alge DNS Server 30 01-21-2010 05:26 AM
Error code 0x80071A30 Anjomaba Windows Update 8 11-13-2009 10:59 PM
Windows Media Player (11) is not installed properly. Reinstall... Godenjoyer Windows Media Player 19 10-28-2009 10:50 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59