enable.c revision 25be0b1daccd180b98ac7bd0a81e2acb75db6146
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/******************************Module*Header*******************************\
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (C) 2006-2007 Oracle Corporation
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * available from http://www.virtualbox.org. This file is free software;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * General Public License (GPL) as published by the Free Software
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync* Based in part on Microsoft DDK sample code
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync* *******************
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync* * GDI SAMPLE CODE *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync* *******************
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync* Module Name: enable.c
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync* This module contains the functions that enable and disable the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync* driver, the pdev, and the surface.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync* Copyright (c) 1992-1998 Microsoft Corporation
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync\**************************************************************************/
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// The driver function table with all function index/address pairs
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// Hook functions to track dirty rectangles and generate RDP orders.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// NT4 functions
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvCompletePDEV, (PFN) DrvCompletePDEV }, // 1
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvDisablePDEV, (PFN) DrvDisablePDEV }, // 2
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvEnableSurface, (PFN) DrvEnableSurface }, // 3
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvDisableSurface, (PFN) DrvDisableSurface }, // 4
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvDisableDriver, (PFN) DrvDisableDriver }, // 8
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// { INDEX_DrvCreateDeviceBitmap, (PFN) DrvCreateDeviceBitmap }, // 10
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync// { INDEX_DrvDeleteDeviceBitmap, (PFN) DrvDeleteDeviceBitmap }, // 11
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvRealizeBrush, (PFN) DrvRealizeBrush }, // 12
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvDitherColor, (PFN) DrvDitherColor }, // 13
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvStrokePath, (PFN) DrvStrokePath }, // 14
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvStretchBlt, (PFN) DrvStretchBlt, }, // 20
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvSetPalette, (PFN) DrvSetPalette }, // 22
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { INDEX_DrvSetPointerShape, (PFN) DrvSetPointerShape }, // 29
#ifdef VBOX_WITH_DDRAW
return TRUE;
BOOL DrvNineGrid (PVOID x1, PVOID x2, PVOID x3, PVOID x4, PVOID x5, PVOID x6, PVOID x7, PVOID x8, PVOID x9)
DISPDBG((0, "Experimental %s: %p, %p, %p, %p, %p, %p, %p, %p, %p\n", __FUNCTION__, x1, x2, x3, x4, x5, x6, x7, x8, x9));
return FALSE;
ULONG APIENTRY DrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, PVOID pvIn, ULONG cjOut, PVOID pvOut)
switch(iEsc)
#ifdef VBOX_WITH_OPENGL
case OPENGL_GETINFO:
&& pvOut)
return cjOut;
DISPDBG((0, "OPENGL_GETINFO invalid size %d\n", cjOut)); /* It doesn't matter that we fail here. Opengl32 will fall back to software rendering when this escape is not supported. */
case VBOXESC_ISVRDPACTIVE:
DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> %d (%x)\n", ret, ppdev->vbvaCtx.pVBVA->hostFlags.u32HostEvents));
return ret;
case VBOXESC_SETVISIBLEREGION:
&& pvIn
DISPDBG((0, "New visible rectangle (%d,%d) (%d,%d)\n", pRect[i].left, pRect[i].bottom, pRect[i].right, pRect[i].top));
NULL,
&ulReturn))
if (pvIn)
DISPDBG((0, "check failed rdh.dwSize=%x iType=%d size=%d expected size=%d\n", lpRgnData->rdh.dwSize, lpRgnData->rdh.iType, cjIn, lpRgnData->rdh.nCount * sizeof(RECT) + sizeof(RGNDATAHEADER)));
case QUERYESCSUPPORT:
&& pvIn)
switch(nEscapeQuery)
#ifdef VBOX_WITH_OPENGL
case OPENGL_GETINFO:
return TRUE;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
#ifdef VBOX_WITH_DDRAW
#ifdef VBOX_NEW_SURFACE_CODE
return(TRUE);
return((DHPDEV) 0);
goto error_free;
goto error_free;
DISPDBG((0, "VBoxDisp::DrvEnablePDEV: sizeof(DEVINFO) = %d, cjDevInfo = %d, alpha = %d\n", sizeof(DEVINFO), cjDevInfo, DevInfo.flGraphicsCaps2 & GCAPS2_ALPHACURSOR));
// @todo seems to be not necessary. these bits are initialized in screen.c DevInfo.flGraphicsCaps |= GCAPS_OPAQUERECT |
return((DHPDEV) 0);
return(TRUE);
#ifdef VBOX_NEW_SURFACE_CODE
return(FALSE);
return(FALSE);
#ifdef VBOX_NEW_SURFACE_CODE
goto l_Failure;
if(g_bOnNT40)
if ( hsurf == 0 )
goto l_Failure;
if(g_bOnNT40)
goto l_Failure;
goto l_Failure;
NULL))
goto l_Failure;
goto l_Failure;
ppdev->hsurfScreen = (HSURF)EngCreateDeviceSurface((DHSURF)ppdev, /* Handle assigned by the device. */
sizl,
goto l_Failure;
goto l_Failure;
DISPDBG((0, "DISP DrvEnableSurface success ppdev %p, ppdev->hsurfScreen %p\n", ppdev, ppdev->hsurfScreen));
return((HSURF)0);
#ifdef VBOX_NEW_SURFACE_CODE
if (bEnable)
return (FALSE);
#ifdef VBOX_NEW_SURFACE_CODE
return FALSE;
return FALSE;
return FALSE;
return TRUE;
#ifdef VBOX_WITH_VIDEOHWACCEL
/* tells we can not process host commands any more and ensures we've completed processing of the host VHWA commands */
NULL,
NULL,
&ulReturn))
return FALSE;
return TRUE;
return (HBITMAP)0;
&cbModeSize);
if (cModes == 0)
cbOutputSize = 0;
if (cOutputModes == 0)
cOutputModes--;
} while (--cModes);
return cbOutputSize;
switch(iType)
case DN_DEVICE_ORIGIN:
case DN_DRAWING_BEGIN:
#ifdef VBOX_WITH_DDRAW
AssertMsg(!(pSurfaceGlobal->ddpfSurface.dwFlags & DDPF_FOURCC), ("GDI called us with a non-RGB surface!"));
if (hbmDevice)
return(hbmDevice);
return(hbmDevice);
DISPDBG((0, "pSurfaceGlobal->ddpfSurface.dwRGBBitCount = %d, lPitch =%ld\n", pSurfaceGlobal->ddpfSurface.dwRGBBitCount,pSurfaceGlobal->lPitch));