Author: fireball
Date: Sat May 10 14:03:58 2008
New Revision: 33418
URL: http://svn.reactos.org/svn/reactos?rev=33418&view=rev
Log:
- Get rid of duplicated (and different) NB_LAST_STOCK definitions in gdi32 and win32k, now it's defined to 22 (19 being a last public stock object, other 2 are internal).
- Move a DEFAULT_BITMAP definiton from gdi32 into ntgdityp.h (not the best place, but could be moved to a better one later), and assign it a number 21, which it is on Windows XP (tested with a win32kntest framework, tests are committed).
- Fix CreateBitmap to return a 1x1 stock bitmap object if the requested Width and Height are 0.
- All of this work is based on Magnus Olsen's patches and Wine.
Modified:
trunk/reactos/dll/win32/gdi32/include/gdi32p.h
trunk/reactos/dll/win32/gdi32/misc/stubs.c
trunk/reactos/include/reactos/win32k/ntgdityp.h
trunk/reactos/subsystems/win32/win32k/include/object.h
trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/gd…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/include/gdi32p.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/include/gdi32p.h [iso-8859-1] Sat May 10 14:03:58 2008
@@ -29,9 +29,6 @@
#define METAFILE_MEMORY 1
#define METAFILE_DISK 2
-
-#define DEFAULT_BITMAP (STOCK_LAST+1)
-#define NB_STOCK_OBJECTS (STOCK_LAST+2)
/* TYPES *********************************************************************/
Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/misc/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/misc/stubs.c [iso-8859-1] Sat May 10 14:03:58 2008
@@ -1936,7 +1936,15 @@
PCVOID pUnsafeBits)
{
/* FIXME some part should be done in user mode */
- return NtGdiCreateBitmap(Width, Height, Planes, BitsPixel, (LPBYTE) pUnsafeBits);
+ if (Width && Height)
+ {
+ return NtGdiCreateBitmap(Width, Height, Planes, BitsPixel, (LPBYTE) pUnsafeBits);
+ }
+ else
+ {
+ /* Return 1x1 bitmap */
+ return GetStockObject(DEFAULT_BITMAP);
+ }
}
/*
Modified: trunk/reactos/include/reactos/win32k/ntgdityp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntg…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] Sat May 10 14:03:58 2008
@@ -159,10 +159,12 @@
typedef DWORD FULLSCREENCONTROL;
typedef DWORD LFTYPE;
-/* NOTE DC_BITMAP or the value are not documented in MSDN or ms header
- * it return a 1x1 1Bpp Bitmap in all case from GetStockObject
- */
-#define DC_BITMAP 21
+/* Public LAST_STOCK = 19, plus 2 more internal entries */
+#define NB_STOCK_OBJECTS 22
+
+/* extra stock object: default 1x1 bitmap for memory DCs */
+#define DEFAULT_BITMAP (21)
+
/* DEFINES *******************************************************************/
Modified: trunk/reactos/subsystems/win32/win32k/include/object.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1] Sat May 10 14:03:58 2008
@@ -7,11 +7,6 @@
#define FIRST_USER_HANDLE 0x0020 /* first possible value for low word of user handle */
#define LAST_USER_HANDLE 0xffef /* last possible value for low word of user handle */
-
-/* Comments from reserve two extra entry for the stock default bitmap this is what Windows does too
- * and verify if it is true it is not. in XP/2003 it is 22 stockobjects for each bitmap
- */
-#define PRV_STOCK_LAST 22
#define USER_HEADER_TO_BODY(ObjectHeader) \
((PVOID)(((PUSER_OBJECT_HEADER)ObjectHeader) + 1))
Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] Sat May 10 14:03:58 2008
@@ -107,11 +107,6 @@
{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" }; //Bitstream Vera Sans
-/* Comments from reserve two extra entry for the stock default bitmap this is what Windows does too
- * and verify if it is true it is not. in XP/2003 it is 22 stockobjects for each bitmap
- */
-#define NB_STOCK_OBJECTS (PRV_STOCK_LAST)
-
static HGDIOBJ StockObjects[NB_STOCK_OBJECTS];
/*!
@@ -139,8 +134,8 @@
StockObjects[DC_PEN] = IntGdiExtCreatePen(BlackPen.lopnStyle, BlackPen.lopnWidth.x, BS_SOLID, BlackPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
StockObjects[NULL_PEN] = IntGdiExtCreatePen(NullPen.lopnStyle, NullPen.lopnWidth.x, BS_SOLID, NullPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
- StockObjects[20] = NULL;
- StockObjects[DC_BITMAP] = IntGdiCreateBitmap (1, 1, 1, 1, NULL);
+ StockObjects[20] = NULL; /* TODO: Unknown internal stock object */
+ StockObjects[DEFAULT_BITMAP] = IntGdiCreateBitmap(1, 1, 1, 1, NULL);
(void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]);
(void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]);
Author: greatlrd
Date: Sat May 10 13:10:36 2008
New Revision: 33416
URL: http://svn.reactos.org/svn/reactos?rev=33416&view=rev
Log:
move the undoc DC_BITMAP to ntgdityp.h header after advice from fireball and kjk
Modified:
trunk/reactos/include/psdk/wingdi.h
trunk/reactos/include/reactos/win32k/ntgdityp.h
Modified: trunk/reactos/include/psdk/wingdi.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wingdi.h?rev=…
==============================================================================
--- trunk/reactos/include/psdk/wingdi.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/wingdi.h [iso-8859-1] Sat May 10 13:10:36 2008
@@ -813,12 +813,6 @@
#define SYSTEM_FONT 13
#define SYSTEM_FIXED_FONT 16
#define DEFAULT_PALETTE 15
-
-/* NOTE DC_BITMAP or the value are not documented in MSDN or ms header
- * it return a 1x1 1Bpp Bitmap in all case from GetStockObject
- */
-#define DC_BITMAP 21
-
#if (_WIN32_WINNT >= 0x0500)
#define DC_BRUSH 18
#define DC_PEN 19
Modified: trunk/reactos/include/reactos/win32k/ntgdityp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntg…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntgdityp.h [iso-8859-1] Sat May 10 13:10:36 2008
@@ -158,6 +158,11 @@
/* FIXME: Unknown */
typedef DWORD FULLSCREENCONTROL;
typedef DWORD LFTYPE;
+
+/* NOTE DC_BITMAP or the value are not documented in MSDN or ms header
+ * it return a 1x1 1Bpp Bitmap in all case from GetStockObject
+ */
+#define DC_BITMAP 21
/* DEFINES *******************************************************************/
Author: greatlrd
Date: Sat May 10 13:07:41 2008
New Revision: 33415
URL: http://svn.reactos.org/svn/reactos?rev=33415&view=rev
Log:
fixing a memory overwrite bug I miskate intrudes
the private size of stackobject list contain 22 object, and we do not want mix up the private size and the user mode size for different version.
Modified:
trunk/reactos/subsystems/win32/win32k/include/object.h
trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
Modified: trunk/reactos/subsystems/win32/win32k/include/object.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1] Sat May 10 13:07:41 2008
@@ -8,6 +8,10 @@
#define FIRST_USER_HANDLE 0x0020 /* first possible value for low word of user handle */
#define LAST_USER_HANDLE 0xffef /* last possible value for low word of user handle */
+/* Comments from reserve two extra entry for the stock default bitmap this is what Windows does too
+ * and verify if it is true it is not. in XP/2003 it is 22 stockobjects for each bitmap
+ */
+#define PRV_STOCK_LAST 22
#define USER_HEADER_TO_BODY(ObjectHeader) \
((PVOID)(((PUSER_OBJECT_HEADER)ObjectHeader) + 1))
Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] Sat May 10 13:07:41 2008
@@ -107,10 +107,10 @@
{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" }; //Bitstream Vera Sans
-/* Comments from wine reserve two extra entry for the stock default bitmap this is what Windows does too
- * and verify if it it is true it is not. in XP/2003 it is 22 stockobjects for each bitmap
+/* Comments from reserve two extra entry for the stock default bitmap this is what Windows does too
+ * and verify if it is true it is not. in XP/2003 it is 22 stockobjects for each bitmap
*/
-#define NB_STOCK_OBJECTS (STOCK_LAST + 3)
+#define NB_STOCK_OBJECTS (PRV_STOCK_LAST)
static HGDIOBJ StockObjects[NB_STOCK_OBJECTS];
@@ -139,6 +139,7 @@
StockObjects[DC_PEN] = IntGdiExtCreatePen(BlackPen.lopnStyle, BlackPen.lopnWidth.x, BS_SOLID, BlackPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
StockObjects[NULL_PEN] = IntGdiExtCreatePen(NullPen.lopnStyle, NullPen.lopnWidth.x, BS_SOLID, NullPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
+ StockObjects[20] = NULL;
StockObjects[DC_BITMAP] = IntGdiCreateBitmap (1, 1, 1, 1, NULL);
(void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]);
Author: greatlrd
Date: Sat May 10 12:39:38 2008
New Revision: 33412
URL: http://svn.reactos.org/svn/reactos?rev=33412&view=rev
Log:
implement DC_BITMAP for GetStockObject.
it works for any apps want it. and using this undoc value
testcase exists in w32knapi have been run in windows and reactos.
Modified:
trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] Sat May 10 12:39:38 2008
@@ -107,7 +107,10 @@
{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" }; //Bitstream Vera Sans
-#define NB_STOCK_OBJECTS (STOCK_LAST + 1)
+/* Comments from wine reserve two extra entry for the stock default bitmap this is what Windows does too
+ * and verify if it it is true it is not. in XP/2003 it is 22 stockobjects for each bitmap
+ */
+#define NB_STOCK_OBJECTS (STOCK_LAST + 3)
static HGDIOBJ StockObjects[NB_STOCK_OBJECTS];
@@ -135,6 +138,8 @@
StockObjects[BLACK_PEN] = IntGdiExtCreatePen(BlackPen.lopnStyle, BlackPen.lopnWidth.x, BS_SOLID, BlackPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
StockObjects[DC_PEN] = IntGdiExtCreatePen(BlackPen.lopnStyle, BlackPen.lopnWidth.x, BS_SOLID, BlackPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
StockObjects[NULL_PEN] = IntGdiExtCreatePen(NullPen.lopnStyle, NullPen.lopnWidth.x, BS_SOLID, NullPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
+
+ StockObjects[DC_BITMAP] = IntGdiCreateBitmap (1, 1, 1, 1, NULL);
(void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]);
(void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]);
Author: greatlrd
Date: Sat May 10 12:37:43 2008
New Revision: 33411
URL: http://svn.reactos.org/svn/reactos?rev=33411&view=rev
Log:
adding a new define DC_BITMAP for GetStockObject
Modified:
trunk/reactos/include/psdk/wingdi.h
Modified: trunk/reactos/include/psdk/wingdi.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wingdi.h?rev=…
==============================================================================
--- trunk/reactos/include/psdk/wingdi.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/wingdi.h [iso-8859-1] Sat May 10 12:37:43 2008
@@ -813,6 +813,12 @@
#define SYSTEM_FONT 13
#define SYSTEM_FIXED_FONT 16
#define DEFAULT_PALETTE 15
+
+/* NOTE DC_BITMAP or the value are not documented in MSDN or ms header
+ * it return a 1x1 1Bpp Bitmap in all case from GetStockObject
+ */
+#define DC_BITMAP 21
+
#if (_WIN32_WINNT >= 0x0500)
#define DC_BRUSH 18
#define DC_PEN 19