A set of Power Management resources is allocated when an application calls this IOCtl. This resource set consists of a queue that holds Power Management event messages. Only one resource set (event queue) can be created per file handle.

If a semaphore is established, the caller is notified (that is, the semaphore is cleared) each time a Power Management event message is added to the queue. It is the responsibility of the calling application to reset the semaphore. Because different applications might be interested in different event messages, EventMask can be tailored to specify only those event messages the application is interested in processing. The resource set is freed when DosClose is performed on the associated file handle.

If the resource set is defined without a semaphore, the IOCtl 61h interface must be polled to determine whether any events have occurred (that is, if any event messages are in the queue).

If a SemRemoval request (Bit 1 is set) attempts to release a semaphore with a bad handle, or to release a handle to a semaphore that is different from the handle provided in the SemSetup request (bit set to 0), then PowerBadSemHandle is referenced in the ReturnCode field.

When a semaphore handle has been provided, all subsequent Setup requests for that resource set fail with a ReturnCode value of PowerSemAlreadySetup unless a corresponding SemRemoval request has been processed.

If an input semaphore handle value is rejected by the DevHlp semaphore management functions, the request fails with a ReturnCode value of PowerBadSemaphore.


[Back] [Next]