mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[GDI32/WIN32K]
- Rewrite GetCurrentObject and GetObject, fixes a lot of tests svn path=/trunk/; revision=56400
This commit is contained in:
parent
3b3feb61a8
commit
4bc462e69c
11 changed files with 251 additions and 252 deletions
|
@ -130,7 +130,6 @@ BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, DWORD ObjectType, PVOID *UserData)
|
||||||
((Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK) != ObjectType ||
|
((Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK) != ObjectType ||
|
||||||
(Entry->Type & GDI_ENTRY_BASETYPE_MASK) != (ObjectType & GDI_ENTRY_BASETYPE_MASK))
|
(Entry->Type & GDI_ENTRY_BASETYPE_MASK) != (ObjectType & GDI_ENTRY_BASETYPE_MASK))
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ GetETM(HDC hdc,
|
||||||
BOOL Ret = NtGdiGetETM(hdc, petm);
|
BOOL Ret = NtGdiGetETM(hdc, petm);
|
||||||
|
|
||||||
if (Ret && petm)
|
if (Ret && petm)
|
||||||
petm->emKernPairs = GetKerningPairsA(hdc, 0, 0);
|
petm->emKernPairs = (WORD)GetKerningPairsA(hdc, 0, 0);
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ GetICMProfileA(
|
||||||
|
|
||||||
if (GetICMProfileW(hdc, &buflen, filenameW))
|
if (GetICMProfileW(hdc, &buflen, filenameW))
|
||||||
{
|
{
|
||||||
int len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL);
|
ULONG len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL);
|
||||||
if (*pBufSize >= len)
|
if (*pBufSize >= len)
|
||||||
{
|
{
|
||||||
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, pszFilename, *pBufSize, NULL, NULL);
|
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, pszFilename, *pBufSize, NULL, NULL);
|
||||||
|
|
|
@ -554,7 +554,7 @@ SetDIBits(HDC hDC,
|
||||||
if ( hOldBitmap )
|
if ( hOldBitmap )
|
||||||
{
|
{
|
||||||
if ( hDC )
|
if ( hDC )
|
||||||
hPal = SelectPalette(SavehDC, (HPALETTE)GetDCObject(hDC, GDI_OBJECT_TYPE_PALETTE), FALSE);
|
hPal = SelectPalette(SavehDC, (HPALETTE)GetCurrentObject(hDC, OBJ_PAL), FALSE);
|
||||||
|
|
||||||
if ( lpbmi->bmiHeader.biSize < sizeof(BITMAPINFOHEADER))
|
if ( lpbmi->bmiHeader.biSize < sizeof(BITMAPINFOHEADER))
|
||||||
{
|
{
|
||||||
|
|
|
@ -412,83 +412,62 @@ SetArcDirection( HDC hdc, INT nDirection )
|
||||||
return GetAndSetDCDWord( hdc, GdiGetSetArcDirection, nDirection, 0, 0, 0 );
|
return GetAndSetDCDWord( hdc, GdiGetSetArcDirection, nDirection, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HGDIOBJ
|
|
||||||
WINAPI
|
|
||||||
GetDCObject( HDC hDC, INT iType)
|
|
||||||
{
|
|
||||||
if((iType == GDI_OBJECT_TYPE_BRUSH) ||
|
|
||||||
(iType == GDI_OBJECT_TYPE_EXTPEN)||
|
|
||||||
(iType == GDI_OBJECT_TYPE_PEN) ||
|
|
||||||
(iType == GDI_OBJECT_TYPE_COLORSPACE))
|
|
||||||
{
|
|
||||||
HGDIOBJ hGO = NULL;
|
|
||||||
PDC_ATTR Dc_Attr;
|
|
||||||
|
|
||||||
if (!hDC) return hGO;
|
|
||||||
|
|
||||||
if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return NULL;
|
|
||||||
|
|
||||||
switch (iType)
|
|
||||||
{
|
|
||||||
case GDI_OBJECT_TYPE_BRUSH:
|
|
||||||
hGO = Dc_Attr->hbrush;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GDI_OBJECT_TYPE_EXTPEN:
|
|
||||||
case GDI_OBJECT_TYPE_PEN:
|
|
||||||
hGO = Dc_Attr->hpen;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GDI_OBJECT_TYPE_COLORSPACE:
|
|
||||||
hGO = Dc_Attr->hColorSpace;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return hGO;
|
|
||||||
}
|
|
||||||
return NtGdiGetDCObject( hDC, iType );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
HGDIOBJ
|
HGDIOBJ
|
||||||
WINAPI
|
WINAPI
|
||||||
GetCurrentObject(HDC hdc,
|
GetCurrentObject(
|
||||||
UINT uObjectType)
|
_In_ HDC hdc,
|
||||||
|
_In_ UINT uObjectType)
|
||||||
{
|
{
|
||||||
switch(uObjectType)
|
PDC_ATTR pdcattr;
|
||||||
|
|
||||||
|
/* Check if this is a user mode object */
|
||||||
|
if ((uObjectType == OBJ_PEN) ||
|
||||||
|
(uObjectType == OBJ_EXTPEN) ||
|
||||||
|
(uObjectType == OBJ_BRUSH) ||
|
||||||
|
(uObjectType == OBJ_COLORSPACE))
|
||||||
{
|
{
|
||||||
case OBJ_EXTPEN:
|
/* Get the dc attribute */
|
||||||
case OBJ_PEN:
|
pdcattr = GdiGetDcAttr(hdc);
|
||||||
uObjectType = GDI_OBJECT_TYPE_PEN;
|
if (!pdcattr) return NULL;
|
||||||
break;
|
|
||||||
case OBJ_BRUSH:
|
|
||||||
uObjectType = GDI_OBJECT_TYPE_BRUSH;
|
|
||||||
break;
|
|
||||||
case OBJ_PAL:
|
|
||||||
uObjectType = GDI_OBJECT_TYPE_PALETTE;
|
|
||||||
break;
|
|
||||||
case OBJ_FONT:
|
|
||||||
uObjectType = GDI_OBJECT_TYPE_FONT;
|
|
||||||
break;
|
|
||||||
case OBJ_BITMAP:
|
|
||||||
uObjectType = GDI_OBJECT_TYPE_BITMAP;
|
|
||||||
break;
|
|
||||||
case OBJ_COLORSPACE:
|
|
||||||
uObjectType = GDI_OBJECT_TYPE_COLORSPACE;
|
|
||||||
break;
|
|
||||||
/* tests show that OBJ_REGION is explicitly ignored */
|
|
||||||
case OBJ_REGION:
|
|
||||||
return NULL;
|
|
||||||
/* the SDK only mentions those above */
|
|
||||||
default:
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
return GetDCObject(hdc, uObjectType);
|
|
||||||
|
/* Check what object was requested */
|
||||||
|
switch (uObjectType)
|
||||||
|
{
|
||||||
|
case OBJ_EXTPEN:
|
||||||
|
case OBJ_PEN:
|
||||||
|
return pdcattr->hpen;
|
||||||
|
|
||||||
|
case OBJ_BRUSH:
|
||||||
|
return pdcattr->hbrush;
|
||||||
|
|
||||||
|
case OBJ_COLORSPACE:
|
||||||
|
return pdcattr->hColorSpace;
|
||||||
|
|
||||||
|
case OBJ_PAL:
|
||||||
|
uObjectType = GDI_OBJECT_TYPE_PALETTE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OBJ_FONT:
|
||||||
|
uObjectType = GDI_OBJECT_TYPE_FONT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OBJ_BITMAP:
|
||||||
|
uObjectType = GDI_OBJECT_TYPE_BITMAP;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* All others are invalid */
|
||||||
|
default:
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pass the request to win32k */
|
||||||
|
return NtGdiGetDCObject(hdc, uObjectType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -774,8 +753,7 @@ GetDCOrgEx(
|
||||||
LONG
|
LONG
|
||||||
WINAPI
|
WINAPI
|
||||||
GetDCOrg(
|
GetDCOrg(
|
||||||
HDC hdc
|
HDC hdc)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Officially obsolete by Microsoft
|
// Officially obsolete by Microsoft
|
||||||
POINT Pt;
|
POINT Pt;
|
||||||
|
@ -784,117 +762,86 @@ GetDCOrg(
|
||||||
return(MAKELONG(Pt.x, Pt.y));
|
return(MAKELONG(Pt.x, Pt.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
int
|
|
||||||
GetNonFontObject(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer)
|
|
||||||
{
|
|
||||||
INT dwType;
|
|
||||||
|
|
||||||
hGdiObj = (HANDLE)GdiFixUpHandle(hGdiObj);
|
|
||||||
dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
|
|
||||||
|
|
||||||
if (!lpBuffer) // Should pass it all to Win32k and let god sort it out. ;^)
|
|
||||||
{
|
|
||||||
switch(dwType)
|
|
||||||
{
|
|
||||||
case GDI_OBJECT_TYPE_PEN:
|
|
||||||
return sizeof(LOGPEN);
|
|
||||||
case GDI_OBJECT_TYPE_BRUSH:
|
|
||||||
return sizeof(LOGBRUSH);
|
|
||||||
case GDI_OBJECT_TYPE_BITMAP:
|
|
||||||
return sizeof(BITMAP);
|
|
||||||
case GDI_OBJECT_TYPE_PALETTE:
|
|
||||||
return sizeof(WORD);
|
|
||||||
case GDI_OBJECT_TYPE_EXTPEN: /* we don't know the size, ask win32k */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(dwType)
|
|
||||||
{
|
|
||||||
case GDI_OBJECT_TYPE_PEN: //Check the structures and see if A & W are the same.
|
|
||||||
case GDI_OBJECT_TYPE_EXTPEN:
|
|
||||||
case GDI_OBJECT_TYPE_BRUSH: // Mixing Apples and Oranges?
|
|
||||||
case GDI_OBJECT_TYPE_BITMAP:
|
|
||||||
case GDI_OBJECT_TYPE_PALETTE:
|
|
||||||
return NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
|
|
||||||
|
|
||||||
case GDI_OBJECT_TYPE_DC:
|
|
||||||
case GDI_OBJECT_TYPE_REGION:
|
|
||||||
case GDI_OBJECT_TYPE_METAFILE:
|
|
||||||
case GDI_OBJECT_TYPE_ENHMETAFILE:
|
|
||||||
case GDI_OBJECT_TYPE_EMF:
|
|
||||||
SetLastError(ERROR_INVALID_HANDLE);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
WINAPI
|
WINAPI
|
||||||
GetObjectA(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer)
|
GetFontObjectW(HGDIOBJ hfont, ULONG cbSize, LPVOID lpBuffer)
|
||||||
{
|
{
|
||||||
ENUMLOGFONTEXDVW LogFont;
|
ENUMLOGFONTEXDVW elfedvW;
|
||||||
DWORD dwType;
|
ULONG cbResult, cbMaxSize;
|
||||||
INT Result = 0;
|
|
||||||
|
|
||||||
dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
|
/* Check if size only is requested */
|
||||||
|
if (!lpBuffer) return sizeof(LOGFONTW);
|
||||||
|
|
||||||
if(dwType == GDI_OBJECT_TYPE_COLORSPACE) //Stays here, processes struct A
|
/* Check for size 0 */
|
||||||
|
if (cbSize == 0)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NOT_SUPPORTED);
|
/* Windows does not SetLastError() */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dwType == GDI_OBJECT_TYPE_FONT)
|
/* Call win32k to get the logfont (widechar) */
|
||||||
|
cbResult = NtGdiExtGetObjectW(hfont, sizeof(ENUMLOGFONTEXDVW), &elfedvW);
|
||||||
|
if (cbResult == 0)
|
||||||
{
|
{
|
||||||
if (!lpBuffer)
|
return 0;
|
||||||
{
|
|
||||||
return sizeof(LOGFONTA);
|
|
||||||
}
|
|
||||||
if (cbSize == 0)
|
|
||||||
{
|
|
||||||
/* Windows does not SetLastError() */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// ENUMLOGFONTEXDVW is the default size and should be the structure for
|
|
||||||
// Entry->KernelData for Font objects.
|
|
||||||
Result = NtGdiExtGetObjectW(hGdiObj, sizeof(ENUMLOGFONTEXDVW), &LogFont);
|
|
||||||
|
|
||||||
if (0 == Result)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cbSize)
|
|
||||||
{
|
|
||||||
case sizeof(ENUMLOGFONTEXDVA):
|
|
||||||
// need to move more here.
|
|
||||||
case sizeof(ENUMLOGFONTEXA):
|
|
||||||
EnumLogFontExW2A( (LPENUMLOGFONTEXA) lpBuffer, &LogFont.elfEnumLogfontEx );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case sizeof(ENUMLOGFONTA):
|
|
||||||
// Same here, maybe? Check the structures.
|
|
||||||
case sizeof(EXTLOGFONTA):
|
|
||||||
// Same here
|
|
||||||
case sizeof(LOGFONTA):
|
|
||||||
LogFontW2A((LPLOGFONTA) lpBuffer, &LogFont.elfEnumLogfontEx.elfLogFont);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
SetLastError(ERROR_BUFFER_OVERFLOW);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return cbSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetNonFontObject(hGdiObj, cbSize, lpBuffer);
|
/* Calculate the maximum size according to number of axes */
|
||||||
|
cbMaxSize = FIELD_OFFSET(ENUMLOGFONTEXDVW,
|
||||||
|
elfDesignVector.dvValues[elfedvW.elfDesignVector.dvNumAxes]);
|
||||||
|
|
||||||
|
/* Don't copy more than the maximum */
|
||||||
|
if (cbSize > cbMaxSize) cbSize = cbMaxSize;
|
||||||
|
if (cbSize > cbResult) cbSize = cbResult;
|
||||||
|
|
||||||
|
/* Copy the number of bytes requested */
|
||||||
|
memcpy(lpBuffer, &elfedvW, cbSize);
|
||||||
|
|
||||||
|
/* Return the number of bytes copied */
|
||||||
|
return cbSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
WINAPI
|
||||||
|
GetFontObjectA(HGDIOBJ hfont, ULONG cbSize, LPVOID lpBuffer)
|
||||||
|
{
|
||||||
|
ENUMLOGFONTEXDVW elfedvW;
|
||||||
|
ENUMLOGFONTEXDVA elfedvA;
|
||||||
|
ULONG cbResult;
|
||||||
|
|
||||||
|
/* Check if size only is requested */
|
||||||
|
if (!lpBuffer) return sizeof(LOGFONTA);
|
||||||
|
|
||||||
|
/* Check for size 0 */
|
||||||
|
if (cbSize == 0)
|
||||||
|
{
|
||||||
|
/* Windows does not SetLastError() */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Windows does this ... */
|
||||||
|
if (cbSize == sizeof(LOGFONTW)) cbSize = sizeof(LOGFONTA);
|
||||||
|
|
||||||
|
/* Call win32k to get the logfont (widechar) */
|
||||||
|
cbResult = NtGdiExtGetObjectW(hfont, sizeof(ENUMLOGFONTEXDVW), &elfedvW);
|
||||||
|
if (cbResult == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert the logfont from widechar to ansi */
|
||||||
|
EnumLogFontExW2A(&elfedvA.elfEnumLogfontEx, &elfedvW.elfEnumLogfontEx);
|
||||||
|
elfedvA.elfDesignVector = elfedvW.elfDesignVector;
|
||||||
|
|
||||||
|
/* Don't copy more than maximum */
|
||||||
|
if (cbSize > sizeof(ENUMLOGFONTEXDVA)) cbSize = sizeof(ENUMLOGFONTEXDVA);
|
||||||
|
|
||||||
|
/* Copy the number of bytes requested */
|
||||||
|
memcpy(lpBuffer, &elfedvA, cbSize);
|
||||||
|
|
||||||
|
/* Return the number of bytes copied */
|
||||||
|
return cbSize;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
@ -903,47 +850,100 @@ int
|
||||||
WINAPI
|
WINAPI
|
||||||
GetObjectW(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer)
|
GetObjectW(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer)
|
||||||
{
|
{
|
||||||
DWORD dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
|
DWORD dwType;
|
||||||
INT Result = 0;
|
INT cbResult = 0;
|
||||||
|
|
||||||
/*
|
hGdiObj = GdiFixUpHandle(hGdiObj);
|
||||||
Check List:
|
|
||||||
MSDN, "This can be a handle to one of the following: logical bitmap, a brush,
|
/* Get the object type */
|
||||||
a font, a palette, a pen, or a device independent bitmap created by calling
|
dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
|
||||||
the CreateDIBSection function."
|
|
||||||
*/
|
/* Check what kind of object we have */
|
||||||
if(dwType == GDI_OBJECT_TYPE_COLORSPACE) //Stays here, processes struct W
|
switch(dwType)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NOT_SUPPORTED); // Not supported yet.
|
case GDI_OBJECT_TYPE_PEN:
|
||||||
return 0;
|
if (!lpBuffer) return sizeof(LOGPEN);
|
||||||
|
cbResult = NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
|
||||||
|
if (cbResult == 0)
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return cbResult;
|
||||||
|
|
||||||
|
case GDI_OBJECT_TYPE_BRUSH:
|
||||||
|
if (!lpBuffer) return sizeof(LOGBRUSH);
|
||||||
|
cbResult = NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
|
||||||
|
if (cbResult == 0)
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return cbResult;
|
||||||
|
|
||||||
|
case GDI_OBJECT_TYPE_BITMAP:
|
||||||
|
if (!lpBuffer) return sizeof(BITMAP);
|
||||||
|
return NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
|
||||||
|
|
||||||
|
case GDI_OBJECT_TYPE_PALETTE:
|
||||||
|
if (!lpBuffer) return sizeof(WORD);
|
||||||
|
return NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
|
||||||
|
|
||||||
|
case GDI_OBJECT_TYPE_FONT:
|
||||||
|
return GetFontObjectW(hGdiObj, cbSize, lpBuffer);
|
||||||
|
|
||||||
|
case GDI_OBJECT_TYPE_EXTPEN:
|
||||||
|
/* we don't know the size, ask win32k */
|
||||||
|
cbResult = NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
|
||||||
|
if (cbResult == 0)
|
||||||
|
{
|
||||||
|
if (!GdiIsHandleValid(hGdiObj))
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
else if (cbSize == 0)
|
||||||
|
SetLastError(ERROR_NOACCESS);
|
||||||
|
}
|
||||||
|
return cbResult;
|
||||||
|
|
||||||
|
case GDI_OBJECT_TYPE_COLORSPACE:
|
||||||
|
if ((cbSize < 328) || !lpBuffer)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
cbResult = NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
|
||||||
|
if (cbResult == 0)
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return cbResult;
|
||||||
|
|
||||||
|
case GDI_OBJECT_TYPE_METADC:
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case GDI_OBJECT_TYPE_DC:
|
||||||
|
case GDI_OBJECT_TYPE_REGION:
|
||||||
|
case GDI_OBJECT_TYPE_EMF:
|
||||||
|
case GDI_OBJECT_TYPE_METAFILE:
|
||||||
|
case GDI_OBJECT_TYPE_ENHMETAFILE:
|
||||||
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
WINAPI
|
||||||
|
GetObjectA(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer)
|
||||||
|
{
|
||||||
|
DWORD dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
|
||||||
|
|
||||||
|
/* Chjeck if this is anything else but a font */
|
||||||
if (dwType == GDI_OBJECT_TYPE_FONT)
|
if (dwType == GDI_OBJECT_TYPE_FONT)
|
||||||
{
|
{
|
||||||
if (!lpBuffer)
|
return GetFontObjectA(hGdiObj, cbSize, lpBuffer);
|
||||||
{
|
}
|
||||||
return sizeof(LOGFONTW);
|
else
|
||||||
}
|
{
|
||||||
|
/* Simply pass it to the widechar version */
|
||||||
if (cbSize == 0)
|
return GetObjectW(hGdiObj, cbSize, lpBuffer);
|
||||||
{
|
|
||||||
/* Windows does not SetLastError() */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// Poorly written apps are not ReactOS problem!
|
|
||||||
// We fix it here if the size is larger than the default size.
|
|
||||||
if( cbSize > (int)sizeof(ENUMLOGFONTEXDVW) ) cbSize = sizeof(ENUMLOGFONTEXDVW);
|
|
||||||
|
|
||||||
Result = NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer); // Should handle the copy.
|
|
||||||
|
|
||||||
if (0 == Result)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return cbSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetNonFontObject(hGdiObj, cbSize, lpBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,8 @@ FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA )
|
||||||
ptmA->tmFirstChar = ptmW->tmDefaultChar - 1;
|
ptmA->tmFirstChar = ptmW->tmDefaultChar - 1;
|
||||||
ptmA->tmLastChar = min(ptmW->tmLastChar, 0xff);
|
ptmA->tmLastChar = min(ptmW->tmLastChar, 0xff);
|
||||||
}
|
}
|
||||||
ptmA->tmDefaultChar = ptmW->tmDefaultChar;
|
ptmA->tmDefaultChar = (CHAR)ptmW->tmDefaultChar;
|
||||||
ptmA->tmBreakChar = ptmW->tmBreakChar;
|
ptmA->tmBreakChar = (CHAR)ptmW->tmBreakChar;
|
||||||
ptmA->tmItalic = ptmW->tmItalic;
|
ptmA->tmItalic = ptmW->tmItalic;
|
||||||
ptmA->tmUnderlined = ptmW->tmUnderlined;
|
ptmA->tmUnderlined = ptmW->tmUnderlined;
|
||||||
ptmA->tmStruckOut = ptmW->tmStruckOut;
|
ptmA->tmStruckOut = ptmW->tmStruckOut;
|
||||||
|
@ -503,7 +503,7 @@ NewGetCharacterPlacementW(
|
||||||
DWORD dwFlags
|
DWORD dwFlags
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
INT nSet;
|
ULONG nSet;
|
||||||
SIZE Size = {0,0};
|
SIZE Size = {0,0};
|
||||||
|
|
||||||
if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 ) )
|
if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 ) )
|
||||||
|
@ -1497,14 +1497,14 @@ CreateFontW(
|
||||||
logfont.lfEscapement = nEscapement;
|
logfont.lfEscapement = nEscapement;
|
||||||
logfont.lfOrientation = nOrientation;
|
logfont.lfOrientation = nOrientation;
|
||||||
logfont.lfWeight = nWeight;
|
logfont.lfWeight = nWeight;
|
||||||
logfont.lfItalic = fnItalic;
|
logfont.lfItalic = (BYTE)fnItalic;
|
||||||
logfont.lfUnderline = fdwUnderline;
|
logfont.lfUnderline = (BYTE)fdwUnderline;
|
||||||
logfont.lfStrikeOut = fdwStrikeOut;
|
logfont.lfStrikeOut = (BYTE)fdwStrikeOut;
|
||||||
logfont.lfCharSet = fdwCharSet;
|
logfont.lfCharSet = (BYTE)fdwCharSet;
|
||||||
logfont.lfOutPrecision = fdwOutputPrecision;
|
logfont.lfOutPrecision = (BYTE)fdwOutputPrecision;
|
||||||
logfont.lfClipPrecision = fdwClipPrecision;
|
logfont.lfClipPrecision = (BYTE)fdwClipPrecision;
|
||||||
logfont.lfQuality = fdwQuality;
|
logfont.lfQuality = (BYTE)fdwQuality;
|
||||||
logfont.lfPitchAndFamily = fdwPitchAndFamily;
|
logfont.lfPitchAndFamily = (BYTE)fdwPitchAndFamily;
|
||||||
|
|
||||||
if (NULL != lpszFace)
|
if (NULL != lpszFace)
|
||||||
{
|
{
|
||||||
|
|
|
@ -382,7 +382,7 @@ PaintRgn( HDC hDC, HRGN hRgn )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Could just use Dc_Attr->hbrush? No.
|
// Could just use Dc_Attr->hbrush? No.
|
||||||
HBRUSH hBrush = (HBRUSH) GetDCObject( hDC, GDI_OBJECT_TYPE_BRUSH);
|
HBRUSH hBrush = (HBRUSH)GetCurrentObject(hDC, OBJ_BRUSH);
|
||||||
|
|
||||||
return NtGdiFillRgn( hDC, hRgn, hBrush);
|
return NtGdiFillRgn( hDC, hRgn, hBrush);
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ RealizePalette(HDC hDC) /* [in] Handle of device context */
|
||||||
return MFDRV_(hDC);
|
return MFDRV_(hDC);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HPALETTE Pal = GetDCObject(hDC, GDI_OBJECT_TYPE_PALETTE);
|
HPALETTE Pal = GetCurrentObject(hDC, OBJ_PAL);
|
||||||
PLDC pLDC = GdiGetLDC((HDC) Pal);
|
PLDC pLDC = GdiGetLDC((HDC) Pal);
|
||||||
if ( !pLDC ) return FALSE;
|
if ( !pLDC ) return FALSE;
|
||||||
if (pLDC->iType == LDC_EMFLDC) return EMFDRV_(Pal);
|
if (pLDC->iType == LDC_EMFLDC) return EMFDRV_(Pal);
|
||||||
|
|
|
@ -461,7 +461,6 @@ NtGdiGetDCObject(HDC hDC, INT ObjectType)
|
||||||
|
|
||||||
if(!(pdc = DC_LockDc(hDC)))
|
if(!(pdc = DC_LockDc(hDC)))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pdcattr = pdc->pdcattr;
|
pdcattr = pdc->pdcattr;
|
||||||
|
|
|
@ -262,41 +262,43 @@ GreGetCharacterPlacementW(
|
||||||
|
|
||||||
INT
|
INT
|
||||||
FASTCALL
|
FASTCALL
|
||||||
FontGetObject(PTEXTOBJ TFont, INT Count, PVOID Buffer)
|
FontGetObject(PTEXTOBJ TFont, INT cjBuffer, PVOID pvBuffer)
|
||||||
{
|
{
|
||||||
if( Buffer == NULL ) return sizeof(LOGFONTW);
|
if (pvBuffer == NULL) return sizeof(LOGFONTW);
|
||||||
|
|
||||||
switch (Count)
|
switch (cjBuffer)
|
||||||
{
|
{
|
||||||
case sizeof(ENUMLOGFONTEXDVW):
|
case sizeof(ENUMLOGFONTEXDVW):
|
||||||
RtlCopyMemory( (LPENUMLOGFONTEXDVW) Buffer,
|
RtlCopyMemory(pvBuffer,
|
||||||
&TFont->logfont,
|
&TFont->logfont,
|
||||||
sizeof(ENUMLOGFONTEXDVW));
|
sizeof(ENUMLOGFONTEXDVW));
|
||||||
break;
|
break;
|
||||||
case sizeof(ENUMLOGFONTEXW):
|
|
||||||
RtlCopyMemory( (LPENUMLOGFONTEXW) Buffer,
|
case sizeof(ENUMLOGFONTEXW):
|
||||||
&TFont->logfont.elfEnumLogfontEx,
|
RtlCopyMemory(pvBuffer,
|
||||||
sizeof(ENUMLOGFONTEXW));
|
&TFont->logfont.elfEnumLogfontEx,
|
||||||
|
sizeof(ENUMLOGFONTEXW));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case sizeof(EXTLOGFONTW):
|
case sizeof(EXTLOGFONTW):
|
||||||
case sizeof(ENUMLOGFONTW):
|
case sizeof(ENUMLOGFONTW):
|
||||||
RtlCopyMemory((LPENUMLOGFONTW) Buffer,
|
RtlCopyMemory((LPENUMLOGFONTW) pvBuffer,
|
||||||
&TFont->logfont.elfEnumLogfontEx.elfLogFont,
|
&TFont->logfont.elfEnumLogfontEx.elfLogFont,
|
||||||
sizeof(ENUMLOGFONTW));
|
sizeof(ENUMLOGFONTW));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case sizeof(LOGFONTW):
|
case sizeof(LOGFONTW):
|
||||||
RtlCopyMemory((LPLOGFONTW) Buffer,
|
RtlCopyMemory((LPLOGFONTW) pvBuffer,
|
||||||
&TFont->logfont.elfEnumLogfontEx.elfLogFont,
|
&TFont->logfont.elfEnumLogfontEx.elfLogFont,
|
||||||
sizeof(LOGFONTW));
|
sizeof(LOGFONTW));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
EngSetLastError(ERROR_BUFFER_OVERFLOW);
|
EngSetLastError(ERROR_BUFFER_OVERFLOW);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return Count;
|
|
||||||
|
return cjBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
|
@ -928,7 +930,7 @@ NtGdiGetFontResourceInfoInternalW(
|
||||||
|
|
||||||
/* Allocate a safe unicode string buffer */
|
/* Allocate a safe unicode string buffer */
|
||||||
cbStringSize = cwc * sizeof(WCHAR);
|
cbStringSize = cwc * sizeof(WCHAR);
|
||||||
SafeFileNames.MaximumLength = SafeFileNames.Length = cbStringSize - sizeof(WCHAR);
|
SafeFileNames.MaximumLength = SafeFileNames.Length = (USHORT)cbStringSize - sizeof(WCHAR);
|
||||||
SafeFileNames.Buffer = ExAllocatePoolWithTag(PagedPool,
|
SafeFileNames.Buffer = ExAllocatePoolWithTag(PagedPool,
|
||||||
cbStringSize,
|
cbStringSize,
|
||||||
'RTSU');
|
'RTSU');
|
||||||
|
|
|
@ -1021,7 +1021,6 @@ GreGetObject(
|
||||||
if (!pvObj)
|
if (!pvObj)
|
||||||
{
|
{
|
||||||
DPRINT("GreGetObject: Could not lock object\n");
|
DPRINT("GreGetObject: Could not lock object\n");
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue