https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dc483bd700a58a1b42b3d…
commit dc483bd700a58a1b42b3dd4e4103793cc5147384
Author: Oleg Dubinskiy <oleg.dubinskij2013(a)yandex.ua>
AuthorDate: Wed Dec 29 17:51:23 2021 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Dec 29 16:51:23 2021 +0100
[WIN32SS:ENG] EngCreateBitmap: mark created bitmaps as API bitmaps (#4146)
CORE-17561
Set the API_BITMAP flag for bitmaps created by EngCreateBitmap().
This avoids failure when created bitmap is passed to NtGdiSelectBitmap(), since it checks for this flag and fails if it isn't set.
Otherwise, if failure occurs, the bitmap is hot handled properly.
Setting this flag outside of that function is not an option at all, because it is a public (exported) function, and in many cases it's called directly by the caller (in case with MS DDraw stack, it can be called also by dxg.sys from dxgthk!EngCreateBitmap, which directly calls win32k!EngCreateBitmap).
In particular, it allows Windows XP/2003 DirectDraw stack (ddraw.dll & dxg.sys) to properly work in ReactOS (in software emulation mode), even on real hardware. So now, a lot of DirectX 1-7 apps and games (whose can work withoug hardware acceleation), are working properly with ddraw.dll + dxg.sys replacement! Also Justin Miller (DarkFire01) confirmed that even Direct3D software emulation now also works correctly on real hardware!
---
win32ss/gdi/eng/surface.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/win32ss/gdi/eng/surface.c b/win32ss/gdi/eng/surface.c
index 9bce8373692..3bfe6f89276 100644
--- a/win32ss/gdi/eng/surface.c
+++ b/win32ss/gdi/eng/surface.c
@@ -332,6 +332,9 @@ EngCreateBitmap(
/* Get the handle for the bitmap */
hbmp = (HBITMAP)psurf->SurfObj.hsurf;
+ /* Mark as API bitmap */
+ psurf->flags = API_BITMAP;
+
/* Set public ownership */
GDIOBJ_vSetObjectOwner(&psurf->BaseObject, GDI_OBJ_HMGR_PUBLIC);