Hi all,
the DDk document say that "Do not use IoInitializeIrp to initialize the IRP
before its first use".
If I misuse IoInitializeIrp next to IoAllocateIrp will cause any problem ?
Is it possible to cause system crash ?

Re: Question about IoAllocateIrp and IoInitializeIrp by Doron

Doron
Mon Feb 06 23:02:29 CST 2006

you won't cause a crash, but when the irp is freed, it could be freed to the
wrong place.

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.


"SL" <slchang@sq.com.tw> wrote in message
news:OOZ9fq5KGHA.2276@TK2MSFTNGP15.phx.gbl...
> Hi all,
> the DDk document say that "Do not use IoInitializeIrp to initialize the
> IRP
> before its first use".
> If I misuse IoInitializeIrp next to IoAllocateIrp will cause any problem ?
> Is it possible to cause system crash ?
>
>



Re: Question about IoAllocateIrp and IoInitializeIrp by SL

SL
Tue Feb 07 00:05:06 CST 2006

Thanks your reply :)
So you mean there are two space be allocated, one is wasted and always
there.
There will not cause other problem except waste memory pool.



Re: Question about IoAllocateIrp and IoInitializeIrp by Doron

Doron
Tue Feb 07 00:11:36 CST 2006

it will get freed, the question is to where. the OS keeps a lookaside of
list of PIRPs, by initializing an allocated irp, you can clear the flags
that indicate where to free the irp back to. If you have an irp that you
allocated that you want to initialize, call IoReinitializeIrp.

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.


"SL" <slchang@sq.com.tw> wrote in message
news:OGJE1x6KGHA.1532@TK2MSFTNGP12.phx.gbl...
> Thanks your reply :)
> So you mean there are two space be allocated, one is wasted and always
> there.
> There will not cause other problem except waste memory pool.
>
>



Re: Question about IoAllocateIrp and IoInitializeIrp by SL

SL
Tue Feb 07 01:34:57 CST 2006

Sorry, I am confused.

Case a)
When I call IoAllocateIrp( ), OS allocate a memory pool A.
Than I call IoInitializeIrp( ) before first use irp, OS allocate another
memory pool B then lose the pointer to A ?
So after irp complete, B be free and A will not free.

Or,
Case b)
When I call IoAllocateIrp( ), OS allocate a memory pool A.
Than I call IoInitializeIrp( ) before first use irp, OS allocate another
memory pool B but lookaside table point to A ?
So after irp complete, A be free and B will not free.


If OS free something should not be free, is it possible crash because page
fault error ?




Re: Question about IoAllocateIrp and IoInitializeIrp by Maxim

Maxim
Tue Feb 07 20:06:04 CST 2006

I would forget IoInitializeIrp forever. Never had any need in this routine.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"SL" <slchang@sq.com.tw> wrote in message
news:OOZ9fq5KGHA.2276@TK2MSFTNGP15.phx.gbl...
> Hi all,
> the DDk document say that "Do not use IoInitializeIrp to initialize the IRP
> before its first use".
> If I misuse IoInitializeIrp next to IoAllocateIrp will cause any problem ?
> Is it possible to cause system crash ?
>
>


Re: Question about IoAllocateIrp and IoInitializeIrp by Alexander

Alexander
Tue Feb 07 23:10:29 CST 2006

I don't think there is any gain in reusing an IRP. It will involve some kind
of lookaside list, IoReinitializeIrp, that is same expenses as just
IoFreeIrp+IoAllocateIrp.

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:%23a$wiOFLGHA.1536@TK2MSFTNGP11.phx.gbl...
> I would forget IoInitializeIrp forever. Never had any need in this
> routine.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
> "SL" <slchang@sq.com.tw> wrote in message
> news:OOZ9fq5KGHA.2276@TK2MSFTNGP15.phx.gbl...
>> Hi all,
>> the DDk document say that "Do not use IoInitializeIrp to initialize the
>> IRP
>> before its first use".
>> If I misuse IoInitializeIrp next to IoAllocateIrp will cause any problem
>> ?
>> Is it possible to cause system crash ?
>>
>>
>



Re: Question about IoAllocateIrp and IoInitializeIrp by Doron

Doron
Tue Feb 07 23:57:23 CST 2006

not true. for instance if you are polling a device, you keep the irp around
until you get a pnp remove. look at the mouser example. it has one PIRP
which it allocates on start and in the completion routines, calls
IoReinitializeIrp, reformats the irp and resends it.

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.


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:uar%2373GLGHA.536@TK2MSFTNGP09.phx.gbl...
>I don't think there is any gain in reusing an IRP. It will involve some
>kind of lookaside list, IoReinitializeIrp, that is same expenses as just
>IoFreeIrp+IoAllocateIrp.
>
> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> news:%23a$wiOFLGHA.1536@TK2MSFTNGP11.phx.gbl...
>> I would forget IoInitializeIrp forever. Never had any need in this
>> routine.
>>
>> --
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> maxim@storagecraft.com
>> http://www.storagecraft.com
>>
>> "SL" <slchang@sq.com.tw> wrote in message
>> news:OOZ9fq5KGHA.2276@TK2MSFTNGP15.phx.gbl...
>>> Hi all,
>>> the DDk document say that "Do not use IoInitializeIrp to initialize the
>>> IRP
>>> before its first use".
>>> If I misuse IoInitializeIrp next to IoAllocateIrp will cause any problem
>>> ?
>>> Is it possible to cause system crash ?
>>>
>>>
>>
>
>



Re: Question about IoAllocateIrp and IoInitializeIrp by Doron

Doron
Tue Feb 07 23:58:24 CST 2006

IoInitializeIrp will not do any allocating, you pass it the memory that it
will initialize. IoInitializeIrp will clear out and not restore flags that
IoAllocateIrp sets. IoReinitializeIrp maintains these flags after the call.

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.


"SL" <slchang@sq.com.tw> wrote in message
news:%23gm8Ek7KGHA.516@TK2MSFTNGP15.phx.gbl...
> Sorry, I am confused.
>
> Case a)
> When I call IoAllocateIrp( ), OS allocate a memory pool A.
> Than I call IoInitializeIrp( ) before first use irp, OS allocate another
> memory pool B then lose the pointer to A ?
> So after irp complete, B be free and A will not free.
>
> Or,
> Case b)
> When I call IoAllocateIrp( ), OS allocate a memory pool A.
> Than I call IoInitializeIrp( ) before first use irp, OS allocate another
> memory pool B but lookaside table point to A ?
> So after irp complete, A be free and B will not free.
>
>
> If OS free something should not be free, is it possible crash because page
> fault error ?
>
>
>



Re: Question about IoAllocateIrp and IoInitializeIrp by SL

SL
Wed Feb 08 00:49:26 CST 2006

I can't find "IoReinitializeIrp" on MSDN website.
Do you mean "IoReuseIrp" or something else ?



Re: Question about IoAllocateIrp and IoInitializeIrp by Doron

Doron
Wed Feb 08 02:26:18 CST 2006

yes, IoReuseIrp,my mistake

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.


"SL" <slchang@sq.com.tw> wrote in message
news:OsdGSvHLGHA.3396@TK2MSFTNGP10.phx.gbl...
>I can't find "IoReinitializeIrp" on MSDN website.
> Do you mean "IoReuseIrp" or something else ?
>
>



Re: Question about IoAllocateIrp and IoInitializeIrp by Alexander

Alexander
Wed Feb 08 10:10:36 CST 2006

Does mouser do the polling that frequently that it justifies all the
troubles of keeping the IRP, vs allocating when needed and freing
immediately when done?

"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:uwqWJSHLGHA.4052@TK2MSFTNGP15.phx.gbl...
> not true. for instance if you are polling a device, you keep the irp
> around until you get a pnp remove. look at the mouser example. it has one
> PIRP which it allocates on start and in the completion routines, calls
> IoReinitializeIrp, reformats the irp and resends it.
>
> 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.
>
>
> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> news:uar%2373GLGHA.536@TK2MSFTNGP09.phx.gbl...
>>I don't think there is any gain in reusing an IRP. It will involve some
>>kind of lookaside list, IoReinitializeIrp, that is same expenses as just
>>IoFreeIrp+IoAllocateIrp.
>>
>> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
>> news:%23a$wiOFLGHA.1536@TK2MSFTNGP11.phx.gbl...
>>> I would forget IoInitializeIrp forever. Never had any need in this
>>> routine.
>>>
>>> --
>>> Maxim Shatskih, Windows DDK MVP
>>> StorageCraft Corporation
>>> maxim@storagecraft.com
>>> http://www.storagecraft.com
>>>
>>> "SL" <slchang@sq.com.tw> wrote in message
>>> news:OOZ9fq5KGHA.2276@TK2MSFTNGP15.phx.gbl...
>>>> Hi all,
>>>> the DDk document say that "Do not use IoInitializeIrp to initialize the
>>>> IRP
>>>> before its first use".
>>>> If I misuse IoInitializeIrp next to IoAllocateIrp will cause any
>>>> problem ?
>>>> Is it possible to cause system crash ?
>>>>
>>>>
>>>
>>
>>
>
>



Re: Question about IoAllocateIrp and IoInitializeIrp by Doron

Doron
Wed Feb 08 23:39:21 CST 2006

it is that frequent. a read always needs to be pending. there is alot less
trouble in keeping the same irp around vs freeing it. why? b/c allocating
can fail and what do you do then? have the mouse stop moving? fwd progress
is important, esp if you can preallocate all the resources you will ever
need during start device and then just them for the lifetime of the device.

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.


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:u$qlzoMLGHA.3496@TK2MSFTNGP14.phx.gbl...
> Does mouser do the polling that frequently that it justifies all the
> troubles of keeping the IRP, vs allocating when needed and freing
> immediately when done?
>
> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
> news:uwqWJSHLGHA.4052@TK2MSFTNGP15.phx.gbl...
>> not true. for instance if you are polling a device, you keep the irp
>> around until you get a pnp remove. look at the mouser example. it has
>> one PIRP which it allocates on start and in the completion routines,
>> calls IoReinitializeIrp, reformats the irp and resends it.
>>
>> 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.
>>
>>
>> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
>> news:uar%2373GLGHA.536@TK2MSFTNGP09.phx.gbl...
>>>I don't think there is any gain in reusing an IRP. It will involve some
>>>kind of lookaside list, IoReinitializeIrp, that is same expenses as just
>>>IoFreeIrp+IoAllocateIrp.
>>>
>>> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
>>> news:%23a$wiOFLGHA.1536@TK2MSFTNGP11.phx.gbl...
>>>> I would forget IoInitializeIrp forever. Never had any need in this
>>>> routine.
>>>>
>>>> --
>>>> Maxim Shatskih, Windows DDK MVP
>>>> StorageCraft Corporation
>>>> maxim@storagecraft.com
>>>> http://www.storagecraft.com
>>>>
>>>> "SL" <slchang@sq.com.tw> wrote in message
>>>> news:OOZ9fq5KGHA.2276@TK2MSFTNGP15.phx.gbl...
>>>>> Hi all,
>>>>> the DDk document say that "Do not use IoInitializeIrp to initialize
>>>>> the IRP
>>>>> before its first use".
>>>>> If I misuse IoInitializeIrp next to IoAllocateIrp will cause any
>>>>> problem ?
>>>>> Is it possible to cause system crash ?
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: Question about IoAllocateIrp and IoInitializeIrp by Alexander

Alexander
Thu Feb 09 10:03:19 CST 2006

Do you really need to call IoReuseIrp on IRP that's passed to your
completion routine and you just want to resubmit it?

"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:upLzusTLGHA.3944@tk2msftngp13.phx.gbl...
> it is that frequent. a read always needs to be pending. there is alot
> less trouble in keeping the same irp around vs freeing it. why? b/c
> allocating can fail and what do you do then? have the mouse stop moving?
> fwd progress is important, esp if you can preallocate all the resources
> you will ever need during start device and then just them for the lifetime
> of the device.
>
> 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.
>
>
> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> news:u$qlzoMLGHA.3496@TK2MSFTNGP14.phx.gbl...
>> Does mouser do the polling that frequently that it justifies all the
>> troubles of keeping the IRP, vs allocating when needed and freing
>> immediately when done?
>>
>> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
>> news:uwqWJSHLGHA.4052@TK2MSFTNGP15.phx.gbl...
>>> not true. for instance if you are polling a device, you keep the irp
>>> around until you get a pnp remove. look at the mouser example. it has
>>> one PIRP which it allocates on start and in the completion routines,
>>> calls IoReinitializeIrp, reformats the irp and resends it.
>>>
>>> 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.
>>>
>>>
>>> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
>>> news:uar%2373GLGHA.536@TK2MSFTNGP09.phx.gbl...
>>>>I don't think there is any gain in reusing an IRP. It will involve some
>>>>kind of lookaside list, IoReinitializeIrp, that is same expenses as just
>>>>IoFreeIrp+IoAllocateIrp.
>>>>
>>>> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
>>>> news:%23a$wiOFLGHA.1536@TK2MSFTNGP11.phx.gbl...
>>>>> I would forget IoInitializeIrp forever. Never had any need in this
>>>>> routine.
>>>>>
>>>>> --
>>>>> Maxim Shatskih, Windows DDK MVP
>>>>> StorageCraft Corporation
>>>>> maxim@storagecraft.com
>>>>> http://www.storagecraft.com
>>>>>
>>>>> "SL" <slchang@sq.com.tw> wrote in message
>>>>> news:OOZ9fq5KGHA.2276@TK2MSFTNGP15.phx.gbl...
>>>>>> Hi all,
>>>>>> the DDk document say that "Do not use IoInitializeIrp to initialize
>>>>>> the IRP
>>>>>> before its first use".
>>>>>> If I misuse IoInitializeIrp next to IoAllocateIrp will cause any
>>>>>> problem ?
>>>>>> Is it possible to cause system crash ?
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: Question about IoAllocateIrp and IoInitializeIrp by Doron

Doron
Fri Feb 10 00:34:57 CST 2006

yes. it is the most fool proof way to clear out the previous
status/information/cancel flag and reset the current stack location back to
the top. i don't see what the big deal is here. Instead of doing something
by hand, you have a tested and well documented call that does it which is
written by the folks who understand IRPs in and out.

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.


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:OZzQaJZLGHA.2276@TK2MSFTNGP15.phx.gbl...
> Do you really need to call IoReuseIrp on IRP that's passed to your
> completion routine and you just want to resubmit it?
>
> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
> news:upLzusTLGHA.3944@tk2msftngp13.phx.gbl...
>> it is that frequent. a read always needs to be pending. there is alot
>> less trouble in keeping the same irp around vs freeing it. why? b/c
>> allocating can fail and what do you do then? have the mouse stop moving?
>> fwd progress is important, esp if you can preallocate all the resources
>> you will ever need during start device and then just them for the
>> lifetime of the device.
>>
>> 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.
>>
>>
>> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
>> news:u$qlzoMLGHA.3496@TK2MSFTNGP14.phx.gbl...
>>> Does mouser do the polling that frequently that it justifies all the
>>> troubles of keeping the IRP, vs allocating when needed and freing
>>> immediately when done?
>>>
>>> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
>>> news:uwqWJSHLGHA.4052@TK2MSFTNGP15.phx.gbl...
>>>> not true. for instance if you are polling a device, you keep the irp
>>>> around until you get a pnp remove. look at the mouser example. it has
>>>> one PIRP which it allocates on start and in the completion routines,
>>>> calls IoReinitializeIrp, reformats the irp and resends it.
>>>>
>>>> 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.
>>>>
>>>>
>>>> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
>>>> news:uar%2373GLGHA.536@TK2MSFTNGP09.phx.gbl...
>>>>>I don't think there is any gain in reusing an IRP. It will involve some
>>>>>kind of lookaside list, IoReinitializeIrp, that is same expenses as
>>>>>just IoFreeIrp+IoAllocateIrp.
>>>>>
>>>>> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
>>>>> news:%23a$wiOFLGHA.1536@TK2MSFTNGP11.phx.gbl...
>>>>>> I would forget IoInitializeIrp forever. Never had any need in this
>>>>>> routine.
>>>>>>
>>>>>> --
>>>>>> Maxim Shatskih, Windows DDK MVP
>>>>>> StorageCraft Corporation
>>>>>> maxim@storagecraft.com
>>>>>> http://www.storagecraft.com
>>>>>>
>>>>>> "SL" <slchang@sq.com.tw> wrote in message
>>>>>> news:OOZ9fq5KGHA.2276@TK2MSFTNGP15.phx.gbl...
>>>>>>> Hi all,
>>>>>>> the DDk document say that "Do not use IoInitializeIrp to initialize
>>>>>>> the IRP
>>>>>>> before its first use".
>>>>>>> If I misuse IoInitializeIrp next to IoAllocateIrp will cause any
>>>>>>> problem ?
>>>>>>> Is it possible to cause system crash ?
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>