xref: /reactos/dll/appcompat/shims/layer/dispmode.c (revision c2c66aff)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * PROJECT:     ReactOS 'Layers' Shim library
3*c2c66affSColin Finck  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4*c2c66affSColin Finck  * PURPOSE:     Display settings related shims
5*c2c66affSColin Finck  * COPYRIGHT:   Copyright 2016,2017 Mark Jansen (mark.jansen@reactos.org)
6*c2c66affSColin Finck  */
7*c2c66affSColin Finck 
8*c2c66affSColin Finck #define WIN32_NO_STATUS
9*c2c66affSColin Finck #include <windef.h>
10*c2c66affSColin Finck #include <winbase.h>
11*c2c66affSColin Finck #include <wingdi.h>
12*c2c66affSColin Finck #include <winuser.h>
13*c2c66affSColin Finck #include <shimlib.h>
14*c2c66affSColin Finck 
15*c2c66affSColin Finck 
16*c2c66affSColin Finck #define SHIM_NS         Force8BitColor
17*c2c66affSColin Finck #include <setup_shim.inl>
18*c2c66affSColin Finck 
19*c2c66affSColin Finck #define SHIM_NUM_HOOKS  0
20*c2c66affSColin Finck #define SHIM_NOTIFY_FN SHIM_OBJ_NAME(Notify)
21*c2c66affSColin Finck 
SHIM_OBJ_NAME(Notify)22*c2c66affSColin Finck BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason, PVOID ptr)
23*c2c66affSColin Finck {
24*c2c66affSColin Finck     if (fdwReason == SHIM_REASON_INIT)
25*c2c66affSColin Finck     {
26*c2c66affSColin Finck         DEVMODEA dm = { { 0 } };
27*c2c66affSColin Finck         dm.dmSize = sizeof(dm);
28*c2c66affSColin Finck         if (EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm) &&
29*c2c66affSColin Finck             dm.dmBitsPerPel != 8)
30*c2c66affSColin Finck         {
31*c2c66affSColin Finck             dm.dmBitsPerPel = 8;
32*c2c66affSColin Finck             dm.dmFields |= DM_BITSPERPEL;
33*c2c66affSColin Finck             ChangeDisplaySettingsA(&dm, CDS_FULLSCREEN);
34*c2c66affSColin Finck         }
35*c2c66affSColin Finck     }
36*c2c66affSColin Finck     return TRUE;
37*c2c66affSColin Finck }
38*c2c66affSColin Finck 
39*c2c66affSColin Finck #include <implement_shim.inl>
40*c2c66affSColin Finck 
41*c2c66affSColin Finck 
42*c2c66affSColin Finck 
43*c2c66affSColin Finck #define SHIM_NS         Force640x480
44*c2c66affSColin Finck #include <setup_shim.inl>
45*c2c66affSColin Finck 
46*c2c66affSColin Finck #define SHIM_NUM_HOOKS  0
47*c2c66affSColin Finck #define SHIM_NOTIFY_FN SHIM_OBJ_NAME(Notify)
48*c2c66affSColin Finck 
SHIM_OBJ_NAME(Notify)49*c2c66affSColin Finck BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason, PVOID ptr)
50*c2c66affSColin Finck {
51*c2c66affSColin Finck     if (fdwReason == SHIM_REASON_INIT)
52*c2c66affSColin Finck     {
53*c2c66affSColin Finck         DEVMODEA dm = { { 0 } };
54*c2c66affSColin Finck         dm.dmSize = sizeof(dm);
55*c2c66affSColin Finck         if (EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm) &&
56*c2c66affSColin Finck             (dm.dmPelsWidth != 640 || dm.dmPelsHeight != 480))
57*c2c66affSColin Finck         {
58*c2c66affSColin Finck             dm.dmPelsWidth = 640;
59*c2c66affSColin Finck             dm.dmPelsHeight = 480;
60*c2c66affSColin Finck             dm.dmFields |= (DM_PELSWIDTH | DM_PELSHEIGHT);
61*c2c66affSColin Finck             ChangeDisplaySettingsA(&dm, CDS_FULLSCREEN);
62*c2c66affSColin Finck         }
63*c2c66affSColin Finck     }
64*c2c66affSColin Finck     return TRUE;
65*c2c66affSColin Finck }
66*c2c66affSColin Finck 
67*c2c66affSColin Finck #include <implement_shim.inl>
68*c2c66affSColin Finck 
69*c2c66affSColin Finck 
70