Hello Yatindra,
You are correct, but it just leads to more questions.
From the help:
Exclusive
Reserved for system use. Drivers set this parameter to FALSE.
So, why would the author set this to True?
On a related note, once I tried this code using FALSE, it worked until I
got this sequence:
Ch 7 Driver - DispatchCreate
Ch 7 Driver - DispatchCreate
Ch 7 Driver - DispatchWrite
Ch 7 Driver - DispatchWrite
Ch 7 Driver - DispatchRead
Ch 7 Driver - DispatchClose
Ch 7 Driver - DispatchRead
The error seemed that it tried to free the buffer twice. You can see that
it tried to do a read twice without an interleaving write.
Here is the stack trace:
BAD_POOL_CALLER (c2)
The current thread is making a bad pool request. Typically this is at a
bad IRQL level or double freeing the same allocation, etc.
Arguments:
Arg1: 00000040, Attempt to free usermode address to kernel pool
Arg2: 00000000, Starting address
Arg3: 80000000, Start of system address space
Arg4: 00000000, 0
Debugging Details:
***** Kernel symbols are WRONG. Please fix symbols to do analysis.
DEFAULT_BUCKET_ID: DRIVER_FAULT
BUGCHECK_STR: 0xC2
LAST_CONTROL_TRANSFER: from 805008cb to 8052a488
STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be
wrong.
bed6d810 805008cb 00000003 00000000 8054a740
nt!DbgBreakPointWithStatus+0x4
bed6db9c 8054049a 000000c2 00000040 00000000 nt!KeBugCheckEx+0x169
bed6dbd8 8053f43a 00000000 81f3f7a8 00000000 nt!ExFreePoolWithTag+0x1134
bed6dc04 8053f2e2 00000000 00000000 eb970825 nt!ExFreePoolWithTag+0xd4
bed6dc3c 804f3b8b 81efdc70 81e15108 81e15108 nt!ExFreePool+0xb
bed6dc64 8056d71b 81efdc70 81e15108 81f3c708
nt!IoBuildSynchronousFsdRequest+0x8f
bed6dd38 80539691 000003d4 00000000 00000000 nt!NtReadFile+0x364
bed6dd64 00000000 00000000 00000000 00000000
nt!ExReleaseResourceForThread+0xbd5
So, I wonder if there is a way to keep track of the buffers? Any hints?
Anything I should look at? I’m thinking I should pass an id in for the
write and then pass
an id in for the read. The read only returns buffers associated with the
write and only free’s the same buffer.
JD
“yatindra vaishnav”
Sent by: xxxxx@lists.osr.com
01/20/2004 07:11 AM
Please respond to “Windows System Software Devs Interest List”
To: “Windows System Software Devs Interest List”
cc:
Subject: RE: [ntdev] failure to get a file handle when
multiple user programs involved.
Hi John,
you are setting the execlusive flag of “IoCreateDevice” as TRUE, because
of that you are gettin the problem of not opening the multiple handles to
the same device. Just set it as FALSE u will get the success in opening
device handle and all.
Good Luck,
>From: John F Davis
>Reply-To: “Windows System Software Devs Interest List”
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] failure to get a file handle when multiple user programs
involved.
>Date: Mon, 19 Jan 2004 17:59:04 -0500
>
>Hello
>
>I am reading “The windows 2000 Device Driver Book” by Art Baker and Jerry
>Lozano. I am at the point where I have built the loopback driver and I
>have installed it on my target machine. I also have a host machine which
>allows me to run WinDbg so that I can get DbgPrint output from the
driver.
> Everything works ok when I run one copy of the user land test program.
It
>writes a buffer to the device driver and then reads back the same buffer.
>
>However, when I more than one copy of the user land test program
>simulataneously, I often get “Failed to obtain file handle to Device:
LBK1
>with Win32 error code: 5” which corresponds to Access is Denied. This is
>generated when the test program attempts to CreateFile the device.
>
>By default, the test code has the CreateFile share mode parameter set to
>0. I added SHARE_READ | SHARE_WRITE but it still fails with this error
>code. Any idea how to fix this? I’m only trying to read/write
>simulataneosly because his book says that is a good test.
>
>JD
>
>—
>Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
Marriage? Join BharatMatrimony.com and get married. —
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: johndavi@us.ibm.com
To unsubscribe send a blank email to xxxxx@lists.osr.com