- GdiIsPlayMetafileDC: function GdiGetHandleUserData might fail
[reactos.git] / reactos / dll / win32 / gdi32 / misc / stubs.c
index c0150bd..a826faf 100644 (file)
 
 #define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__);
 
+
 /*
  * @unimplemented
  */
 BOOL
-STDCALL
-CancelDC(
-       HDC     a0
-       )
+WINAPI
+PtInRegion(IN HRGN hrgn,
+           int x,
+           int y)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
+    /* FIXME some stuff at user mode need be fixed */
+    return NtGdiPtInRegion(hrgn,x,y);
 }
-  
 
 /*
  * @unimplemented
  */
-int
-STDCALL
-DrawEscape(
-       HDC             a0,
-       int             a1,
-       int             a2,
-       LPCSTR          a3
-       )
+BOOL
+WINAPI
+RectInRegion(HRGN hrgn,
+             LPCRECT prcl)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    /* FIXME some stuff at user mode need be fixed */
+    return NtGdiRectInRegion(hrgn, (LPRECT) prcl);
 }
 
-
 /*
  * @unimplemented
  */
-int
-STDCALL
-EnumObjects(
-       HDC             a0,
-       int             a1,
-       GOBJENUMPROC    a2,
-       LPARAM          a3
-       )
+BOOL
+WINAPI
+RestoreDC(IN HDC hdc,
+          IN INT iLevel)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    /* FIXME Sharememory */
+    return NtGdiRestoreDC(hdc, iLevel);
 }
 
 /*
  * @unimplemented
  */
-int
-STDCALL
-Escape(HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out_data)
+INT
+WINAPI
+SaveDC(IN HDC hdc)
 {
-        UNIMPLEMENTED;
-        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-        return 0;
+    /* FIXME Sharememory */
+    return NtGdiSaveDC(hdc);
 }
 
-/*
- * @unimplemented
- */
-HRGN
-STDCALL
-ExtCreateRegion(
-       CONST XFORM *   a0,
-       DWORD           a1,
-       CONST RGNDATA * a2
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
 
 
 /*
- * @implemented
+ * @unimplemented
  */
-UINT
-STDCALL
-GetBoundsRect(
-       HDC     hdc,
-       LPRECT  lprcBounds,
-       UINT    flags
-       )
+BOOL
+WINAPI
+CancelDC(HDC hdc)
 {
-    return NtGdiGetBoundsRect(hdc,lprcBounds,flags & DCB_RESET);
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
 }
 
 
 /*
- * @implemented
+ * @unimplemented
  */
 int
-STDCALL
-GetMetaRgn(HDC hdc,
-           HRGN hrgn)
+WINAPI
+DrawEscape(HDC  hdc,
+           int a1,
+           int a2,
+           LPCSTR a3)
 {
-    return NtGdiGetRandomRgn(hdc,hrgn,2);
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 
 /*
  * @unimplemented
  */
-UINT
-STDCALL
-GetMetaFileBitsEx(
-       HMETAFILE       a0,
-       UINT            a1,
-       LPVOID          a2
-       )
+int
+WINAPI
+EnumObjects(HDC hdc,
+            int a1,
+            GOBJENUMPROC a2,
+            LPARAM a3)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GetRasterizerCaps(
-       LPRASTERIZER_STATUS     a0,
-       UINT                    a1
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
-}
 
 /*
- * @unimplemented
+ * @implemented
  */
 UINT
-STDCALL
-GetSystemPaletteUse(HDC hDc)
+WINAPI
+GetBoundsRect(
+       HDC     hdc,
+       LPRECT  lprcBounds,
+       UINT    flags
+       )
 {
-    return NtGdiGetSystemPaletteUse(hDc);
+    return NtGdiGetBoundsRect(hdc,lprcBounds,flags & DCB_RESET);
 }
 
 
 /*
  * @unimplemented
  */
-DWORD
-STDCALL
-GetFontLanguageInfo(
-       HDC     hDc
+UINT
+WINAPI
+GetMetaFileBitsEx(
+       HMETAFILE       a0,
+       UINT            a1,
+       LPVOID          a2
        )
 {
        UNIMPLEMENTED;
@@ -183,12 +148,11 @@ GetFontLanguageInfo(
        return 0;
 }
 
-
 /*
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 PlayMetaFile(
        HDC             a0,
        HMETAFILE       a1
@@ -199,76 +163,24 @@ PlayMetaFile(
        return FALSE;
 }
 
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-ResizePalette(
-       HPALETTE        a0,
-       UINT            a1
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-int
-STDCALL
-SetMetaRgn(
-       HDC     hdc
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-
 /*
- * @unimplemented
+ * @implemented
  */
 UINT
-STDCALL
-SetBoundsRect(
-       HDC             a0,
-       CONST RECT      *a1,
-       UINT            a2
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-
-/*
- * @unimplemented
- */
-DWORD
-STDCALL
-SetMapperFlags(
-       HDC     a0,
-       DWORD   a1
-       )
+WINAPI
+SetBoundsRect(HDC hdc,
+              CONST RECT *prc,
+              UINT flags)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    /* FIXME add check for validate the flags */
+    return NtGdiSetBoundsRect(hdc, (LPRECT)prc, flags);
 }
 
-
 /*
  * @unimplemented
  */
 HMETAFILE
-STDCALL
+WINAPI
 SetMetaFileBitsEx(
        UINT            a0,
        CONST BYTE      *a1
@@ -279,60 +191,11 @@ SetMetaFileBitsEx(
        return 0;
 }
 
-
-/*
- * @unimplemented
- */
-UINT
-STDCALL
-SetSystemPaletteUse(
-       HDC     a0,
-       UINT    a1
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-SetTextJustification(
-       HDC     a0,
-       int     a1,
-       int     a2
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-UpdateColors(
-       HDC     hdc
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
-}
-
-
 /*
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 PlayMetaFileRecord(
        HDC             a0,
        LPHANDLETABLE   a1,
@@ -350,7 +213,7 @@ PlayMetaFileRecord(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 EnumMetaFile(
        HDC                     a0,
        HMETAFILE               a1,
@@ -363,15 +226,11 @@ EnumMetaFile(
        return FALSE;
 }
 
-
-
-
-
 /*
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 DeleteEnhMetaFile(
        HENHMETAFILE    a0
        )
@@ -381,12 +240,11 @@ DeleteEnhMetaFile(
        return FALSE;
 }
 
-
 /*
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 EnumEnhMetaFile(
        HDC             a0,
        HENHMETAFILE    a1,
@@ -400,12 +258,11 @@ EnumEnhMetaFile(
        return FALSE;
 }
 
-
 /*
  * @unimplemented
  */
 UINT
-STDCALL
+WINAPI
 GetEnhMetaFileBits(
        HENHMETAFILE    a0,
        UINT            a1,
@@ -422,7 +279,7 @@ GetEnhMetaFileBits(
  * @unimplemented
  */
 UINT
-STDCALL
+WINAPI
 GetEnhMetaFileHeader(
        HENHMETAFILE    a0,
        UINT            a1,
@@ -434,12 +291,11 @@ GetEnhMetaFileHeader(
        return 0;
 }
 
-
 /*
  * @unimplemented
  */
 UINT
-STDCALL
+WINAPI
 GetEnhMetaFilePaletteEntries(
        HENHMETAFILE    a0,
        UINT            a1,
@@ -451,12 +307,11 @@ GetEnhMetaFilePaletteEntries(
        return 0;
 }
 
-
 /*
  * @unimplemented
  */
 UINT
-STDCALL
+WINAPI
 GetWinMetaFileBits(
        HENHMETAFILE    a0,
        UINT            a1,
@@ -475,7 +330,7 @@ GetWinMetaFileBits(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 PlayEnhMetaFile(
        HDC             a0,
        HENHMETAFILE    a1,
@@ -492,7 +347,7 @@ PlayEnhMetaFile(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 PlayEnhMetaFileRecord(
        HDC                     a0,
        LPHANDLETABLE           a1,
@@ -510,7 +365,7 @@ PlayEnhMetaFileRecord(
  * @unimplemented
  */
 HENHMETAFILE
-STDCALL
+WINAPI
 SetEnhMetaFileBits(
        UINT            a0,
        CONST BYTE      *a1
@@ -526,7 +381,7 @@ SetEnhMetaFileBits(
  * @unimplemented
  */
 HENHMETAFILE
-STDCALL
+WINAPI
 SetWinMetaFileBits(
        UINT                    a0,
        CONST BYTE              *a1,
@@ -543,7 +398,7 @@ SetWinMetaFileBits(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 GdiComment(
        HDC             hDC,
        UINT            bytes,
@@ -573,27 +428,7 @@ GdiComment(
  * @unimplemented
  */
 BOOL
-STDCALL
-AngleArc(
-       HDC     hdc,
-       int     a1,
-       int     a2,
-       DWORD   a3,
-       FLOAT   a4,
-       FLOAT   a5
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
-}
-
-
-/*
- * @unimplemented 
- */
-BOOL
-STDCALL
+WINAPI
 SetColorAdjustment(
        HDC                     hdc,
        CONST COLORADJUSTMENT   *a1
@@ -604,15 +439,11 @@ SetColorAdjustment(
        return FALSE;
 }
 
-
-
-
-
 /*
  * @unimplemented
  */
 int
-STDCALL
+WINAPI
 EndDoc(
        HDC     hdc
        )
@@ -627,7 +458,7 @@ EndDoc(
  * @unimplemented
  */
 int
-STDCALL
+WINAPI
 StartPage(
        HDC     hdc
        )
@@ -642,7 +473,7 @@ StartPage(
  * @unimplemented
  */
 int
-STDCALL
+WINAPI
 EndPage(
        HDC     hdc
        )
@@ -657,7 +488,7 @@ EndPage(
  * @unimplemented
  */
 int
-STDCALL
+WINAPI
 AbortDoc(
        HDC     hdc
        )
@@ -672,68 +503,43 @@ AbortDoc(
  * @unimplemented
  */
 int
-STDCALL
+WINAPI
 SetAbortProc(
-       HDC             hdc,
-       ABORTPROC       a1
-       )
+       HDC hdc,
+       ABORTPROC lpAbortProc)
 {
        UNIMPLEMENTED;
        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
        return 0;
 }
 
-
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL
-STDCALL
-ScaleViewportExtEx(
-       HDC     a0,
-       int     a1,
-       int     a2,
-       int     a3,
-       int     a4,
-       LPSIZE  a5
-       )
+WINAPI
+UnrealizeObject(HGDIOBJ  hgdiobj)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
-}
-
-
+    BOOL retValue = TRUE;
 /*
- * @unimplemented
- */
-BOOL
-STDCALL
-ScaleWindowExtEx(
-       HDC     a0,
-       int     a1,
-       int     a2,
-       int     a3,
-       int     a4,
-       LPSIZE  a5
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
-}
-
+   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);
+ */
 /*
- * @implemented
+    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."
  */
-BOOL
-STDCALL
-UnrealizeObject(
-       HGDIOBJ a0
-       )
-{
-       return NtGdiUnrealizeObject(a0);
+    if (GDI_HANDLE_GET_TYPE(hgdiobj) != GDI_OBJECT_TYPE_BRUSH)
+    {
+        retValue = NtGdiUnrealizeObject(hgdiobj);
+    }
+
+    return retValue;
 }
 
 
@@ -741,7 +547,7 @@ UnrealizeObject(
  * @implemented
  */
 BOOL
-STDCALL
+WINAPI
 GdiFlush()
 {
     NtGdiFlush();
@@ -753,7 +559,7 @@ GdiFlush()
  * @unimplemented
  */
 int
-STDCALL
+WINAPI
 SetICMMode(
        HDC     a0,
        int     a1
@@ -769,7 +575,7 @@ SetICMMode(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 CheckColorsInGamut(
        HDC     a0,
        LPVOID  a1,
@@ -783,41 +589,11 @@ CheckColorsInGamut(
 }
 
 
-/*
- * @unimplemented
- */
-HCOLORSPACE
-STDCALL
-GetColorSpace(
-       HDC     hDc
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-
-/*
- * @unimplemented
- */
-HCOLORSPACE
-STDCALL
-SetColorSpace(
-       HDC             a0,
-       HCOLORSPACE     a1
-       )
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
-}
-
 /*
  * @implemented
  */
 BOOL
-STDCALL
+WINAPI
 GetDeviceGammaRamp( HDC hdc,
                     LPVOID lpGammaRamp)
 {
@@ -834,24 +610,26 @@ GetDeviceGammaRamp( HDC hdc,
     return retValue;
 }
 
-
-    
-
-
-
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL
-STDCALL
-SetDeviceGammaRamp(
-       HDC     a0,
-       LPVOID  a1
-       )
+WINAPI
+SetDeviceGammaRamp(HDC hdc,
+                   LPVOID lpGammaRamp)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return FALSE;
+    BOOL retValue = FALSE;
+
+    if (lpGammaRamp)
+    {
+        retValue = NtGdiSetDeviceGammaRamp(hdc, lpGammaRamp);
+    }
+    else
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+    }
+
+    return  retValue;
 }
 
 
@@ -859,7 +637,7 @@ SetDeviceGammaRamp(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 ColorMatchToTarget(
        HDC     a0,
        HDC     a1,
@@ -876,7 +654,7 @@ ColorMatchToTarget(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 wglCopyContext(
        HGLRC   a0,
        HGLRC   a1,
@@ -893,7 +671,7 @@ wglCopyContext(
  * @unimplemented
  */
 HGLRC
-STDCALL
+WINAPI
 wglCreateContext(
        HDC     hDc
        )
@@ -908,7 +686,7 @@ wglCreateContext(
  * @unimplemented
  */
 HGLRC
-STDCALL
+WINAPI
 wglCreateLayerContext(
        HDC     hDc,
        int     a1
@@ -924,7 +702,7 @@ wglCreateLayerContext(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 wglDeleteContext(
        HGLRC   a
        )
@@ -939,7 +717,7 @@ wglDeleteContext(
  * @unimplemented
  */
 HGLRC
-STDCALL
+WINAPI
 wglGetCurrentContext(VOID)
 {
        UNIMPLEMENTED;
@@ -952,7 +730,7 @@ wglGetCurrentContext(VOID)
  * @unimplemented
  */
 HDC
-STDCALL
+WINAPI
 wglGetCurrentDC(VOID)
 {
        UNIMPLEMENTED;
@@ -965,7 +743,7 @@ wglGetCurrentDC(VOID)
  * @unimplemented
  */
 PROC
-STDCALL
+WINAPI
 wglGetProcAddress(
        LPCSTR          a0
        )
@@ -980,7 +758,7 @@ wglGetProcAddress(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 wglMakeCurrent(
        HDC     a0,
        HGLRC   a1
@@ -996,7 +774,7 @@ wglMakeCurrent(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 wglShareLists(
        HGLRC   a0,
        HGLRC   a1
@@ -1012,7 +790,7 @@ wglShareLists(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 wglDescribeLayerPlane(
        HDC                     a0,
        int                     a1,
@@ -1031,7 +809,7 @@ wglDescribeLayerPlane(
  * @unimplemented
  */
 int
-STDCALL
+WINAPI
 wglSetLayerPaletteEntries(
        HDC             a0,
        int             a1,
@@ -1050,7 +828,7 @@ wglSetLayerPaletteEntries(
  * @unimplemented
  */
 int
-STDCALL
+WINAPI
 wglGetLayerPaletteEntries(
        HDC             a0,
        int             a1,
@@ -1069,7 +847,7 @@ wglGetLayerPaletteEntries(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 wglRealizeLayerPalette(
        HDC             a0,
        int             a1,
@@ -1086,7 +864,7 @@ wglRealizeLayerPalette(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 wglSwapLayerBuffers(
        HDC             a0,
        UINT            a1
@@ -1103,45 +881,12 @@ wglSwapLayerBuffers(
  * === WHERE ARE THEY DEFINED? =============
  */
 
-
-
-
-
-
-
-
-
-
-
-/*
- * @unimplemented
- */
-DWORD
-STDCALL
-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
-STDCALL
-SelectBrushLocal(
+WINAPI
+IsValidEnhMetaRecord(
        DWORD   a0,
        DWORD   a1
        )
@@ -1149,32 +894,40 @@ SelectBrushLocal(
        UNIMPLEMENTED;
        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
        return 0;
-}
 
+}
 
 /*
  * @unimplemented
  */
 DWORD
-STDCALL
-SelectFontLocal(
+WINAPI
+IsValidEnhMetaRecordOffExt(
        DWORD   a0,
-       DWORD   a1
+       DWORD   a1,
+       DWORD   a2,
+       DWORD   a3
        )
 {
        UNIMPLEMENTED;
        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
        return 0;
-}
 
+}
 
 /*
  * @unimplemented
  */
 DWORD
-STDCALL
-SetFontEnumeration(
-       DWORD   a0
+WINAPI
+GetGlyphOutlineWow(
+       DWORD   a0,
+       DWORD   a1,
+       DWORD   a2,
+       DWORD   a3,
+       DWORD   a4,
+       DWORD   a5,
+       DWORD   a6
        )
 {
        UNIMPLEMENTED;
@@ -1182,12 +935,11 @@ SetFontEnumeration(
        return 0;
 }
 
-
 /*
  * @unimplemented
  */
 DWORD
-STDCALL
+WINAPI
 gdiPlaySpoolStream(
        DWORD   a0,
        DWORD   a1,
@@ -1203,10 +955,10 @@ gdiPlaySpoolStream(
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
-HANDLE 
-STDCALL 
+HANDLE
+WINAPI
 AddFontMemResourceEx(
        PVOID pbFont,
        DWORD cbFont,
@@ -1214,16 +966,19 @@ AddFontMemResourceEx(
        DWORD *pcFonts
 )
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+  if ( pbFont && cbFont && pcFonts)
+  {
+     return NtGdiAddFontMemResourceEx(pbFont, cbFont, NULL, 0, pcFonts);
+  }
+  SetLastError(ERROR_INVALID_PARAMETER);
+  return NULL;
 }
 
 /*
  * @unimplemented
  */
-int 
-STDCALL 
+int
+WINAPI
 AddFontResourceTracking(
        LPCSTR lpString,
        int unknown
@@ -1239,8 +994,8 @@ AddFontResourceTracking(
 /*
  * @unimplemented
  */
-HBITMAP 
-STDCALL
+HBITMAP
+WINAPI
 ClearBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
 {
        UNIMPLEMENTED;
@@ -1251,8 +1006,8 @@ ClearBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
 /*
  * @unimplemented
  */
-HBRUSH 
-STDCALL
+HBRUSH
+WINAPI
 ClearBrushAttributes(HBRUSH hbm, DWORD dwFlags)
 {
        UNIMPLEMENTED;
@@ -1263,8 +1018,8 @@ ClearBrushAttributes(HBRUSH hbm, DWORD dwFlags)
 /*
  * @unimplemented
  */
-BOOL 
-STDCALL
+BOOL
+WINAPI
 ColorCorrectPalette(HDC hDC,HPALETTE hPalette,DWORD dwFirstEntry,DWORD dwNumOfEntries)
 {
        UNIMPLEMENTED;
@@ -1276,7 +1031,7 @@ ColorCorrectPalette(HDC hDC,HPALETTE hPalette,DWORD dwFirstEntry,DWORD dwNumOfEn
  * @unimplemented
  */
 int
-STDCALL
+WINAPI
 EndFormPage(HDC hdc)
 {
        UNIMPLEMENTED;
@@ -1284,25 +1039,11 @@ EndFormPage(HDC hdc)
        return 0;
 }
 
-
-
-/*
- * @unimplemented
- */
-DWORD 
-STDCALL
-GdiAddGlsBounds(HDC hdc,LPRECT prc)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
 /*
  * @unimplemented
  */
-BOOL 
-STDCALL
+BOOL
+WINAPI
 GdiArtificialDecrementDriver(LPWSTR pDriverName,BOOL unknown)
 {
        UNIMPLEMENTED;
@@ -1314,7 +1055,7 @@ GdiArtificialDecrementDriver(LPWSTR pDriverName,BOOL unknown)
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 GdiCleanCacheDC(HDC hdc)
 {
        UNIMPLEMENTED;
@@ -1326,7 +1067,7 @@ GdiCleanCacheDC(HDC hdc)
  * @unimplemented
  */
 HDC
-STDCALL
+WINAPI
 GdiConvertAndCheckDC(HDC hdc)
 {
        UNIMPLEMENTED;
@@ -1337,190 +1078,134 @@ GdiConvertAndCheckDC(HDC hdc)
 /*
  * @unimplemented
  */
-HENHMETAFILE 
-STDCALL
+HENHMETAFILE
+WINAPI
 GdiConvertEnhMetaFile(HENHMETAFILE hmf)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 GdiDrawStream(HDC dc, ULONG l, VOID *v)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-DWORD 
-STDCALL
-GdiGetCodePage(HDC hdc)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-HBRUSH 
-STDCALL
-GdiGetLocalBrush(HBRUSH hbr)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-HDC 
-STDCALL
-GdiGetLocalDC(HDC hdc)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-HFONT 
-STDCALL
-GdiGetLocalFont(HFONT hfont)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL
-STDCALL
-GdiIsMetaFileDC(HDC hdc)
+WINAPI
+GdiIsMetaFileDC(HDC hDC)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+  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;
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL
-STDCALL
-GdiIsMetaPrintDC(HDC hdc)
+WINAPI
+GdiIsMetaPrintDC(HDC hDC)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+
+  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
+ * @implemented
  */
 BOOL
-STDCALL
-GdiIsPlayMetafileDC(HDC hdc)
+WINAPI
+GdiIsPlayMetafileDC(HDC hDC)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+  PLDC pLDC = GdiGetLDC(hDC);
+  if ( pLDC )
+  {
+     if ( pLDC->Flags & LDC_PLAY_MFDC ) return TRUE;
+  }
+  return FALSE;
 }
 
 /*
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 GdiValidateHandle(HGDIOBJ hobj)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-DWORD 
-STDCALL
+DWORD
+WINAPI
 GetBitmapAttributes(HBITMAP hbm)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-DWORD 
-STDCALL
+DWORD
+WINAPI
 GetBrushAttributes(HBRUSH hbr)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL 
-STDCALL
-GetCharABCWidthsI(
-       HDC hdc,
-       UINT giFirst,
-       UINT cgi,
-       LPWORD pgi,
-       LPABC lpabc
-)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL 
-STDCALL
-GetCharWidthI(
-       HDC hdc,
-       UINT giFirst,
-       UINT cgi,
-       LPWORD pgi,
-       LPINT lpBuffer
-)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
-
-
 /*
  * @implemented
  */
-ULONG 
-STDCALL
+ULONG
+WINAPI
 GetEUDCTimeStamp(VOID)
 {
     return NtGdiGetEudcTimeStampEx(NULL,0,TRUE);
@@ -1529,8 +1214,8 @@ GetEUDCTimeStamp(VOID)
 /*
  * @implemented
  */
-ULONG 
-STDCALL
+ULONG
+WINAPI
 GetFontAssocStatus(HDC hdc)
 {
     ULONG retValue = 0;
@@ -1544,49 +1229,54 @@ GetFontAssocStatus(HDC hdc)
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
-HFONT 
-STDCALL
-GetHFONT(HDC dc)
+BOOL
+WINAPI
+GetTextExtentExPointWPri(HDC hdc,
+                         LPWSTR lpwsz,
+                         ULONG cwc,
+                         ULONG dxMax,
+                         ULONG *pcCh,
+                         PULONG pdxOut,
+                         LPSIZE psize)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    return NtGdiGetTextExtentExW(hdc,lpwsz,cwc,dxMax,pcCh,pdxOut,psize,0);
 }
 
 /*
  * @unimplemented
  */
-DWORD 
-STDCALL
-GetLayout(
-       HDC hdc
-)
+DWORD
+WINAPI
+QueryFontAssocStatus(VOID)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL
-STDCALL
-GetTextExtentExPointWPri(HDC hdc,LPWSTR lpwsz,ULONG cwc,ULONG dxMax,ULONG *pcCh,PULONG pdxOut,LPSIZE psize)
+WINAPI
+RemoveFontMemResourceEx(HANDLE fh)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+  if (fh)
+  {
+     return NtGdiRemoveFontMemResourceEx(fh);
+  }
+  SetLastError(ERROR_INVALID_PARAMETER);
+  return FALSE;
 }
 
 /*
  * @unimplemented
  */
-int 
-STDCALL
-GetTextFaceAliasW(HDC hdc,int cChar,LPWSTR pszOut)
+int
+WINAPI
+RemoveFontResourceTracking(LPCSTR lpString,int unknown)
 {
        UNIMPLEMENTED;
        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
@@ -1596,9 +1286,9 @@ GetTextFaceAliasW(HDC hdc,int cChar,LPWSTR pszOut)
 /*
  * @unimplemented
  */
-LONG 
-STDCALL
-HT_Get8BPPFormatPalette(LPPALETTEENTRY pPaletteEntry, USHORT RedGamma,USHORT GreenGamma, USHORT BlueGamma)
+HBITMAP
+WINAPI
+SetBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
 {
        UNIMPLEMENTED;
        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
@@ -1608,9 +1298,9 @@ HT_Get8BPPFormatPalette(LPPALETTEENTRY pPaletteEntry, USHORT RedGamma,USHORT Gre
 /*
  * @unimplemented
  */
-LONG 
-STDCALL
-HT_Get8BPPMaskPalette(LPPALETTEENTRY pPaletteEntry, BOOL Use8BPPMaskPal,BYTE CMYMask, USHORT RedGamma, USHORT GreenGamma, USHORT BlueGamma)
+HBRUSH
+WINAPI
+SetBrushAttributes(HBRUSH hbm, DWORD dwFlags)
 {
        UNIMPLEMENTED;
        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
@@ -1618,835 +1308,549 @@ HT_Get8BPPMaskPalette(LPPALETTEENTRY pPaletteEntry, BOOL Use8BPPMaskPal,BYTE CMY
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
-BOOL 
-STDCALL
-MirrorRgn(HWND hwnd,HRGN hrgn)
+int
+WINAPI
+StartFormPage(HDC hdc)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    return StartPage(hdc);
 }
 
 /*
  * @unimplemented
  */
-int 
-STDCALL
-NamedEscape(HDC hdc,PWCHAR pDriver,int nDriver,int iEsc,int cjIn,LPSTR pjIn,int cjOut,LPSTR pjOut)
+VOID
+WINAPI
+UnloadNetworkFonts(DWORD unknown)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
 }
 
 /*
  * @unimplemented
  */
-DWORD 
-STDCALL
-QueryFontAssocStatus(VOID)
+BOOL
+WINAPI
+GdiRealizationInfo(HDC hdc,
+                   PREALIZATION_INFO pri)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    // ATM we do not support local font data and Language Pack.
+    return NtGdiGetRealizationInfo(hdc, pri, (HFONT) NULL);
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
-BOOL 
-STDCALL
-RemoveFontMemResourceEx(
-       HANDLE fh
-)
+BOOL
+WINAPI
+GetETM(HDC hdc,
+       EXTTEXTMETRIC *petm)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+  BOOL Ret = NtGdiGetETM(hdc, petm);
+
+  if (Ret && petm)
+    petm->emKernPairs = GetKerningPairsA(hdc, 0, 0);
+
+  return Ret;
 }
 
 /*
  * @unimplemented
  */
-int 
-STDCALL
-RemoveFontResourceTracking(LPCSTR lpString,int unknown)
+int
+WINAPI
+Escape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpvInData, LPVOID lpvOutData)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
+    int retValue = SP_ERROR;    
+    HGDIOBJ hObject = hdc;
+    UINT Type = 0;
+    LPVOID pUserData = NULL;
 
-/*
- * @unimplemented
- */
-HBITMAP 
-STDCALL
-SetBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
+    Type = GDI_HANDLE_GET_TYPE(hObject);
 
-/*
- * @unimplemented
- */
-HBRUSH 
-STDCALL
-SetBrushAttributes(HBRUSH hbm, DWORD dwFlags)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-DWORD 
-STDCALL
-SetLayout(
-       HDC hdc,
-       DWORD dwLayout
-)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-DWORD 
-STDCALL
-SetLayoutWidth(HDC hdc,LONG wox,DWORD dwLayout)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL 
-STDCALL
-SetMagicColors(HDC hdc,PALETTEENTRY peMagic,ULONG Index)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-SetVirtualResolution(HDC hdc, int cxVirtualDevicePixel,int cyVirtualDevicePixel,int cxVirtualDeviceMm, int cyVirtualDeviceMm)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-int 
-STDCALL
-StartFormPage(HDC hdc)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-VOID 
-STDCALL
-UnloadNetworkFonts(DWORD unknown)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-}
-
-/*
- * @unimplemented
- */
-BOOL 
-STDCALL
-GetTextExtentExPointI(
-       HDC hdc,
-       LPWORD pgiIn,
-       int cgi,
-       int nMaxExtent,
-       LPINT lpnFit,
-       LPINT alpDx,
-       LPSIZE lpSize
-)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL 
-STDCALL
-GetTextExtentPointI(
-       HDC hdc,
-       LPWORD pgiIn,
-       int cgi,
-       LPSIZE lpSize
-)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-
-
-
-
-/*
- * @unimplemented
- */
-BOOL 
-STDCALL
-GdiRealizationInfo(HDC hdc, PREALIZATION_INFO pri)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-
-
-/*
- * @unimplemented
- */
-BOOL 
-STDCALL
-GetETM(HDC hdc,EXTTEXTMETRIC *petm)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GdiAddGlsRecord(HDC hdc,DWORD unknown1,LPCSTR unknown2,LPRECT unknown3)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-HANDLE
-STDCALL
-GdiConvertMetaFilePict(HGLOBAL hMem)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @implemented
- */
-DEVMODEW *
-STDCALL
-GdiConvertToDevmodeW(DEVMODEA *dm)
-{
-  LPDEVMODEW dmw;
-  
-  dmw = HEAP_alloc(sizeof(DEVMODEW));
-#define COPYS(f,len) MultiByteToWideChar ( CP_THREAD_ACP, 0, (LPSTR)dm->f, len, dmw->f, len )
-#define COPYN(f) dmw->f = dm->f
-  COPYS(dmDeviceName, CCHDEVICENAME );
-  COPYN(dmSpecVersion);
-  COPYN(dmDriverVersion);
-  switch ( dm->dmSize )
+    if (Type == GDI_OBJECT_TYPE_METADC)
+    {
+        /* FIXME we do not support metafile */
+        UNIMPLEMENTED;
+        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    }
+    else
     {
-    case SIZEOF_DEVMODEA_300:
-      dmw->dmSize = SIZEOF_DEVMODEW_300;
-      break;
-    case SIZEOF_DEVMODEA_400:
-      dmw->dmSize = SIZEOF_DEVMODEW_400;
-      break;
-    case SIZEOF_DEVMODEA_500:
-    default: /* FIXME what to do??? */
-      dmw->dmSize = SIZEOF_DEVMODEW_500;
-      break;
+        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);                
+        }
     }
-  COPYN(dmDriverExtra);
-  COPYN(dmFields);
-  COPYN(dmPosition.x);
-  COPYN(dmPosition.y);
-  COPYN(dmScale);
-  COPYN(dmCopies);
-  COPYN(dmDefaultSource);
-  COPYN(dmPrintQuality);
-  COPYN(dmColor);
-  COPYN(dmDuplex);
-  COPYN(dmYResolution);
-  COPYN(dmTTOption);
-  COPYN(dmCollate);
-  COPYS(dmFormName,CCHFORMNAME);
-  COPYN(dmLogPixels);
-  COPYN(dmBitsPerPel);
-  COPYN(dmPelsWidth);
-  COPYN(dmPelsHeight);
-  COPYN(dmDisplayFlags); // aka dmNup
-  COPYN(dmDisplayFrequency);
-
-  if ( dm->dmSize <= SIZEOF_DEVMODEA_300 )
-    return dmw; // we're done with 0x300 fields
-
-  COPYN(dmICMMethod);
-  COPYN(dmICMIntent);
-  COPYN(dmMediaType);
-  COPYN(dmDitherType);
-  COPYN(dmReserved1);
-  COPYN(dmReserved2);
-
-  if ( dm->dmSize <= SIZEOF_DEVMODEA_400 )
-    return dmw; // we're done with 0x400 fields
-
-  COPYN(dmPanningWidth);
-  COPYN(dmPanningHeight);
-
-  return dmw;
-
-#undef COPYN
-#undef COPYS
-}
-
-/*
- * @unimplemented
- */
-HENHMETAFILE
-STDCALL
-GdiCreateLocalEnhMetaFile(HENHMETAFILE hmo)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-METAFILEPICT *
-STDCALL
-GdiCreateLocalMetaFilePict(HENHMETAFILE hmo)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-
-/*
- * @unimplemented
- */
-HANDLE 
-STDCALL
-GdiGetSpoolFileHandle(
-       LPWSTR          pwszPrinterName,
-       LPDEVMODEW      pDevmode,
-       LPWSTR          pwszDocName)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GdiDeleteSpoolFileHandle(
-       HANDLE  SpoolFileHandle)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-DWORD 
-STDCALL
-GdiGetPageCount(
-       HANDLE  SpoolFileHandle)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-HDC
-STDCALL
-GdiGetDC(
-       HANDLE  SpoolFileHandle)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-HANDLE 
-STDCALL
-GdiGetPageHandle(
-       HANDLE  SpoolFileHandle,
-       DWORD   Page,
-       LPDWORD pdwPageType)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GdiStartDocEMF(
-       HANDLE          SpoolFileHandle,
-       DOCINFOW        *pDocInfo)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GdiStartPageEMF(
-       HANDLE  SpoolFileHandle)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GdiPlayPageEMF(
-       HANDLE  SpoolFileHandle,
-       HANDLE  hemf,
-       RECT    *prectDocument,
-       RECT    *prectBorder,
-       RECT    *prectClip)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GdiEndPageEMF(
-       HANDLE  SpoolFileHandle,
-       DWORD   dwOptimization)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GdiEndDocEMF(
-       HANDLE  SpoolFileHandle)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GdiGetDevmodeForPage(
-       HANDLE          SpoolFileHandle,
-       DWORD           dwPageNumber,
-       PDEVMODEW       *pCurrDM,
-       PDEVMODEW       *pLastDM)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GdiResetDCEMF(
-       HANDLE          SpoolFileHandle,
-       PDEVMODEW       pCurrDM)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    
+    return retValue;
 }
 
-
-HBITMAP 
-STDCALL 
-CreateDIBitmap(HDC
-       hDc, const BITMAPINFOHEADER *Header,
-       DWORD Init, LPCVOID Bits, const BITMAPINFO *Data,
-       UINT ColorUse)
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+GdiAddGlsRecord(HDC hdc,
+                DWORD unknown1,
+                LPCSTR unknown2,
+                LPRECT unknown3)
 {
-       /* FIMXE we need do more thing in user mode */
-       return NtGdiCreateDIBitmap(hDc, Header, Init, Bits, Data,  ColorUse);
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-INT
-STDCALL
-CombineRgn(HRGN  hDest,
-                    HRGN  hSrc1,
-                    HRGN  hSrc2,
-                    INT  CombineMode)
+HANDLE
+WINAPI
+GdiConvertMetaFilePict(HGLOBAL hMem)
 {
-    /* FIXME some part should be done in user mode */
-    return NtGdiCombineRgn(hDest, hSrc1, hSrc2, CombineMode); 
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
-HBITMAP STDCALL
-CreateBitmap(
-    INT  Width,
-    INT  Height,
-    UINT  Planes,
-    UINT  BitsPixel,
-    PCVOID pUnsafeBits)
+DEVMODEW *
+WINAPI
+GdiConvertToDevmodeW(DEVMODEA *dmA)
 {
-    /* FIXME some part should be done in user mode */
-    return NtGdiCreateBitmap(Width, Height, Planes, BitsPixel, (LPBYTE) pUnsafeBits);
-}
+    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);
 
-/*
- * @unimplemented
- */
-LPWSTR STDCALL
-EngGetDriverName(HDEV hdev)
-{
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
+    dmW_size = dmA_size + CCHDEVICENAME;
+    if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
+        dmW_size += CCHFORMNAME;
 
-/*
- * @unimplemented
- * wrong info it is not Obsolete GDI Function as http://www.osronline.com/DDKx/graphics/gdioview_20tj.htm say
- */
-BOOL STDCALL
-EngQueryEMFInfo(HDEV hdev,EMFINFO *pEMFInfo)
-{
-#if 0
-    BOOL retValue = FALSE;
-    DHPDEV Dhpdev;
+    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 ((!hdev) && (!pEMFInfo))
+    if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
     {
-        if ((Dhpdev = NtGdiGetDhpdev(hdev)))
-        {
-            /* FIXME check if it support or if it is pEMFInfo we got */
-            /* FIXME copy the data from Dhpdev to pEMFInfo           */
-        }
+        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));
     }
-    return retValue;
-#else
-    return FALSE;
-#endif
-}
 
+    if (dmA->dmDriverExtra)
+        memcpy((char *)dmW + dmW_size, (const char *)dmA + dmA_size, dmA->dmDriverExtra);
 
+    dmW->dmSize = dmW_size;
 
-
-/*
- * @implemented
- */
-BOOL 
-STDCALL
-Ellipse(
-  HDC hdc,
-  int nLeftRect,
-  int nTopRect,
-  int nRightRect,
-  int nBottomRect)
-{
-    /* FIXME some parts need be done in user mode */
-    return NtGdiEllipse(hdc,nLeftRect,nTopRect,nRightRect,nBottomRect);
+    return dmW;
 }
 
-
 /*
  * @unimplemented
  */
-INT STDCALL 
-EngWideCharToMultiByte( UINT CodePage,
-                        LPWSTR WideCharString,
-                        INT BytesInWideCharString,
-                        LPSTR MultiByteString,
-                        INT BytesInMultiByteString)
+HENHMETAFILE
+WINAPI
+GdiCreateLocalEnhMetaFile(HENHMETAFILE hmo)
 {
-  return WideCharToMultiByte(
-                         CodePage,
-                         0,
-                         WideCharString,
-                        (BytesInWideCharString/sizeof(WCHAR)), /* Bytes to (in WCHARs) */
-                         MultiByteString,
-                         BytesInMultiByteString,
-                         NULL,
-                         NULL);
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
-
 /*
  * @unimplemented
  */
-BOOL STDCALL
-PATHOBJ_bEnum(PATHOBJ *ppo,PATHDATA *ppd)
+METAFILEPICT *
+WINAPI
+GdiCreateLocalMetaFilePict(HENHMETAFILE hmo)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
+
 /*
  * @unimplemented
  */
-BOOL STDCALL 
-PATHOBJ_bEnumClipLines(PATHOBJ *ppo,ULONG cb,CLIPLINE *pcl)
+HANDLE
+WINAPI
+GdiGetSpoolFileHandle(LPWSTR pwszPrinterName,
+                      LPDEVMODEW pDevmode,
+                      LPWSTR pwszDocName)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-VOID STDCALL 
-PATHOBJ_vEnumStart(PATHOBJ *ppo)
+BOOL
+WINAPI
+GdiDeleteSpoolFileHandle(HANDLE SpoolFileHandle)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-VOID STDCALL
-PATHOBJ_vEnumStartClipLines(PATHOBJ *ppo,CLIPOBJ *pco,SURFOBJ *pso,LINEATTRS *pla)
+DWORD
+WINAPI
+GdiGetPageCount(HANDLE SpoolFileHandle)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-VOID STDCALL
-PATHOBJ_vGetBounds(PATHOBJ *ppo,PRECTFX prectfx)
+HDC
+WINAPI
+GdiGetDC(HANDLE SpoolFileHandle)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-BOOL STDCALL
-STROBJ_bEnum(STROBJ *pstro,ULONG *pc,PGLYPHPOS *ppgpos)
+HANDLE
+WINAPI
+GdiGetPageHandle(HANDLE SpoolFileHandle,
+                 DWORD Page,
+                 LPDWORD pdwPageType)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-BOOL STDCALL
-STROBJ_bEnumPositionsOnly(STROBJ *pstro,ULONG *pc,PGLYPHPOS *ppgpos)
+BOOL
+WINAPI
+GdiStartDocEMF(HANDLE SpoolFileHandle,
+               DOCINFOW *pDocInfo)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-BOOL STDCALL
-STROBJ_bGetAdvanceWidths(STROBJ *pso,ULONG iFirst,ULONG c,POINTQF *pptqD)
+BOOL
+WINAPI
+GdiStartPageEMF(HANDLE SpoolFileHandle)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-DWORD STDCALL
-STROBJ_dwGetCodePage(STROBJ  *pstro)
+BOOL
+WINAPI
+GdiPlayPageEMF(HANDLE SpoolFileHandle,
+               HANDLE hemf,
+               RECT *prectDocument,
+               RECT *prectBorder,
+               RECT *prectClip)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-VOID STDCALL
-STROBJ_vEnumStart(STROBJ *pstro)
+BOOL
+WINAPI
+GdiEndPageEMF(HANDLE SpoolFileHandle,
+              DWORD dwOptimization)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-BOOL STDCALL
-XFORMOBJ_bApplyXform(XFORMOBJ *pxo,ULONG iMode,ULONG cPoints,PVOID pvIn,PVOID pvOut)
+BOOL
+WINAPI
+GdiEndDocEMF(HANDLE SpoolFileHandle)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-ULONG STDCALL
-XFORMOBJ_iGetXform(XFORMOBJ *pxo,XFORML *pxform)
+BOOL
+WINAPI
+GdiGetDevmodeForPage(HANDLE SpoolFileHandle,
+                     DWORD dwPageNumber,
+                     PDEVMODEW *pCurrDM,
+                     PDEVMODEW *pLastDM)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-ULONG STDCALL
-XLATEOBJ_cGetPalette(XLATEOBJ *XlateObj,
-                    ULONG PalOutType,
-                    ULONG cPal,
-                    ULONG *OutPal)
+BOOL
+WINAPI
+GdiResetDCEMF(HANDLE SpoolFileHandle,
+              PDEVMODEW pCurrDM)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
+
 /*
  * @unimplemented
  */
-HANDLE STDCALL
-XLATEOBJ_hGetColorTransform(XLATEOBJ *pxlo)
+INT
+WINAPI
+CombineRgn(HRGN  hDest,
+           HRGN  hSrc1,
+           HRGN  hSrc2,
+           INT  CombineMode)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    /* FIXME some part should be done in user mode */
+    return NtGdiCombineRgn(hDest, hSrc1, hSrc2, CombineMode);
 }
 
 /*
  * @unimplemented
  */
-ULONG STDCALL
+ULONG WINAPI
 XLATEOBJ_iXlate(XLATEOBJ *XlateObj,
-               ULONG Color)
+                ULONG Color)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-ULONG * STDCALL
+ULONG *
+WINAPI
 XLATEOBJ_piVector(XLATEOBJ *XlateObj)
 {
-  return XlateObj->pulXlate;
+    return XlateObj->pulXlate;
 }
 
 /*
  * @unimplemented
  */
-BOOL 
-STDCALL
-GdiPlayEMF
-(
-       LPWSTR     pwszPrinterName,
-       LPDEVMODEW pDevmode,
-       LPWSTR     pwszDocName,
-       EMFPLAYPROC pfnEMFPlayFn,
-       HANDLE     hPageQuery
+BOOL
+WINAPI
+GdiPlayEMF(LPWSTR pwszPrinterName,
+           LPDEVMODEW pDevmode,
+           LPWSTR pwszDocName,
+           EMFPLAYPROC pfnEMFPlayFn,
+           HANDLE hPageQuery
 )
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 
@@ -2455,26 +1859,23 @@ GdiPlayEMF
  * @unimplemented
  */
 BOOL
-STDCALL
-GdiPlayPrivatePageEMF
-(
-       HANDLE  SpoolFileHandle,
-       DWORD   unknown,
-       RECT    *prectDocument
-)
+WINAPI
+GdiPlayPrivatePageEMF(HANDLE SpoolFileHandle,
+                      DWORD unknown,
+                      RECT *prectDocument)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
 }
 
 /*
  * @unimplemented
  */
-VOID STDCALL GdiInitializeLanguagePack(DWORD InitParam)
+VOID WINAPI GdiInitializeLanguagePack(DWORD InitParam)
 {
-       UNIMPLEMENTED;
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    UNIMPLEMENTED;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
 }
 
 
@@ -2482,40 +1883,29 @@ VOID STDCALL GdiInitializeLanguagePack(DWORD InitParam)
  * @implemented
  */
 INT
-STDCALL
+WINAPI
 ExcludeClipRect(IN HDC hdc, IN INT xLeft, IN INT yTop, IN INT xRight, IN INT yBottom)
 {
-       /* FIXME some part need be done on user mode size */
-       return NtGdiExcludeClipRect(hdc, xLeft, yTop, xRight, yBottom);
+    /* FIXME some part need be done on user mode size */
+    return NtGdiExcludeClipRect(hdc, xLeft, yTop, xRight, yBottom);
 }
 
 /*
  * @implemented
  */
 INT
-STDCALL
+WINAPI
 ExtSelectClipRgn( IN HDC hdc, IN HRGN hrgn, IN INT iMode)
 {
-       /* FIXME some part need be done on user mode size */
-       return NtGdiExtSelectClipRgn(hdc,hrgn, iMode);
-}
-
-/*
- * @implemented
- */
-BOOL
-STDCALL
-FillRgn( IN HDC hdc, IN HRGN hrgn, IN HBRUSH hbrush)
-{
-       /* FIXME some part need be done on user mode size */
-       return NtGdiFillRgn( hdc, hrgn, hbrush);
+    /* FIXME some part need be done on user mode size */
+    return NtGdiExtSelectClipRgn(hdc,hrgn, iMode);
 }
 
 /*
  * @implemented
  */
 BOOL
-STDCALL
+WINAPI
 GdiGradientFill(
     IN HDC hdc,
     IN PTRIVERTEX pVertex,
@@ -2533,35 +1923,18 @@ GdiGradientFill(
  * @implemented
  */
 BOOL
-STDCALL
-FrameRgn(
-    IN HDC hdc,
-    IN HRGN hrgn,
-    IN HBRUSH hbrush,
-    IN INT xWidth,
-    IN INT yHeight)
-{
-    /* FIXME some part need be done in user mode */
-    return NtGdiFrameRgn(hdc, hrgn, hbrush, xWidth, yHeight);
-}
-
-/*
- * @implemented
- */
-BOOL
-STDCALL
-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 COLORREF TransColor
+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 COLORREF TransColor
 )
 {
     /* FIXME some part need be done in user mode */
@@ -2572,7 +1945,7 @@ GdiTransparentBlt(
  * @unimplemented
  */
 BOOL
-STDCALL
+WINAPI
 GdiPrinterThunk(
     IN HUMPD humpd,
     DWORD *status,
@@ -2591,207 +1964,217 @@ GdiPrinterThunk(
  *
  */
 HBITMAP
-STDCALL
+WINAPI
 GdiConvertBitmapV5(
-    HBITMAP in_format_BitMap, 
+    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, 
+    /*
+     * it have create a new bitmap with desired in format,
      * then convert it src_bitmap to new format
-     * and return it as HBITMAP 
+     * and return it as HBITMAP
      */
 
     return FALSE;
 }
 
-
-/*
- * @implemented
- *
- */
-COLORREF 
-STDCALL 
-GetBkColor(HDC hdc)
-{
-    /* FIXME some part are done in user mode */
-    return NtGdiGetBkColor(hdc);
-}
-
 /*
  * @implemented
  *
  */
 int
-STDCALL 
-GetBkMode(HDC hdc)
+WINAPI
+GetClipBox(HDC hdc,
+           LPRECT lprc)
 {
-    /* FIXME some part are done in user mode */
-    return NtGdiGetBkMode(hdc);
+    return  NtGdiGetAppClipBox(hdc, lprc);
 }
 
 /*
  * @implemented
  *
  */
-BOOL 
-STDCALL 
-GetBrushOrgEx(HDC hdc,LPPOINT pt)
+DWORD
+WINAPI
+GetFontData(HDC hdc,
+            DWORD dwTable,
+            DWORD dwOffset,
+            LPVOID lpvBuffer,
+            DWORD cbData)
 {
-    /* FIXME some part are done in user mode */
-    return NtGdiGetBrushOrgEx(hdc,pt);
+    if (!lpvBuffer)
+    {
+       cbData = 0;
+    }
+    return NtGdiGetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData);
 }
 
-/*
- * @implemented
- *
- */
-BOOL 
-STDCALL 
-GetCharABCWidthsFloatW(HDC hdc,UINT FirstChar,UINT LastChar,LPABCFLOAT abcF)
-{
-    /* FIXME some part are done in user mode */
-    return NtGdiGetCharABCWidthsFloat(hdc, FirstChar, LastChar, abcF);
-}
 
 /*
  * @implemented
  *
  */
-int 
-STDCALL 
-GetDeviceCaps(HDC hdc,
-              int i)
+DWORD
+WINAPI
+GetRegionData(HRGN hrgn,
+              DWORD nCount,
+              LPRGNDATA lpRgnData)
 {
-    /* FIXME some part need be done in user mode */
-    return NtGdiGetDeviceCaps(hdc,i);
-}
-
+    if (!lpRgnData)
+    {
+        nCount = 0;
+    }
 
-/*
- * @implemented
- *
- */
-BOOL 
-STDCALL 
-GetCurrentPositionEx(HDC hdc,
-                     LPPOINT lpPoint)
-{
-    /* FIXME some part need be done in user mode */
-    return  NtGdiGetCurrentPositionEx(hdc, lpPoint);
+    return NtGdiGetRegionData(hrgn,nCount,lpRgnData);
 }
 
-/*
- * @implemented
- *
- */
-HGDIOBJ 
-STDCALL
-GetCurrentObject(HDC hdc,
-                 UINT uObjectType)
-{
-    /* FIXME some part need be done in user mode */
-    return  NtGdiGetCurrentObject(hdc, uObjectType);
-}
 
 /*
  * @implemented
  *
  */
-int 
-STDCALL
-GetClipBox(HDC hdc,
-           LPRECT lprc)
+INT
+WINAPI
+GetRgnBox(HRGN hrgn,
+          LPRECT prcOut)
 {
-    /* FIXME some part need be done in user mode */
-    return  NtGdiGetClipBox(hdc, lprc);
+#if 0
+  PRGN_ATTR Rgn_Attr;
+  if (!GdiGetHandleUserData((HGDIOBJ) hRgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr))
+     return NtGdiGetRgnBox(hrgn, prcOut);
+  if (Rgn_Attr->Flags == NULLREGION)
+  {
+     prcOut->left   = 0;
+     prcOut->top    = 0;
+     prcOut->right  = 0;
+     prcOut->bottom = 0;
+  }
+  else
+  {
+     if (Rgn_Attr->Flags != SIMPLEREGION) return NtGdiGetRgnBox(hrgn, prcOut);
+     *prcOut = Rgn_Attr->Rect;
+  }
+  return Rgn_Attr->Flags;
+#endif
+  return NtGdiGetRgnBox(hrgn, prcOut);
 }
 
-/*
- * @implemented
- *
- */
-BOOL 
-STDCALL
-GetCharWidthFloatW(HDC hdc,
-                   UINT iFirstChar, 
-                   UINT iLastChar, 
-                   PFLOAT pxBuffer)
-{
-    /* FIXME some part need be done in user mode */
-    return NtGdiGetCharWidthFloat(hdc, iFirstChar, iLastChar, pxBuffer);
-}
 
 /*
  * @implemented
  *
  */
-BOOL
-STDCALL
-GetCharWidth32W(HDC hdc,
-               UINT iFirstChar,
-               UINT iLastChar,
-               LPINT lpBuffer)
+INT
+WINAPI
+OffsetRgn( HRGN hrgn,
+          int nXOffset,
+          int nYOffset)
 {
-    /* FIXME some part need be done in user mode */
-    return NtGdiGetCharWidth32(hdc, iFirstChar, iLastChar, lpBuffer);
+    /* FIXME some part are done in user mode */
+    return NtGdiOffsetRgn(hrgn,nXOffset,nYOffset);
 }
 
 /*
  * @implemented
- *
  */
-BOOL
-STDCALL
-GetCharABCWidths(HDC hdc,
-                 UINT uFirstChar,
-                 UINT uLastChar,
-                 LPABC lpabc)
+INT
+WINAPI
+IntersectClipRect(HDC hdc,
+                  int nLeftRect,
+                  int nTopRect,
+                  int nRightRect,
+                  int nBottomRect)
 {
-    /* FIXME some part need be done in user mode */
-    return NtGdiGetCharABCWidths(hdc, uFirstChar, uLastChar, lpabc);
+#if 0
+// Handle something other than a normal dc object.
+  if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)
+  {
+    if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC)
+      return MFDRV_IntersectClipRect( hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
+    else
+    {
+      PLDC pLDC = GdiGetLDC(hdc);
+      if ( pLDC )
+      {
+         if (pLDC->iType != LDC_EMFLDC || EMFDRV_IntersectClipRect( hdc, nLeftRect, nTopRect, nRightRect, nBottomRect))
+             return NtGdiIntersectClipRect(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
+      }
+      else
+        SetLastError(ERROR_INVALID_HANDLE);
+      return 0;
+    }
+  }
+#endif
+    return NtGdiIntersectClipRect(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
 }
 
-
 /*
  * @implemented
- *
  */
-DWORD 
-STDCALL
-GetFontData(HDC hdc,
-            DWORD dwTable,
-            DWORD dwOffset,
-            LPVOID lpvBuffer,
-            DWORD cbData)
+INT
+WINAPI
+OffsetClipRgn(HDC hdc,
+              int nXOffset,
+              int nYOffset)
 {
-    if (!lpvBuffer)
+#if 0
+// Handle something other than a normal dc object.
+  if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)
+  {
+    if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC)
+      return MFDRV_OffsetClipRgn( hdc, nXOffset, nYOffset );
+    else
     {
-       cbData = 0;
+      PLDC pLDC = GdiGetLDC(hdc);
+      if ( !pLDC )
+      {
+         SetLastError(ERROR_INVALID_HANDLE);
+         return 0;
+      }
+      if (pLDC->iType == LDC_EMFLDC && !EMFDRV_OffsetClipRgn( hdc, nXOffset, nYOffset ))
+         return 0;
+      return NtGdiOffsetClipRgn( hdc,  nXOffset,  nYOffset);
     }
-    return NtGdiGetFontData(hdc, dwTable, dwOffset, lpvBuffer, cbData);
+  }
+#endif
+  return NtGdiOffsetClipRgn( hdc,  nXOffset,  nYOffset);
+}
+
+
+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
- *
+ * @unimplemented
  */
-DWORD 
-STDCALL
-GetRegionData(HRGN hrgn,
-              DWORD nCount,
-              LPRGNDATA lpRgnData)
-{
-    if (!lpRgnData)
-    {
-        nCount = 0;
-    }
 
-    return NtGdiGetRegionData(hrgn,nCount,lpRgnData);
+/* 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;
 }