https://git.reactos.org/?p=reactos.git;a=commitdiff;h=970344bd16df0e21aa6b9…
commit 970344bd16df0e21aa6b92fa6c235dae6143fe1c
Author: James Tabor <james.tabor(a)reactos.org>
AuthorDate: Sat Sep 25 11:57:26 2021 -0500
Commit: James Tabor <james.tabor(a)reactos.org>
CommitDate: Sat Sep 25 11:57:26 2021 -0500
[Win32SS|GDI] Implement seldom used API and update types for local DC's.
Two working in house application require these API. Known as FolCOL and Reach.
---
win32ss/gdi/eng/stubs.c | 20 +++++--
win32ss/gdi/gdi32/objects/bitmap.c | 111 +++++++++++--------------------------
win32ss/gdi/gdi32/objects/brush.c | 28 ++++++----
win32ss/gdi/gdi32/objects/icm.c | 29 +++++++++-
win32ss/gdi/ntgdi/brush.cpp | 16 +++++-
win32ss/gdi/ntgdi/gdiobj.c | 34 ++++++++++++
win32ss/gdi/ntgdi/gdiobj.h | 1 +
win32ss/include/ntgdihdl.h | 9 +++
8 files changed, 150 insertions(+), 98 deletions(-)
diff --git a/win32ss/gdi/eng/stubs.c b/win32ss/gdi/eng/stubs.c
index 8a91c86ff5f..5cc878e0d80 100644
--- a/win32ss/gdi/eng/stubs.c
+++ b/win32ss/gdi/eng/stubs.c
@@ -784,7 +784,7 @@ NtGdiCheckBitmapBits(
}
/*
- * @unimplemented
+ * @implemented
*/
HBITMAP
APIENTRY
@@ -792,7 +792,13 @@ NtGdiClearBitmapAttributes(
IN HBITMAP hbm,
IN DWORD dwFlags)
{
- UNIMPLEMENTED;
+ if ( dwFlags & SC_BB_STOCKOBJ )
+ {
+ if (GDIOBJ_ConvertFromStockObj((HGDIOBJ*)&hbm))
+ {
+ return hbm;
+ }
+ }
return NULL;
}
@@ -1406,7 +1412,7 @@ NtGdiMonoBitmap(
}
/*
- * @unimplemented
+ * @implemented
*/
HBITMAP
APIENTRY
@@ -1414,7 +1420,13 @@ NtGdiSetBitmapAttributes(
IN HBITMAP hbm,
IN DWORD dwFlags)
{
- UNIMPLEMENTED;
+ if ( dwFlags & SC_BB_STOCKOBJ )
+ {
+ if (GDIOBJ_ConvertToStockObj((HGDIOBJ*)&hbm))
+ {
+ return hbm;
+ }
+ }
return NULL;
}
diff --git a/win32ss/gdi/gdi32/objects/bitmap.c b/win32ss/gdi/gdi32/objects/bitmap.c
index 91e8a0be9ee..f290b546617 100644
--- a/win32ss/gdi/gdi32/objects/bitmap.c
+++ b/win32ss/gdi/gdi32/objects/bitmap.c
@@ -812,52 +812,23 @@ StretchDIBits(
DPRINT("StretchDIBits %p : %p : %u\n", lpBits, lpBitsInfo, iUsage);
#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_StretchBlt( hdc,
- XDest,
- YDest,
- nDestWidth,
- nDestHeight,
- XSrc,
- YSrc,
- nSrcWidth,
- nSrcHeight,
- lpBits,
- lpBitsInfo,
- iUsage,
- dwRop);
- else
- {
- PLDC pLDC = GdiGetLDC(hdc);
- if ( !pLDC )
- {
- SetLastError(ERROR_INVALID_HANDLE);
- return 0;
- }
- if (pLDC->iType == LDC_EMFLDC)
- {
- return EMFDRV_StretchBlt(hdc,
- XDest,
- YDest,
- nDestWidth,
- nDestHeight,
- XSrc,
- YSrc,
- nSrcWidth,
- nSrcHeight,
- lpBits,
- lpBitsInfo,
- iUsage,
- dwRop);
- }
- return 0;
- }
- }
+ HANDLE_METADC( int,
+ StretchDIBits,
+ 0,
+ hdc,
+ XDest,
+ YDest,
+ nDestWidth,
+ nDestHeight,
+ XSrc,
+ YSrc,
+ nSrcWidth,
+ nSrcHeight,
+ lpBits,
+ lpBitsInfo,
+ iUsage,
+ dwRop );
#endif
-
if ( GdiConvertAndCheckDC(hdc) == NULL ) return 0;
pConvertedInfo = ConvertBitmapInfo(lpBitsInfo, iUsage, &ConvertedInfoSize,
@@ -921,61 +892,45 @@ StretchDIBits(
}
/*
- * @unimplemented
+ * @implemented
*/
DWORD
WINAPI
GetBitmapAttributes(HBITMAP hbm)
{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ if ( GDI_HANDLE_IS_STOCKOBJ(hbm) )
+ {
+ return SC_BB_STOCKOBJ;
+ }
return 0;
}
/*
- * @unimplemented
+ * @implemented
*/
HBITMAP
WINAPI
SetBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
+ if ( dwFlags & ~SC_BB_STOCKOBJ )
+ {
+ return NULL;
+ }
+ return NtGdiSetBitmapAttributes( hbm, dwFlags );
}
/*
- * @unimplemented
+ * @implemented
*/
HBITMAP
WINAPI
ClearBitmapAttributes(HBITMAP hbm, DWORD dwFlags)
{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
+ if ( dwFlags & ~SC_BB_STOCKOBJ )
+ {
+ return NULL;
+ }
+ return NtGdiClearBitmapAttributes( hbm, dwFlags );;
}
-/*
- * @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;
-}
diff --git a/win32ss/gdi/gdi32/objects/brush.c b/win32ss/gdi/gdi32/objects/brush.c
index 6f73d62a8d4..9be9dc980f8 100644
--- a/win32ss/gdi/gdi32/objects/brush.c
+++ b/win32ss/gdi/gdi32/objects/brush.c
@@ -340,39 +340,45 @@ SetBrushOrgEx(HDC hdc,
}
/*
- * @unimplemented
+ * @implemented
*/
DWORD
WINAPI
GetBrushAttributes(HBRUSH hbr)
{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ if ( GDI_HANDLE_IS_STOCKOBJ(hbr) )
+ {
+ return SC_BB_STOCKOBJ;
+ }
return 0;
}
/*
- * @unimplemented
+ * @implemented
*/
HBRUSH
WINAPI
SetBrushAttributes(HBRUSH hbm, DWORD dwFlags)
{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
+ if ( dwFlags & ~SC_BB_STOCKOBJ )
+ {
+ return NULL;
+ }
+ return NtGdiSetBrushAttributes(hbm, dwFlags);
}
/*
- * @unimplemented
+ * @implemented
*/
HBRUSH
WINAPI
ClearBrushAttributes(HBRUSH hbm, DWORD dwFlags)
{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
+ if ( dwFlags & ~SC_BB_STOCKOBJ )
+ {
+ return NULL;
+ }
+ return NtGdiClearBrushAttributes(hbm, dwFlags);
}
/*
diff --git a/win32ss/gdi/gdi32/objects/icm.c b/win32ss/gdi/gdi32/objects/icm.c
index 520463a491a..97dc3424445 100644
--- a/win32ss/gdi/gdi32/objects/icm.c
+++ b/win32ss/gdi/gdi32/objects/icm.c
@@ -106,12 +106,12 @@ SetColorSpace(
{
HCOLORSPACE rhCS = GetColorSpace(hDC);
- if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_DC)
+ if (GDI_HANDLE_GET_TYPE(hDC) == GDILoObjType_LO_DC_TYPE)
{
if (NtGdiSetColorSpace(hDC, hCS)) return rhCS;
}
#if 0
- if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_METADC)
+ if (GDI_HANDLE_GET_TYPE(hDC) != GDILoObjType_LO_METADC16_TYPE)
{
PLDC pLDC = GdiGetLDC(hDC);
if ( !pLDC )
@@ -119,7 +119,7 @@ SetColorSpace(
SetLastError(ERROR_INVALID_HANDLE);
return NULL;
}
- if (pLDC->iType == LDC_EMFLDC)
+ if (pLDC->iType == LDC_EMFLDC && !EMFDC_SetColorSpace( pLDC, hCS ))
{
return NULL;
}
@@ -327,3 +327,26 @@ SetICMMode(
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;
+}
diff --git a/win32ss/gdi/ntgdi/brush.cpp b/win32ss/gdi/ntgdi/brush.cpp
index 41d13184b12..2c18e25b307 100644
--- a/win32ss/gdi/ntgdi/brush.cpp
+++ b/win32ss/gdi/ntgdi/brush.cpp
@@ -543,7 +543,13 @@ NtGdiSetBrushAttributes(
_In_ HBRUSH hbr,
_In_ DWORD dwFlags)
{
- FIXME("NtGdiSetBrushAttributes is unimplemented\n");
+ if ( dwFlags & SC_BB_STOCKOBJ )
+ {
+ if (GDIOBJ_ConvertToStockObj((HGDIOBJ*)&hbr))
+ {
+ return hbr;
+ }
+ }
return NULL;
}
@@ -554,7 +560,13 @@ NtGdiClearBrushAttributes(
_In_ HBRUSH hbr,
_In_ DWORD dwFlags)
{
- FIXME("NtGdiClearBrushAttributes is unimplemented\n");
+ if ( dwFlags & SC_BB_STOCKOBJ )
+ {
+ if (GDIOBJ_ConvertFromStockObj((HGDIOBJ*)&hbr))
+ {
+ return hbr;
+ }
+ }
return NULL;
}
diff --git a/win32ss/gdi/ntgdi/gdiobj.c b/win32ss/gdi/ntgdi/gdiobj.c
index e92c070b469..7bd97e3fa6d 100644
--- a/win32ss/gdi/ntgdi/gdiobj.c
+++ b/win32ss/gdi/ntgdi/gdiobj.c
@@ -1484,6 +1484,40 @@ GDIOBJ_ConvertToStockObj(HGDIOBJ *phObj)
return TRUE;
}
+BOOL
+NTAPI
+GDIOBJ_ConvertFromStockObj(HGDIOBJ *phObj)
+{
+ PENTRY pentry;
+ POBJ pobj;
+
+ /* Reference the handle entry */
+ pentry = ENTRY_ReferenceEntryByHandle(*phObj, 0);
+ if (!pentry)
+ {
+ DPRINT1("GDIOBJ: Requested handle 0x%p is not valid.\n", *phObj);
+ return FALSE;
+ }
+
+ /* Update the entry */
+ pentry->FullUnique &= ~GDI_ENTRY_STOCK_MASK;
+ pentry->ObjectOwner.ulObj = 0;
+
+ /* Get the pointer to the BASEOBJECT */
+ pobj = pentry->einfo.pobj;
+
+ /* Calculate the new handle */
+ pobj->hHmgr = (HGDIOBJ)((ULONG_PTR)pobj->hHmgr & ~GDI_HANDLE_STOCK_MASK);
+
+ /* Return the new handle */
+ *phObj = pobj->hHmgr;
+
+ /* Dereference the handle */
+ GDIOBJ_vDereferenceObject(pobj);
+
+ return TRUE;
+}
+
POBJ NTAPI
GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize)
{
diff --git a/win32ss/gdi/ntgdi/gdiobj.h b/win32ss/gdi/ntgdi/gdiobj.h
index f7b65594187..bd7c416a16c 100644
--- a/win32ss/gdi/ntgdi/gdiobj.h
+++ b/win32ss/gdi/ntgdi/gdiobj.h
@@ -195,6 +195,7 @@ GDIOBJ_pvGetObjectAttr(
POBJ pobj);
BOOL NTAPI GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj);
+BOOL NTAPI GDIOBJ_ConvertFromStockObj(HGDIOBJ *phObj);
POBJ NTAPI GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize);
PGDIOBJ NTAPI GDIOBJ_ShareLockObj(HGDIOBJ hObj, DWORD ObjectType);
PVOID NTAPI GDI_MapHandleTable(PEPROCESS Process);
diff --git a/win32ss/include/ntgdihdl.h b/win32ss/include/ntgdihdl.h
index 1c0c230823b..36dc54ce8e7 100644
--- a/win32ss/include/ntgdihdl.h
+++ b/win32ss/include/ntgdihdl.h
@@ -174,16 +174,23 @@
#define LDC_INIT_PAGE 0x00000080
#define LDC_STARTPAGE 0x00000100
#define LDC_NEXTBAND 0x00000200
+#define LDC_FONTHASH 0x00001000
#define LDC_CLOCKWISE 0x00002000
+#define LDC_NEWFONT 0x00008000
#define LDC_KILL_DOCUMENT 0x00010000
#define LDC_META_PRINT 0x00020000
#define LDC_DIRECT 0x00040000
#define LDC_RESET_BANDING 0x00080000
+#define LDC_DOWNLOADFONTS 0x00100000
#define LDC_RESETDC 0x00200000
#define LDC_UFIMAP 0x00400000
#define LDC_INFODC 0x01000000 /* If CreateIC was passed. */
#define LDC_DEVCAPS 0x02000000
+#define LDC_XPS_PASS 0x08000000 // Guessing, not sure.
#define LDC_ATENDPAGE 0x10000000
+#define LDC_COLORPAGE 0x20000000
+
+#define UFIHASHTABLESIZE 64
/* DC_ATTR Xform Flags */
#define METAFILE_TO_WORLD_IDENTITY 0x00000001
@@ -210,6 +217,8 @@
#define ATTR_RGN_VALID 0x00000010
#define ATTR_RGN_DIRTY 0x00000020
+/* Set/Clear Bitmap/Brush Stock Attribute */
+#define SC_BB_STOCKOBJ 1
/* TYPES *********************************************************************/