Jacek Caban : win32u: Implement NtGdiGetDCDword.

Alexandre Julliard julliard at winehq.org
Tue Apr 12 15:35:16 CDT 2022


Module: wine
Branch: master
Commit: e9cfbef46b9d78af8c70558bd8b6fd08f7a4c74b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e9cfbef46b9d78af8c70558bd8b6fd08f7a4c74b

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Apr 12 13:08:54 2022 +0200

win32u: Implement NtGdiGetDCDword.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/win32u/dc.c        | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
 dlls/win32u/syscall.c   |  1 +
 dlls/win32u/win32u.spec |  2 +-
 dlls/wow64win/gdi.c     |  9 +++++++
 dlls/wow64win/syscall.h |  1 +
 include/ntgdi.h         | 16 ++++++++++++
 6 files changed, 95 insertions(+), 1 deletion(-)

diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c
index 6336c8afb2e..01a9c5d258a 100644
--- a/dlls/win32u/dc.c
+++ b/dlls/win32u/dc.c
@@ -960,6 +960,73 @@ BOOL WINAPI NtGdiGetAndSetDCDword( HDC hdc, UINT method, DWORD value, DWORD *pre
 }
 
 
+/***********************************************************************
+ *           NtGdiGetDCDword    (win32u.@)
+ */
+BOOL WINAPI NtGdiGetDCDword( HDC hdc, UINT method, DWORD *result )
+{
+    BOOL ret = TRUE;
+    DC *dc;
+
+    if (!(dc = get_dc_ptr( hdc ))) return 0;
+
+    switch (method)
+    {
+    case NtGdiGetArcDirection:
+        *result = dc->attr->arc_direction;
+        break;
+
+    case NtGdiGetBkColor:
+        *result = dc->attr->background_color;
+        break;
+
+    case NtGdiGetBkMode:
+        *result = dc->attr->background_mode;
+        break;
+
+    case NtGdiGetDCBrushColor:
+        *result = dc->attr->brush_color;
+        break;
+
+    case NtGdiGetDCPenColor:
+        *result = dc->attr->pen_color;
+        break;
+
+    case NtGdiGetGraphicsMode:
+        *result = dc->attr->graphics_mode;
+        break;
+
+    case NtGdiGetLayout:
+        *result = dc->attr->layout;
+        break;
+
+    case NtGdiGetPolyFillMode:
+        *result = dc->attr->poly_fill_mode;
+        break;
+
+    case NtGdiGetROP2:
+        *result = dc->attr->rop_mode;
+        break;
+
+    case NtGdiGetTextColor:
+        *result = dc->attr->text_color;
+        break;
+
+    case NtGdiIsMemDC:
+        *result = get_gdi_object_type( hdc ) == NTGDI_OBJ_MEMDC;
+        break;
+
+    default:
+        WARN( "unknown method %u\n", method );
+        ret = FALSE;
+        break;
+    }
+
+    release_dc_ptr( dc );
+    return ret;
+}
+
+
 /***********************************************************************
  *           NtGdiSetBrushOrg    (win32u.@)
  */
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index 2be2cfce3bf..f9e1d67bb6b 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -70,6 +70,7 @@ static void * const syscalls[] =
     NtGdiGetBitmapBits,
     NtGdiGetBitmapDimension,
     NtGdiGetColorAdjustment,
+    NtGdiGetDCDword,
     NtGdiGetDCObject,
     NtGdiGetFontFileData,
     NtGdiGetFontFileInfo,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index e083797b544..522f280f9ae 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -462,7 +462,7 @@
 @ stub NtGdiGetColorSpaceforBitmap
 @ stub NtGdiGetCurrentDpiInfo
 @ stub NtGdiGetDCDpiScaleValue
-@ stub NtGdiGetDCDword
+@ stdcall -syscall NtGdiGetDCDword(long long ptr)
 @ stdcall -syscall NtGdiGetDCObject(long long)
 @ stub NtGdiGetDCPoint
 @ stub NtGdiGetDCforBitmap
diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c
index 3abe6daeda4..15dae62c1e0 100644
--- a/dlls/wow64win/gdi.c
+++ b/dlls/wow64win/gdi.c
@@ -50,6 +50,15 @@ NTSTATUS WINAPI wow64_NtGdiExtGetObjectW( UINT *args )
     return NtGdiExtGetObjectW( handle, count, buffer );
 }
 
+NTSTATUS WINAPI wow64_NtGdiGetDCDword( UINT *args )
+{
+    HDC hdc = get_handle( &args );
+    UINT method = get_ulong( &args );
+    DWORD *result = get_ptr( &args );
+
+    return NtGdiGetDCDword( hdc, method, result );
+}
+
 NTSTATUS WINAPI wow64_NtGdiGetDCObject( UINT *args )
 {
     HDC hdc = get_handle( &args );
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index a90c4c20d40..1632f007e34 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -57,6 +57,7 @@
     SYSCALL_ENTRY( NtGdiGetBitmapBits ) \
     SYSCALL_ENTRY( NtGdiGetBitmapDimension ) \
     SYSCALL_ENTRY( NtGdiGetColorAdjustment ) \
+    SYSCALL_ENTRY( NtGdiGetDCDword ) \
     SYSCALL_ENTRY( NtGdiGetDCObject ) \
     SYSCALL_ENTRY( NtGdiGetFontFileData ) \
     SYSCALL_ENTRY( NtGdiGetFontFileInfo ) \
diff --git a/include/ntgdi.h b/include/ntgdi.h
index 3bc1d4206e4..8f3d4c05178 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -115,6 +115,22 @@ enum
     NtGdiSetGraphicsMode,
 };
 
+/* NtGdiGetDCDword parameter, not compatible with Windows */
+enum
+{
+    NtGdiGetArcDirection,
+    NtGdiGetBkColor,
+    NtGdiGetBkMode,
+    NtGdiGetDCBrushColor,
+    NtGdiGetDCPenColor,
+    NtGdiGetGraphicsMode,
+    NtGdiGetLayout,
+    NtGdiGetPolyFillMode,
+    NtGdiGetROP2,
+    NtGdiGetTextColor,
+    NtGdiIsMemDC,
+};
+
 enum
 {
     NtGdiAnimatePalette,




More information about the wine-cvs mailing list