[ACLAYERS] Implement Force8BitColor and Force640x480 shims. CORE-11927
authorMark Jansen <mark.jansen@reactos.org>
Fri, 16 Dec 2016 21:54:06 +0000 (21:54 +0000)
committerMark Jansen <mark.jansen@reactos.org>
Fri, 16 Dec 2016 21:54:06 +0000 (21:54 +0000)
svn path=/trunk/; revision=73462

reactos/dll/appcompat/shims/layer/CMakeLists.txt
reactos/dll/appcompat/shims/layer/dispmode.c [new file with mode: 0644]

index b0424f2..d18ee3b 100644 (file)
@@ -4,6 +4,7 @@ include_directories(${SHIMLIB_DIR})
 spec2def(aclayers.dll layer.spec)
 
 list(APPEND SOURCE
+    dispmode.c
     versionlie.c
     main.c
     layer.spec)
@@ -14,5 +15,5 @@ add_library(aclayers SHARED
 
 set_module_type(aclayers win32dll)
 target_link_libraries(aclayers shimlib)
-add_importlibs(aclayers msvcrt kernel32 ntdll)
+add_importlibs(aclayers user32 msvcrt kernel32 ntdll)
 add_cd_file(TARGET aclayers DESTINATION reactos/AppPatch FOR all)
diff --git a/reactos/dll/appcompat/shims/layer/dispmode.c b/reactos/dll/appcompat/shims/layer/dispmode.c
new file mode 100644 (file)
index 0000000..64e2250
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Shim library
+ * FILE:            dll/appcompat/shims/layer/dispmode.c
+ * PURPOSE:         Display settings related shims
+ * PROGRAMMER:      Mark Jansen
+ */
+
+#include <windows.h>
+#include <shimlib.h>
+#include <strsafe.h>
+
+
+#define SHIM_NS         Force8BitColor
+#include <setup_shim.inl>
+
+#define SHIM_NUM_HOOKS  0
+#define SHIM_NOTIFY_FN SHIM_OBJ_NAME(Notify)
+
+BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason, PVOID ptr)
+{
+    if (fdwReason == SHIM_REASON_INIT)
+    {
+        DEVMODEA dm = { { 0 } };
+        dm.dmSize = sizeof(dm);
+        if (EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm) &&
+            dm.dmBitsPerPel != 8)
+        {
+            dm.dmBitsPerPel = 8;
+            dm.dmFields |= DM_BITSPERPEL;
+            ChangeDisplaySettingsA(&dm, CDS_FULLSCREEN);
+        }
+    }
+    return TRUE;
+}
+
+#include <implement_shim.inl>
+
+
+
+#define SHIM_NS         Force640x480
+#include <setup_shim.inl>
+
+#define SHIM_NUM_HOOKS  0
+#define SHIM_NOTIFY_FN SHIM_OBJ_NAME(Notify)
+
+BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason, PVOID ptr)
+{
+    if (fdwReason == SHIM_REASON_INIT)
+    {
+        DEVMODEA dm = { { 0 } };
+        dm.dmSize = sizeof(dm);
+        if (EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm) &&
+            (dm.dmPelsWidth != 640 || dm.dmPelsHeight != 480))
+        {
+            dm.dmPelsWidth = 640;
+            dm.dmPelsHeight = 480;
+            dm.dmFields |= (DM_PELSWIDTH | DM_PELSHEIGHT);
+            ChangeDisplaySettingsA(&dm, CDS_FULLSCREEN);
+        }
+    }
+    return TRUE;
+}
+
+#include <implement_shim.inl>
+
+