I have captured my driver's KdPrints:
00000000 0.00000000 PCIDEMO - Enter DispatchCreate: DeviceObject
825918E0
00000001 0.00018913 PCIDEMO - Enter DispatchClose: DeviceObject
825918E0
00000002 0.00021008 PCIDEMO - Exit DispatchClose

that is in reponse to my Usermode program:
main()
{
..
CreateFile(..);
WriteFile(...);
ReadFile(..);
}

my question is why does Windows didn't called my DispatchRead or
DispatchWrite
in reponse to ReadFile/WriteFile?

the fact that i have made a dispactch routine for IRP_MJ_READ and
IRP_MJ_WRITE:

NTSTATUS DispatchRead (IN PDEVICE_OBJECT device, IN PIRP Irp)
{
KdPrint((DRIVERNAME" - Enter DispatchRead: DeviceObject %8.8lX\n",
device));
KdPrint((DRIVERNAME" - Exit DispatchRead: DeviceObject %8.8lX\n",
device));
return STATUS_SUCCESS;
}
NTSTATUS DispatchRead (IN PDEVICE_OBJECT device, IN PIRP Irp)
{
KdPrint((DRIVERNAME" - Enter DispatchWrite: DeviceObject %8.8lX\n",
device));
KdPrint((DRIVERNAME" - Exit DispatchWrite: DeviceObject %8.8lX\n",
device));
return STATUS_SUCCESS;
}

i made it just like that just to test if DispatchRead/DispatchRead is
really called

what could be wrong with this?

Re: IRP_MJ_CREATE question by Doron

Doron
Wed Jan 04 10:06:22 CST 2006

did you assign these functions to the dispatch table? btw, when printing
pointer values in KdPrint, use %p, not %x. did you return STATUS_SUCCESS
from DispatchCreate? did CreateFile return a valid handle?

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"krby_xtrm" <kerby.martino@gmail.com> wrote in message
news:1136385661.304886.137260@z14g2000cwz.googlegroups.com...
>I have captured my driver's KdPrints:
> 00000000 0.00000000 PCIDEMO - Enter DispatchCreate: DeviceObject
> 825918E0
> 00000001 0.00018913 PCIDEMO - Enter DispatchClose: DeviceObject
> 825918E0
> 00000002 0.00021008 PCIDEMO - Exit DispatchClose
>
> that is in reponse to my Usermode program:
> main()
> {
> ..
> CreateFile(..);
> WriteFile(...);
> ReadFile(..);
> }
>
> my question is why does Windows didn't called my DispatchRead or
> DispatchWrite
> in reponse to ReadFile/WriteFile?
>
> the fact that i have made a dispactch routine for IRP_MJ_READ and
> IRP_MJ_WRITE:
>
> NTSTATUS DispatchRead (IN PDEVICE_OBJECT device, IN PIRP Irp)
> {
> KdPrint((DRIVERNAME" - Enter DispatchRead: DeviceObject %8.8lX\n",
> device));
> KdPrint((DRIVERNAME" - Exit DispatchRead: DeviceObject %8.8lX\n",
> device));
> return STATUS_SUCCESS;
> }
> NTSTATUS DispatchRead (IN PDEVICE_OBJECT device, IN PIRP Irp)
> {
> KdPrint((DRIVERNAME" - Enter DispatchWrite: DeviceObject %8.8lX\n",
> device));
> KdPrint((DRIVERNAME" - Exit DispatchWrite: DeviceObject %8.8lX\n",
> device));
> return STATUS_SUCCESS;
> }
>
> i made it just like that just to test if DispatchRead/DispatchRead is
> really called
>
> what could be wrong with this?
>



Re: IRP_MJ_CREATE question by krby_xtrm

krby_xtrm
Wed Jan 04 13:56:23 CST 2006

i assign it in the DriverEntry.
DriverObject->MajorFunction[IRP_MJ_READ] = DispatchRead;

in my usermode application i have there
if (hDevice == INVALID_HANDLE_VALUE){
MessageBox(NULL, "INVALID_HANDLE_VALUE", "error", MB_ICONERROR);
}
what could be wrong with this, and is it that IRP_MJ_CREATE is always
immediately followed by IRP_MJ_CLOSE?
as the results show?