Index: win32ss/gdi/ntgdi/bitmaps.c =================================================================== --- win32ss/gdi/ntgdi/bitmaps.c (revision 73499) +++ win32ss/gdi/ntgdi/bitmaps.c (working copy) @@ -430,13 +430,12 @@ } BOOL -APIENTRY -NtGdiGetBitmapDimension( - HBITMAP hBitmap, - LPSIZE psizDim) +NTAPI +GreGetBitmapDimension( + _In_ HBITMAP hBitmap, + _Out_ LPSIZE psizDim) { PSURFACE psurfBmp; - BOOL bResult = TRUE; if (hBitmap == NULL) return FALSE; @@ -449,22 +448,36 @@ return FALSE; } + /* Unlock the bitmap */ + SURFACE_ShareUnlockSurface(psurfBmp); + + return TRUE; +} + +BOOL +APIENTRY +NtGdiGetBitmapDimension( + HBITMAP hBitmap, + LPSIZE psizDim) +{ + SIZE dim; + + if (!GreGetBitmapDimension(hBitmap, &dim)) + return FALSE; + /* Use SEH to copy the data to the caller */ _SEH2_TRY { - ProbeForWrite(psizDim, sizeof(SIZE), 1); - *psizDim = psurfBmp->sizlDim; + ProbeForWrite(psizDim, sizeof(*psizDim), 1); + *psizDim = dim; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - bResult = FALSE; + _SEH2_YIELD(return FALSE); } _SEH2_END - /* Unlock the bitmap */ - SURFACE_ShareUnlockSurface(psurfBmp); - - return bResult; + return TRUE; } Index: win32ss/gdi/ntgdi/bitmaps.h =================================================================== --- win32ss/gdi/ntgdi/bitmaps.h (revision 73499) +++ win32ss/gdi/ntgdi/bitmaps.h (working copy) @@ -50,3 +50,10 @@ _Inout_ PSURFACE psurf, _In_ ULONG cjBits, _In_ const VOID *pvBits); + +BOOL +NTAPI +GreGetBitmapDimension( + _In_ HBITMAP hBitmap, + _Out_ LPSIZE psizDim); + Index: win32ss/user/ntuser/caret.c =================================================================== --- win32ss/user/ntuser/caret.c (revision 73499) +++ win32ss/user/ntuser/caret.c (working copy) @@ -43,10 +43,10 @@ if (CaretInfo->Bitmap) { - if (!NtGdiGetBitmapDimension(CaretInfo->Bitmap, &CaretInfo->Size)) + if (!GreGetBitmapDimension(CaretInfo->Bitmap, &CaretInfo->Size)) { ERR("Failed to get bitmap dimensions\n"); - return; + goto cleanup; } hdcMem = NtGdiCreateCompatibleDC(hdc); @@ -79,6 +79,7 @@ DSTINVERT); } +cleanup: if (pWnd->hrgnUpdate) { NtGdiRestoreDC(hdc, -1);