Hello,
I allocate memory in AddDevice routine. Is IRP_MN_STOP_DEVICE the right place to free allocated memory there?
Jan Halama
Hello,
I allocate memory in AddDevice routine. Is IRP_MN_STOP_DEVICE the right place to free allocated memory there?
Jan Halama
Typically I use the following pairings, i.e. x/y where allocate in x free in
y
DriverEntry / unload routine
AddDevice / IRP_MN_REMOVE_DEVICE
IRP_MN_START_DEVICE / IRP_MN_STOP_DEVICE
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
“Jan Halama” wrote in message news:xxxxx@ntdev…
Hello,
I allocate memory in AddDevice routine. Is IRP_MN_STOP_DEVICE the right
place to free allocated memory there?
Jan Halama
Since start does so many things, it is usually a one to many relation
ship
IRP_MN_START_DEVICE/IRP_MN_STOP_DEVICE
IRP_MN_START_DEVICE/IRP_MN_REMOVE_DEVICE
IRP_MN_START_DEVICE/IRP_MN_SURPRISE_DEVICE
If you fail AddDevice, a IRP_MN_REMOVE_DEVICE will be sent to your
device (if a device was created *AND* attached to the stack).
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Friday, January 07, 2005 5:57 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] cleanup after AddDevice
Typically I use the following pairings, i.e. x/y where allocate in x
free in
y
DriverEntry / unload routine
AddDevice / IRP_MN_REMOVE_DEVICE
IRP_MN_START_DEVICE / IRP_MN_STOP_DEVICE
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
“Jan Halama” wrote in message news:xxxxx@ntdev…
Hello,
I allocate memory in AddDevice routine. Is IRP_MN_STOP_DEVICE the right
place to free allocated memory there?
Jan Halama
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
No, REMOVE_DEVICE is a proper place.
Forget about STOP_DEVICE, it is insignificant, its goal is resource rebalancing only. In STOP state, the driver ceases to touch the hardware, but retains all else. After a new START occurs, the driver re-picks the hardware addresses and resumes to work.
Most stacks will never ever saw a STOP IRP.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Jan Halama
To: Windows System Software Devs Interest List
Sent: Friday, January 07, 2005 4:13 PM
Subject: [ntdev] cleanup after AddDevice
Hello,
I allocate memory in AddDevice routine. Is IRP_MN_STOP_DEVICE the right place to free allocated memory there?
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
But you must release all the hardware resources in STOP processing
(including unmapping device BAR space). I would code this so that both STOP
and REMOVE processing free the resources for the device (and REMOVE also
deletes the FDO).
Oh and there definitely are platforms where this will be seen (any one that
support hot plug for example - e.g. laptops & fault tolerant systems)
/simgr
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Saturday, January 08, 2005 1:25 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] cleanup after AddDevice
No, REMOVE_DEVICE is a proper place.
Forget about STOP_DEVICE, it is insignificant, its goal is resource
rebalancing only. In STOP state, the driver ceases to touch the hardware,
but retains all else. After a new START occurs, the driver re-picks the
hardware addresses and resumes to work.
Most stacks will never ever saw a STOP IRP.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com mailto:xxxxx
http://www.storagecraft.com http:
----- Original Message -----
From: Jan mailto:xxxxx Halama
To: Windows System Software Devs Interest mailto:xxxxx List
Sent: Friday, January 07, 2005 4:13 PM
Subject: [ntdev] cleanup after AddDevice
Hello,
I allocate memory in AddDevice routine. Is IRP_MN_STOP_DEVICE the right
place to free allocated memory there?
Jan Halama
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
http:
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com</http:></mailto:xxxxx></mailto:xxxxx></http:></mailto:xxxxx>