From: Royce Mitchell III Date: Sun, 12 Dec 2004 21:58:42 +0000 (+0000) Subject: BUGFIX: NtGdiGetDeviceCaps() called NtGdiEscape() with hDC when it already had it... X-Git-Tag: backups/ELF_support@12700~7^2~10 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=50a975cc086b8d4e2737d265c3af20c468596501 BUGFIX: NtGdiGetDeviceCaps() called NtGdiEscape() with hDC when it already had it locked. BUGFIX: fixed condition surrounding failed ASSERT in NtGdiGetTextExtentPoint32(). svn path=/trunk/; revision=12061 --- diff --git a/reactos/subsys/win32k/include/intgdi.h b/reactos/subsys/win32k/include/intgdi.h index c04c74f834b..32f8ab11567 100644 --- a/reactos/subsys/win32k/include/intgdi.h +++ b/reactos/subsys/win32k/include/intgdi.h @@ -179,5 +179,18 @@ IntGetSysColorPens(HPEN *Pens, UINT nPens); BOOL FASTCALL IntGetSysColors(COLORREF *Colors, UINT nColors); +/* Other Stuff */ + +INT FASTCALL +IntGdiGetDeviceCaps(PDC dc, INT Index); + +INT +FASTCALL +IntGdiEscape(PDC dc, + INT Escape, + INT InSize, + LPCSTR InData, + LPVOID OutData); + #endif /* _WIN32K_INTGDI_H */ diff --git a/reactos/subsys/win32k/objects/dc.c b/reactos/subsys/win32k/objects/dc.c index 462b759d893..6d3b4519f69 100644 --- a/reactos/subsys/win32k/objects/dc.c +++ b/reactos/subsys/win32k/objects/dc.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: dc.c,v 1.151 2004/12/12 21:25:05 weiden Exp $ +/* $Id: dc.c,v 1.152 2004/12/12 21:58:42 royce Exp $ * * DC.C - Device context functions * @@ -1269,21 +1269,12 @@ NtGdiSetDCState ( HDC hDC, HDC hDCSave ) SetLastWin32Error(ERROR_INVALID_HANDLE); } -INT STDCALL -NtGdiGetDeviceCaps(HDC hDC, - INT Index) +INT FASTCALL +IntGdiGetDeviceCaps(PDC dc, INT Index) { - PDC dc; - INT ret; + INT ret; POINT pt; - dc = DC_LockDc(hDC); - if (dc == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - /* Retrieve capability */ switch (Index) { @@ -1376,7 +1367,7 @@ NtGdiGetDeviceCaps(HDC hDC, break; case PHYSICALWIDTH: - if(NtGdiEscape(hDC, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) + if(IntGdiEscape(dc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) { ret = pt.x; } @@ -1387,7 +1378,7 @@ NtGdiGetDeviceCaps(HDC hDC, break; case PHYSICALHEIGHT: - if(NtGdiEscape(hDC, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) + if(IntGdiEscape(dc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) { ret = pt.y; } @@ -1398,7 +1389,7 @@ NtGdiGetDeviceCaps(HDC hDC, break; case PHYSICALOFFSETX: - if(NtGdiEscape(hDC, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) + if(IntGdiEscape(dc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) { ret = pt.x; } @@ -1409,7 +1400,7 @@ NtGdiGetDeviceCaps(HDC hDC, break; case PHYSICALOFFSETY: - if(NtGdiEscape(hDC, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) + if(IntGdiEscape(dc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) { ret = pt.y; } @@ -1424,7 +1415,7 @@ NtGdiGetDeviceCaps(HDC hDC, break; case SCALINGFACTORX: - if(NtGdiEscape(hDC, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) + if(IntGdiEscape(dc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) { ret = pt.x; } @@ -1435,7 +1426,7 @@ NtGdiGetDeviceCaps(HDC hDC, break; case SCALINGFACTORY: - if(NtGdiEscape(hDC, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) + if(IntGdiEscape(dc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) { ret = pt.y; } @@ -1470,6 +1461,25 @@ NtGdiGetDeviceCaps(HDC hDC, break; } + return ret; +} + +INT STDCALL +NtGdiGetDeviceCaps(HDC hDC, + INT Index) +{ + PDC dc; + INT ret; + + dc = DC_LockDc(hDC); + if (dc == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + ret = IntGdiGetDeviceCaps(dc, Index); + DPRINT("(%04x,%d): returning %d\n", hDC, Index, ret); DC_UnlockDc( hDC ); diff --git a/reactos/subsys/win32k/objects/print.c b/reactos/subsys/win32k/objects/print.c index bd9655ed81d..0198504165d 100644 --- a/reactos/subsys/win32k/objects/print.c +++ b/reactos/subsys/win32k/objects/print.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: print.c,v 1.24 2004/12/12 01:40:38 weiden Exp $ */ +/* $Id: print.c,v 1.25 2004/12/12 21:58:42 royce Exp $ */ #include INT @@ -43,6 +43,18 @@ NtGdiEndPage(HDC hDC) return 0; } +INT +FASTCALL +IntGdiEscape(PDC dc, + INT Escape, + INT InSize, + LPCSTR InData, + LPVOID OutData) +{ + UNIMPLEMENTED; + return 0; +} + INT STDCALL NtGdiEscape(HDC hDC, @@ -51,8 +63,21 @@ NtGdiEscape(HDC hDC, LPCSTR InData, LPVOID OutData) { - UNIMPLEMENTED; - return 0; + PDC dc; + INT ret; + + dc = DC_LockDc(hDC); + if (dc == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + /* TODO FIXME - don't pass umode buffer to an Int function */ + ret = IntGdiEscape(dc, Escape, InSize, InData, OutData); + + DC_UnlockDc( hDC ); + return ret; } INT diff --git a/reactos/subsys/win32k/objects/text.c b/reactos/subsys/win32k/objects/text.c index b1f82398ee8..f31b2669e0d 100644 --- a/reactos/subsys/win32k/objects/text.c +++ b/reactos/subsys/win32k/objects/text.c @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: text.c,v 1.113 2004/12/12 01:40:38 weiden Exp $ */ +/* $Id: text.c,v 1.114 2004/12/12 21:58:42 royce Exp $ */ #include #include @@ -2131,7 +2131,7 @@ NtGdiGetTextCharsetInfo(HDC hDC, static BOOL FASTCALL -TextIntGetTextExtentPoint(HDC hDC, +TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, int Count, @@ -2241,7 +2241,7 @@ TextIntGetTextExtentPoint(HDC hDC, Size->cx = (TotalWidth + 32) >> 6; Size->cy = (TextObj->logfont.lfHeight < 0 ? - TextObj->logfont.lfHeight : TextObj->logfont.lfHeight); - Size->cy = EngMulDiv(Size->cy, NtGdiGetDeviceCaps(hDC, LOGPIXELSY), 72); + Size->cy = EngMulDiv(Size->cy, IntGdiGetDeviceCaps(dc, LOGPIXELSY), 72); return TRUE; } @@ -2329,11 +2329,15 @@ NtGdiGetTextExtentExPoint(HDC hDC, return FALSE; } TextObj = TEXTOBJ_LockText(dc->w.hFont); - /* FIXME - TextObj can be NULL!!!! Handle this case!!! */ - DC_UnlockDc(hDC); - Result = TextIntGetTextExtentPoint(hDC, TextObj, String, Count, MaxExtent, + if ( TextObj ) + { + Result = TextIntGetTextExtentPoint(dc, TextObj, String, Count, MaxExtent, NULL == UnsafeFit ? NULL : &Fit, Dx, &Size); + } + else + Result = FALSE; TEXTOBJ_UnlockText(dc->w.hFont); + DC_UnlockDc(hDC); ExFreePool(String); if (! Result) @@ -2452,13 +2456,14 @@ NtGdiGetTextExtentPoint32(HDC hDC, return FALSE; } TextObj = TEXTOBJ_LockText(dc->w.hFont); - /* FIXME - TextObj can be NULL!!! Handle this case!!! */ - DC_UnlockDc(hDC); - Result = TextIntGetTextExtentPoint ( - hDC, TextObj, String, Count, 0, NULL, NULL, &Size); - dc = DC_LockDc(hDC); - ASSERT(dc); // it succeeded earlier, it should now, too - TEXTOBJ_UnlockText(dc->w.hFont); + if ( TextObj != NULL ) + { + Result = TextIntGetTextExtentPoint ( + dc, TextObj, String, Count, 0, NULL, NULL, &Size); + TEXTOBJ_UnlockText(dc->w.hFont); + } + else + Result = FALSE; DC_UnlockDc(hDC); ExFreePool(String);