ImageSectionHandle

What is an ImageSectionHandle? It is not a regular Win32 handle and I don’t
think it is simply a pointer. I need to get out my Intel manuals and see if
anything jumps out as being related to it.

BTW, I am switching to a WDF driver to get ACPI status for my wifi card.
I’m failing on IOCTL_ACPI_EVAL_METHOD with a 0xC0000001. Peter urged others
to use WDF so I am going to take his advice. But I like learning new things
and ImageSectionHandle is new to me.

Thanks,
Paul

What does ImageSectionHandle have to do with evaluating an acpi method?

d

debt from my phone


From: Paul Sanders
Sent: 9/27/2012 8:15 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] ImageSectionHandle

What is an ImageSectionHandle? It is not a regular Win32 handle and I don’t think it is simply a pointer. I need to get out my Intel manuals and see if anything jumps out as being related to it.

BTW, I am switching to a WDF driver to get ACPI status for my wifi card. I’m failing on IOCTL_ACPI_EVAL_METHOD with a 0xC0000001. Peter urged others to use WDF so I am going to take his advice. But I like learning new things and ImageSectionHandle is new to me.

Thanks,
Paul
— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

The MmLockPagableSectionByHandle routine takes an indirect value that MmLockPagableDataSection or MmLockPagableCodeSection returns.

VOID
MmLockPagableSectionByHandle(
IN PVOID ImageSectionHandle
);

Parameters
ImageSectionHandle
Supplies the handle returned by a call to MmLockPagableCodeSection or MmLockPagableDataSection.

Does it explain enough?

Doron,

I have written a filter driver that sits directly on top of the miniport driver for which I want to monitor the power. I build an IRP for IOCTL_ACPI_EVAL_METHOD and use that irp and the miniport’s device object for IoCallDriver. I fail with a 0xC0000001. I step through the disassembly and find that I am failing in MmLockPageableSectionByHandle. The handle is shifted right 20 bits and the two LSB’s are set to 0. Then, the result is compared with 0x81 and 0x01. (I am conveying this last part from memory as I am at home, so I might have a number wrong) Then the call returns to some code that is not identified (no symbolic info) and the result ends up with the 0xC0000001 going to the eax register. I did notice that since the two LSB’s would be zeroed, the two comparisons would always be negative.

I searched a couple of days ago and found a couple of threads. Peter suggested WDF and I will probably go that route. I would still like to figure out why my WDM method didn’t work.

I am monitoring a wifi card to make sure it is always powered on. If it is not, I am to send an ACPI IOCTL to turn the power back on. I was brought in to make sure the power stays on barring main power loss. This code is a second level of redundancy. It will probably not be asserted, but it is there just in case. The PC is in an inconvenient location and mostly unmanned.

>I am monitoring a wifi card to make sure it is always powered on.

How about simply disabling powerdown in Device Manager?

I doubt this has anything to do with section handles. Most likely ndis doesnt pass through IOCTL_ACPI_EVAL_METHOD and just fails it outright. Insert your filter below thr miniport and send the request down the stack from there. But to monitor power state you don’t need to ask acpi, your power up/down callbacks will be invoked on power transitions and you will see the state changes as they occur. How are you going to prevent power down?

d

debt from my phone


From: xxxxx@gmail.com
Sent: 9/27/2012 1:34 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] ImageSectionHandle

Doron,

I have written a filter driver that sits directly on top of the miniport driver for which I want to monitor the power. I build an IRP for IOCTL_ACPI_EVAL_METHOD and use that irp and the miniport’s device object for IoCallDriver. I fail with a 0xC0000001. I step through the disassembly and find that I am failing in MmLockPageableSectionByHandle. The handle is shifted right 20 bits and the two LSB’s are set to 0. Then, the result is compared with 0x81 and 0x01. (I am conveying this last part from memory as I am at home, so I might have a number wrong) Then the call returns to some code that is not identified (no symbolic info) and the result ends up with the 0xC0000001 going to the eax register. I did notice that since the two LSB’s would be zeroed, the two comparisons would always be negative.

I searched a couple of days ago and found a couple of threads. Peter suggested WDF and I will probably go that route. I would still like to figure out why my WDM method didn’t work.

I am monitoring a wifi card to make sure it is always powered on. If it is not, I am to send an ACPI IOCTL to turn the power back on. I was brought in to make sure the power stays on barring main power loss. This code is a second level of redundancy. It will probably not be asserted, but it is there just in case. The PC is in an inconvenient location and mostly unmanned.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I have a few questions about what you think you’re going to accomplish.
From what I understand of your undertaking, you’re going to fail.

First, let’s examine the notion that you can turn the device on simply by
running an ACPI control method. Do you control the BIOS? Is the device
sitting on a bus where some of the power management controls are outside of
ACPI? Do you know that the BIOS has independent control for this device?
Is it modeled with a _PS0 method or is it a power resource, where the power
will be turned off again the next time any device dependent on that power
resource get re-evaluated?

Second, ask yourself what state the device will be in even if you can manage
to run a control method that re-enables power to the device. What is its
state coming out of reset?

Third, ask yourself what the device driver will do when the device driver
thinks that the device is in D3 and you suddenly put it in D0. It won’t
receive any interrupts from the device, as it will have disabled them on the
way into D3. It won’t initiate any I/O to the device, as it thinks it is
turned off. From the point of view of the device driver stack, it will
appear to be turned off, even though you’ve turned it on.

Fourth, ask yourself what happens when you change state of a device (in any
dimension) when the device driver has put it into some other state. In my
experience, every device driver is written to assume that devices state in
the state that the driver put them into. A very few device drivers are good
at dealing with the case where the device is surprise-removed or where the
device fails at run time. Essentially none of them do anything other than
reset the device in response to detected state changes.

Jake Oshins
Windows Kernel Team

This message offers no warranties and confers no rights.

wrote in message news:xxxxx@ntdev…

Doron,

I have written a filter driver that sits directly on top of the miniport
driver for which I want to monitor the power. I build an IRP for
IOCTL_ACPI_EVAL_METHOD and use that irp and the miniport’s device object for
IoCallDriver. I fail with a 0xC0000001. I step through the disassembly and
find that I am failing in MmLockPageableSectionByHandle. The handle is
shifted right 20 bits and the two LSB’s are set to 0. Then, the result is
compared with 0x81 and 0x01. (I am conveying this last part from memory as I
am at home, so I might have a number wrong) Then the call returns to some
code that is not identified (no symbolic info) and the result ends up with
the 0xC0000001 going to the eax register. I did notice that since the two
LSB’s would be zeroed, the two comparisons would always be negative.

I searched a couple of days ago and found a couple of threads. Peter
suggested WDF and I will probably go that route. I would still like to
figure out why my WDM method didn’t work.

I am monitoring a wifi card to make sure it is always powered on. If it is
not, I am to send an ACPI IOCTL to turn the power back on. I was brought in
to make sure the power stays on barring main power loss. This code is a
second level of redundancy. It will probably not be asserted, but it is
there just in case. The PC is in an inconvenient location and mostly
unmanned.