Thursday, June 18, 2009

Accessing DrvEscape

In display drivers, DrvEscape is a function to retrieve information from a device that is not available in DDI for example, issuing a DrvEscape to the PXA27X display driver with GETGXINFO parameters will fill in the GAPI data structure.

For accessing the DrvEscape routines, the following code segment can be used:


{
HDC hDC = NULL;
DWORD Status;
CEDEVICE_POWER_STATE pwrState = D0;
hDC = CreateDC(NULL, NULL, NULL, NULL);
if (NULL != hDC)
{
pwrState = D0;
Status= ExtEscape(hDC, IOCTL_POWER_SET,
0, NULL,
sizeof(pwrState), (LPSTR)&pwrState );
ReleaseDC(NULL,hDC);
}
}


This code will open the display driver and will issue a IOCTL_POWER_SET command to make the display ON. In the PXA27X display driver, uses two display buffers, one for the filling in of graphic data, another a blank buffer , which will be used during D2 to D4 modes.

So if the display driver is in D2-D4 mode, this DrvEscape will bring the driver into D0. This will be equivalent of using SetDevicePower, but Microsoft is not recommending the usage of such APIs as it restricts the device self-management.

2 comments:

Polo said...

This code gives me an error LNK2019: unresolved external symbol _CreateDCA under WinCE 6.0 !

Vaisakh P S said...

Hey can you send me the source code/?? or the sources file?