[GDI32]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 28 Oct 2014 21:09:01 +0000 (21:09 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 28 Oct 2014 21:09:01 +0000 (21:09 +0000)
- Move functions to the appropriate source files, zap hacks.c, stubs.c, stubsa.c and stubsw.c (sorry for the noise, but this mess had to be cleaned up)

svn path=/trunk/; revision=65086

23 files changed:
reactos/win32ss/gdi/gdi32/CMakeLists.txt
reactos/win32ss/gdi/gdi32/include/gdi32p.h
reactos/win32ss/gdi/gdi32/misc/hacks.c [deleted file]
reactos/win32ss/gdi/gdi32/misc/misc.c
reactos/win32ss/gdi/gdi32/misc/stubs.c [deleted file]
reactos/win32ss/gdi/gdi32/misc/stubsa.c [deleted file]
reactos/win32ss/gdi/gdi32/misc/stubsw.c [deleted file]
reactos/win32ss/gdi/gdi32/misc/wingl.c
reactos/win32ss/gdi/gdi32/objects/bitmap.c
reactos/win32ss/gdi/gdi32/objects/brush.c
reactos/win32ss/gdi/gdi32/objects/colorspace.c [new file with mode: 0644]
reactos/win32ss/gdi/gdi32/objects/coord.c
reactos/win32ss/gdi/gdi32/objects/dc.c
reactos/win32ss/gdi/gdi32/objects/eng.c
reactos/win32ss/gdi/gdi32/objects/enhmfile.c
reactos/win32ss/gdi/gdi32/objects/font.c
reactos/win32ss/gdi/gdi32/objects/gdiobj.c [new file with mode: 0644]
reactos/win32ss/gdi/gdi32/objects/icm.c
reactos/win32ss/gdi/gdi32/objects/metafile.c
reactos/win32ss/gdi/gdi32/objects/painting.c
reactos/win32ss/gdi/gdi32/objects/palette.c
reactos/win32ss/gdi/gdi32/objects/printdrv.c
reactos/win32ss/gdi/gdi32/objects/text.c

index 1d60fe3..f2ee241 100644 (file)
@@ -14,22 +14,20 @@ list(APPEND SOURCE
     main/dllmain.c
     misc/heap.c
     misc/gdientry.c
-    #misc/hacks.c
     misc/historic.c
     misc/misc.c
-    misc/stubs.c
-    misc/stubsa.c
-    misc/stubsw.c
     misc/wingl.c
     objects/arc.c
     objects/bitmap.c
     objects/brush.c
     objects/clientobj.c
+    objects/colorspace.c
     objects/coord.c
     objects/dc.c
     objects/eng.c
     objects/enhmfile.c
     objects/font.c
+    objects/gdiobj.c
     objects/icm.c
     objects/linedda.c
     objects/metafile.c
index c453784..58ea3eb 100644 (file)
@@ -279,6 +279,11 @@ EnumLogFontExW2A(
     LPENUMLOGFONTEXA fontA,
     CONST ENUMLOGFONTEXW *fontW );
 
+BOOL
+WINAPI
+GetETM(HDC hdc,
+       EXTTEXTMETRIC *petm);
+
 /* FIXME: Put in some public header */
 UINT
 WINAPI
diff --git a/reactos/win32ss/gdi/gdi32/misc/hacks.c b/reactos/win32ss/gdi/gdi32/misc/hacks.c
deleted file mode 100644 (file)
index c8ac998..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "precomp.h"
-
-/*
- * reactos/lib/gdi32/misc/hacks.c
- *
- * GDI32.DLL hacks
- *
- * Apis that are hacked but we cannot write correct implementations yet but we are using our own syscall
- *
- */
-
-
-
-
index 9d6dae9..f597b56 100644 (file)
@@ -34,41 +34,299 @@ PGDI_TABLE_ENTRY GdiHandleTable = NULL;
 PGDI_SHARED_HANDLE_TABLE GdiSharedHandleTable = NULL;
 HANDLE CurrentProcessId = NULL;
 DWORD GDI_BatchLimit = 1;
+extern PGDIHANDLECACHE GdiHandleCache;
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GdiFlush()
+{
+    NtGdiFlush();
+    return TRUE;
+}
+
+/*
+ * @unimplemented
+ */
+int
+WINAPI
+Escape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpvInData, LPVOID lpvOutData)
+{
+    int retValue = SP_ERROR;
+    HGDIOBJ hObject = hdc;
+    UINT Type = 0;
+    LPVOID pUserData = NULL;
+
+    Type = GDI_HANDLE_GET_TYPE(hObject);
+
+    if (Type == GDI_OBJECT_TYPE_METADC)
+    {
+        /* FIXME we do not support metafile */
+        UNIMPLEMENTED;
+        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    }
+    else
+    {
+        switch (nEscape)
+        {
+        case ABORTDOC:
+            /* Note Winodws check see if the handle have any user data for ABORTDOC command
+             * ReactOS copy this behavior to be compatible with windows 2003
+             */
+            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserData)) ||
+                    (pUserData == NULL) )
+            {
+                GdiSetLastError(ERROR_INVALID_HANDLE);
+                retValue = FALSE;
+            }
+            else
+            {
+                retValue = AbortDoc(hdc);
+            }
+            break;
+
+        case DRAFTMODE:
+        case FLUSHOUTPUT:
+        case SETCOLORTABLE:
+            /* Note 1: DRAFTMODE, FLUSHOUTPUT, SETCOLORTABLE is outdated and been replace with other api */
+            /* Note 2: Winodws check see if the handle have any user data for DRAFTMODE, FLUSHOUTPUT, SETCOLORTABLE command
+             * ReactOS copy this behavior to be compatible with windows 2003
+             */
+            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserData)) ||
+                    (pUserData == NULL) )
+            {
+                GdiSetLastError(ERROR_INVALID_HANDLE);
+            }
+            retValue = FALSE;
+            break;
+
+        case SETABORTPROC:
+            /* Note : Winodws check see if the handle have any user data for DRAFTMODE, FLUSHOUTPUT, SETCOLORTABLE command
+             * ReactOS copy this behavior to be compatible with windows 2003
+             */
+            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserData)) ||
+                    (pUserData == NULL) )
+            {
+                GdiSetLastError(ERROR_INVALID_HANDLE);
+                retValue = FALSE;
+            }
+            retValue = SetAbortProc(hdc, (ABORTPROC)lpvInData);
+            break;
+
+        case GETCOLORTABLE:
+            retValue = GetSystemPaletteEntries(hdc, (UINT)*lpvInData, 1, (LPPALETTEENTRY)lpvOutData);
+            if ( !retValue )
+            {
+                retValue = SP_ERROR;
+            }
+            break;
+
+        case ENDDOC:
+            /* Note : Winodws check see if the handle have any user data for DRAFTMODE, FLUSHOUTPUT, SETCOLORTABLE command
+             * ReactOS copy this behavior to be compatible with windows 2003
+             */
+            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserData)) ||
+                    (pUserData == NULL) )
+            {
+                GdiSetLastError(ERROR_INVALID_HANDLE);
+                retValue = FALSE;
+            }
+            retValue = EndDoc(hdc);
+            break;
+
+
+        case GETSCALINGFACTOR:
+            /* Note GETSCALINGFACTOR is outdated have been replace by GetDeviceCaps */
+            if ( Type == GDI_OBJECT_TYPE_DC )
+            {
+                if ( lpvOutData )
+                {
+                    PPOINT ptr = (PPOINT) lpvOutData;
+                    ptr->x = 0;
+                    ptr->y = 0;
+                }
+            }
+            retValue = FALSE;
+            break;
 
+        case GETEXTENDEDTEXTMETRICS:
+            retValue = (int) GetETM( hdc, (EXTTEXTMETRIC *) lpvOutData) != 0;
+            break;
 
+        case  STARTDOC:
+        {
+            DOCINFOA *pUserDatalpdi;
+            DOCINFOA lpdi;
+
+            /* Note : Winodws check see if the handle have any user data for STARTDOC command
+             * ReactOS copy this behavior to be compatible with windows 2003
+             */
+            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserDatalpdi)) ||
+                    (pUserData == NULL) )
+            {
+                GdiSetLastError(ERROR_INVALID_HANDLE);
+                retValue = FALSE;
+            }
+
+            lpdi.cbSize = sizeof(DOCINFOA);
+
+            /* NOTE lpszOutput will be store in handle userdata */
+            lpdi.lpszOutput = 0;
+
+            lpdi.lpszDatatype = 0;
+            lpdi.fwType = 0;
+            lpdi.lpszDocName = lpvInData;
+
+            /* NOTE : doc for StartDocA/W at msdn http://msdn2.microsoft.com/en-us/library/ms535793(VS.85).aspx */
+            retValue = StartDocA(hdc, &lpdi);
+
+            /* StartDocA fail */
+            if (retValue < 0)
+            {
+                /* check see if outbuffer contain any data, if it does abort */
+                if  ( (pUserDatalpdi->lpszOutput != 0) &&
+                        ( (*(WCHAR *)pUserDatalpdi->lpszOutput) != UNICODE_NULL) )
+                {
+                    retValue = SP_APPABORT;
+                }
+                else
+                {
+                    retValue = GetLastError();
+
+                    /* Translate StartDocA error code to STARTDOC error code
+                     * see msdn http://msdn2.microsoft.com/en-us/library/ms535472.aspx
+                     */
+                    switch(retValue)
+                    {
+                    case ERROR_NOT_ENOUGH_MEMORY:
+                        retValue = SP_OUTOFMEMORY;
+                        break;
+
+                    case ERROR_PRINT_CANCELLED:
+                        retValue = SP_USERABORT;
+                        break;
+
+                    case ERROR_DISK_FULL:
+                        retValue = SP_OUTOFDISK;
+                        break;
+
+                    default:
+                        retValue = SP_ERROR;
+                        break;
+                    }
+                }
+            }
+        }
+        break;
+
+
+
+
+        default:
+            UNIMPLEMENTED;
+            SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+        }
+    }
+
+    return retValue;
+}
+
+INT
+WINAPI
+ExtEscape(HDC hDC,
+          int nEscape,
+          int cbInput,
+          LPCSTR lpszInData,
+          int cbOutput,
+          LPSTR lpszOutData)
+{
+    return NtGdiExtEscape(hDC, NULL, 0, nEscape, cbInput, (LPSTR)lpszInData, cbOutput, lpszOutData);
+}
+
+INT
+WINAPI
+NamedEscape(HDC hdc,
+            PWCHAR pDriver,
+            INT iEsc,
+            INT cjIn,
+            LPSTR pjIn,
+            INT cjOut,
+            LPSTR pjOut)
+{
+    /* FIXME metadc, metadc are done most in user mode, and we do not support it
+     * Windows 2000/XP/Vista ignore the current hdc, that are being pass and always set hdc to NULL
+     * when it calls to NtGdiExtEscape from NamedEscape
+     */
+    return NtGdiExtEscape(NULL,pDriver,wcslen(pDriver),iEsc,cjIn,pjIn,cjOut,pjOut);
+}
+
+/*
+ * @implemented
+ */
+int
+WINAPI
+DrawEscape(HDC  hDC,
+           INT nEscape,
+           INT cbInput,
+           LPCSTR lpszInData)
+{
+    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_DC)
+        return NtGdiDrawEscape(hDC, nEscape, cbInput, (LPSTR) lpszInData);
+
+    if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_METADC)
+    {
+        PLDC pLDC = GdiGetLDC(hDC);
+        if ( pLDC )
+        {
+            if (pLDC->Flags & LDC_META_PRINT)
+            {
+//           if (nEscape != QUERYESCSUPPORT)
+//              return EMFDRV_WriteEscape(hDC, nEscape, cbInput, lpszInData, EMR_DRAWESCAPE);
+
+                return NtGdiDrawEscape(hDC, nEscape, cbInput, (LPSTR) lpszInData);
+            }
+        }
+        SetLastError(ERROR_INVALID_HANDLE);
+    }
+    return 0;
+}
+
+
+/*
+ * @unimplemented
+ */
 BOOL
 WINAPI
-GdiAlphaBlend(
-    HDC hDCDst,
-    int DstX,
-    int DstY,
-    int DstCx,
-    int DstCy,
-    HDC hDCSrc,
-    int SrcX,
-    int SrcY,
-    int SrcCx,
-    int SrcCy,
-    BLENDFUNCTION BlendFunction
-)
+GdiDrawStream(HDC dc, ULONG l, VOID *v) // See Bug 4784
 {
-    if ( hDCSrc == NULL ) return FALSE;
-
-    if (GDI_HANDLE_GET_TYPE(hDCSrc) == GDI_OBJECT_TYPE_METADC) return FALSE;
-
-    return NtGdiAlphaBlend(
-               hDCDst,
-               DstX,
-               DstY,
-               DstCx,
-               DstCy,
-               hDCSrc,
-               SrcX,
-               SrcY,
-               SrcCx,
-               SrcCy,
-               BlendFunction,
-               0 );
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GdiValidateHandle(HGDIOBJ hobj)
+{
+    PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hobj);
+    if ( (Entry->Type & GDI_ENTRY_BASETYPE_MASK) != 0 &&
+            ( (Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK ) ==
+            GDI_HANDLE_GET_TYPE(hobj) )
+    {
+        HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
+        if(pid == NULL || pid == CurrentProcessId)
+        {
+            return TRUE;
+        }
+    }
+    return FALSE;
+
 }
 
 /*
@@ -227,27 +485,6 @@ GdiGetBatchLimit()
     return GDI_BatchLimit;
 }
 
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiReleaseDC(HDC hdc)
-{
-    return 0;
-}
-
-INT
-WINAPI
-ExtEscape(HDC hDC,
-          int nEscape,
-          int cbInput,
-          LPCSTR lpszInData,
-          int cbOutput,
-          LPSTR lpszOutData)
-{
-    return NtGdiExtEscape(hDC, NULL, 0, nEscape, cbInput, (LPSTR)lpszInData, cbOutput, lpszOutData);
-}
 
 /*
  * @implemented
@@ -259,16 +496,6 @@ GdiSetLastError(DWORD dwErrCode)
     NtCurrentTeb()->LastErrorValue = (ULONG) dwErrCode;
 }
 
-BOOL
-WINAPI
-GdiAddGlsBounds(HDC hdc,LPRECT prc)
-{
-    //FIXME: Lookup what 0x8000 means
-    return NtGdiSetBoundsRect(hdc, prc, 0x8000 |  DCB_ACCUMULATE ) ? TRUE : FALSE;
-}
-
-extern PGDIHANDLECACHE GdiHandleCache;
-
 HGDIOBJ
 FASTCALL
 hGetPEBHandle(HANDLECACHETYPE Type, COLORREF cr)
@@ -342,3 +569,107 @@ hGetPEBHandle(HANDLECACHETYPE Type, COLORREF cr)
     return Handle;
 }
 
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+bMakePathNameW(LPWSTR lpBuffer,LPCWSTR lpFileName,LPWSTR *lpFilePart,DWORD unknown)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @implemented
+ */
+DEVMODEW *
+WINAPI
+GdiConvertToDevmodeW(const DEVMODEA *dmA)
+{
+    DEVMODEW *dmW;
+    WORD dmW_size, dmA_size;
+
+    dmA_size = dmA->dmSize;
+
+    /* this is the minimal dmSize that XP accepts */
+    if (dmA_size < FIELD_OFFSET(DEVMODEA, dmFields))
+        return NULL;
+
+    if (dmA_size > sizeof(DEVMODEA))
+        dmA_size = sizeof(DEVMODEA);
+
+    dmW_size = dmA_size + CCHDEVICENAME;
+    if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
+        dmW_size += CCHFORMNAME;
+
+    dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra);
+    if (!dmW) return NULL;
+
+    MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, CCHDEVICENAME,
+                        dmW->dmDeviceName, CCHDEVICENAME);
+    /* copy slightly more, to avoid long computations */
+    memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size - CCHDEVICENAME);
+
+    if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
+    {
+        MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, CCHFORMNAME,
+                            dmW->dmFormName, CCHFORMNAME);
+        if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
+            memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size - FIELD_OFFSET(DEVMODEA, dmLogPixels));
+    }
+
+    if (dmA->dmDriverExtra)
+        memcpy((char *)dmW + dmW_size, (const char *)dmA + dmA_size, dmA->dmDriverExtra);
+
+    dmW->dmSize = dmW_size;
+
+    return dmW;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiRealizationInfo(HDC hdc,
+                   PREALIZATION_INFO pri)
+{
+    // ATM we do not support local font data and Language Pack.
+    return NtGdiGetRealizationInfo(hdc, pri, (HFONT) NULL);
+}
+
+
+/*
+ * @unimplemented
+ */
+VOID WINAPI GdiInitializeLanguagePack(DWORD InitParam)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+}
+
+BOOL
+WINAPI
+GdiAddGlsBounds(HDC hdc,LPRECT prc)
+{
+    //FIXME: Lookup what 0x8000 means
+    return NtGdiSetBoundsRect(hdc, prc, 0x8000 |  DCB_ACCUMULATE ) ? TRUE : FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiAddGlsRecord(HDC hdc,
+                DWORD unknown1,
+                LPCSTR unknown2,
+                LPRECT unknown3)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
diff --git a/reactos/win32ss/gdi/gdi32/misc/stubs.c b/reactos/win32ss/gdi/gdi32/misc/stubs.c
deleted file mode 100644 (file)
index 8d57a8a..0000000
+++ /dev/null
@@ -1,1736 +0,0 @@
-/*
- * dll/win32/gdi32/misc/stubs.c
- *
- * GDI32.DLL Stubs
- *
- * When you implement one of these functions,
- * remove its stub from this file.
- *
- */
-
-#include <precomp.h>
-#include <debug.h>
-
-#define SIZEOF_DEVMODEA_300 124
-#define SIZEOF_DEVMODEA_400 148
-#define SIZEOF_DEVMODEA_500 156
-#define SIZEOF_DEVMODEW_300 188
-#define SIZEOF_DEVMODEW_400 212
-#define SIZEOF_DEVMODEW_500 220
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-RestoreDC(IN HDC hdc,
-          IN INT iLevel)
-{
-    /* FIXME Sharememory */
-    return NtGdiRestoreDC(hdc, iLevel);
-}
-
-/*
- * @unimplemented
- */
-INT
-WINAPI
-SaveDC(IN HDC hdc)
-{
-    /* FIXME Sharememory */
-    return NtGdiSaveDC(hdc);
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-CancelDC(HDC hDC)
-{
-    PDC_ATTR pDc_Attr;
-
-    if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC &&
-            GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_METADC )
-    {
-        PLDC pLDC = GdiGetLDC(hDC);
-        if ( !pLDC )
-        {
-            SetLastError(ERROR_INVALID_HANDLE);
-            return FALSE;
-        }
-        /* If a document has started set it to die. */
-        if (pLDC->Flags & LDC_INIT_DOCUMENT) pLDC->Flags |= LDC_KILL_DOCUMENT;
-
-        return NtGdiCancelDC(hDC);
-    }
-
-    if (GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &pDc_Attr))
-    {
-        pDc_Attr->ulDirty_ &= ~DC_PLAYMETAFILE;
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-
-/*
- * @implemented
- */
-int
-WINAPI
-DrawEscape(HDC  hDC,
-           INT nEscape,
-           INT cbInput,
-           LPCSTR lpszInData)
-{
-    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_DC)
-        return NtGdiDrawEscape(hDC, nEscape, cbInput, (LPSTR) lpszInData);
-
-    if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_METADC)
-    {
-        PLDC pLDC = GdiGetLDC(hDC);
-        if ( pLDC )
-        {
-            if (pLDC->Flags & LDC_META_PRINT)
-            {
-//           if (nEscape != QUERYESCSUPPORT)
-//              return EMFDRV_WriteEscape(hDC, nEscape, cbInput, lpszInData, EMR_DRAWESCAPE);
-
-                return NtGdiDrawEscape(hDC, nEscape, cbInput, (LPSTR) lpszInData);
-            }
-        }
-        SetLastError(ERROR_INVALID_HANDLE);
-    }
-    return 0;
-}
-
-
-/*
- * @implemented
- */
-int
-WINAPI
-EnumObjects(HDC hdc,
-            int nObjectType,
-            GOBJENUMPROC lpObjectFunc,
-            LPARAM lParam)
-{
-    ULONG ObjectsCount;
-    ULONG Size;
-    PVOID Buffer = NULL;
-    DWORD_PTR EndOfBuffer;
-    int Result = 0;
-
-    switch (nObjectType)
-    {
-    case OBJ_BRUSH:
-        Size = sizeof(LOGBRUSH);
-        break;
-
-    case OBJ_PEN:
-        Size = sizeof(LOGPEN);
-        break;
-
-    default:
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    ObjectsCount = NtGdiEnumObjects(hdc, nObjectType, 0, NULL);
-    if (!ObjectsCount) return 0;
-
-    Buffer = HeapAlloc(GetProcessHeap(), 0, ObjectsCount * Size);
-    if (!Buffer)
-    {
-        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-        return 0;
-    }
-
-    if (!NtGdiEnumObjects(hdc, nObjectType, ObjectsCount * Size, Buffer))
-    {
-        HeapFree(GetProcessHeap(), 0, Buffer);
-        return 0;
-    }
-
-    EndOfBuffer = (DWORD_PTR)Buffer + (ObjectsCount * Size);
-    while ((DWORD_PTR)Buffer < EndOfBuffer)
-    {
-        Result = lpObjectFunc(Buffer, lParam);
-        if (!Result) break;
-        Buffer = (PVOID)((DWORD_PTR)Buffer + Size);
-    }
-
-    HeapFree(GetProcessHeap(), 0, Buffer);
-    return Result;
-}
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetBoundsRect(
-    HDC        hdc,
-    LPRECT     lprcBounds,
-    UINT       flags
-)
-{
-    return NtGdiGetBoundsRect(hdc,lprcBounds,flags & DCB_RESET);
-}
-
-/*
- * @unimplemented
- */
-UINT
-WINAPI
-GetMetaFileBitsEx(
-    HMETAFILE  a0,
-    UINT               a1,
-    LPVOID             a2
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-PlayMetaFile(
-    HDC                a0,
-    HMETAFILE  a1
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-SetBoundsRect(HDC hdc,
-              CONST RECT *prc,
-              UINT flags)
-{
-    /* FIXME add check for validate the flags */
-    return NtGdiSetBoundsRect(hdc, (LPRECT)prc, flags);
-}
-
-/*
- * @unimplemented
- */
-HMETAFILE
-WINAPI
-SetMetaFileBitsEx(
-    UINT               size,
-    CONST BYTE *lpData
-)
-{
-    const METAHEADER *mh_in = (const METAHEADER *)lpData;
-
-    if (size & 1) return 0;
-
-    if (!size || mh_in->mtType != METAFILE_MEMORY || mh_in->mtVersion != 0x300 ||
-            mh_in->mtHeaderSize != sizeof(METAHEADER) / 2)
-    {
-        DPRINT1("SetMetaFileBitsEx failed: %lu,%lu,0x&lx,%lu\n",
-                size, mh_in->mtType, mh_in->mtVersion, mh_in->mtHeaderSize);
-        SetLastError(ERROR_INVALID_DATA);
-        return 0;
-    }
-
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-PlayMetaFileRecord(
-    HDC                a0,
-    LPHANDLETABLE      a1,
-    LPMETARECORD       a2,
-    UINT               a3
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-EnumMetaFile(
-    HDC                        a0,
-    HMETAFILE          a1,
-    MFENUMPROC         a2,
-    LPARAM                     a3
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-DeleteEnhMetaFile(
-    HENHMETAFILE       a0
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-EnumEnhMetaFile(
-    HDC                hdc,
-    HENHMETAFILE       hmf,
-    ENHMFENUMPROC      callback,
-    LPVOID             data,
-    CONST RECT *lpRect
-)
-{
-    if(!lpRect && hdc)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/*
- * @unimplemented
- */
-UINT
-WINAPI
-GetEnhMetaFileBits(
-    HENHMETAFILE       a0,
-    UINT               a1,
-    LPBYTE             a2
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-UINT
-WINAPI
-GetEnhMetaFileHeader(
-    HENHMETAFILE       a0,
-    UINT               a1,
-    LPENHMETAHEADER    a2
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-UINT
-WINAPI
-GetEnhMetaFilePaletteEntries(
-    HENHMETAFILE       a0,
-    UINT               a1,
-    LPPALETTEENTRY     a2
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-UINT
-WINAPI
-GetWinMetaFileBits(
-    HENHMETAFILE       a0,
-    UINT               a1,
-    LPBYTE             a2,
-    INT                a3,
-    HDC                a4
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-PlayEnhMetaFile(
-    HDC                a0,
-    HENHMETAFILE       a1,
-    CONST RECT *a2
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-PlayEnhMetaFileRecord(
-    HDC                        a0,
-    LPHANDLETABLE              a1,
-    CONST ENHMETARECORD        *a2,
-    UINT                       a3
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-HENHMETAFILE
-WINAPI
-SetEnhMetaFileBits(
-    UINT               a0,
-    CONST BYTE *a1
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-HENHMETAFILE
-WINAPI
-SetWinMetaFileBits(
-    UINT                       a0,
-    CONST BYTE         *a1,
-    HDC                        a2,
-    CONST METAFILEPICT *a3)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiComment(
-    HDC                hDC,
-    UINT               bytes,
-    CONST BYTE *buffer
-)
-{
-#if 0
-    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_EMF)
-    {
-        PLDC pLDC = GdiGetLDC(hDC);
-        if ( !pLDC )
-        {
-            SetLastError(ERROR_INVALID_HANDLE);
-            return FALSE;
-        }
-        if (pLDC->iType == LDC_EMFLDC)
-        {
-            // Wine port
-            return EMFDRV_GdiComment( hDC, bytes, buffer );
-        }
-    }
-#endif
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-SetColorAdjustment(
-    HDC                        hdc,
-    CONST COLORADJUSTMENT      *a1
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-UnrealizeObject(HGDIOBJ  hgdiobj)
-{
-    BOOL retValue = TRUE;
-    /*
-       Win 2k Graphics API, Black Book. by coriolis.com
-       Page 62, Note that Steps 3, 5, and 6 are not required for Windows NT(tm)
-       and Windows 2000(tm).
-
-       Step 5. UnrealizeObject(hTrackBrush);
-     */
-    /*
-        msdn.microsoft.com,
-        "Windows 2000/XP: If hgdiobj is a brush, UnrealizeObject does nothing,
-        and the function returns TRUE. Use SetBrushOrgEx to set the origin of
-        a brush."
-     */
-    if (GDI_HANDLE_GET_TYPE(hgdiobj) != GDI_OBJECT_TYPE_BRUSH)
-    {
-        retValue = NtGdiUnrealizeObject(hgdiobj);
-    }
-
-    return retValue;
-}
-
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GdiFlush()
-{
-    NtGdiFlush();
-    return TRUE;
-}
-
-
-/*
- * @unimplemented
- */
-int
-WINAPI
-SetICMMode(
-    HDC        hdc,
-    int        iEnableICM
-)
-{
-    /*FIXME:  Assume that ICM is always off, and cannot be turned on */
-    if (iEnableICM == ICM_OFF) return ICM_OFF;
-    if (iEnableICM == ICM_ON) return 0;
-    if (iEnableICM == ICM_QUERY) return ICM_OFF;
-
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-CheckColorsInGamut(
-    HDC        a0,
-    LPVOID     a1,
-    LPVOID     a2,
-    DWORD      a3
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GetDeviceGammaRamp( HDC hdc,
-                    LPVOID lpGammaRamp)
-{
-    BOOL retValue = FALSE;
-    if (lpGammaRamp == NULL)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-    }
-    else
-    {
-        retValue = NtGdiGetDeviceGammaRamp(hdc,lpGammaRamp);
-    }
-
-    return retValue;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-SetDeviceGammaRamp(HDC hdc,
-                   LPVOID lpGammaRamp)
-{
-    BOOL retValue = FALSE;
-
-    if (lpGammaRamp)
-    {
-        retValue = NtGdiSetDeviceGammaRamp(hdc, lpGammaRamp);
-    }
-    else
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-    }
-
-    return  retValue;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-ColorMatchToTarget(
-    HDC        a0,
-    HDC        a1,
-    DWORD      a2
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/* === AFTER THIS POINT I GUESS... =========
- * (based on stack size in Norlander's .def)
- * === WHERE ARE THEY DEFINED? =============
- */
-
-/*
- * @unimplemented
- */
-DWORD
-WINAPI
-IsValidEnhMetaRecord(
-    DWORD      a0,
-    DWORD      a1
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-
-}
-
-/*
- * @unimplemented
- */
-DWORD
-WINAPI
-IsValidEnhMetaRecordOffExt(
-    DWORD      a0,
-    DWORD      a1,
-    DWORD      a2,
-    DWORD      a3
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-
-}
-
-/*
- * @unimplemented
- */
-DWORD
-WINAPI
-GetGlyphOutlineWow(
-    DWORD      a0,
-    DWORD      a1,
-    DWORD      a2,
-    DWORD      a3,
-    DWORD      a4,
-    DWORD      a5,
-    DWORD      a6
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-DWORD
-WINAPI
-gdiPlaySpoolStream(
-    DWORD      a0,
-    DWORD      a1,
-    DWORD      a2,
-    DWORD      a3,
-    DWORD      a4,
-    DWORD      a5
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @implemented
- */
-HANDLE
-WINAPI
-AddFontMemResourceEx(
-    PVOID pbFont,
-    DWORD cbFont,
-    PVOID pdv,
-    DWORD *pcFonts
-)
-{
-    if ( pbFont && cbFont && pcFonts)
-    {
-        return NtGdiAddFontMemResourceEx(pbFont, cbFont, NULL, 0, pcFonts);
-    }
-    SetLastError(ERROR_INVALID_PARAMETER);
-    return NULL;
-}
-
-/*
- * @unimplemented
- */
-int
-WINAPI
-AddFontResourceTracking(
-    LPCSTR lpString,
-    int unknown
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-
-
-/*
- * @unimplemented
- */
-HBITMAP
-WINAPI
-ClearBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-HBRUSH
-WINAPI
-ClearBrushAttributes(HBRUSH hbm, DWORD dwFlags)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-ColorCorrectPalette(HDC hDC,HPALETTE hPalette,DWORD dwFirstEntry,DWORD dwNumOfEntries)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiArtificialDecrementDriver(LPWSTR pDriverName,BOOL unknown)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GdiCleanCacheDC(HDC hdc)
-{
-    if (GDI_HANDLE_GET_TYPE(hdc) == GDILoObjType_LO_DC_TYPE)
-        return TRUE;
-    SetLastError(ERROR_INVALID_HANDLE);
-    return FALSE;
-}
-
-/*
- * @implemented
- */
-HDC
-WINAPI
-GdiConvertAndCheckDC(HDC hdc)
-{
-    PLDC pldc;
-    ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
-    if (hType == GDILoObjType_LO_DC_TYPE || hType == GDILoObjType_LO_METADC16_TYPE)
-        return hdc;
-    pldc = GdiGetLDC(hdc);
-    if (pldc)
-    {
-        if (pldc->Flags & LDC_SAPCALLBACK) GdiSAPCallback(pldc);
-        if (pldc->Flags & LDC_KILL_DOCUMENT) return NULL;
-        if (pldc->Flags & LDC_STARTPAGE) StartPage(hdc);
-        return hdc;
-    }
-    SetLastError(ERROR_INVALID_HANDLE);
-    return NULL;
-}
-
-/*
- * @unimplemented
- */
-HENHMETAFILE
-WINAPI
-GdiConvertEnhMetaFile(HENHMETAFILE hmf)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiDrawStream(HDC dc, ULONG l, VOID *v) // See Bug 4784
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GdiIsMetaFileDC(HDC hDC)
-{
-    if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
-    {
-        if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
-            return TRUE;
-        else
-        {
-            PLDC pLDC = GdiGetLDC(hDC);
-            if ( !pLDC )
-            {
-                SetLastError(ERROR_INVALID_HANDLE);
-                return FALSE;
-            }
-            if ( pLDC->iType == LDC_EMFLDC) return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GdiIsMetaPrintDC(HDC hDC)
-{
-
-    if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
-    {
-        if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
-            return FALSE;
-        else
-        {
-            PLDC pLDC = GdiGetLDC(hDC);
-            if ( !pLDC )
-            {
-                SetLastError(ERROR_INVALID_HANDLE);
-                return FALSE;
-            }
-            if ( pLDC->Flags & LDC_META_PRINT) return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GdiIsPlayMetafileDC(HDC hDC)
-{
-    PLDC pLDC = GdiGetLDC(hDC);
-    if ( pLDC )
-    {
-        if ( pLDC->Flags & LDC_PLAY_MFDC ) return TRUE;
-    }
-    return FALSE;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GdiValidateHandle(HGDIOBJ hobj)
-{
-    PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hobj);
-    if ( (Entry->Type & GDI_ENTRY_BASETYPE_MASK) != 0 &&
-            ( (Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK ) ==
-            GDI_HANDLE_GET_TYPE(hobj) )
-    {
-        HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
-        if(pid == NULL || pid == CurrentProcessId)
-        {
-            return TRUE;
-        }
-    }
-    return FALSE;
-
-}
-
-/*
- * @unimplemented
- */
-DWORD
-WINAPI
-GetBitmapAttributes(HBITMAP hbm)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-DWORD
-WINAPI
-GetBrushAttributes(HBRUSH hbr)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @implemented
- */
-ULONG
-WINAPI
-GetEUDCTimeStamp(VOID)
-{
-    return NtGdiGetEudcTimeStampEx(NULL,0,TRUE);
-}
-
-/*
- * @implemented
- */
-ULONG
-WINAPI
-GetFontAssocStatus(HDC hdc)
-{
-    ULONG retValue = 0;
-
-    if (hdc)
-    {
-        retValue = NtGdiQueryFontAssocInfo(hdc);
-    }
-
-    return retValue;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GetTextExtentExPointWPri(HDC hdc,
-                         LPWSTR lpwsz,
-                         ULONG cwc,
-                         ULONG dxMax,
-                         ULONG *pcCh,
-                         PULONG pdxOut,
-                         LPSIZE psize)
-{
-    return NtGdiGetTextExtentExW(hdc,lpwsz,cwc,dxMax,pcCh,pdxOut,psize,0);
-}
-
-/*
- * @unimplemented
- */
-DWORD
-WINAPI
-QueryFontAssocStatus(VOID)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-RemoveFontMemResourceEx(HANDLE fh)
-{
-    if (fh)
-    {
-        return NtGdiRemoveFontMemResourceEx(fh);
-    }
-    SetLastError(ERROR_INVALID_PARAMETER);
-    return FALSE;
-}
-
-/*
- * @unimplemented
- */
-int
-WINAPI
-RemoveFontResourceTracking(LPCSTR lpString,int unknown)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-HBITMAP
-WINAPI
-SetBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-HBRUSH
-WINAPI
-SetBrushAttributes(HBRUSH hbm, DWORD dwFlags)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @implemented
- */
-int
-WINAPI
-StartFormPage(HDC hdc)
-{
-    return StartPage(hdc);
-}
-
-/*
- * @unimplemented
- */
-VOID
-WINAPI
-UnloadNetworkFonts(DWORD unknown)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiRealizationInfo(HDC hdc,
-                   PREALIZATION_INFO pri)
-{
-    // ATM we do not support local font data and Language Pack.
-    return NtGdiGetRealizationInfo(hdc, pri, (HFONT) NULL);
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GetETM(HDC hdc,
-       EXTTEXTMETRIC *petm)
-{
-    BOOL Ret = NtGdiGetETM(hdc, petm);
-
-    if (Ret && petm)
-        petm->emKernPairs = (WORD)GetKerningPairsA(hdc, 0, 0);
-
-    return Ret;
-}
-
-/*
- * @unimplemented
- */
-int
-WINAPI
-Escape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpvInData, LPVOID lpvOutData)
-{
-    int retValue = SP_ERROR;
-    HGDIOBJ hObject = hdc;
-    UINT Type = 0;
-    LPVOID pUserData = NULL;
-
-    Type = GDI_HANDLE_GET_TYPE(hObject);
-
-    if (Type == GDI_OBJECT_TYPE_METADC)
-    {
-        /* FIXME we do not support metafile */
-        UNIMPLEMENTED;
-        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    }
-    else
-    {
-        switch (nEscape)
-        {
-        case ABORTDOC:
-            /* Note Winodws check see if the handle have any user data for ABORTDOC command
-             * ReactOS copy this behavior to be compatible with windows 2003
-             */
-            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserData)) ||
-                    (pUserData == NULL) )
-            {
-                GdiSetLastError(ERROR_INVALID_HANDLE);
-                retValue = FALSE;
-            }
-            else
-            {
-                retValue = AbortDoc(hdc);
-            }
-            break;
-
-        case DRAFTMODE:
-        case FLUSHOUTPUT:
-        case SETCOLORTABLE:
-            /* Note 1: DRAFTMODE, FLUSHOUTPUT, SETCOLORTABLE is outdated and been replace with other api */
-            /* Note 2: Winodws check see if the handle have any user data for DRAFTMODE, FLUSHOUTPUT, SETCOLORTABLE command
-             * ReactOS copy this behavior to be compatible with windows 2003
-             */
-            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserData)) ||
-                    (pUserData == NULL) )
-            {
-                GdiSetLastError(ERROR_INVALID_HANDLE);
-            }
-            retValue = FALSE;
-            break;
-
-        case SETABORTPROC:
-            /* Note : Winodws check see if the handle have any user data for DRAFTMODE, FLUSHOUTPUT, SETCOLORTABLE command
-             * ReactOS copy this behavior to be compatible with windows 2003
-             */
-            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserData)) ||
-                    (pUserData == NULL) )
-            {
-                GdiSetLastError(ERROR_INVALID_HANDLE);
-                retValue = FALSE;
-            }
-            retValue = SetAbortProc(hdc, (ABORTPROC)lpvInData);
-            break;
-
-        case GETCOLORTABLE:
-            retValue = GetSystemPaletteEntries(hdc, (UINT)*lpvInData, 1, (LPPALETTEENTRY)lpvOutData);
-            if ( !retValue )
-            {
-                retValue = SP_ERROR;
-            }
-            break;
-
-        case ENDDOC:
-            /* Note : Winodws check see if the handle have any user data for DRAFTMODE, FLUSHOUTPUT, SETCOLORTABLE command
-             * ReactOS copy this behavior to be compatible with windows 2003
-             */
-            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserData)) ||
-                    (pUserData == NULL) )
-            {
-                GdiSetLastError(ERROR_INVALID_HANDLE);
-                retValue = FALSE;
-            }
-            retValue = EndDoc(hdc);
-            break;
-
-
-        case GETSCALINGFACTOR:
-            /* Note GETSCALINGFACTOR is outdated have been replace by GetDeviceCaps */
-            if ( Type == GDI_OBJECT_TYPE_DC )
-            {
-                if ( lpvOutData )
-                {
-                    PPOINT ptr = (PPOINT) lpvOutData;
-                    ptr->x = 0;
-                    ptr->y = 0;
-                }
-            }
-            retValue = FALSE;
-            break;
-
-        case GETEXTENDEDTEXTMETRICS:
-            retValue = (int) GetETM( hdc, (EXTTEXTMETRIC *) lpvOutData) != 0;
-            break;
-
-        case  STARTDOC:
-        {
-            DOCINFOA *pUserDatalpdi;
-            DOCINFOA lpdi;
-
-            /* Note : Winodws check see if the handle have any user data for STARTDOC command
-             * ReactOS copy this behavior to be compatible with windows 2003
-             */
-            if ( (!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &pUserDatalpdi)) ||
-                    (pUserData == NULL) )
-            {
-                GdiSetLastError(ERROR_INVALID_HANDLE);
-                retValue = FALSE;
-            }
-
-            lpdi.cbSize = sizeof(DOCINFOA);
-
-            /* NOTE lpszOutput will be store in handle userdata */
-            lpdi.lpszOutput = 0;
-
-            lpdi.lpszDatatype = 0;
-            lpdi.fwType = 0;
-            lpdi.lpszDocName = lpvInData;
-
-            /* NOTE : doc for StartDocA/W at msdn http://msdn2.microsoft.com/en-us/library/ms535793(VS.85).aspx */
-            retValue = StartDocA(hdc, &lpdi);
-
-            /* StartDocA fail */
-            if (retValue < 0)
-            {
-                /* check see if outbuffer contain any data, if it does abort */
-                if  ( (pUserDatalpdi->lpszOutput != 0) &&
-                        ( (*(WCHAR *)pUserDatalpdi->lpszOutput) != UNICODE_NULL) )
-                {
-                    retValue = SP_APPABORT;
-                }
-                else
-                {
-                    retValue = GetLastError();
-
-                    /* Translate StartDocA error code to STARTDOC error code
-                     * see msdn http://msdn2.microsoft.com/en-us/library/ms535472.aspx
-                     */
-                    switch(retValue)
-                    {
-                    case ERROR_NOT_ENOUGH_MEMORY:
-                        retValue = SP_OUTOFMEMORY;
-                        break;
-
-                    case ERROR_PRINT_CANCELLED:
-                        retValue = SP_USERABORT;
-                        break;
-
-                    case ERROR_DISK_FULL:
-                        retValue = SP_OUTOFDISK;
-                        break;
-
-                    default:
-                        retValue = SP_ERROR;
-                        break;
-                    }
-                }
-            }
-        }
-        break;
-
-
-
-
-        default:
-            UNIMPLEMENTED;
-            SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-        }
-    }
-
-    return retValue;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiAddGlsRecord(HDC hdc,
-                DWORD unknown1,
-                LPCSTR unknown2,
-                LPRECT unknown3)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-HANDLE
-WINAPI
-GdiConvertMetaFilePict(HGLOBAL hMem)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @implemented
- */
-DEVMODEW *
-WINAPI
-GdiConvertToDevmodeW(const DEVMODEA *dmA)
-{
-    DEVMODEW *dmW;
-    WORD dmW_size, dmA_size;
-
-    dmA_size = dmA->dmSize;
-
-    /* this is the minimal dmSize that XP accepts */
-    if (dmA_size < FIELD_OFFSET(DEVMODEA, dmFields))
-        return NULL;
-
-    if (dmA_size > sizeof(DEVMODEA))
-        dmA_size = sizeof(DEVMODEA);
-
-    dmW_size = dmA_size + CCHDEVICENAME;
-    if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
-        dmW_size += CCHFORMNAME;
-
-    dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra);
-    if (!dmW) return NULL;
-
-    MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, CCHDEVICENAME,
-                        dmW->dmDeviceName, CCHDEVICENAME);
-    /* copy slightly more, to avoid long computations */
-    memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size - CCHDEVICENAME);
-
-    if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
-    {
-        MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, CCHFORMNAME,
-                            dmW->dmFormName, CCHFORMNAME);
-        if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
-            memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size - FIELD_OFFSET(DEVMODEA, dmLogPixels));
-    }
-
-    if (dmA->dmDriverExtra)
-        memcpy((char *)dmW + dmW_size, (const char *)dmA + dmA_size, dmA->dmDriverExtra);
-
-    dmW->dmSize = dmW_size;
-
-    return dmW;
-}
-
-/*
- * @unimplemented
- */
-HENHMETAFILE
-WINAPI
-GdiCreateLocalEnhMetaFile(HENHMETAFILE hmo)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-METAFILEPICT *
-WINAPI
-GdiCreateLocalMetaFilePict(HENHMETAFILE hmo)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-HDC
-WINAPI
-GdiGetDC(HANDLE SpoolFileHandle)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-HANDLE
-WINAPI
-GdiGetPageHandle(HANDLE SpoolFileHandle,
-                 DWORD Page,
-                 LPDWORD pdwPageType)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiStartDocEMF(HANDLE SpoolFileHandle,
-               DOCINFOW *pDocInfo)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiStartPageEMF(HANDLE SpoolFileHandle)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiPlayPageEMF(HANDLE SpoolFileHandle,
-               HANDLE hemf,
-               RECT *prectDocument,
-               RECT *prectBorder,
-               RECT *prectClip)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiEndPageEMF(HANDLE SpoolFileHandle,
-              DWORD dwOptimization)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiEndDocEMF(HANDLE SpoolFileHandle)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiGetDevmodeForPage(HANDLE SpoolFileHandle,
-                     DWORD dwPageNumber,
-                     PDEVMODEW *pCurrDM,
-                     PDEVMODEW *pLastDM)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiResetDCEMF(HANDLE SpoolFileHandle,
-              PDEVMODEW pCurrDM)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-ULONG *
-WINAPI
-XLATEOBJ_piVector(XLATEOBJ *XlateObj)
-{
-    return XlateObj->pulXlate;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiPlayEMF(LPWSTR pwszPrinterName,
-           LPDEVMODEW pDevmode,
-           LPWSTR pwszDocName,
-           EMFPLAYPROC pfnEMFPlayFn,
-           HANDLE hPageQuery
-          )
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiPlayPrivatePageEMF(HANDLE SpoolFileHandle,
-                      DWORD unknown,
-                      RECT *prectDocument)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-VOID WINAPI GdiInitializeLanguagePack(DWORD InitParam)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GdiGradientFill(
-    IN HDC hdc,
-    IN PTRIVERTEX pVertex,
-    IN ULONG nVertex,
-    IN PVOID pMesh,
-    IN ULONG nMesh,
-    IN ULONG ulMode)
-{
-    /* FIXME some part need be done in user mode */
-    return NtGdiGradientFill(hdc, pVertex, nVertex, pMesh, nMesh, ulMode);
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-GdiTransparentBlt(IN HDC hdcDst,
-                  IN INT xDst,
-                  IN INT yDst,
-                  IN INT cxDst,
-                  IN INT cyDst,
-                  IN HDC hdcSrc,
-                  IN INT xSrc,
-                  IN INT ySrc,
-                  IN INT cxSrc,
-                  IN INT cySrc,
-                  IN UINT TransColor
-                 )
-{
-    /* FIXME some part need be done in user mode */
-    return NtGdiTransparentBlt(hdcDst, xDst, yDst, cxDst, cyDst, hdcSrc, xSrc, ySrc, cxSrc, cySrc, (COLORREF)TransColor);
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiPrinterThunk(
-    IN HUMPD humpd,
-    DWORD *status,
-    DWORD unuse)
-{
-    /* FIXME figout the protypes, the HUMPD are a STRUCT or COM object */
-    /* status contain some form of return value that being save, what it is I do not known */
-    /* unsue seam have zero effect, what it is for I do not known */
-
-    // ? return NtGdiSetPUMPDOBJ(humpd->0x10,TRUE, humpd, ?) <- blackbox, OpenRCE info, and api hooks for anylaysing;
-    return FALSE;
-}
-
-/*
- * @unimplemented
- *
- */
-HBITMAP
-WINAPI
-GdiConvertBitmapV5(
-    HBITMAP in_format_BitMap,
-    HBITMAP src_BitMap,
-    INT bpp,
-    INT unuse)
-{
-    /* FIXME guessing the prototypes */
-
-    /*
-     * it have create a new bitmap with desired in format,
-     * then convert it src_bitmap to new format
-     * and return it as HBITMAP
-     */
-
-    return FALSE;
-}
-
-/*
- * @implemented
- *
- */
-int
-WINAPI
-GetClipBox(HDC hdc,
-           LPRECT lprc)
-{
-    return  NtGdiGetAppClipBox(hdc, lprc);
-}
-
-/*
- * @implemented
- *
- */
-DWORD
-WINAPI
-GetFontData(HDC hdc,
-            DWORD dwTable,
-            DWORD dwOffset,
-            LPVOID lpvBuffer,
-            DWORD cbData)
-{
-    if (!lpvBuffer)
-    {
-        cbData = 0;
-    }
-    return NtGdiGetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData);
-}
-
-INT
-WINAPI
-NamedEscape(HDC hdc,
-            PWCHAR pDriver,
-            INT iEsc,
-            INT cjIn,
-            LPSTR pjIn,
-            INT cjOut,
-            LPSTR pjOut)
-{
-    /* FIXME metadc, metadc are done most in user mode, and we do not support it
-     * Windows 2000/XP/Vista ignore the current hdc, that are being pass and always set hdc to NULL
-     * when it calls to NtGdiExtEscape from NamedEscape
-     */
-    return NtGdiExtEscape(NULL,pDriver,wcslen(pDriver),iEsc,cjIn,pjIn,cjOut,pjOut);
-}
-
-/*
- * @unimplemented
- */
-
-/* FIXME wrong protypes, it is a fastcall api */
-DWORD
-WINAPI
-cGetTTFFromFOT(DWORD x1 ,DWORD x2 ,DWORD x3, DWORD x4, DWORD x5, DWORD x6, DWORD x7)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
diff --git a/reactos/win32ss/gdi/gdi32/misc/stubsa.c b/reactos/win32ss/gdi/gdi32/misc/stubsa.c
deleted file mode 100644 (file)
index c4c502b..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * dll/win32/gdi32/misc/stubsa.c
- *
- * GDI32.DLL Stubs for ANSI functions
- *
- * When you implement one of these functions,
- * remove its stub from this file.
- *
- */
-
-#include <precomp.h>
-#include <debug.h>
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-PolyTextOutA( HDC hdc, const POLYTEXTA *pptxt, INT cStrings )
-{
-    for (; cStrings>0; cStrings--, pptxt++)
-        if (!ExtTextOutA( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
-            return FALSE;
-    return TRUE;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GetLogColorSpaceA(
-    HCOLORSPACE                a0,
-    LPLOGCOLORSPACEA   a1,
-    DWORD                      a2
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GetICMProfileA(
-    HDC                hdc,
-    LPDWORD pBufSize,
-    LPSTR              pszFilename
-)
-{
-    WCHAR filenameW[MAX_PATH];
-    DWORD buflen = MAX_PATH;
-    BOOL ret = FALSE;
-
-    if (!hdc || !pBufSize || !pszFilename) return FALSE;
-
-    if (GetICMProfileW(hdc, &buflen, filenameW))
-    {
-        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);
-            ret = TRUE;
-        }
-        else SetLastError(ERROR_INSUFFICIENT_BUFFER);
-        *pBufSize = len;
-    }
-
-    return ret;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-SetICMProfileA(
-    HDC        a0,
-    LPSTR      a1
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-int
-WINAPI
-EnumICMProfilesA(
-    HDC                a0,
-    ICMENUMPROCA       a1,
-    LPARAM             a2
-)
-{
-    /*
-     * FIXME - call NtGdiEnumICMProfiles with NULL for lpstrBuffer
-     * to find out how big a buffer we need. Then allocate that buffer
-     * and call NtGdiEnumICMProfiles again to have the buffer filled.
-     *
-     * Finally, step through the buffer ( MULTI-SZ recommended for format ),
-     * and convert each string to ANSI, calling the user's callback function
-     * until we run out of strings or the user returns FALSE
-     */
-
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-UpdateICMRegKeyA(
-    DWORD      a0,
-    LPSTR      a1,
-    LPSTR      a2,
-    UINT       a3
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetStringBitmapA(HDC hdc,
-                 LPSTR psz,
-                 BOOL DoCall,
-                 UINT cj,
-                 BYTE *lpSB)
-{
-
-    NTSTATUS Status;
-    PWSTR pwsz;
-    UINT retValue = 0;
-
-    if (DoCall)
-    {
-        Status = HEAP_strdupA2W ( &pwsz, psz );
-        if ( !NT_SUCCESS (Status) )
-        {
-            SetLastError (RtlNtStatusToDosError(Status));
-        }
-        else
-        {
-            retValue = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
-            HEAP_free ( pwsz );
-        }
-    }
-
-    return retValue;
-
-}
-
-
-/* EOF */
diff --git a/reactos/win32ss/gdi/gdi32/misc/stubsw.c b/reactos/win32ss/gdi/gdi32/misc/stubsw.c
deleted file mode 100644 (file)
index d649db7..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * dll/win32/gdi32/misc/stubsw.c
- *
- * GDI32.DLL Stubs for Unicode functions
- *
- * When you implement one of these functions,
- * remove its stub from this file.
- *
- */
-
-#include <precomp.h>
-#include <debug.h>
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-PolyTextOutW( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
-{
-    for (; cStrings>0; cStrings--, pptxt++)
-        if (!ExtTextOutW( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
-            return FALSE;
-    return TRUE;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GetLogColorSpaceW(
-    HCOLORSPACE                a0,
-    LPLOGCOLORSPACEW   a1,
-    DWORD                      a2
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GetICMProfileW(
-    HDC                hdc,
-    LPDWORD            size,
-    LPWSTR             filename
-)
-{
-    if (!hdc || !size || !filename) return FALSE;
-
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-SetICMProfileW(
-    HDC        a0,
-    LPWSTR     a1
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-int
-WINAPI
-EnumICMProfilesW(
-    HDC                hDC,
-    ICMENUMPROCW       lpEnumICMProfilesFunc,
-    LPARAM             lParam
-)
-{
-    /*
-     * FIXME - call NtGdiEnumICMProfiles with NULL for lpstrBuffer
-     * to find out how big a buffer we need. Then allocate that buffer
-     * and call NtGdiEnumICMProfiles again to have the buffer filled.
-     *
-     * Finally, step through the buffer ( MULTI-SZ recommended for format ),
-     * and call the user's callback function until we run out of strings or
-     * the user returns FALSE
-     */
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-UpdateICMRegKeyW(
-    DWORD      a0,
-    LPWSTR     a1,
-    LPWSTR     a2,
-    UINT       a3
-)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-
-/* === AFTER THIS POINT I GUESS... =========
- * (based on stack size in Norlander's .def)
- * === WHERE ARE THEY DEFINED? =============
- */
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-EudcLoadLinkW(LPCWSTR pBaseFaceName,LPCWSTR pEudcFontPath,INT iPriority,INT iFontLinkType)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-EudcUnloadLinkW(LPCWSTR pBaseFaceName,LPCWSTR pEudcFontPath)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-int
-WINAPI
-GdiAddFontResourceW(
-    LPCWSTR lpszFilename,
-    FLONG fl,
-    DESIGNVECTOR *pdv)
-{
-    return NtGdiAddFontResourceW((PWSTR)lpszFilename, 0, 0, fl, 0, pdv);
-}
-
-/*
- * @implemented
- */
-DWORD
-WINAPI
-GetEUDCTimeStampExW(LPWSTR lpBaseFaceName)
-{
-    DWORD retValue = 0;
-
-    if (!lpBaseFaceName)
-    {
-        retValue = NtGdiGetEudcTimeStampEx(NULL,0,FALSE);
-    }
-    else
-    {
-        retValue = NtGdiGetEudcTimeStampEx(lpBaseFaceName, wcslen(lpBaseFaceName), FALSE);
-    }
-
-    return retValue;
-}
-
-
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-bInitSystemAndFontsDirectoriesW(LPWSTR *SystemDir,LPWSTR *FontsDir)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-bMakePathNameW(LPWSTR lpBuffer,LPCWSTR lpFileName,LPWSTR *lpFilePart,DWORD unknown)
-{
-    UNIMPLEMENTED;
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-}
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetStringBitmapW(HDC hdc,
-                 LPWSTR pwsz,
-                 BOOL doCall,
-                 UINT cj,
-                 BYTE *lpSB)
-{
-    UINT retValue = 0;
-
-    if (doCall)
-    {
-        retValue = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
-    }
-
-    return retValue;
-
-}
-
-
-BOOL
-WINAPI
-CreateScalableFontResourceW(
-    DWORD fdwHidden,
-    LPCWSTR lpszFontRes,
-    LPCWSTR lpszFontFile,
-    LPCWSTR lpszCurrentPath
-)
-{
-    HANDLE f;
-
-    UNIMPLEMENTED;
-
-    /* fHidden=1 - only visible for the calling app, read-only, not
-     * enumerated with EnumFonts/EnumFontFamilies
-     * lpszCurrentPath can be NULL
-     */
-
-    /* If the output file already exists, return the ERROR_FILE_EXISTS error as specified in MSDN */
-    if ((f = CreateFileW(lpszFontRes, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE)
-    {
-        CloseHandle(f);
-        SetLastError(ERROR_FILE_EXISTS);
-        return FALSE;
-    }
-    return FALSE; /* create failed */
-}
-
-
-/* EOF */
index 7389109..13fee27 100644 (file)
@@ -199,31 +199,4 @@ SwapBuffers(HDC  hdc)
        Do this here for now.
 */
 
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetEnhMetaFilePixelFormat(
-    HENHMETAFILE                       hemf,
-    UINT                               cbBuffer,
-    PIXELFORMATDESCRIPTOR      *ppfd
-)
-{
-    ENHMETAHEADER pemh;
-
-    if(GetEnhMetaFileHeader(hemf, sizeof(ENHMETAHEADER), &pemh))
-    {
-        if(pemh.bOpenGL)
-        {
-            if(pemh.cbPixelFormat)
-            {
-                memcpy((void*)ppfd, UlongToPtr(pemh.offPixelFormat), cbBuffer );
-                return(pemh.cbPixelFormat);
-            }
-        }
-    }
-    return(0);
-}
-
 /* EOF */
index 4173e4b..e764fa3 100644 (file)
@@ -243,60 +243,6 @@ CreateDIBSection(
     return hBitmap;
 }
 
-/*
- * @implemented
- */
-BOOL
-WINAPI
-BitBlt(
-    HDC hdcDest, /* handle to destination DC */
-    int nXOriginDest, /* x-coord of destination upper-left corner */
-    int nYOriginDest, /* y-coord of destination upper-left corner */
-    int nWidthDest, /* width of destination rectangle */
-    int nHeightDest, /* height of destination rectangle */
-    HDC hdcSrc, /* handle to source DC */
-    int nXSrc, /* x-coordinate of source upper-left corner */
-    int nYSrc, /* y-coordinate of source upper-left corner */
-    DWORD dwRop) /* raster operation code */
-{
-    /* use patBlt for no source blt  Like windows does */
-    if (!ROP_USES_SOURCE(dwRop))
-    {
-        return PatBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, dwRop);
-    }
-
-    return NtGdiBitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXSrc,
-        nYSrc, dwRop, 0, 0);
-}
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-StretchBlt(
-    HDC hdcDest, /* handle to destination DC */
-    int nXOriginDest, /* x-coord of destination upper-left corner */
-    int nYOriginDest, /* y-coord of destination upper-left corner */
-    int nWidthDest, /* width of destination rectangle */
-    int nHeightDest, /* height of destination rectangle */
-    HDC hdcSrc, /* handle to source DC */
-    int nXOriginSrc, /* x-coord of source upper-left corner */
-    int nYOriginSrc, /* y-coord of source upper-left corner */
-    int nWidthSrc, /* width of source rectangle */
-    int nHeightSrc, /* height of source rectangle */
-    DWORD dwRop) /* raster operation code */
-
-{
-    if ((nWidthDest != nWidthSrc) || (nHeightDest != nHeightSrc))
-    {
-        return NtGdiStretchBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc,
-            nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, dwRop, 0);
-    }
-
-    return NtGdiBitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc,
-        nXOriginSrc, nYOriginSrc, dwRop, 0, 0);
-}
 
 /*
  * @implemented
@@ -925,3 +871,62 @@ StretchDIBits(
     return LinesCopied;
 }
 
+/*
+ * @unimplemented
+ */
+DWORD
+WINAPI
+GetBitmapAttributes(HBITMAP hbm)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HBITMAP
+WINAPI
+SetBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HBITMAP
+WINAPI
+ClearBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ *
+ */
+HBITMAP
+WINAPI
+GdiConvertBitmapV5(
+    HBITMAP in_format_BitMap,
+    HBITMAP src_BitMap,
+    INT bpp,
+    INT unuse)
+{
+    /* FIXME guessing the prototypes */
+
+    /*
+     * it have create a new bitmap with desired in format,
+     * then convert it src_bitmap to new format
+     * and return it as HBITMAP
+     */
+
+    return FALSE;
+}
+
index 6a68640..4931c48 100644 (file)
@@ -427,3 +427,68 @@ SetBrushOrgEx(HDC hdc,
     /* Fall back to the slower kernel path */
     return NtGdiSetBrushOrg(hdc, nXOrg, nYOrg, lppt);
 }
+
+/*
+ * @unimplemented
+ */
+DWORD
+WINAPI
+GetBrushAttributes(HBRUSH hbr)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HBRUSH
+WINAPI
+SetBrushAttributes(HBRUSH hbm, DWORD dwFlags)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HBRUSH
+WINAPI
+ClearBrushAttributes(HBRUSH hbm, DWORD dwFlags)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+UnrealizeObject(HGDIOBJ  hgdiobj)
+{
+    BOOL retValue = TRUE;
+    /*
+       Win 2k Graphics API, Black Book. by coriolis.com
+       Page 62, Note that Steps 3, 5, and 6 are not required for Windows NT(tm)
+       and Windows 2000(tm).
+
+       Step 5. UnrealizeObject(hTrackBrush);
+     */
+    /*
+        msdn.microsoft.com,
+        "Windows 2000/XP: If hgdiobj is a brush, UnrealizeObject does nothing,
+        and the function returns TRUE. Use SetBrushOrgEx to set the origin of
+        a brush."
+     */
+    if (GDI_HANDLE_GET_TYPE(hgdiobj) != GDI_OBJECT_TYPE_BRUSH)
+    {
+        retValue = NtGdiUnrealizeObject(hgdiobj);
+    }
+
+    return retValue;
+}
diff --git a/reactos/win32ss/gdi/gdi32/objects/colorspace.c b/reactos/win32ss/gdi/gdi32/objects/colorspace.c
new file mode 100644 (file)
index 0000000..14918ad
--- /dev/null
@@ -0,0 +1,130 @@
+#include <precomp.h>
+
+#define NDEBUG
+#include <debug.h>
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GetLogColorSpaceA(
+    HCOLORSPACE                a0,
+    LPLOGCOLORSPACEA   a1,
+    DWORD                      a2
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GetLogColorSpaceW(
+    HCOLORSPACE                a0,
+    LPLOGCOLORSPACEW   a1,
+    DWORD                      a2
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+CheckColorsInGamut(
+    HDC        a0,
+    LPVOID     a1,
+    LPVOID     a2,
+    DWORD      a3
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GetDeviceGammaRamp( HDC hdc,
+                    LPVOID lpGammaRamp)
+{
+    BOOL retValue = FALSE;
+    if (lpGammaRamp == NULL)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+    }
+    else
+    {
+        retValue = NtGdiGetDeviceGammaRamp(hdc,lpGammaRamp);
+    }
+
+    return retValue;
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+SetDeviceGammaRamp(HDC hdc,
+                   LPVOID lpGammaRamp)
+{
+    BOOL retValue = FALSE;
+
+    if (lpGammaRamp)
+    {
+        retValue = NtGdiSetDeviceGammaRamp(hdc, lpGammaRamp);
+    }
+    else
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+    }
+
+    return  retValue;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+ColorMatchToTarget(
+    HDC        a0,
+    HDC        a1,
+    DWORD      a2
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+SetColorAdjustment(
+    HDC                        hdc,
+    CONST COLORADJUSTMENT      *a1
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
index b919e1f..cc28b06 100644 (file)
@@ -105,6 +105,69 @@ CombineTransform(
 }
 
 
+/*
+ * @implemented
+ *
+ */
+int
+WINAPI
+GetMapMode(HDC hdc)
+{
+    PDC_ATTR pdcattr;
+
+    /* Get the DC attribute */
+    pdcattr = GdiGetDcAttr(hdc);
+    if (pdcattr == NULL)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;
+    }
+
+    return pdcattr->iMapMode;
+}
+
+/*
+ * @implemented
+ */
+INT
+WINAPI
+SetMapMode(
+    _In_ HDC hdc,
+    _In_ INT iMode)
+{
+    PDC_ATTR pdcattr;
+
+    /* Get the DC attribute */
+    pdcattr = GdiGetDcAttr(hdc);
+    if (pdcattr == NULL)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;
+    }
+
+#if 0
+    if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)
+    {
+        if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC)
+            return MFDRV_SetMapMode(hdc, iMode);
+        else
+        {
+            SetLastError(ERROR_INVALID_HANDLE);
+            return 0;
+        }
+    }
+#endif
+    /* Force change if Isotropic is set for recompute. */
+    if ((iMode != pdcattr->iMapMode) || (iMode == MM_ISOTROPIC))
+    {
+        pdcattr->ulDirty_ &= ~SLOW_WIDTHS;
+        return GetAndSetDCDWord( hdc, GdiGetSetMapMode, iMode, 0, 0, 0 );
+    }
+
+    return pdcattr->iMapMode;
+}
+
+
 BOOL
 WINAPI
 DPtoLP(HDC hdc, LPPOINT lpPoints, INT nCount)
@@ -745,6 +808,35 @@ SetLayoutWidth(HDC hdc,LONG wox,DWORD dwLayout)
     return NtGdiSetLayout( hdc, wox, dwLayout);
 }
 
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GetDCOrgEx(
+    HDC hdc,
+    LPPOINT lpPoint)
+{
+    return NtGdiGetDCPoint( hdc, GdiGetDCOrg, (PPOINTL)lpPoint );
+}
+
+
+/*
+ * @implemented
+ */
+LONG
+WINAPI
+GetDCOrg(
+    HDC hdc)
+{
+    // Officially obsolete by Microsoft
+    POINT Pt;
+    if (!GetDCOrgEx(hdc, &Pt))
+        return 0;
+    return(MAKELONG(Pt.x, Pt.y));
+}
+
+
 /*
  * @implemented
  *
index 07eac4f..6c8a82d 100644 (file)
@@ -3,8 +3,6 @@
 #define NDEBUG
 #include <debug.h>
 
-HGDIOBJ stock_objects[NB_STOCK_OBJECTS]; // temp location.
-
 HDC
 FASTCALL
 IntCreateDICW(
@@ -320,86 +318,63 @@ DeleteDC(HDC hdc)
     return bResult;
 }
 
+
 /*
- * @implemented
+ * @unimplemented
  */
-BOOL
+INT
 WINAPI
-DeleteObject(HGDIOBJ hObject)
+SaveDC(IN HDC hdc)
 {
-    DWORD dwType = 0;
-
-    /* From Wine: DeleteObject does not SetLastError() on a null object */
-    if(!hObject) return FALSE;
-
-    if ((DWORD)hObject & GDI_HANDLE_STOCK_MASK)
-    {
-        // Relax! This is a normal return!
-        DPRINT("Trying to delete system object 0x%p\n", hObject);
-        return TRUE;
-    }
+    /* FIXME Sharememory */
+    return NtGdiSaveDC(hdc);
+}
 
-    // If you dont own it?! Get OUT!
-    if(!GdiIsHandleValid(hObject)) return FALSE;
 
-    dwType = GDI_HANDLE_GET_TYPE(hObject);
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+RestoreDC(IN HDC hdc,
+          IN INT iLevel)
+{
+    /* FIXME Sharememory */
+    return NtGdiRestoreDC(hdc, iLevel);
+}
 
-    if ((dwType == GDI_OBJECT_TYPE_METAFILE) ||
-        (dwType == GDI_OBJECT_TYPE_ENHMETAFILE))
-        return FALSE;
 
-    switch (dwType)
-    {
-    case GDI_OBJECT_TYPE_DC:
-        return DeleteDC((HDC) hObject);
-    case GDI_OBJECT_TYPE_COLORSPACE:
-        return NtGdiDeleteColorSpace((HCOLORSPACE) hObject);
-    case GDI_OBJECT_TYPE_REGION:
-        return DeleteRegion((HRGN) hObject);
-#if 0
-    case GDI_OBJECT_TYPE_METADC:
-        return MFDRV_DeleteObject( hObject );
-    case GDI_OBJECT_TYPE_EMF:
-    {
-        PLDC pLDC = GdiGetLDC(hObject);
-        if ( !pLDC ) return FALSE;
-        return EMFDRV_DeleteObject( hObject );
-    }
-#endif
-    case GDI_OBJECT_TYPE_FONT:
-        break;
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+CancelDC(HDC hDC)
+{
+    PDC_ATTR pDc_Attr;
 
-    case GDI_OBJECT_TYPE_BRUSH:
-    case GDI_OBJECT_TYPE_EXTPEN:
-    case GDI_OBJECT_TYPE_PEN:
+    if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC &&
+            GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_METADC )
     {
-        PBRUSH_ATTR Brh_Attr;
-        PTEB pTeb;
-        PGDIBSOBJECT pgO;
-
-        if ((!GdiGetHandleUserData(hObject, dwType, (PVOID*)&Brh_Attr)) ||
-            (Brh_Attr == NULL)) break;
-
-        pTeb = NtCurrentTeb();
-
-        if (pTeb->Win32ThreadInfo == NULL) break;
-
-        pgO = GdiAllocBatchCommand(NULL, GdiBCDelObj);
-        if (pgO)
+        PLDC pLDC = GdiGetLDC(hDC);
+        if ( !pLDC )
         {
-            pgO->hgdiobj = hObject;
-            return TRUE;
+            SetLastError(ERROR_INVALID_HANDLE);
+            return FALSE;
         }
+        /* If a document has started set it to die. */
+        if (pLDC->Flags & LDC_INIT_DOCUMENT) pLDC->Flags |= LDC_KILL_DOCUMENT;
 
-        break;
+        return NtGdiCancelDC(hDC);
     }
 
-    case GDI_OBJECT_TYPE_BITMAP:
-    default:
-        break;
+    if (GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &pDc_Attr))
+    {
+        pDc_Attr->ulDirty_ &= ~DC_PLAYMETAFILE;
+        return TRUE;
     }
 
-    return NtGdiDeleteObjectApp(hObject);
+    return FALSE;
 }
 
 INT
@@ -420,6 +395,54 @@ SetArcDirection(
     return GetAndSetDCDWord(hdc, GdiGetSetArcDirection, nDirection, 0, 0, 0);
 }
 
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiReleaseDC(HDC hdc)
+{
+    return 0;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GdiCleanCacheDC(HDC hdc)
+{
+    if (GDI_HANDLE_GET_TYPE(hdc) == GDILoObjType_LO_DC_TYPE)
+        return TRUE;
+    SetLastError(ERROR_INVALID_HANDLE);
+    return FALSE;
+}
+
+/*
+ * @implemented
+ */
+HDC
+WINAPI
+GdiConvertAndCheckDC(HDC hdc)
+{
+    PLDC pldc;
+    ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
+    if (hType == GDILoObjType_LO_DC_TYPE || hType == GDILoObjType_LO_METADC16_TYPE)
+        return hdc;
+    pldc = GdiGetLDC(hdc);
+    if (pldc)
+    {
+        if (pldc->Flags & LDC_SAPCALLBACK) GdiSAPCallback(pldc);
+        if (pldc->Flags & LDC_KILL_DOCUMENT) return NULL;
+        if (pldc->Flags & LDC_STARTPAGE) StartPage(hdc);
+        return hdc;
+    }
+    SetLastError(ERROR_INVALID_HANDLE);
+    return NULL;
+}
+
+
 /*
  * @implemented
  *
@@ -481,6 +504,67 @@ GetCurrentObject(
     return NtGdiGetDCObject(hdc, uObjectType);
 }
 
+
+/*
+ * @implemented
+ */
+int
+WINAPI
+EnumObjects(HDC hdc,
+            int nObjectType,
+            GOBJENUMPROC lpObjectFunc,
+            LPARAM lParam)
+{
+    ULONG ObjectsCount;
+    ULONG Size;
+    PVOID Buffer = NULL;
+    DWORD_PTR EndOfBuffer;
+    int Result = 0;
+
+    switch (nObjectType)
+    {
+    case OBJ_BRUSH:
+        Size = sizeof(LOGBRUSH);
+        break;
+
+    case OBJ_PEN:
+        Size = sizeof(LOGPEN);
+        break;
+
+    default:
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;
+    }
+
+    ObjectsCount = NtGdiEnumObjects(hdc, nObjectType, 0, NULL);
+    if (!ObjectsCount) return 0;
+
+    Buffer = HeapAlloc(GetProcessHeap(), 0, ObjectsCount * Size);
+    if (!Buffer)
+    {
+        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+        return 0;
+    }
+
+    if (!NtGdiEnumObjects(hdc, nObjectType, ObjectsCount * Size, Buffer))
+    {
+        HeapFree(GetProcessHeap(), 0, Buffer);
+        return 0;
+    }
+
+    EndOfBuffer = (DWORD_PTR)Buffer + (ObjectsCount * Size);
+    while ((DWORD_PTR)Buffer < EndOfBuffer)
+    {
+        Result = lpObjectFunc(Buffer, lParam);
+        if (!Result) break;
+        Buffer = (PVOID)((DWORD_PTR)Buffer + Size);
+    }
+
+    HeapFree(GetProcessHeap(), 0, Buffer);
+    return Result;
+}
+
+
 /*
  * @implemented
  *
@@ -769,198 +853,42 @@ GetAspectRatioFilterEx(
 /*
  * @implemented
  */
-BOOL
+UINT
 WINAPI
-GetDCOrgEx(
-    HDC hdc,
-    LPPOINT lpPoint)
+GetBoundsRect(
+    HDC        hdc,
+    LPRECT     lprcBounds,
+    UINT       flags
+)
 {
-    return NtGdiGetDCPoint( hdc, GdiGetDCOrg, (PPOINTL)lpPoint );
+    return NtGdiGetBoundsRect(hdc,lprcBounds,flags & DCB_RESET);
 }
 
 
 /*
  * @implemented
  */
-LONG
+UINT
 WINAPI
-GetDCOrg(
-    HDC hdc)
+SetBoundsRect(HDC hdc,
+              CONST RECT *prc,
+              UINT flags)
 {
-    // Officially obsolete by Microsoft
-    POINT Pt;
-    if (!GetDCOrgEx(hdc, &Pt))
-        return 0;
-    return(MAKELONG(Pt.x, Pt.y));
-}
-
-
-/*
- * @implemented
- */
-int
-WINAPI
-GetObjectW(
-    _In_ HGDIOBJ hGdiObj,
-    _In_ int cbSize,
-    _Out_ LPVOID lpBuffer)
-{
-    DWORD dwType;
-    INT cbResult = 0;
-
-    /* Fixup handles with upper 16 bits masked */
-    hGdiObj = GdiFixUpHandle(hGdiObj);
-
-    /* Get the object type */
-    dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
-
-    /* Check what kind of object we have */
-    switch (dwType)
-    {
-        case GDI_OBJECT_TYPE_PEN:
-            if (!lpBuffer) return sizeof(LOGPEN);
-            break;
-
-        case GDI_OBJECT_TYPE_BRUSH:
-            if (!lpBuffer || !cbSize) return sizeof(LOGBRUSH);
-            break;
-
-        case GDI_OBJECT_TYPE_BITMAP:
-            if (!lpBuffer) return sizeof(BITMAP);
-            break;
-
-        case GDI_OBJECT_TYPE_PALETTE:
-            if (!lpBuffer) return sizeof(WORD);
-            break;
-
-        case GDI_OBJECT_TYPE_FONT:
-            if (!lpBuffer) return sizeof(LOGFONTW);
-            break;
-
-        case GDI_OBJECT_TYPE_EXTPEN:
-            /* we don't know the size, ask win32k */
-            break;
-
-        case GDI_OBJECT_TYPE_COLORSPACE:
-            if ((cbSize < 328) || !lpBuffer)
-            {
-                SetLastError(ERROR_INSUFFICIENT_BUFFER);
-                return 0;
-            }
-            break;
-
-        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;
-    }
-
-    /* Call win32k */
-    cbResult = NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
-
-    /* Handle error */
-    if (cbResult == 0)
-    {
-        if (!GdiIsHandleValid(hGdiObj))
-        {
-            if ((dwType == GDI_OBJECT_TYPE_PEN) ||
-                (dwType == GDI_OBJECT_TYPE_EXTPEN) ||
-                (dwType == GDI_OBJECT_TYPE_BRUSH) ||
-                (dwType == GDI_OBJECT_TYPE_COLORSPACE))
-            {
-                SetLastError(ERROR_INVALID_PARAMETER);
-            }
-        }
-        else
-        {
-            if ((dwType == GDI_OBJECT_TYPE_PEN) ||
-                (dwType == GDI_OBJECT_TYPE_BRUSH) ||
-                (dwType == GDI_OBJECT_TYPE_COLORSPACE) ||
-                ( (dwType == GDI_OBJECT_TYPE_EXTPEN) &&
-                    ( (cbSize >= sizeof(EXTLOGPEN)) || (cbSize == 0) ) ) ||
-                ( (dwType == GDI_OBJECT_TYPE_BITMAP) && (cbSize >= sizeof(BITMAP)) ))
-            {
-                SetLastError(ERROR_NOACCESS);
-            }
-        }
-    }
-
-    return cbResult;
-}
-
-
-ULONG
-WINAPI
-GetFontObjectA(
-    _In_ HGDIOBJ hfont,
-    _In_ ULONG cbSize,
-    _Out_ 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;
+    /* FIXME add check for validate the flags */
+    return NtGdiSetBoundsRect(hdc, (LPRECT)prc, flags);
 }
 
 
 /*
  * @implemented
+ *
  */
 int
 WINAPI
-GetObjectA(
-    _In_ HGDIOBJ hGdiObj,
-    _In_ int cbSize,
-    _Out_ LPVOID lpBuffer)
+GetClipBox(HDC hdc,
+           LPRECT lprc)
 {
-    DWORD dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
-
-    /* Chjeck if this is anything else but a font */
-    if (dwType == GDI_OBJECT_TYPE_FONT)
-    {
-        return GetFontObjectA(hGdiObj, cbSize, lpBuffer);
-    }
-    else
-    {
-        /* Simply pass it to the widechar version */
-        return GetObjectW(hGdiObj, cbSize, lpBuffer);
-    }
+    return  NtGdiGetAppClipBox(hdc, lprc);
 }
 
 
@@ -1402,109 +1330,6 @@ ResetDCA(
 }
 
 
-/*
- * @implemented
- */
-DWORD
-WINAPI
-GetObjectType(
-    HGDIOBJ h)
-{
-    DWORD Ret = 0;
-
-    if (GdiIsHandleValid(h))
-    {
-        LONG Type = GDI_HANDLE_GET_TYPE(h);
-        switch(Type)
-        {
-        case GDI_OBJECT_TYPE_PEN:
-            Ret = OBJ_PEN;
-            break;
-        case GDI_OBJECT_TYPE_BRUSH:
-            Ret = OBJ_BRUSH;
-            break;
-        case GDI_OBJECT_TYPE_BITMAP:
-            Ret = OBJ_BITMAP;
-            break;
-        case GDI_OBJECT_TYPE_FONT:
-            Ret = OBJ_FONT;
-            break;
-        case GDI_OBJECT_TYPE_PALETTE:
-            Ret = OBJ_PAL;
-            break;
-        case GDI_OBJECT_TYPE_REGION:
-            Ret = OBJ_REGION;
-            break;
-        case GDI_OBJECT_TYPE_DC:
-            if ( GetDCDWord( h, GdiGetIsMemDc, 0))
-            {
-                Ret = OBJ_MEMDC;
-            }
-            else
-                Ret = OBJ_DC;
-            break;
-        case GDI_OBJECT_TYPE_COLORSPACE:
-            Ret = OBJ_COLORSPACE;
-            break;
-        case GDI_OBJECT_TYPE_METAFILE:
-            Ret = OBJ_METAFILE;
-            break;
-        case GDI_OBJECT_TYPE_ENHMETAFILE:
-            Ret = OBJ_ENHMETAFILE;
-            break;
-        case GDI_OBJECT_TYPE_METADC:
-            Ret = OBJ_METADC;
-            break;
-        case GDI_OBJECT_TYPE_EXTPEN:
-            Ret = OBJ_EXTPEN;
-            break;
-
-        case GDILoObjType_LO_ALTDC_TYPE:
-            // FIXME: could be something else?
-            Ret = OBJ_ENHMETADC;
-            break;
-
-        default:
-            DPRINT1("GetObjectType: Magic 0x%08x not implemented\n", Type);
-            break;
-        }
-    }
-    else
-        /* From Wine: GetObjectType does SetLastError() on a null object */
-        SetLastError(ERROR_INVALID_HANDLE);
-    return Ret;
-}
-
-
-/*
- * @implemented
- */
-HGDIOBJ
-WINAPI
-GetStockObject(
-    INT fnObject)
-{
-    HGDIOBJ hobj;
-
-    if ((fnObject < 0) || (fnObject >= NB_STOCK_OBJECTS))
-        return NULL;
-
-    hobj = stock_objects[fnObject];
-    if (hobj == NULL)
-    {
-        hobj = NtGdiGetStockObject(fnObject);
-
-        if (!GdiIsHandleValid(hobj))
-        {
-            return NULL;
-        }
-
-        stock_objects[fnObject] = hobj;
-    }
-
-    return hobj;
-}
-
 /* FIXME: include correct header */
 HPALETTE WINAPI NtUserSelectPalette(HDC  hDC,
                                     HPALETTE  hpal,
@@ -1540,68 +1365,6 @@ SelectPalette(
     return NtUserSelectPalette(hdc, hpal, bForceBackground);
 }
 
-/*
- * @implemented
- *
- */
-int
-WINAPI
-GetMapMode(HDC hdc)
-{
-    PDC_ATTR pdcattr;
-
-    /* Get the DC attribute */
-    pdcattr = GdiGetDcAttr(hdc);
-    if (pdcattr == NULL)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-    return pdcattr->iMapMode;
-}
-
-/*
- * @implemented
- */
-INT
-WINAPI
-SetMapMode(
-    _In_ HDC hdc,
-    _In_ INT iMode)
-{
-    PDC_ATTR pdcattr;
-
-    /* Get the DC attribute */
-    pdcattr = GdiGetDcAttr(hdc);
-    if (pdcattr == NULL)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return 0;
-    }
-
-#if 0
-    if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)
-    {
-        if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC)
-            return MFDRV_SetMapMode(hdc, iMode);
-        else
-        {
-            SetLastError(ERROR_INVALID_HANDLE);
-            return 0;
-        }
-    }
-#endif
-    /* Force change if Isotropic is set for recompute. */
-    if ((iMode != pdcattr->iMapMode) || (iMode == MM_ISOTROPIC))
-    {
-        pdcattr->ulDirty_ &= ~SLOW_WIDTHS;
-        return GetAndSetDCDWord( hdc, GdiGetSetMapMode, iMode, 0, 0, 0 );
-    }
-
-    return pdcattr->iMapMode;
-}
-
 /*
  * @implemented
  *
@@ -1695,6 +1458,7 @@ GetHFONT(HDC hdc)
 }
 
 
+
 HBITMAP
 WINAPI
 GdiSelectBitmap(
@@ -1854,3 +1618,4 @@ SelectObject(
 
     return NULL;
 }
+
index fbdaa58..4785267 100644 (file)
@@ -237,9 +237,6 @@ EngReleaseSemaphore ( IN HSEMAPHORE hsem )
     RtlLeaveCriticalSection( (PRTL_CRITICAL_SECTION) hsem);
 }
 
-
-
-
 /*
  * @implemented
  */
@@ -254,3 +251,14 @@ EngWideCharToMultiByte( UINT CodePage,
     return WideCharToMultiByte(CodePage, 0, WideCharString, (BytesInWideCharString/sizeof(WCHAR)),
                                MultiByteString, BytesInMultiByteString, NULL, NULL);
 }
+
+/*
+ * @unimplemented
+ */
+ULONG *
+WINAPI
+XLATEOBJ_piVector(XLATEOBJ *XlateObj)
+{
+    return XlateObj->pulXlate;
+}
+
index 45ed4f2..e44a61c 100644 (file)
@@ -551,3 +551,253 @@ CreateEnhMetaFileW(
     UNIMPLEMENTED;
     return 0;
 }
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+DeleteEnhMetaFile(
+    HENHMETAFILE       a0
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+EnumEnhMetaFile(
+    HDC                hdc,
+    HENHMETAFILE       hmf,
+    ENHMFENUMPROC      callback,
+    LPVOID             data,
+    CONST RECT *lpRect
+)
+{
+    if(!lpRect && hdc)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+UINT
+WINAPI
+GetEnhMetaFileBits(
+    HENHMETAFILE       a0,
+    UINT               a1,
+    LPBYTE             a2
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HENHMETAFILE
+WINAPI
+SetEnhMetaFileBits(
+    UINT               a0,
+    CONST BYTE *a1
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+UINT
+WINAPI
+GetEnhMetaFileHeader(
+    HENHMETAFILE       a0,
+    UINT               a1,
+    LPENHMETAHEADER    a2
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+UINT
+WINAPI
+GetEnhMetaFilePaletteEntries(
+    HENHMETAFILE       a0,
+    UINT               a1,
+    LPPALETTEENTRY     a2
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+PlayEnhMetaFile(
+    HDC                a0,
+    HENHMETAFILE       a1,
+    CONST RECT *a2
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+PlayEnhMetaFileRecord(
+    HDC                        a0,
+    LPHANDLETABLE              a1,
+    CONST ENHMETARECORD        *a2,
+    UINT                       a3
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+DWORD
+WINAPI
+IsValidEnhMetaRecord(
+    DWORD      a0,
+    DWORD      a1
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+
+}
+
+/*
+ * @unimplemented
+ */
+DWORD
+WINAPI
+IsValidEnhMetaRecordOffExt(
+    DWORD      a0,
+    DWORD      a1,
+    DWORD      a2,
+    DWORD      a3
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+
+}
+
+/*
+ * @unimplemented
+ */
+HENHMETAFILE
+WINAPI
+GdiConvertEnhMetaFile(HENHMETAFILE hmf)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HENHMETAFILE
+WINAPI
+GdiCreateLocalEnhMetaFile(HENHMETAFILE hmo)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiComment(
+    HDC                hDC,
+    UINT               bytes,
+    CONST BYTE *buffer
+)
+{
+#if 0
+    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_EMF)
+    {
+        PLDC pLDC = GdiGetLDC(hDC);
+        if ( !pLDC )
+        {
+            SetLastError(ERROR_INVALID_HANDLE);
+            return FALSE;
+        }
+        if (pLDC->iType == LDC_EMFLDC)
+        {
+            // Wine port
+            return EMFDRV_GdiComment( hDC, bytes, buffer );
+        }
+    }
+#endif
+    return FALSE;
+}
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
+GetEnhMetaFilePixelFormat(
+    HENHMETAFILE                       hemf,
+    UINT                               cbBuffer,
+    PIXELFORMATDESCRIPTOR      *ppfd
+)
+{
+    ENHMETAHEADER pemh;
+
+    if(GetEnhMetaFileHeader(hemf, sizeof(ENHMETAHEADER), &pemh))
+    {
+        if(pemh.bOpenGL)
+        {
+            if(pemh.cbPixelFormat)
+            {
+                memcpy((void*)ppfd, UlongToPtr(pemh.offPixelFormat), cbBuffer );
+                return(pemh.cbPixelFormat);
+            }
+        }
+    }
+    return(0);
+}
index d580e5f..4225005 100644 (file)
@@ -1039,6 +1039,25 @@ GetGlyphOutlineW(
     return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
 }
 
+/*
+ * @unimplemented
+ */
+DWORD
+WINAPI
+GetGlyphOutlineWow(
+    DWORD      a0,
+    DWORD      a1,
+    DWORD      a2,
+    DWORD      a3,
+    DWORD      a4,
+    DWORD      a5,
+    DWORD      a6
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
 
 /*
  * @implemented
@@ -2160,3 +2179,243 @@ NewEnumFontFamiliesExW(
 
     return ret;
 }
+
+/*
+ * @unimplemented
+ */
+int
+WINAPI
+GdiAddFontResourceW(
+    LPCWSTR lpszFilename,
+    FLONG fl,
+    DESIGNVECTOR *pdv)
+{
+    return NtGdiAddFontResourceW((PWSTR)lpszFilename, 0, 0, fl, 0, pdv);
+}
+
+/*
+ * @implemented
+ */
+HANDLE
+WINAPI
+AddFontMemResourceEx(
+    PVOID pbFont,
+    DWORD cbFont,
+    PVOID pdv,
+    DWORD *pcFonts
+)
+{
+    if ( pbFont && cbFont && pcFonts)
+    {
+        return NtGdiAddFontMemResourceEx(pbFont, cbFont, NULL, 0, pcFonts);
+    }
+    SetLastError(ERROR_INVALID_PARAMETER);
+    return NULL;
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+RemoveFontMemResourceEx(HANDLE fh)
+{
+    if (fh)
+    {
+        return NtGdiRemoveFontMemResourceEx(fh);
+    }
+    SetLastError(ERROR_INVALID_PARAMETER);
+    return FALSE;
+}
+
+
+/*
+ * @unimplemented
+ */
+int
+WINAPI
+AddFontResourceTracking(
+    LPCSTR lpString,
+    int unknown
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+int
+WINAPI
+RemoveFontResourceTracking(LPCSTR lpString,int unknown)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+BOOL
+WINAPI
+CreateScalableFontResourceW(
+    DWORD fdwHidden,
+    LPCWSTR lpszFontRes,
+    LPCWSTR lpszFontFile,
+    LPCWSTR lpszCurrentPath
+)
+{
+    HANDLE f;
+
+    UNIMPLEMENTED;
+
+    /* fHidden=1 - only visible for the calling app, read-only, not
+     * enumerated with EnumFonts/EnumFontFamilies
+     * lpszCurrentPath can be NULL
+     */
+
+    /* If the output file already exists, return the ERROR_FILE_EXISTS error as specified in MSDN */
+    if ((f = CreateFileW(lpszFontRes, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE)
+    {
+        CloseHandle(f);
+        SetLastError(ERROR_FILE_EXISTS);
+        return FALSE;
+    }
+    return FALSE; /* create failed */
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+bInitSystemAndFontsDirectoriesW(LPWSTR *SystemDir,LPWSTR *FontsDir)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+EudcLoadLinkW(LPCWSTR pBaseFaceName,LPCWSTR pEudcFontPath,INT iPriority,INT iFontLinkType)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+EudcUnloadLinkW(LPCWSTR pBaseFaceName,LPCWSTR pEudcFontPath)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @implemented
+ */
+ULONG
+WINAPI
+GetEUDCTimeStamp(VOID)
+{
+    return NtGdiGetEudcTimeStampEx(NULL,0,TRUE);
+}
+
+/*
+ * @implemented
+ */
+DWORD
+WINAPI
+GetEUDCTimeStampExW(LPWSTR lpBaseFaceName)
+{
+    DWORD retValue = 0;
+
+    if (!lpBaseFaceName)
+    {
+        retValue = NtGdiGetEudcTimeStampEx(NULL,0,FALSE);
+    }
+    else
+    {
+        retValue = NtGdiGetEudcTimeStampEx(lpBaseFaceName, wcslen(lpBaseFaceName), FALSE);
+    }
+
+    return retValue;
+}
+
+/*
+ * @implemented
+ */
+ULONG
+WINAPI
+GetFontAssocStatus(HDC hdc)
+{
+    ULONG retValue = 0;
+
+    if (hdc)
+    {
+        retValue = NtGdiQueryFontAssocInfo(hdc);
+    }
+
+    return retValue;
+}
+
+/*
+ * @unimplemented
+ */
+DWORD
+WINAPI
+QueryFontAssocStatus(VOID)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+VOID
+WINAPI
+UnloadNetworkFonts(DWORD unknown)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+}
+
+/*
+ * @implemented
+ *
+ */
+DWORD
+WINAPI
+GetFontData(HDC hdc,
+            DWORD dwTable,
+            DWORD dwOffset,
+            LPVOID lpvBuffer,
+            DWORD cbData)
+{
+    if (!lpvBuffer)
+    {
+        cbData = 0;
+    }
+    return NtGdiGetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData);
+}
+
+DWORD
+WINAPI
+cGetTTFFromFOT(DWORD x1 ,DWORD x2 ,DWORD x3, DWORD x4, DWORD x5, DWORD x6, DWORD x7)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
diff --git a/reactos/win32ss/gdi/gdi32/objects/gdiobj.c b/reactos/win32ss/gdi/gdi32/objects/gdiobj.c
new file mode 100644 (file)
index 0000000..9343625
--- /dev/null
@@ -0,0 +1,362 @@
+#include <precomp.h>
+
+#define NDEBUG
+#include <debug.h>
+
+HGDIOBJ stock_objects[NB_STOCK_OBJECTS];
+
+/*
+ * @implemented
+ */
+HGDIOBJ
+WINAPI
+GetStockObject(
+    INT fnObject)
+{
+    HGDIOBJ hobj;
+
+    if ((fnObject < 0) || (fnObject >= NB_STOCK_OBJECTS))
+        return NULL;
+
+    hobj = stock_objects[fnObject];
+    if (hobj == NULL)
+    {
+        hobj = NtGdiGetStockObject(fnObject);
+
+        if (!GdiIsHandleValid(hobj))
+        {
+            return NULL;
+        }
+
+        stock_objects[fnObject] = hobj;
+    }
+
+    return hobj;
+}
+
+
+/*
+ * @implemented
+ */
+DWORD
+WINAPI
+GetObjectType(
+    HGDIOBJ h)
+{
+    DWORD Ret = 0;
+
+    if (GdiIsHandleValid(h))
+    {
+        LONG Type = GDI_HANDLE_GET_TYPE(h);
+        switch(Type)
+        {
+        case GDI_OBJECT_TYPE_PEN:
+            Ret = OBJ_PEN;
+            break;
+        case GDI_OBJECT_TYPE_BRUSH:
+            Ret = OBJ_BRUSH;
+            break;
+        case GDI_OBJECT_TYPE_BITMAP:
+            Ret = OBJ_BITMAP;
+            break;
+        case GDI_OBJECT_TYPE_FONT:
+            Ret = OBJ_FONT;
+            break;
+        case GDI_OBJECT_TYPE_PALETTE:
+            Ret = OBJ_PAL;
+            break;
+        case GDI_OBJECT_TYPE_REGION:
+            Ret = OBJ_REGION;
+            break;
+        case GDI_OBJECT_TYPE_DC:
+            if ( GetDCDWord( h, GdiGetIsMemDc, 0))
+            {
+                Ret = OBJ_MEMDC;
+            }
+            else
+                Ret = OBJ_DC;
+            break;
+        case GDI_OBJECT_TYPE_COLORSPACE:
+            Ret = OBJ_COLORSPACE;
+            break;
+        case GDI_OBJECT_TYPE_METAFILE:
+            Ret = OBJ_METAFILE;
+            break;
+        case GDI_OBJECT_TYPE_ENHMETAFILE:
+            Ret = OBJ_ENHMETAFILE;
+            break;
+        case GDI_OBJECT_TYPE_METADC:
+            Ret = OBJ_METADC;
+            break;
+        case GDI_OBJECT_TYPE_EXTPEN:
+            Ret = OBJ_EXTPEN;
+            break;
+
+        case GDILoObjType_LO_ALTDC_TYPE:
+            // FIXME: could be something else?
+            Ret = OBJ_ENHMETADC;
+            break;
+
+        default:
+            DPRINT1("GetObjectType: Magic 0x%08x not implemented\n", Type);
+            break;
+        }
+    }
+    else
+        /* From Wine: GetObjectType does SetLastError() on a null object */
+        SetLastError(ERROR_INVALID_HANDLE);
+    return Ret;
+}
+
+ULONG
+WINAPI
+GetFontObjectA(
+    _In_ HGDIOBJ hfont,
+    _In_ ULONG cbSize,
+    _Out_ 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
+WINAPI
+GetObjectA(
+    _In_ HGDIOBJ hGdiObj,
+    _In_ int cbSize,
+    _Out_ LPVOID lpBuffer)
+{
+    DWORD dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
+
+    /* Chjeck if this is anything else but a font */
+    if (dwType == GDI_OBJECT_TYPE_FONT)
+    {
+        return GetFontObjectA(hGdiObj, cbSize, lpBuffer);
+    }
+    else
+    {
+        /* Simply pass it to the widechar version */
+        return GetObjectW(hGdiObj, cbSize, lpBuffer);
+    }
+}
+
+
+/*
+ * @implemented
+ */
+int
+WINAPI
+GetObjectW(
+    _In_ HGDIOBJ hGdiObj,
+    _In_ int cbSize,
+    _Out_ LPVOID lpBuffer)
+{
+    DWORD dwType;
+    INT cbResult = 0;
+
+    /* Fixup handles with upper 16 bits masked */
+    hGdiObj = GdiFixUpHandle(hGdiObj);
+
+    /* Get the object type */
+    dwType = GDI_HANDLE_GET_TYPE(hGdiObj);
+
+    /* Check what kind of object we have */
+    switch (dwType)
+    {
+        case GDI_OBJECT_TYPE_PEN:
+            if (!lpBuffer) return sizeof(LOGPEN);
+            break;
+
+        case GDI_OBJECT_TYPE_BRUSH:
+            if (!lpBuffer || !cbSize) return sizeof(LOGBRUSH);
+            break;
+
+        case GDI_OBJECT_TYPE_BITMAP:
+            if (!lpBuffer) return sizeof(BITMAP);
+            break;
+
+        case GDI_OBJECT_TYPE_PALETTE:
+            if (!lpBuffer) return sizeof(WORD);
+            break;
+
+        case GDI_OBJECT_TYPE_FONT:
+            if (!lpBuffer) return sizeof(LOGFONTW);
+            break;
+
+        case GDI_OBJECT_TYPE_EXTPEN:
+            /* we don't know the size, ask win32k */
+            break;
+
+        case GDI_OBJECT_TYPE_COLORSPACE:
+            if ((cbSize < 328) || !lpBuffer)
+            {
+                SetLastError(ERROR_INSUFFICIENT_BUFFER);
+                return 0;
+            }
+            break;
+
+        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;
+    }
+
+    /* Call win32k */
+    cbResult = NtGdiExtGetObjectW(hGdiObj, cbSize, lpBuffer);
+
+    /* Handle error */
+    if (cbResult == 0)
+    {
+        if (!GdiIsHandleValid(hGdiObj))
+        {
+            if ((dwType == GDI_OBJECT_TYPE_PEN) ||
+                (dwType == GDI_OBJECT_TYPE_EXTPEN) ||
+                (dwType == GDI_OBJECT_TYPE_BRUSH) ||
+                (dwType == GDI_OBJECT_TYPE_COLORSPACE))
+            {
+                SetLastError(ERROR_INVALID_PARAMETER);
+            }
+        }
+        else
+        {
+            if ((dwType == GDI_OBJECT_TYPE_PEN) ||
+                (dwType == GDI_OBJECT_TYPE_BRUSH) ||
+                (dwType == GDI_OBJECT_TYPE_COLORSPACE) ||
+                ( (dwType == GDI_OBJECT_TYPE_EXTPEN) &&
+                    ( (cbSize >= sizeof(EXTLOGPEN)) || (cbSize == 0) ) ) ||
+                ( (dwType == GDI_OBJECT_TYPE_BITMAP) && (cbSize >= sizeof(BITMAP)) ))
+            {
+                SetLastError(ERROR_NOACCESS);
+            }
+        }
+    }
+
+    return cbResult;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+DeleteObject(HGDIOBJ hObject)
+{
+    DWORD dwType = 0;
+
+    /* From Wine: DeleteObject does not SetLastError() on a null object */
+    if(!hObject) return FALSE;
+
+    if ((DWORD)hObject & GDI_HANDLE_STOCK_MASK)
+    {
+        // Relax! This is a normal return!
+        DPRINT("Trying to delete system object 0x%p\n", hObject);
+        return TRUE;
+    }
+
+    // If you dont own it?! Get OUT!
+    if(!GdiIsHandleValid(hObject)) return FALSE;
+
+    dwType = GDI_HANDLE_GET_TYPE(hObject);
+
+    if ((dwType == GDI_OBJECT_TYPE_METAFILE) ||
+        (dwType == GDI_OBJECT_TYPE_ENHMETAFILE))
+        return FALSE;
+
+    switch (dwType)
+    {
+    case GDI_OBJECT_TYPE_DC:
+        return DeleteDC((HDC) hObject);
+    case GDI_OBJECT_TYPE_COLORSPACE:
+        return NtGdiDeleteColorSpace((HCOLORSPACE) hObject);
+    case GDI_OBJECT_TYPE_REGION:
+        return DeleteRegion((HRGN) hObject);
+#if 0
+    case GDI_OBJECT_TYPE_METADC:
+        return MFDRV_DeleteObject( hObject );
+    case GDI_OBJECT_TYPE_EMF:
+    {
+        PLDC pLDC = GdiGetLDC(hObject);
+        if ( !pLDC ) return FALSE;
+        return EMFDRV_DeleteObject( hObject );
+    }
+#endif
+    case GDI_OBJECT_TYPE_FONT:
+        break;
+
+    case GDI_OBJECT_TYPE_BRUSH:
+    case GDI_OBJECT_TYPE_EXTPEN:
+    case GDI_OBJECT_TYPE_PEN:
+    {
+        PBRUSH_ATTR Brh_Attr;
+        PTEB pTeb;
+        PGDIBSOBJECT pgO;
+
+        if ((!GdiGetHandleUserData(hObject, dwType, (PVOID*)&Brh_Attr)) ||
+            (Brh_Attr == NULL)) break;
+
+        pTeb = NtCurrentTeb();
+
+        if (pTeb->Win32ThreadInfo == NULL) break;
+
+        pgO = GdiAllocBatchCommand(NULL, GdiBCDelObj);
+        if (pgO)
+        {
+            pgO->hgdiobj = hObject;
+            return TRUE;
+        }
+
+        break;
+    }
+
+    case GDI_OBJECT_TYPE_BITMAP:
+    default:
+        break;
+    }
+
+    return NtGdiDeleteObjectApp(hObject);
+}
+
+
index 7080866..e6c2fbd 100644 (file)
@@ -128,3 +128,195 @@ SetColorSpace(
     return NULL;
 }
 
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GetICMProfileA(
+    HDC                hdc,
+    LPDWORD pBufSize,
+    LPSTR              pszFilename
+)
+{
+    WCHAR filenameW[MAX_PATH];
+    DWORD buflen = MAX_PATH;
+    BOOL ret = FALSE;
+
+    if (!hdc || !pBufSize || !pszFilename) return FALSE;
+
+    if (GetICMProfileW(hdc, &buflen, filenameW))
+    {
+        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);
+            ret = TRUE;
+        }
+        else SetLastError(ERROR_INSUFFICIENT_BUFFER);
+        *pBufSize = len;
+    }
+
+    return ret;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GetICMProfileW(
+    HDC                hdc,
+    LPDWORD            size,
+    LPWSTR             filename
+)
+{
+    if (!hdc || !size || !filename) return FALSE;
+
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+SetICMProfileA(
+    HDC        a0,
+    LPSTR      a1
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+SetICMProfileW(
+    HDC        a0,
+    LPWSTR     a1
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+/*
+ * @unimplemented
+ */
+int
+WINAPI
+EnumICMProfilesA(
+    HDC                a0,
+    ICMENUMPROCA       a1,
+    LPARAM             a2
+)
+{
+    /*
+     * FIXME - call NtGdiEnumICMProfiles with NULL for lpstrBuffer
+     * to find out how big a buffer we need. Then allocate that buffer
+     * and call NtGdiEnumICMProfiles again to have the buffer filled.
+     *
+     * Finally, step through the buffer ( MULTI-SZ recommended for format ),
+     * and convert each string to ANSI, calling the user's callback function
+     * until we run out of strings or the user returns FALSE
+     */
+
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+
+/*
+ * @unimplemented
+ */
+int
+WINAPI
+EnumICMProfilesW(
+    HDC                hDC,
+    ICMENUMPROCW       lpEnumICMProfilesFunc,
+    LPARAM             lParam
+)
+{
+    /*
+     * FIXME - call NtGdiEnumICMProfiles with NULL for lpstrBuffer
+     * to find out how big a buffer we need. Then allocate that buffer
+     * and call NtGdiEnumICMProfiles again to have the buffer filled.
+     *
+     * Finally, step through the buffer ( MULTI-SZ recommended for format ),
+     * and call the user's callback function until we run out of strings or
+     * the user returns FALSE
+     */
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+UpdateICMRegKeyA(
+    DWORD      a0,
+    LPSTR      a1,
+    LPSTR      a2,
+    UINT       a3
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+UpdateICMRegKeyW(
+    DWORD      a0,
+    LPWSTR     a1,
+    LPWSTR     a2,
+    UINT       a3
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+int
+WINAPI
+SetICMMode(
+    HDC        hdc,
+    int        iEnableICM
+)
+{
+    /*FIXME:  Assume that ICM is always off, and cannot be turned on */
+    if (iEnableICM == ICM_OFF) return ICM_OFF;
+    if (iEnableICM == ICM_ON) return 0;
+    if (iEnableICM == ICM_QUERY) return ICM_OFF;
+
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
index 410d50e..c75bca8 100644 (file)
@@ -1,4 +1,5 @@
 #include <precomp.h>
+#include <debug.h>
 
 /* DEFINES *******************************************************************/
 
@@ -271,3 +272,219 @@ GetMetaFileA(
 }
 
 
+/*
+ * @unimplemented
+ */
+UINT
+WINAPI
+GetMetaFileBitsEx(
+    HMETAFILE  a0,
+    UINT               a1,
+    LPVOID             a2
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HMETAFILE
+WINAPI
+SetMetaFileBitsEx(
+    UINT               size,
+    CONST BYTE *lpData
+)
+{
+    const METAHEADER *mh_in = (const METAHEADER *)lpData;
+
+    if (size & 1) return 0;
+
+    if (!size || mh_in->mtType != METAFILE_MEMORY || mh_in->mtVersion != 0x300 ||
+            mh_in->mtHeaderSize != sizeof(METAHEADER) / 2)
+    {
+        DPRINT1("SetMetaFileBitsEx failed: %lu,%lu,0x&lx,%lu\n",
+                size, mh_in->mtType, mh_in->mtVersion, mh_in->mtHeaderSize);
+        SetLastError(ERROR_INVALID_DATA);
+        return 0;
+    }
+
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GdiIsPlayMetafileDC(HDC hDC)
+{
+    PLDC pLDC = GdiGetLDC(hDC);
+    if ( pLDC )
+    {
+        if ( pLDC->Flags & LDC_PLAY_MFDC ) return TRUE;
+    }
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+PlayMetaFile(
+    HDC                a0,
+    HMETAFILE  a1
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+PlayMetaFileRecord(
+    HDC                a0,
+    LPHANDLETABLE      a1,
+    LPMETARECORD       a2,
+    UINT               a3
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+EnumMetaFile(
+    HDC                        a0,
+    HMETAFILE          a1,
+    MFENUMPROC         a2,
+    LPARAM                     a3
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+UINT
+WINAPI
+GetWinMetaFileBits(
+    HENHMETAFILE       a0,
+    UINT               a1,
+    LPBYTE             a2,
+    INT                a3,
+    HDC                a4
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HENHMETAFILE
+WINAPI
+SetWinMetaFileBits(
+    UINT                       a0,
+    CONST BYTE         *a1,
+    HDC                        a2,
+    CONST METAFILEPICT *a3)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GdiIsMetaFileDC(HDC hDC)
+{
+    if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
+    {
+        if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
+            return TRUE;
+        else
+        {
+            PLDC pLDC = GdiGetLDC(hDC);
+            if ( !pLDC )
+            {
+                SetLastError(ERROR_INVALID_HANDLE);
+                return FALSE;
+            }
+            if ( pLDC->iType == LDC_EMFLDC) return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GdiIsMetaPrintDC(HDC hDC)
+{
+
+    if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
+    {
+        if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
+            return FALSE;
+        else
+        {
+            PLDC pLDC = GdiGetLDC(hDC);
+            if ( !pLDC )
+            {
+                SetLastError(ERROR_INVALID_HANDLE);
+                return FALSE;
+            }
+            if ( pLDC->Flags & LDC_META_PRINT) return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+METAFILEPICT *
+WINAPI
+GdiCreateLocalMetaFilePict(HENHMETAFILE hmo)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HANDLE
+WINAPI
+GdiConvertMetaFilePict(HGLOBAL hMem)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
index 169f436..24c7ecd 100644 (file)
@@ -709,6 +709,62 @@ FloodFill(
     return ExtFloodFill(hDC, nXStart, nYStart, crFill, FLOODFILLBORDER);
 }
 
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+BitBlt(
+    HDC hdcDest, /* handle to destination DC */
+    int nXOriginDest, /* x-coord of destination upper-left corner */
+    int nYOriginDest, /* y-coord of destination upper-left corner */
+    int nWidthDest, /* width of destination rectangle */
+    int nHeightDest, /* height of destination rectangle */
+    HDC hdcSrc, /* handle to source DC */
+    int nXSrc, /* x-coordinate of source upper-left corner */
+    int nYSrc, /* y-coordinate of source upper-left corner */
+    DWORD dwRop) /* raster operation code */
+{
+    /* use patBlt for no source blt  Like windows does */
+    if (!ROP_USES_SOURCE(dwRop))
+    {
+        return PatBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, dwRop);
+    }
+
+    return NtGdiBitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXSrc,
+        nYSrc, dwRop, 0, 0);
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+StretchBlt(
+    HDC hdcDest, /* handle to destination DC */
+    int nXOriginDest, /* x-coord of destination upper-left corner */
+    int nYOriginDest, /* y-coord of destination upper-left corner */
+    int nWidthDest, /* width of destination rectangle */
+    int nHeightDest, /* height of destination rectangle */
+    HDC hdcSrc, /* handle to source DC */
+    int nXOriginSrc, /* x-coord of source upper-left corner */
+    int nYOriginSrc, /* y-coord of source upper-left corner */
+    int nWidthSrc, /* width of source rectangle */
+    int nHeightSrc, /* height of source rectangle */
+    DWORD dwRop) /* raster operation code */
+
+{
+    if ((nWidthDest != nWidthSrc) || (nHeightDest != nHeightSrc))
+    {
+        return NtGdiStretchBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc,
+            nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, dwRop, 0);
+    }
+
+    return NtGdiBitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc,
+        nXOriginSrc, nYOriginSrc, dwRop, 0, 0);
+}
+
 
 /*
  * @implemented
@@ -773,3 +829,77 @@ PlgBlt(
                        yMask,
                        GetBkColor(hdcSrc));
 }
+
+BOOL
+WINAPI
+GdiAlphaBlend(
+    HDC hDCDst,
+    int DstX,
+    int DstY,
+    int DstCx,
+    int DstCy,
+    HDC hDCSrc,
+    int SrcX,
+    int SrcY,
+    int SrcCx,
+    int SrcCy,
+    BLENDFUNCTION BlendFunction)
+{
+    if ( hDCSrc == NULL ) return FALSE;
+
+    if (GDI_HANDLE_GET_TYPE(hDCSrc) == GDI_OBJECT_TYPE_METADC) return FALSE;
+
+    return NtGdiAlphaBlend(
+               hDCDst,
+               DstX,
+               DstY,
+               DstCx,
+               DstCy,
+               hDCSrc,
+               SrcX,
+               SrcY,
+               SrcCx,
+               SrcCy,
+               BlendFunction,
+               0 );
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GdiTransparentBlt(IN HDC hdcDst,
+                  IN INT xDst,
+                  IN INT yDst,
+                  IN INT cxDst,
+                  IN INT cyDst,
+                  IN HDC hdcSrc,
+                  IN INT xSrc,
+                  IN INT ySrc,
+                  IN INT cxSrc,
+                  IN INT cySrc,
+                  IN UINT TransColor
+                 )
+{
+    /* FIXME some part need be done in user mode */
+    return NtGdiTransparentBlt(hdcDst, xDst, yDst, cxDst, cyDst, hdcSrc, xSrc, ySrc, cxSrc, cySrc, (COLORREF)TransColor);
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GdiGradientFill(
+    IN HDC hdc,
+    IN PTRIVERTEX pVertex,
+    IN ULONG nVertex,
+    IN PVOID pMesh,
+    IN ULONG nMesh,
+    IN ULONG ulMode)
+{
+    /* FIXME some part need be done in user mode */
+    return NtGdiGradientFill(hdc, pVertex, nVertex, pMesh, nMesh, ulMode);
+}
index d8856e0..81202ef 100644 (file)
@@ -202,4 +202,16 @@ UpdateColors(
     return NtGdiUpdateColors(hdc);
 }
 
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+ColorCorrectPalette(HDC hDC,HPALETTE hPalette,DWORD dwFirstEntry,DWORD dwNumOfEntries)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
 /* EOF */
index d127664..067a427 100644 (file)
@@ -691,6 +691,17 @@ StartPage(
     return SP_ERROR;
 }
 
+/*
+ * @implemented
+ */
+int
+WINAPI
+StartFormPage(HDC hdc)
+{
+    return StartPage(hdc);
+}
+
+
 /*
  * @implemented
  */
@@ -731,3 +742,203 @@ SetAbortProc(
     return SP_ERROR;
 }
 
+/*
+ * @unimplemented
+ */
+DWORD
+WINAPI
+gdiPlaySpoolStream(
+    DWORD      a0,
+    DWORD      a1,
+    DWORD      a2,
+    DWORD      a3,
+    DWORD      a4,
+    DWORD      a5
+)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HDC
+WINAPI
+GdiGetDC(HANDLE SpoolFileHandle)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+HANDLE
+WINAPI
+GdiGetPageHandle(HANDLE SpoolFileHandle,
+                 DWORD Page,
+                 LPDWORD pdwPageType)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiStartDocEMF(HANDLE SpoolFileHandle,
+               DOCINFOW *pDocInfo)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiStartPageEMF(HANDLE SpoolFileHandle)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiPlayPageEMF(HANDLE SpoolFileHandle,
+               HANDLE hemf,
+               RECT *prectDocument,
+               RECT *prectBorder,
+               RECT *prectClip)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiEndPageEMF(HANDLE SpoolFileHandle,
+              DWORD dwOptimization)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiEndDocEMF(HANDLE SpoolFileHandle)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiGetDevmodeForPage(HANDLE SpoolFileHandle,
+                     DWORD dwPageNumber,
+                     PDEVMODEW *pCurrDM,
+                     PDEVMODEW *pLastDM)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiResetDCEMF(HANDLE SpoolFileHandle,
+              PDEVMODEW pCurrDM)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiPlayEMF(LPWSTR pwszPrinterName,
+           LPDEVMODEW pDevmode,
+           LPWSTR pwszDocName,
+           EMFPLAYPROC pfnEMFPlayFn,
+           HANDLE hPageQuery
+          )
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiPlayPrivatePageEMF(HANDLE SpoolFileHandle,
+                      DWORD unknown,
+                      RECT *prectDocument)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiPrinterThunk(
+    IN HUMPD humpd,
+    DWORD *status,
+    DWORD unuse)
+{
+    /* FIXME figout the protypes, the HUMPD are a STRUCT or COM object */
+    /* status contain some form of return value that being save, what it is I do not known */
+    /* unsue seam have zero effect, what it is for I do not known */
+
+    // ? return NtGdiSetPUMPDOBJ(humpd->0x10,TRUE, humpd, ?) <- blackbox, OpenRCE info, and api hooks for anylaysing;
+    return FALSE;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiArtificialDecrementDriver(LPWSTR pDriverName,BOOL unknown)
+{
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+}
index 68af7c6..e7b7b85 100644 (file)
@@ -49,6 +49,34 @@ TextOutW(
 }
 
 
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+PolyTextOutA( HDC hdc, const POLYTEXTA *pptxt, INT cStrings )
+{
+    for (; cStrings>0; cStrings--, pptxt++)
+        if (!ExtTextOutA( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
+            return FALSE;
+    return TRUE;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+PolyTextOutW( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
+{
+    for (; cStrings>0; cStrings--, pptxt++)
+        if (!ExtTextOutW( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
+            return FALSE;
+    return TRUE;
+}
+
+
 /*
  * @implemented
  */
@@ -205,6 +233,22 @@ GetTextExtentExPointW(
 }
 
 
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GetTextExtentExPointWPri(HDC hdc,
+                         LPWSTR lpwsz,
+                         ULONG cwc,
+                         ULONG dxMax,
+                         ULONG *pcCh,
+                         PULONG pdxOut,
+                         LPSIZE psize)
+{
+    return NtGdiGetTextExtentExW(hdc,lpwsz,cwc,dxMax,pcCh,pdxOut,psize,0);
+}
+
 /*
  * @implemented
  */
@@ -688,3 +732,75 @@ SetTextJustification(
         Dc_Attr->lBreakExtra = extra;
         return TRUE;
     }
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
+GetStringBitmapA(HDC hdc,
+                 LPSTR psz,
+                 BOOL DoCall,
+                 UINT cj,
+                 BYTE *lpSB)
+{
+
+    NTSTATUS Status;
+    PWSTR pwsz;
+    UINT retValue = 0;
+
+    if (DoCall)
+    {
+        Status = HEAP_strdupA2W ( &pwsz, psz );
+        if ( !NT_SUCCESS (Status) )
+        {
+            SetLastError (RtlNtStatusToDosError(Status));
+        }
+        else
+        {
+            retValue = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
+            HEAP_free ( pwsz );
+        }
+    }
+
+    return retValue;
+
+}
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
+GetStringBitmapW(HDC hdc,
+                 LPWSTR pwsz,
+                 BOOL doCall,
+                 UINT cj,
+                 BYTE *lpSB)
+{
+    UINT retValue = 0;
+
+    if (doCall)
+    {
+        retValue = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
+    }
+
+    return retValue;
+
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+GetETM(HDC hdc,
+       EXTTEXTMETRIC *petm)
+{
+    BOOL Ret = NtGdiGetETM(hdc, petm);
+
+    if (Ret && petm)
+        petm->emKernPairs = (WORD)GetKerningPairsA(hdc, 0, 0);
+
+    return Ret;
+}