Hi,
How does the ACPI AML code: “Notify (device, 1)” (eject) actually works?
Is it causes the operating system to send the IRP_MJ_CLOSE IRP? or
does it execute driver specific code?
How could I load/unload a pnp driver using AML code?
Thanks in advance for your help!
Best,
David.
That that ejecting a device does not unload a driver. Ejecting a device
can tear down a device stack and if and only if the function driver’s
device object is the last device object in that driver, will the driver
unload. Eject does not send a IRP_MJ_CLOSE. A close irp is related to
a file handle, not pnp; an eject causes a graceful remove of the stack
(query remove -> remove) which tears down the stack and then an eject
irp is sent to the PDO. As a part of that graceful remove, any open
handles must be closed, but it is up to the application to close them on
its own, they will not be forcefully closed behind the application’s
back.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David Pilger
Sent: Thursday, July 12, 2007 2:15 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Unloading a driver [ACPI docking]
Hi,
How does the ACPI AML code: “Notify (device, 1)” (eject) actually works?
Is it causes the operating system to send the IRP_MJ_CLOSE IRP? or
does it execute driver specific code?
How could I load/unload a pnp driver using AML code?
Thanks in advance for your help!
Best,
David.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Oh, thank you.
How could I cause the PnP manager to send the remove query & remove
irps to a certain device from a user mode process?
On 7/12/07, Doron Holan wrote:
> That that ejecting a device does not unload a driver. Ejecting a device
> can tear down a device stack and if and only if the function driver’s
> device object is the last device object in that driver, will the driver
> unload. Eject does not send a IRP_MJ_CLOSE. A close irp is related to
> a file handle, not pnp; an eject causes a graceful remove of the stack
> (query remove -> remove) which tears down the stack and then an eject
> irp is sent to the PDO. As a part of that graceful remove, any open
> handles must be closed, but it is up to the application to close them on
> its own, they will not be forcefully closed behind the application’s
> back.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of David Pilger
> Sent: Thursday, July 12, 2007 2:15 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Unloading a driver [ACPI docking]
>
> Hi,
>
> How does the ACPI AML code: “Notify (device, 1)” (eject) actually works?
> Is it causes the operating system to send the IRP_MJ_CLOSE IRP? or
> does it execute driver specific code?
>
> How could I load/unload a pnp driver using AML code?
> Thanks in advance for your help!
>
> Best,
> David.
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
look at the devcon sample, specifically the code to implement device disable (which does a q.r. / remove)
d
From: xxxxx@lists.osr.com on behalf of David Pilger
Sent: Sun 7/15/2007 7:40 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Unloading a driver [ACPI docking]
Oh, thank you.
How could I cause the PnP manager to send the remove query & remove
irps to a certain device from a user mode process?
On 7/12/07, Doron Holan wrote:
> That that ejecting a device does not unload a driver. Ejecting a device
> can tear down a device stack and if and only if the function driver’s
> device object is the last device object in that driver, will the driver
> unload. Eject does not send a IRP_MJ_CLOSE. A close irp is related to
> a file handle, not pnp; an eject causes a graceful remove of the stack
> (query remove -> remove) which tears down the stack and then an eject
> irp is sent to the PDO. As a part of that graceful remove, any open
> handles must be closed, but it is up to the application to close them on
> its own, they will not be forcefully closed behind the application’s
> back.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of David Pilger
> Sent: Thursday, July 12, 2007 2:15 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Unloading a driver [ACPI docking]
>
> Hi,
>
> How does the ACPI AML code: “Notify (device, 1)” (eject) actually works?
> Is it causes the operating system to send the IRP_MJ_CLOSE IRP? or
> does it execute driver specific code?
>
> How could I load/unload a pnp driver using AML code?
> Thanks in advance for your help!
>
> Best,
> David.
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
—
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Doron’s answer was a little cryptic. Let me try to be a little more
helpful.
When a device is described in the ACPI namespace (because the BIOS included
a description of it, along with some bytecode to run when specific events
occur) the ACPI driver will filter that device stack. Thus it has a pointer
to the PDO (or it provided the PDO, if no other bus could enumerate the
device) and so it can call IoInvalidateDeviceRelations on the parent bus.
Since it is also filtering the parent bus, it can then remove that PDO from
the list that the parent bus returns on the subsequent
IRP_MN_QUERY_DEVICE_RELATIONS.
This results in the PnP manager thinking that the device has been ejected
and it then starts tearing down the stack. When all handles are gone, the
driver will be unloaded. The handles won’t be torn down unless the
applications holding them open either exit or close the handles during the
course of their normal operation. A well-written application will often
include code to be notified by the PnP manager that the device is being
ejected and it should close its handles.
- Jake Oshins
Windows Kernel Team
“Doron Holan” wrote in message
news:xxxxx@ntdev…
That that ejecting a device does not unload a driver. Ejecting a device
can tear down a device stack and if and only if the function driver’s
device object is the last device object in that driver, will the driver
unload. Eject does not send a IRP_MJ_CLOSE. A close irp is related to
a file handle, not pnp; an eject causes a graceful remove of the stack
(query remove -> remove) which tears down the stack and then an eject
irp is sent to the PDO. As a part of that graceful remove, any open
handles must be closed, but it is up to the application to close them on
its own, they will not be forcefully closed behind the application’s
back.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David Pilger
Sent: Thursday, July 12, 2007 2:15 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Unloading a driver [ACPI docking]
Hi,
How does the ACPI AML code: “Notify (device, 1)” (eject) actually works?
Is it causes the operating system to send the IRP_MJ_CLOSE IRP? or
does it execute driver specific code?
How could I load/unload a pnp driver using AML code?
Thanks in advance for your help!
Best,
David.
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Thanks for the replay,
Are you sure it performs just the qr/r cycle when calling the
disable command of the devcon tool? It takes too much time, and for
the graphic disaply device it requires a reboot. Any idea why that is?
David.
On 7/16/07, Doron Holan wrote:
>
> look at the devcon sample, specifically the code to implement device disable
> (which does a q.r. / remove)
>
> d
>
> ________________________________
> From: xxxxx@lists.osr.com on behalf of David
> Pilger
> Sent: Sun 7/15/2007 7:40 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Unloading a driver [ACPI docking]
>
>
>
>
> Oh, thank you.
> How could I cause the PnP manager to send the remove query & remove
> irps to a certain device from a user mode process?
>
> On 7/12/07, Doron Holan wrote:
> > That that ejecting a device does not unload a driver. Ejecting a device
> > can tear down a device stack and if and only if the function driver’s
> > device object is the last device object in that driver, will the driver
> > unload. Eject does not send a IRP_MJ_CLOSE. A close irp is related to
> > a file handle, not pnp; an eject causes a graceful remove of the stack
> > (query remove -> remove) which tears down the stack and then an eject
> > irp is sent to the PDO. As a part of that graceful remove, any open
> > handles must be closed, but it is up to the application to close them on
> > its own, they will not be forcefully closed behind the application’s
> > back.
> >
> > d
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of
> David Pilger
> > Sent: Thursday, July 12, 2007 2:15 AM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Unloading a driver [ACPI docking]
> >
> > Hi,
> >
> > How does the ACPI AML code: “Notify (device, 1)” (eject) actually works?
> > Is it causes the operating system to send the IRP_MJ_CLOSE IRP? or
> > does it execute driver specific code?
> >
> > How could I load/unload a pnp driver using AML code?
> > Thanks in advance for your help!
> >
> > Best,
> > David.
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
Ok, I got it, thanks!
What I’m actully looking for is a fast way to connect and disconnect
the display adapter’s driver? I want to disconnect it from its driver
or at least put it in a state where the driver wouldn’t access the
adapter, and after that, allow the driver to use it again and restore
the previous state?
I guess I could perform a “IOCTL_VIDEO_QUERY_CURRENT_MODE ->
IOCTL_VIDEO_RESET_DEVICE -> IOCTL_VIDEO_SET_CURRENT_MODE” cycle in
order to do that, but as far as I understand, the GDI holds
exclusively the handle to \.\DISPLAY[1…N], Is there a way to perform
the above operation, or, how do I send IOCTLs to the display driver?
David.
On 7/16/07, Jake Oshins wrote:
> Doron’s answer was a little cryptic. Let me try to be a little more
> helpful.
>
> When a device is described in the ACPI namespace (because the BIOS included
> a description of it, along with some bytecode to run when specific events
> occur) the ACPI driver will filter that device stack. Thus it has a pointer
> to the PDO (or it provided the PDO, if no other bus could enumerate the
> device) and so it can call IoInvalidateDeviceRelations on the parent bus.
> Since it is also filtering the parent bus, it can then remove that PDO from
> the list that the parent bus returns on the subsequent
> IRP_MN_QUERY_DEVICE_RELATIONS.
>
> This results in the PnP manager thinking that the device has been ejected
> and it then starts tearing down the stack. When all handles are gone, the
> driver will be unloaded. The handles won’t be torn down unless the
> applications holding them open either exit or close the handles during the
> course of their normal operation. A well-written application will often
> include code to be notified by the PnP manager that the device is being
> ejected and it should close its handles.
>
> - Jake Oshins
> Windows Kernel Team
>
>
>
> “Doron Holan” wrote in message
> news:xxxxx@ntdev…
> That that ejecting a device does not unload a driver. Ejecting a device
> can tear down a device stack and if and only if the function driver’s
> device object is the last device object in that driver, will the driver
> unload. Eject does not send a IRP_MJ_CLOSE. A close irp is related to
> a file handle, not pnp; an eject causes a graceful remove of the stack
> (query remove -> remove) which tears down the stack and then an eject
> irp is sent to the PDO. As a part of that graceful remove, any open
> handles must be closed, but it is up to the application to close them on
> its own, they will not be forcefully closed behind the application’s
> back.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of David Pilger
> Sent: Thursday, July 12, 2007 2:15 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Unloading a driver [ACPI docking]
>
> Hi,
>
> How does the ACPI AML code: “Notify (device, 1)” (eject) actually works?
> Is it causes the operating system to send the IRP_MJ_CLOSE IRP? or
> does it execute driver specific code?
>
> How could I load/unload a pnp driver using AML code?
> Thanks in advance for your help!
>
> Best,
> David.
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
Any component, including the driver itself can fail query remove. Look
at the setup logs (%windir%\setupapi.log pre vista, windir%\inf*.log in
Vista) to tell you who vetoed the query.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David Pilger
Sent: Monday, July 16, 2007 2:22 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Unloading a driver [ACPI docking]
Thanks for the replay,
Are you sure it performs just the qr/r cycle when calling the
disable command of the devcon tool? It takes too much time, and for
the graphic disaply device it requires a reboot. Any idea why that is?
David.
On 7/16/07, Doron Holan wrote:
>
> look at the devcon sample, specifically the code to implement device
disable
> (which does a q.r. / remove)
>
> d
>
> ________________________________
> From: xxxxx@lists.osr.com on behalf of David
> Pilger
> Sent: Sun 7/15/2007 7:40 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Unloading a driver [ACPI docking]
>
>
>
>
> Oh, thank you.
> How could I cause the PnP manager to send the remove query & remove
> irps to a certain device from a user mode process?
>
> On 7/12/07, Doron Holan wrote:
> > That that ejecting a device does not unload a driver. Ejecting a
device
> > can tear down a device stack and if and only if the function
driver’s
> > device object is the last device object in that driver, will the
driver
> > unload. Eject does not send a IRP_MJ_CLOSE. A close irp is related
to
> > a file handle, not pnp; an eject causes a graceful remove of the
stack
> > (query remove -> remove) which tears down the stack and then an
eject
> > irp is sent to the PDO. As a part of that graceful remove, any open
> > handles must be closed, but it is up to the application to close
them on
> > its own, they will not be forcefully closed behind the application’s
> > back.
> >
> > d
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of
> David Pilger
> > Sent: Thursday, July 12, 2007 2:15 AM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Unloading a driver [ACPI docking]
> >
> > Hi,
> >
> > How does the ACPI AML code: “Notify (device, 1)” (eject) actually
works?
> > Is it causes the operating system to send the IRP_MJ_CLOSE IRP? or
> > does it execute driver specific code?
> >
> > How could I load/unload a pnp driver using AML code?
> > Thanks in advance for your help!
> >
> > Best,
> > David.
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer