- Re: Sending IRP
- Posted by Don Burn on August 8th, 2003
The short answer is do not do this. Tell us what you are trying to achieve
and the group will be happy to give you suggestions.
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
"Ron" <ynon_r@yahoo.com.au> wrote in message
news:0b2201c35dc2$86a05940$a401280a@phx.gbl...
- Posted by Ron on August 9th, 2003
Thank you very much for your help,
There is a known problem with removable disks: when you
pull them out when windows reading or writing to them the
application that does that freeze. Microsoft has a
workaround: don't take out the removable disk when in use.
I am looking for an acceptable workaround for this
problem. I am using a USB disk device on a dual processor
machine. So when I take the disk out the application
freeze. When I take out physically the USB wire out, the
plug&play stop the disk driver and the application
unfreezes. I guess I want to impersonate the plug&play and
send the device removed IRP.
Thank you for your time.
Ron
- Posted by Doron Holan [MS] on August 9th, 2003
you can't do this. you must let the pnp manager manage the state of the
device. the problem you are referring to is by design.
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ron" <ynon_r@yahoo.com.au> wrote in message
news:04f101c35e45$54c07800$a601280a@phx.gbl...
- Posted by Ron on August 11th, 2003
Hey Doron,
Do you know of a way to send IRP's to drivers. there has
to be an acceptable way to do this, regardless the PNP
IRPs issue.
thanks,
Ron.
- Posted by Gary G. Little on August 11th, 2003
Oh my goo'ness ...
There are all KINDS of ways to send IRPs to drivers. In user mode you do
CreateFile, ReadFile, WriteFile, DeviceIoControl and CloseHandle. In kernel
mode you attach to a driver, get its object pointer and then do
IoCallDriver. You can also create your own using the IoBuildXxxxIrp calls,
and you may always use Spread/Write calls.
Yes ... there be LOTS of ways to send IRPs to drivers.
--
Gary G. Little
Seagate Technologies, LLC
gary.g.little@seagate.com
"Ron" <ynon_r@yahoo.com.au> wrote in message
news:00ed01c3602f$4a4cc360$a401280a@phx.gbl...
- Posted by Nick Ryan on August 11th, 2003
Of course there are ways to send IRPs to drivers. There are APIs to get
device object and file object pointers from device interfaces and
symbolic links. There are also APIs to allocate IRPs and even to request
new power IRPs. You can even call KeBugCheckEx to bugcheck the system.
What Doran is trying to tell you is that just because you have a car and
a full tank of gas doesn't mean you should be driving off cliffs.
Ron wrote:
--
- Nick Ryan (MVP for DDK)
- Posted by Doron Holan [MS] on August 12th, 2003
you can send almost any irp you want to the stack as long as you format it
properly. there are some pnp irp which you can send yourself (query device
caps) and there are some which you cannot (namely state change pnp irps ...
start, stop, query stop / remove, remove, query device relations).
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ron" <ynon_r@yahoo.com.au> wrote in message
news:00ed01c3602f$4a4cc360$a401280a@phx.gbl...
- Posted by ron on August 12th, 2003
OK,
user-mode is understood and straight forward.
From kernel, how do i get the device object, how
to "attach" to a driver???
And i don't get "you may always use Spread/Write calls."
thanks for your time,
Ron.
- Posted by ron on August 12th, 2003
Hey,
The goal is obvious not to bugcheck the system, but to
gracefully unlock a process that stalls when removable
disk ejected while in use.
What APIs I can use to get a Device Object and File
objects.
thanks,
Ron.
- Posted by Gary G. Little on August 12th, 2003
That should have been ZwRead/Write calls.
From the question I take it you have not read the pertinent aspects of the
DDK nor looked at the examples in the DDK. This is fairly well spelled out
in the DDK documentation and examples, as well as most any text on the
subject. Have you not read any of those? If not I would suggest you do so.
<sigh> Do a search in the online docs for IoBuild and look at the two
functions you find there to build IRPs, and then have a gander at
IoGetDeviceObjectPointer and IoAttachToDeviceStack.
--
Gary G. Little
Seagate Technologies, LLC
gary.g.little@seagate.com
"ron" <ynon_r@yahoo.com.au> wrote in message
news:105301c360f0$df6ff5e0$a601280a@phx.gbl...
- Posted by Doron Holan [MS] on August 13th, 2003
you cannot do what you want (gracefully unlock the process). you cannot
overcome a feature designed into the OS.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"ron" <ynon_r@yahoo.com.au> wrote in message
news:0ae701c360f2$7d0e09d0$a001280a@phx.gbl...
- Posted by Doron Holan [MS] on August 13th, 2003
you do not need to attach to a device object to send irps to it. opening up
the deivce object is usually all that is needed to send it I/O requests.
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"ron" <ynon_r@yahoo.com.au> wrote in message
news:105301c360f0$df6ff5e0$a601280a@phx.gbl...
- Posted by Alexander Grigoriev on August 13th, 2003
Obviously, USBSTOR.SYS driver fails to complete read/write operation (with
failure) on USB data/device not ready error (which occurs on unplug). It's
not by design, it's a bug (or by design flaw, if you like).
Properly designed driver should fail its operations if the hardware
disappears.
"Doron Holan [MS]" <doronh@online.microsoft.com> wrote in message
news:uhGTO$VYDHA.3232@tk2msftngp13.phx.gbl...