Author: tkreuzer
Date: Mon Apr 23 19:22:17 2012
New Revision: 56400
URL:
http://svn.reactos.org/svn/reactos?rev=56400&view=rev
Log:
[GDI32/WIN32K]
- Rewrite GetCurrentObject and GetObject, fixes a lot of tests
Modified:
trunk/reactos/win32ss/gdi/gdi32/misc/misc.c
trunk/reactos/win32ss/gdi/gdi32/misc/stubs.c
trunk/reactos/win32ss/gdi/gdi32/misc/stubsa.c
trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c
trunk/reactos/win32ss/gdi/gdi32/objects/dc.c
trunk/reactos/win32ss/gdi/gdi32/objects/font.c
trunk/reactos/win32ss/gdi/gdi32/objects/painting.c
trunk/reactos/win32ss/gdi/gdi32/objects/palette.c
trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c
trunk/reactos/win32ss/gdi/ntgdi/font.c
trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c
Modified: trunk/reactos/win32ss/gdi/gdi32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/misc/mis…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/misc/misc.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/misc/misc.c [iso-8859-1] Mon Apr 23 19:22:17 2012
@@ -130,7 +130,6 @@
((Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK) !=
ObjectType ||
(Entry->Type & GDI_ENTRY_BASETYPE_MASK) != (ObjectType &
GDI_ENTRY_BASETYPE_MASK))
{
- SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
Modified: trunk/reactos/win32ss/gdi/gdi32/misc/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/misc/stu…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/misc/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/misc/stubs.c [iso-8859-1] Mon Apr 23 19:22:17 2012
@@ -1131,7 +1131,7 @@
BOOL Ret = NtGdiGetETM(hdc, petm);
if (Ret && petm)
- petm->emKernPairs = GetKerningPairsA(hdc, 0, 0);
+ petm->emKernPairs = (WORD)GetKerningPairsA(hdc, 0, 0);
return Ret;
}
Modified: trunk/reactos/win32ss/gdi/gdi32/misc/stubsa.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/misc/stu…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/misc/stubsa.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/misc/stubsa.c [iso-8859-1] Mon Apr 23 19:22:17 2012
@@ -61,7 +61,7 @@
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)
{
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, pszFilename, *pBufSize, NULL,
NULL);
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] Mon Apr 23 19:22:17
2012
@@ -554,7 +554,7 @@
if ( hOldBitmap )
{
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))
{
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/objects/dc.c [iso-8859-1] Mon Apr 23 19:22:17 2012
@@ -412,83 +412,62 @@
return GetAndSetDCDWord( hdc, GdiGetSetArcDirection, nDirection, 0, 0, 0 );
}
-
+/*
+ * @implemented
+ *
+ */
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;
+GetCurrentObject(
+ _In_ HDC hdc,
+ _In_ UINT 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))
+ {
+ /* Get the dc attribute */
+ pdcattr = GdiGetDcAttr(hdc);
+ if (!pdcattr) return NULL;
+ }
+
+ /* 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 GDI_OBJECT_TYPE_EXTPEN:
- case GDI_OBJECT_TYPE_PEN:
- hGO = Dc_Attr->hpen;
+ case OBJ_FONT:
+ uObjectType = GDI_OBJECT_TYPE_FONT;
break;
- case GDI_OBJECT_TYPE_COLORSPACE:
- hGO = Dc_Attr->hColorSpace;
+ case OBJ_BITMAP:
+ uObjectType = GDI_OBJECT_TYPE_BITMAP;
break;
- }
- return hGO;
- }
- return NtGdiGetDCObject( hDC, iType );
-}
-
-
-/*
- * @implemented
- *
- */
-HGDIOBJ
-WINAPI
-GetCurrentObject(HDC hdc,
- UINT uObjectType)
-{
- switch(uObjectType)
- {
- case OBJ_EXTPEN:
- case OBJ_PEN:
- uObjectType = GDI_OBJECT_TYPE_PEN;
- 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);
+
+ /* All others are invalid */
+ default:
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return NULL;
+ }
+
+ /* Pass the request to win32k */
+ return NtGdiGetDCObject(hdc, uObjectType);
}
/*
@@ -774,8 +753,7 @@
LONG
WINAPI
GetDCOrg(
- HDC hdc
-)
+ HDC hdc)
{
// Officially obsolete by Microsoft
POINT Pt;
@@ -784,52 +762,169 @@
return(MAKELONG(Pt.x, Pt.y));
}
-
+ULONG
+WINAPI
+GetFontObjectW(HGDIOBJ hfont, ULONG cbSize, LPVOID lpBuffer)
+{
+ ENUMLOGFONTEXDVW elfedvW;
+ ULONG cbResult, cbMaxSize;
+
+ /* Check if size only is requested */
+ if (!lpBuffer) return sizeof(LOGFONTW);
+
+ /* Check for size 0 */
+ if (cbSize == 0)
+ {
+ /* Windows does not SetLastError() */
+ return 0;
+ }
+
+ /* Call win32k to get the logfont (widechar) */
+ cbResult = NtGdiExtGetObjectW(hfont, sizeof(ENUMLOGFONTEXDVW), &elfedvW);
+ if (cbResult == 0)
+ {
+ return 0;
+ }
+
+ /* 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
+ */
int
-GetNonFontObject(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer)
-{
- INT dwType;
-
- hGdiObj = (HANDLE)GdiFixUpHandle(hGdiObj);
+WINAPI
+GetObjectW(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer)
+{
+ DWORD dwType;
+ INT cbResult = 0;
+
+ hGdiObj = GdiFixUpHandle(hGdiObj);
+
+ /* Get the object type */
dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
- if (!lpBuffer) // Should pass it all to Win32k and let god sort it out. ;^)
- {
- switch(dwType)
- {
+ /* Check what kind of object we have */
+ switch(dwType)
+ {
case GDI_OBJECT_TYPE_PEN:
- return sizeof(LOGPEN);
+ if (!lpBuffer) return sizeof(LOGPEN);
+ cbResult = NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
+ if (cbResult == 0)
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return cbResult;
+
case GDI_OBJECT_TYPE_BRUSH:
- return sizeof(LOGBRUSH);
+ if (!lpBuffer) return sizeof(LOGBRUSH);
+ cbResult = NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
+ if (cbResult == 0)
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return cbResult;
+
case GDI_OBJECT_TYPE_BITMAP:
- return sizeof(BITMAP);
+ if (!lpBuffer) return sizeof(BITMAP);
+ return NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
+
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);
- }
+ 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
*/
@@ -837,113 +932,18 @@
WINAPI
GetObjectA(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer)
{
- ENUMLOGFONTEXDVW LogFont;
- DWORD dwType;
- INT Result = 0;
-
- dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
-
- if(dwType == GDI_OBJECT_TYPE_COLORSPACE) //Stays here, processes struct A
- {
- SetLastError(ERROR_NOT_SUPPORTED);
- return 0;
- }
-
+ DWORD dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
+
+ /* Chjeck if this is anything else but a font */
if (dwType == GDI_OBJECT_TYPE_FONT)
{
- if (!lpBuffer)
- {
- 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);
-}
-
-
-/*
- * @implemented
- */
-int
-WINAPI
-GetObjectW(HGDIOBJ hGdiObj, int cbSize, LPVOID lpBuffer)
-{
- DWORD dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
- INT Result = 0;
-
- /*
- Check List:
- MSDN, "This can be a handle to one of the following: logical bitmap, a brush,
- a font, a palette, a pen, or a device independent bitmap created by calling
- the CreateDIBSection function."
- */
- if(dwType == GDI_OBJECT_TYPE_COLORSPACE) //Stays here, processes struct W
- {
- SetLastError(ERROR_NOT_SUPPORTED); // Not supported yet.
- return 0;
- }
-
- if (dwType == GDI_OBJECT_TYPE_FONT)
- {
- if (!lpBuffer)
- {
- return sizeof(LOGFONTW);
- }
-
- if (cbSize == 0)
- {
- /* 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);
+ return GetFontObjectA(hGdiObj, cbSize, lpBuffer);
+ }
+ else
+ {
+ /* Simply pass it to the widechar version */
+ return GetObjectW(hGdiObj, cbSize, lpBuffer);
+ }
}
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/objects/font.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/objects/font.c [iso-8859-1] Mon Apr 23 19:22:17 2012
@@ -88,8 +88,8 @@
ptmA->tmFirstChar = ptmW->tmDefaultChar - 1;
ptmA->tmLastChar = min(ptmW->tmLastChar, 0xff);
}
- ptmA->tmDefaultChar = ptmW->tmDefaultChar;
- ptmA->tmBreakChar = ptmW->tmBreakChar;
+ ptmA->tmDefaultChar = (CHAR)ptmW->tmDefaultChar;
+ ptmA->tmBreakChar = (CHAR)ptmW->tmBreakChar;
ptmA->tmItalic = ptmW->tmItalic;
ptmA->tmUnderlined = ptmW->tmUnderlined;
ptmA->tmStruckOut = ptmW->tmStruckOut;
@@ -503,7 +503,7 @@
DWORD dwFlags
)
{
- INT nSet;
+ ULONG nSet;
SIZE Size = {0,0};
if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 )
)
@@ -1497,14 +1497,14 @@
logfont.lfEscapement = nEscapement;
logfont.lfOrientation = nOrientation;
logfont.lfWeight = nWeight;
- logfont.lfItalic = fnItalic;
- logfont.lfUnderline = fdwUnderline;
- logfont.lfStrikeOut = fdwStrikeOut;
- logfont.lfCharSet = fdwCharSet;
- logfont.lfOutPrecision = fdwOutputPrecision;
- logfont.lfClipPrecision = fdwClipPrecision;
- logfont.lfQuality = fdwQuality;
- logfont.lfPitchAndFamily = fdwPitchAndFamily;
+ logfont.lfItalic = (BYTE)fnItalic;
+ logfont.lfUnderline = (BYTE)fdwUnderline;
+ logfont.lfStrikeOut = (BYTE)fdwStrikeOut;
+ logfont.lfCharSet = (BYTE)fdwCharSet;
+ logfont.lfOutPrecision = (BYTE)fdwOutputPrecision;
+ logfont.lfClipPrecision = (BYTE)fdwClipPrecision;
+ logfont.lfQuality = (BYTE)fdwQuality;
+ logfont.lfPitchAndFamily = (BYTE)fdwPitchAndFamily;
if (NULL != lpszFace)
{
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/painting.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/objects/painting.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/objects/painting.c [iso-8859-1] Mon Apr 23 19:22:17
2012
@@ -382,7 +382,7 @@
}
#endif
// 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);
}
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/palette.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/objects/palette.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/objects/palette.c [iso-8859-1] Mon Apr 23 19:22:17
2012
@@ -145,7 +145,7 @@
return MFDRV_(hDC);
else
{
- HPALETTE Pal = GetDCObject(hDC, GDI_OBJECT_TYPE_PALETTE);
+ HPALETTE Pal = GetCurrentObject(hDC, OBJ_PAL);
PLDC pLDC = GdiGetLDC((HDC) Pal);
if ( !pLDC ) return FALSE;
if (pLDC->iType == LDC_EMFLDC) return EMFDRV_(Pal);
Modified: trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] Mon Apr 23 19:22:17 2012
@@ -461,7 +461,6 @@
if(!(pdc = DC_LockDc(hDC)))
{
- EngSetLastError(ERROR_INVALID_HANDLE);
return NULL;
}
pdcattr = pdc->pdcattr;
Modified: trunk/reactos/win32ss/gdi/ntgdi/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/font.c?r…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/font.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/font.c [iso-8859-1] Mon Apr 23 19:22:17 2012
@@ -74,7 +74,7 @@
}
/*
-
+
It is recommended that an application use the GetFontLanguageInfo function
to determine whether the GCP_DIACRITIC, GCP_DBCS, GCP_USEKERNING, GCP_LIGATE,
GCP_REORDER, GCP_GLYPHSHAPE, and GCP_KASHIDA values are valid for the
@@ -102,7 +102,7 @@
INT *tmpDxCaretPos;
LONG Cx;
SIZE Size = {0,0};
-
+
DPRINT1("GreGCPW Start\n");
if (!pgcpw)
@@ -126,7 +126,7 @@
if ( !gcpwSave.lpDx && gcpwSave.lpCaretPos )
tmpDxCaretPos = gcpwSave.lpCaretPos;
else
- tmpDxCaretPos = gcpwSave.lpDx;
+ tmpDxCaretPos = gcpwSave.lpDx;
if ( !GreGetTextExtentExW( hdc,
pwsz,
@@ -145,7 +145,7 @@
nSet = cSet;
if ( tmpDxCaretPos && nSet > 0)
- {
+ {
for (i = (nSet - 1); i > 0; i--)
{
tmpDxCaretPos[i] -= tmpDxCaretPos[i - 1];
@@ -161,7 +161,7 @@
{
DWORD Count;
LPKERNINGPAIR pKP;
-
+
Count = GreGetKerningPairs( hdc, 0, NULL);
if (Count)
{
@@ -262,41 +262,43 @@
INT
FASTCALL
-FontGetObject(PTEXTOBJ TFont, INT Count, PVOID Buffer)
-{
- if( Buffer == NULL ) return sizeof(LOGFONTW);
-
- switch (Count)
- {
- case sizeof(ENUMLOGFONTEXDVW):
- RtlCopyMemory( (LPENUMLOGFONTEXDVW) Buffer,
- &TFont->logfont,
- sizeof(ENUMLOGFONTEXDVW));
+FontGetObject(PTEXTOBJ TFont, INT cjBuffer, PVOID pvBuffer)
+{
+ if (pvBuffer == NULL) return sizeof(LOGFONTW);
+
+ switch (cjBuffer)
+ {
+ case sizeof(ENUMLOGFONTEXDVW):
+ RtlCopyMemory(pvBuffer,
+ &TFont->logfont,
+ sizeof(ENUMLOGFONTEXDVW));
+ break;
+
+ case sizeof(ENUMLOGFONTEXW):
+ RtlCopyMemory(pvBuffer,
+ &TFont->logfont.elfEnumLogfontEx,
+ sizeof(ENUMLOGFONTEXW));
break;
- case sizeof(ENUMLOGFONTEXW):
- RtlCopyMemory( (LPENUMLOGFONTEXW) Buffer,
- &TFont->logfont.elfEnumLogfontEx,
- sizeof(ENUMLOGFONTEXW));
- break;
-
- case sizeof(EXTLOGFONTW):
- case sizeof(ENUMLOGFONTW):
- RtlCopyMemory((LPENUMLOGFONTW) Buffer,
+
+ case sizeof(EXTLOGFONTW):
+ case sizeof(ENUMLOGFONTW):
+ RtlCopyMemory((LPENUMLOGFONTW) pvBuffer,
&TFont->logfont.elfEnumLogfontEx.elfLogFont,
sizeof(ENUMLOGFONTW));
- break;
-
- case sizeof(LOGFONTW):
- RtlCopyMemory((LPLOGFONTW) Buffer,
+ break;
+
+ case sizeof(LOGFONTW):
+ RtlCopyMemory((LPLOGFONTW) pvBuffer,
&TFont->logfont.elfEnumLogfontEx.elfLogFont,
sizeof(LOGFONTW));
- break;
-
- default:
- EngSetLastError(ERROR_BUFFER_OVERFLOW);
- return 0;
- }
- return Count;
+ break;
+
+ default:
+ EngSetLastError(ERROR_BUFFER_OVERFLOW);
+ return 0;
+ }
+
+ return cjBuffer;
}
DWORD
@@ -928,7 +930,7 @@
/* Allocate a safe unicode string buffer */
cbStringSize = cwc * sizeof(WCHAR);
- SafeFileNames.MaximumLength = SafeFileNames.Length = cbStringSize - sizeof(WCHAR);
+ SafeFileNames.MaximumLength = SafeFileNames.Length = (USHORT)cbStringSize -
sizeof(WCHAR);
SafeFileNames.Buffer = ExAllocatePoolWithTag(PagedPool,
cbStringSize,
'RTSU');
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Mon Apr 23 19:22:17 2012
@@ -1021,7 +1021,6 @@
if (!pvObj)
{
DPRINT("GreGetObject: Could not lock object\n");
- EngSetLastError(ERROR_INVALID_HANDLE);
return 0;
}