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
This commit is contained in:
Royce Mitchell III 2004-12-12 21:58:42 +00:00
parent 522137c499
commit 50a975cc08
4 changed files with 88 additions and 35 deletions

View file

@ -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 */

View file

@ -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 );

View file

@ -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 <w32k.h>
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

View file

@ -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 <w32k.h>
#include <ft2build.h>
@ -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);