Win32k/Gdi32

- Use Batch with SetBrushOrgEx now, removed NtGdiGetBrushOrgEx, update all related files.
- Fixed WinDC DCE death to all window DCE's. This will move to gdiobj as a check to see if a object handle is on deaths door. This prevents exceptions.
- Implemented NtgdiGet/ABCCharWidth/sW, updated all related files. Float and Indices not supported yet.
- Added Brush, Region and Font user attribute structures. Based on Yuan book.
- All tested with linux qemu with AbiWord 2.4.1.

svn path=/trunk/; revision=30244
This commit is contained in:
James Tabor 2007-11-07 17:58:02 +00:00
parent 53a432f25e
commit 9a0cb042b7
11 changed files with 436 additions and 273 deletions

View file

@ -1551,25 +1551,6 @@ GetBrushAttributes(HBRUSH hbr)
return 0;
}
/*
* @unimplemented
*/
BOOL
STDCALL
GetCharWidthI(HDC hdc,
UINT giFirst,
UINT cgi,
LPWORD pgi,
LPINT lpBuffer
)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/*
* @implemented
*/
@ -2381,30 +2362,6 @@ GetBkMode(HDC hdc)
return NtGdiGetBkMode(hdc);
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetBrushOrgEx(HDC hdc,LPPOINT pt)
{
/* FIXME some part are done in user mode */
return NtGdiGetBrushOrgEx(hdc,pt);
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetCharABCWidthsFloatW(HDC hdc,UINT FirstChar,UINT LastChar,LPABCFLOAT abcF)
{
return FALSE;
}
/*
* @implemented
*
@ -2445,52 +2402,6 @@ GetClipBox(HDC hdc,
return NtGdiGetClipBox(hdc, lprc);
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetCharWidthFloatW(HDC hdc,
UINT iFirstChar,
UINT iLastChar,
PFLOAT pxBuffer)
{
return FALSE;
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetCharWidth32W(HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer)
{
/* FIXME some part need be done in user mode */
return NtGdiGetCharWidth32(hdc, iFirstChar, iLastChar, lpBuffer);
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetCharABCWidths(HDC hdc,
UINT uFirstChar,
UINT uLastChar,
LPABC lpabc)
{
/* FIXME some part need be done in user mode */
return NtGdiGetCharABCWidths(hdc, uFirstChar, uLastChar, lpabc);
}
/*
* @implemented
*

View file

@ -255,6 +255,25 @@ SetROP2(HDC hdc,
return Old_ROP2;
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetBrushOrgEx(HDC hdc,LPPOINT pt)
{
PDC_ATTR Dc_Attr;
if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
if (pt)
{
pt->x = Dc_Attr->ptlBrushOrigin.x;
pt->y = Dc_Attr->ptlBrushOrigin.y;
}
return TRUE;
}
/*
* @implemented
*/
@ -265,6 +284,7 @@ SetBrushOrgEx(HDC hdc,
int nYOrg,
LPPOINT lppt)
{
PDC_ATTR Dc_Attr;
#if 0
// Handle something other than a normal dc object.
if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)
@ -282,9 +302,6 @@ SetBrushOrgEx(HDC hdc,
return FALSE;
}
#endif
#if 0
PDC_ATTR Dc_Attr;
if (GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr))
{
PTEB pTeb = NtCurrentTeb();
@ -313,12 +330,17 @@ SetBrushOrgEx(HDC hdc,
pTeb->GdiTebBatch.Offset += sizeof(GDIBSSETBRHORG);
pTeb->GdiTebBatch.HDC = (ULONG)hdc;
pTeb->GdiBatchCount++;
if (pTeb->GdiBatchCount >= GDI_BatchLimit) NtGdiFlush();
DPRINT("Loading the Flush!! COUNT-> %d\n", pTeb->GdiBatchCount);
if (pTeb->GdiBatchCount >= GDI_BatchLimit)
{
DPRINT("Call GdiFlush!!\n");
NtGdiFlush();
DPRINT("Exit GdiFlush!!\n");
}
return TRUE;
}
}
#endif
return NtGdiSetBrushOrg(hdc,nXOrg,nYOrg,lppt);
}

View file

@ -419,88 +419,6 @@ EnumFontFamiliesA(HDC hdc, LPCSTR lpszFamily, FONTENUMPROCA lpEnumFontFamProc,
return IntEnumFontFamilies(hdc, &LogFont, lpEnumFontFamProc, lParam, FALSE);
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidthA (
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
DPRINT1("GCWA iFirstChar %x\n",iFirstChar);
return GetCharWidth32A ( hdc, iFirstChar, iLastChar, lpBuffer );
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidth32A(
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1);
LPSTR str;
LPWSTR wstr;
BOOL ret = TRUE;
DPRINT1("GCW32A iFirstChar %x\n",iFirstChar);
if(count <= 0) return FALSE;
str = HeapAlloc(GetProcessHeap(), 0, count);
for(i = 0; i < count; i++)
str[i] = (BYTE)(iFirstChar + i);
wstr = FONT_mbtowc(NULL, str, count, &wlen, NULL);
for(i = 0; i < wlen; i++)
{
/* FIXME should be NtGdiGetCharWidthW */
if(!NtGdiGetCharWidth32 (hdc, wstr[i], wstr[i], lpBuffer))
{
ret = FALSE;
break;
}
lpBuffer++;
}
HeapFree(GetProcessHeap(), 0, str);
HeapFree(GetProcessHeap(), 0, wstr);
return ret;
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidthW (
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
DPRINT1("GCW32w uFirstChar %x\n",iFirstChar);
/* FIXME should be NtGdiGetCharWidthW */
return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
}
/*
* @implemented
*/
@ -518,6 +436,7 @@ GetCharacterPlacementW(
DWORD ret=0;
SIZE size;
UINT i, nSet;
DPRINT("GetCharacterPlacementW\n");
if(dwFlags&(~GCP_REORDER)) DPRINT("flags 0x%08lx ignored\n", dwFlags);
if(lpResults->lpClass) DPRINT("classes not implemented\n");
@ -558,7 +477,7 @@ GetCharacterPlacementW(
int c;
for (i = 0; i < nSet; i++)
{
if (NtGdiGetCharWidth32(hdc, lpString[i], lpString[i], &c))
if (GetCharWidth32W(hdc, lpString[i], lpString[i], &c))
lpResults->lpDx[i]= c;
}
}
@ -582,9 +501,212 @@ GetCharacterPlacementW(
return ret;
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetCharABCWidthsFloatW(HDC hdc,
UINT FirstChar,
UINT LastChar,
LPABCFLOAT abcF)
{
DPRINT("GetCharABCWidthsFloatW\n");
if ((!abcF) || (FirstChar > LastChar))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return NtGdiGetCharABCWidthsW( hdc,
FirstChar,
(ULONG)(LastChar - FirstChar + 1),
(PWCHAR) NULL,
0,
(PVOID)abcF);
}
/*
* @unimplemented
* @implemented
*
*/
BOOL
STDCALL
GetCharWidthFloatW(HDC hdc,
UINT iFirstChar,
UINT iLastChar,
PFLOAT pxBuffer)
{
DPRINT("GetCharWidthsFloatW\n");
if ((!pxBuffer) || (iFirstChar > iLastChar))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return NtGdiGetCharWidthW( hdc,
iFirstChar,
(ULONG)(iLastChar - iFirstChar + 1),
(PWCHAR) NULL,
0,
(PVOID) pxBuffer);
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetCharWidthW(HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer)
{
DPRINT("GetCharWidthsW\n");
if ((!lpBuffer) || (iFirstChar > iLastChar))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return NtGdiGetCharWidthW( hdc,
iFirstChar,
(ULONG)(iLastChar - iFirstChar + 1),
(PWCHAR) NULL,
GCW_NOFLOAT,
(PVOID) lpBuffer);
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetCharWidth32W(HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer)
{
DPRINT("GetCharWidths32W\n");
if ((!lpBuffer) || (iFirstChar > iLastChar))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return NtGdiGetCharWidthW( hdc,
iFirstChar,
(ULONG)(iLastChar - iFirstChar + 1),
(PWCHAR) NULL,
GCW_NOFLOAT|GCW_WIN32,
(PVOID) lpBuffer);
}
/*
* @implemented
*
*/
BOOL
STDCALL
GetCharABCWidthsW(HDC hdc,
UINT FirstChar,
UINT LastChar,
LPABC lpabc)
{
DPRINT("GetCharABCWidthsW\n");
if ((!lpabc) || (FirstChar > LastChar))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return NtGdiGetCharABCWidthsW( hdc,
FirstChar,
(ULONG)(LastChar - FirstChar + 1),
(PWCHAR) NULL,
GCABCW_NOFLOAT,
(PVOID)lpabc);
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidthA(
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
DPRINT("GetCharWidthsA\n");
INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1);
LPSTR str;
LPWSTR wstr;
BOOL ret = TRUE;
if(count <= 0) return FALSE;
str = HeapAlloc(GetProcessHeap(), 0, count);
for(i = 0; i < count; i++)
str[i] = (BYTE)(iFirstChar + i);
wstr = FONT_mbtowc(NULL, str, count, &wlen, NULL);
ret = NtGdiGetCharWidthW( hdc,
wstr[0],
(ULONG) count,
(PWCHAR) wstr,
GCW_NOFLOAT,
(PVOID) lpBuffer);
HeapFree(GetProcessHeap(), 0, str);
HeapFree(GetProcessHeap(), 0, wstr);
return ret;
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidth32A(
HDC hdc,
UINT iFirstChar,
UINT iLastChar,
LPINT lpBuffer
)
{
DPRINT("GetCharWidths32A\n");
INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1);
LPSTR str;
LPWSTR wstr;
BOOL ret = TRUE;
if(count <= 0) return FALSE;
str = HeapAlloc(GetProcessHeap(), 0, count);
for(i = 0; i < count; i++)
str[i] = (BYTE)(iFirstChar + i);
wstr = FONT_mbtowc(NULL, str, count, &wlen, NULL);
ret = NtGdiGetCharWidthW( hdc,
wstr[0],
(ULONG) count,
(PWCHAR) wstr,
GCW_NOFLOAT|GCW_WIN32,
(PVOID) lpBuffer);
HeapFree(GetProcessHeap(), 0, str);
HeapFree(GetProcessHeap(), 0, wstr);
return ret;
}
/*
* @implemented
*/
BOOL
APIENTRY
@ -595,10 +717,27 @@ GetCharWidthFloatA(
PFLOAT pxBuffer
)
{
/* FIXME what to do with iFirstChar and iLastChar ??? */
return FALSE;
}
DPRINT("GetCharWidthsFloatA\n");
INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1);
LPSTR str;
LPWSTR wstr;
BOOL ret = TRUE;
if(count <= 0) return FALSE;
str = HeapAlloc(GetProcessHeap(), 0, count);
for(i = 0; i < count; i++)
str[i] = (BYTE)(iFirstChar + i);
wstr = FONT_mbtowc(NULL, str, count, &wlen, NULL);
ret = NtGdiGetCharWidthW( hdc, wstr[0], (ULONG) count, (PWCHAR) wstr, 0, (PVOID) pxBuffer);
HeapFree(GetProcessHeap(), 0, str);
HeapFree(GetProcessHeap(), 0, wstr);
return ret;
}
/*
* @implemented
@ -612,14 +751,35 @@ GetCharABCWidthsA(
LPABC lpabc
)
{
DPRINT1("GCABCWA uFirstChar %x\n",uFirstChar);
DPRINT("GetCharABCWidthsA\n");
INT i, wlen, count = (INT)(uLastChar - uFirstChar + 1);
LPSTR str;
LPWSTR wstr;
BOOL ret = TRUE;
return NtGdiGetCharABCWidths(hdc, uFirstChar, uLastChar, lpabc);
if(count <= 0) return FALSE;
str = HeapAlloc(GetProcessHeap(), 0, count);
for(i = 0; i < count; i++)
str[i] = (BYTE)(uFirstChar + i);
wstr = FONT_mbtowc(hdc, str, count, &wlen, NULL);
ret = NtGdiGetCharABCWidthsW( hdc,
wstr[0],
(ULONG)count,
(PWCHAR)wstr,
GCABCW_NOFLOAT,
(PVOID)lpabc);
HeapFree(GetProcessHeap(), 0, str);
HeapFree(GetProcessHeap(), 0, wstr);
return ret;
}
/*
* @unimplemented
* @implemented
*/
BOOL
APIENTRY
@ -630,10 +790,27 @@ GetCharABCWidthsFloatA(
LPABCFLOAT lpABCF
)
{
DPRINT1("GCABCWFA iFirstChar %x\n",iFirstChar);
DPRINT("GetCharABCWidthsFloatA\n");
INT i, wlen, count = (INT)(iLastChar - iFirstChar + 1);
LPSTR str;
LPWSTR wstr;
BOOL ret = TRUE;
/* FIXME what to do with iFirstChar and iLastChar ??? */
return FALSE;
if (count <= 0) return FALSE;
str = HeapAlloc(GetProcessHeap(), 0, count);
for(i = 0; i < count; i++)
str[i] = (BYTE)(iFirstChar + i);
wstr = FONT_mbtowc( hdc, str, count, &wlen, NULL );
ret = NtGdiGetCharABCWidthsW( hdc,wstr[0],(ULONG)count, (PWCHAR)wstr, 0, (PVOID)lpABCF);
HeapFree( GetProcessHeap(), 0, str );
HeapFree( GetProcessHeap(), 0, wstr );
return ret;
}
/*
@ -645,10 +822,42 @@ GetCharABCWidthsI(HDC hdc,
UINT giFirst,
UINT cgi,
LPWORD pgi,
LPABC lpabc
LPABC lpabc)
{
DPRINT("GetCharABCWidthsI\n");
return NtGdiGetCharABCWidthsW( hdc,
giFirst,
(ULONG) cgi,
(PWCHAR) pgi,
GCABCW_NOFLOAT|GCABCW_INDICES,
(PVOID)lpabc);
}
/*
* @implemented
*/
BOOL
STDCALL
GetCharWidthI(HDC hdc,
UINT giFirst,
UINT cgi,
LPWORD pgi,
LPINT lpBuffer
)
{
return NtGdiGetCharABCWidthsW( hdc, giFirst, (ULONG) cgi, (PWCHAR) pgi, 3, (PVOID)lpabc);
DPRINT("GetCharWidthsI\n");
if (!lpBuffer || (!pgi && (giFirst == MAXUSHORT))) // Cannot be at max.
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!cgi) return TRUE;
return NtGdiGetCharWidthW( hdc,
giFirst,
cgi,
(PWCHAR) pgi,
GCW_INDICES|GCW_NOFLOAT|GCW_WIN32,
(PVOID) lpBuffer );
}
/*
@ -730,7 +939,9 @@ GetGlyphOutlineW(
CONST MAT2 *lpmat2
)
{
DPRINT1("GetGlyphOutlineW uChar %x\n", uChar);
DPRINT("GetGlyphOutlineW uChar %x\n", uChar);
if (!lpgm & !lpmat2) return GDI_ERROR;
if (!lpvBuffer) cbBuffer = 0;
return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
}

View file

@ -79,15 +79,6 @@ NtGdiGetTextExtentPoint32(
LPSIZE
);
BOOL
STDCALL
NtGdiGetCharWidth32(
HDC hDC,
UINT FirstChar,
UINT LastChar,
LPINT Buffer
);
/* Use NtGdiAddFontResourceW */
int
STDCALL
@ -211,9 +202,6 @@ COLORREF STDCALL NtGdiGetBkColor(HDC hDC);
/* Should be done in user-mode using shared GDI Objects. */
INT STDCALL NtGdiGetBkMode(HDC hDC);
/* Should be done in user-mode using shared GDI Objects. */
BOOL STDCALL NtGdiGetBrushOrgEx(HDC hDC, LPPOINT brushOrg);
/* Use NtGdiGetCharABCWidthsW */
BOOL
STDCALL

View file

@ -283,4 +283,26 @@ typedef struct _DC_ATTR
RGNATTR VisRectRegion;
} DC_ATTR, *PDC_ATTR;
typedef struct _BRUSH_ATTR
{
LOGBRUSH logbrush;
DWORD dwUnused[3];
} BRUSH_ATTR, *PBRUSH_ATTR;
typedef struct _REGION_ATTR
{
DWORD dwUnknown1;
DWORD dwUnknown2;
LONG right;
LONG bottom;
LONG left;
LONG top;
} REGION_ATTR, *PREGION_ATTR;
typedef struct _FONT_ATTR
{
DWORD dwUnknown;
void *pCharWidthData;
} FONT_ATTR, *PFONT_ATTR;
#endif

View file

@ -77,8 +77,6 @@ typedef enum _GETDCPOINT
GdiGetDCOrg = 6,
} GETDCPOINT, *PGETDCPOINT;
#define GDIBATCHBUFSIZE 0x136*4
#define GDI_BATCH_LIMIT 20
typedef enum _GDIBATCHCMD
{
@ -105,6 +103,21 @@ typedef enum _TRANSFORMTYPE
typedef DWORD FULLSCREENCONTROL;
typedef DWORD LFTYPE;
/* DEFINES *******************************************************************/
#define GDIBATCHBUFSIZE 0x136*4
#define GDI_BATCH_LIMIT 20
// NtGdiGetCharWidthW Flags
#define GCW_WIN32 0x0001
#define GCW_NOFLOAT 0x0002
#define GCW_INDICES 0x0008
// NtGdiGetCharABCWidthW Flags
#define GCABCW_NOFLOAT 0x0001
#define GCABCW_INDICES 0x0002
/* TYPES *********************************************************************/
typedef PVOID KERNEL_PVOID;

View file

@ -55,7 +55,7 @@ __inline static PUSER_HANDLE_ENTRY alloc_user_entry(PUSER_HANDLE_TABLE ht)
{
PUSER_HANDLE_ENTRY entry;
// DPRINT1("handles used %i\n",usedHandles);
DPRINT("handles used %i\n",usedHandles);
if (ht->freelist)
{

View file

@ -678,7 +678,18 @@ DceFreeDCE(PDCE pdce, BOOLEAN Force)
if(Force && !GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, pdce->hDC))
{
DPRINT1("Change ownership for DCE!\n");
DC_SetOwnership( pdce->hDC, PsGetCurrentProcess());
INT Index = GDI_HANDLE_GET_INDEX(pdce->hDC);
PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index];
// Must take control of handles that are not in the process of going away.
if ((Entry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 && Entry->KernelData != NULL)
{
DC_SetOwnership( pdce->hDC, PsGetCurrentProcess());
}
else
{
DPRINT1("Attempted to change ownership of an DCEhDC 0x%x currently being destroyed!!!\n",pdce->hDC);
}
}
NtGdiDeleteObjectApp(pdce->hDC);

View file

@ -1137,7 +1137,6 @@ NtGdiEnumObjects(
DC_GET_VAL( COLORREF, NtGdiGetBkColor, Dc_Attr.crBackgroundClr )
DC_GET_VAL( INT, NtGdiGetBkMode, Dc_Attr.jBkMode )
DC_GET_VAL_EX( GetBrushOrgEx, Dc_Attr.ptlBrushOrigin.x, Dc_Attr.ptlBrushOrigin.y, POINT, x, y )
HANDLE
STDCALL

View file

@ -2130,12 +2130,18 @@ fail:
return FALSE;
}
/*
* @implemented
*/
BOOL
STDCALL
NtGdiGetCharABCWidths(HDC hDC,
UINT FirstChar,
UINT LastChar,
LPABC abc)
NtGdiGetCharABCWidthsW(
IN HDC hDC,
IN UINT FirstChar,
IN ULONG Count,
IN OPTIONAL PWCHAR pwch,
IN FLONG fl,
OUT PVOID Buffer)
{
LPABC SafeBuffer;
PDC dc;
@ -2146,14 +2152,21 @@ NtGdiGetCharABCWidths(HDC hDC,
UINT i, glyph_index, BufferSize;
HFONT hFont = 0;
NTSTATUS Status;
LPABC abc = NULL;
LPABCFLOAT abcf = NULL;
if (LastChar < FirstChar)
if (!fl)
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
abcf = (LPABCFLOAT) Buffer;
// Not supported yet!
return FALSE;
}
else
abc = (LPABC) Buffer;
BufferSize = (LastChar - FirstChar + 1) * sizeof(ABC);
if (fl & GCABCW_INDICES) return FALSE; // Not supported yet!
BufferSize = Count * sizeof(ABC);
SafeBuffer = ExAllocatePoolWithTag(PagedPool, BufferSize, TAG_GDITEXT);
if (SafeBuffer == NULL)
{
@ -2214,7 +2227,7 @@ NtGdiGetCharABCWidths(HDC hDC,
(TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight < 0 ? - TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight :
TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight == 0 ? 11 : TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight));
for (i = FirstChar; i <= LastChar; i++)
for (i = FirstChar; i < FirstChar+Count; i++)
{
int adv, lsb, bbx, left, right;
@ -2252,45 +2265,17 @@ NtGdiGetCharABCWidths(HDC hDC,
}
/*
* @unimplemented
*/
BOOL
STDCALL
NtGdiGetCharABCWidthsW(
IN HDC hdc,
IN UINT wchFirst,
IN ULONG cwch,
IN OPTIONAL PWCHAR pwch,
IN FLONG fl,
OUT PVOID pvBuf)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
* @implemented
*/
BOOL
STDCALL
NtGdiGetCharWidthW(
IN HDC hdc,
IN UINT wcFirst,
IN UINT cwc,
IN HDC hDC,
IN UINT FirstChar,
IN UINT Count,
IN OPTIONAL PWCHAR pwc,
IN FLONG fl,
OUT PVOID pvBuf)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
STDCALL
NtGdiGetCharWidth32(HDC hDC,
UINT FirstChar,
UINT LastChar,
LPINT Buffer)
OUT PVOID Buffer)
{
LPINT SafeBuffer;
PDC dc;
@ -2300,14 +2285,20 @@ NtGdiGetCharWidth32(HDC hDC,
FT_CharMap charmap, found = NULL;
UINT i, glyph_index, BufferSize;
HFONT hFont = 0;
PFLOAT BufF = NULL;
LPINT Buf = NULL;
if (LastChar < FirstChar)
if (fl == 0)
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
BufF = (PFLOAT) Buffer;
return FALSE;
}
else
Buf = (LPINT) Buffer;
BufferSize = (LastChar - FirstChar + 1) * sizeof(INT);
if (fl & GCW_INDICES) return FALSE;
BufferSize = Count * sizeof(INT);
SafeBuffer = ExAllocatePoolWithTag(PagedPool, BufferSize, TAG_GDITEXT);
if (SafeBuffer == NULL)
{
@ -2369,7 +2360,7 @@ NtGdiGetCharWidth32(HDC hDC,
- TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight :
TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight == 0 ? 11 : TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight));
for (i = FirstChar; i <= LastChar; i++)
for (i = FirstChar; i < FirstChar+Count; i++)
{
glyph_index = FT_Get_Char_Index(face, i);
FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
@ -2410,7 +2401,7 @@ NtGdiGetGlyphIndicesW(
OUTLINETEXTMETRICW *potm;
INT i;
FT_Face face;
WCHAR DefChar = 0, tmDefaultChar;
WCHAR DefChar = 0;
PWSTR Buffer = NULL;
ULONG Size;
@ -2441,18 +2432,20 @@ NtGdiGetGlyphIndicesW(
return GDI_ERROR;
}
Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
potm = ExAllocatePoolWithTag(PagedPool, Size, TAG_GDITEXT);
if (!potm)
{
Status = ERROR_NOT_ENOUGH_MEMORY;
goto ErrorRet;
}
IntGetOutlineTextMetrics(FontGDI, Size, potm);
tmDefaultChar = potm->otmTextMetrics.tmDefaultChar; // May need this.
ExFreePool(potm);
if (iMode & GGI_MARK_NONEXISTING_GLYPHS) DefChar = 0x001f; /* Indicate non existence */
else
{
Size = IntGetOutlineTextMetrics(FontGDI, 0, NULL);
potm = ExAllocatePoolWithTag(PagedPool, Size, TAG_GDITEXT);
if (!potm)
{
Status = ERROR_NOT_ENOUGH_MEMORY;
goto ErrorRet;
}
IntGetOutlineTextMetrics(FontGDI, Size, potm);
DefChar = potm->otmTextMetrics.tmDefaultChar; // May need this.
ExFreePool(potm);
}
_SEH_TRY
{
@ -2474,11 +2467,7 @@ NtGdiGetGlyphIndicesW(
for (i = 0; i < cwc; i++)
{
Buffer[i] = FT_Get_Char_Index(face, UnSafepwc[i]);
if (Buffer[i] == 0)
{
if (!DefChar) DefChar = tmDefaultChar;
Buffer[i] = DefChar;
}
if (Buffer[i] == 0) Buffer[i] = DefChar;
}
IntUnLockFreeType;

View file

@ -746,9 +746,6 @@ NtGdiGdiComment 3
NtGdiGetAspectRatioFilterEx 2
NtGdiGetBkColor 1
NtGdiGetBkMode 1
NtGdiGetBrushOrgEx 2
NtGdiGetCharABCWidths 4
NtGdiGetCharWidth32 4
NtGdiGetClipBox 2
NtGdiGetColorSpace 1
NtGdiGetCurrentPositionEx 2