VirtualBox

Changeset 37384 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jun 8, 2011 3:09:14 PM (13 years ago)
Author:
vboxsync
Message:

1 million rectangles ought to be enough for anybody...

Location:
trunk/src/VBox/Additions
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/xpdm/VBoxDispDriver.cpp

    r37335 r37384  
    135135{
    136136    ULONG cnt=0;
    137        
     137
    138138    while (*pwcs!=*L"")
    139139    {
     
    181181        memset(_font.lfFaceName, 0, sizeof(_font.lfFaceName));                       \
    182182        memcpy(_font.lfFaceName, _name, sizeof(_name));                              \
    183     } while (0)                                                                   
     183    } while (0)
    184184
    185185static int VBoxDispInitDevice(PVBOXDISPDEV pDev, DEVMODEW *pdm, GDIINFO *pGdiInfo, DEVINFO *pDevInfo)
     
    286286    pGdiInfo->ulNumPalReg = (pDev->mode.ulBitsPerPel==8) ? (1<<pDev->mode.ulBitsPerPel) : 0;
    287287
    288     /* @todo: might want to implement IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES in miniport driver 
     288    /* @todo: might want to implement IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES in miniport driver
    289289     *        and query host for this info there
    290290     */
     
    343343    pDevInfo->flGraphicsCaps |= GCAPS_DIRECTDRAW;
    344344#endif
    345     VBOXDISPMAKELOGFONTW(pDevInfo->lfDefaultFont, 
     345    VBOXDISPMAKELOGFONTW(pDevInfo->lfDefaultFont,
    346346                         16, 7, FW_BOLD, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, VARIABLE_PITCH, L"System");
    347347
     
    383383
    384384    LOGF_LEAVE();
    385     return rc;   
     385    return rc;
    386386}
    387387
     
    442442}
    443443
    444 /* Returns video modes supported by our device/driver 
     444/* Returns video modes supported by our device/driver
    445445 * Note: If we fail here we'd be asked to enter 800x600@4bpp mode later in VBoxDispDrvEnablePDEV.
    446446 */
     
    492492 * Returns pointer to our driver private info structure which would be passed by GDI to our other callbacks.
    493493 */
    494 DHPDEV APIENTRY 
     494DHPDEV APIENTRY
    495495VBoxDispDrvEnablePDEV(DEVMODEW *pdm, LPWSTR pwszLogAddress, ULONG cPat, HSURF *phsurfPatterns,
    496496                      ULONG cjCaps, ULONG *pdevcaps,
     
    671671    size.cy = pDev->mode.ulHeight;
    672672
    673     pDev->surface.hBitmap = EngCreateBitmap(size, pDev->mode.lScanlineStride, iFormat, 
     673    pDev->surface.hBitmap = EngCreateBitmap(size, pDev->mode.lScanlineStride, iFormat,
    674674                                            pDev->mode.lScanlineStride>0 ? BMF_TOPDOWN:0,
    675675                                            pDev->memInfo.FrameBufferBase);
     
    938938            LOGF(("VBOXESC_SETVISIBLEREGION"));
    939939            LPRGNDATA lpRgnData = (LPRGNDATA)pvIn;
    940 
    941             if (cjIn >= sizeof(RGNDATAHEADER)
     940            DWORD cRects;
     941
     942            if (    cjIn >= sizeof(RGNDATAHEADER)
    942943                &&  pvIn
    943944                &&  lpRgnData->rdh.dwSize == sizeof(RGNDATAHEADER)
    944945                &&  lpRgnData->rdh.iType  == RDH_RECTANGLES
    945                 &&  cjIn == ((uint64_t)lpRgnData->rdh.nCount) * sizeof(RECT) + sizeof(RGNDATAHEADER))
    946             {
     946                &&  (cRects = lpRgnData->rdh.nCount) <= _1M
     947                &&  cjIn == cRects * (uint64_t)sizeof(RECT) + sizeof(RGNDATAHEADER))
     948            {
     949                /** @todo this whole conversion thing could maybe be skipped
     950                 *        since RTRECT matches the RECT layout. */
     951#if 0
     952                AssertCompile(sizeof(RTRECT) == sizeof(RECT));
     953                AssertCompileMembersSameSizeAndOffset(RTRECT, xLeft,    RECT, left);
     954                AssertCompileMembersSameSizeAndOffset(RTRECT, xBottom,  RECT, bottom);
     955                AssertCompileMembersSameSizeAndOffset(RTRECT, xRight,   RECT, right);
     956                AssertCompileMembersSameSizeAndOffset(RTRECT, xTop,     RECT, top);
     957
     958                rc = VBoxDispMPSetVisibleRegion(pDev->hDriver, (PRTRECT)&lpRgnData->Buffer[0], cRects);
     959                VBOX_WARNRC(rc);
     960#else
    947961                DWORD   i;
    948962                PRTRECT pRTRect;
     
    950964                RECT   *pRect = (RECT *)&lpRgnData->Buffer;
    951965
    952                 pRTRect = (PRTRECT) EngAllocMem(0, lpRgnData->rdh.nCount*sizeof(RTRECT), MEM_ALLOC_TAG);
     966                pRTRect = (PRTRECT) EngAllocMem(0, cRects*sizeof(RTRECT), MEM_ALLOC_TAG);
    953967                if (!pRTRect)
    954968                {
    955                     WARN(("failed to allocate %d bytes", lpRgnData->rdh.nCount*sizeof(RTRECT)));
     969                    WARN(("failed to allocate %d bytes", cRects*sizeof(RTRECT)));
    956970                    break;
    957971                }
    958972
    959                 for (i=0; i<lpRgnData->rdh.nCount; ++i)
     973                for (i = 0; i < cRects; ++i)
    960974                {
    961975                    LOG(("New visible rectangle (%d,%d) (%d,%d)",
     
    967981                }
    968982
    969                 rc = VBoxDispMPSetVisibleRegion(pDev->hDriver, pRTRect, lpRgnData->rdh.nCount);
     983                rc = VBoxDispMPSetVisibleRegion(pDev->hDriver, pRTRect, cRects);
    970984                VBOX_WARNRC(rc);
    971985
    972986                EngFreeMem(pRTRect);
    973987
     988#endif
    974989                if (RT_SUCCESS(rc))
    975990                {
     
    983998                {
    984999                    WARN(("check failed rdh.dwSize=%x iType=%d size=%d expected size=%d",
    985                           lpRgnData->rdh.dwSize, lpRgnData->rdh.iType, cjIn, 
     1000                          lpRgnData->rdh.dwSize, lpRgnData->rdh.iType, cjIn,
    9861001                          lpRgnData->rdh.nCount * sizeof(RECT) + sizeof(RGNDATAHEADER)));
    9871002                }
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPDriver.cpp

    r36896 r37384  
    2626
    2727/* Resource list */
    28 VIDEO_ACCESS_RANGE  VBoxLegacyVGAResourceList[] = 
     28VIDEO_ACCESS_RANGE  VBoxLegacyVGAResourceList[] =
    2929{
    3030    { 0x000003B0, 0x00000000, 0x0000000C, 1, 1, 1, 0 }, /* VGA regs (0x3B0-0x3BB) */
     
    106106            ULONG vendorId = 0x80EE;
    107107            ULONG deviceId = 0xBEEF;
    108             rc = VideoPortGetAccessRanges(pExt, 0, NULL, RT_ELEMENTS(tmpRanges), tmpRanges, 
     108            rc = VideoPortGetAccessRanges(pExt, 0, NULL, RT_ELEMENTS(tmpRanges), tmpRanges,
    109109                                          &vendorId, &deviceId, &slot);
    110110        }
     
    142142    }
    143143
    144     /* @todo: pretend success to make the driver work. */
     144    /** @todo pretend success to make the driver work. */
    145145    rc = NO_ERROR;
    146146
     
    281281        }
    282282
    283         /* Returns count of supported video modes and structure size in bytes, 
     283        /* Returns count of supported video modes and structure size in bytes,
    284284         * used to allocate buffer for the following IOCTL_VIDEO_QUERY_AVAIL_MODES call.
    285285         */
     
    350350            STARTIO_IN(VIDEO_POINTER_POSITION, pPos);
    351351
    352             /*@todo: set pointer position*/
     352            /** @todo set pointer position*/
    353353            bResult = VBoxMPEnablePointer(pExt, TRUE, pStatus);
    354354            break;
     
    439439            uint32_t cRects = RequestPacket->InputBufferLength/sizeof(RTRECT);
    440440            /*Sanity check*/
    441             if (RequestPacket->InputBufferLength != cRects*sizeof(RTRECT))
     441            if (   cRects > _1M
     442                || RequestPacket->InputBufferLength != cRects * sizeof(RTRECT))
    442443            {
    443444                pStatus->Status = ERROR_INSUFFICIENT_BUFFER;
     
    487488        case IOCTL_VIDEO_HGSMI_HANDLER_DISABLE:
    488489        {
    489             /* @todo: not implemented */
     490            /** @todo not implemented */
    490491            break;
    491492        }
     
    519520}
    520521
    521 /* Called to set out hardware into desired power state, not supported at the moment. 
     522/* Called to set out hardware into desired power state, not supported at the moment.
    522523 * Required to return NO_ERROR always.
    523524 */
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp

    r37381 r37384  
    147147    int rc;
    148148
    149     AssertReturn(pRects || (cRects == 0), VERR_INVALID_PARAMETER);
    150     AssertReturn(sizeof(VMMDevVideoSetVisibleRegion)+(cRects-1)*sizeof(RTRECT)
    151                  == sizeof(VMMDevVideoSetVisibleRegion)+(uint64_t)(cRects-1)*sizeof(RTRECT), VERR_INVALID_PARAMETER);
     149    AssertReturn(pRects || cRects == 0, VERR_INVALID_PARAMETER);
     150    AssertMsgReturn(cRects <= _1M, ("%u\n", cRects), VERR_OUT_OF_RANGE);
    152151
    153152    rc = vbglR3GRAlloc((VMMDevRequestHeader **)&pReq,
    154153                         sizeof(VMMDevVideoSetVisibleRegion)
    155                        + cRects * sizeof(RTRECT) - sizeof(RTRECT),
     154                       + cRects * sizeof(RTRECT)
     155                       - sizeof(RTRECT),
    156156                       VMMDevReq_VideoSetVisibleRegion);
    157157    if (RT_SUCCESS(rc))
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette