xref: /reactos/win32ss/user/winsrv/concfg/settings.h (revision c2c66aff)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * COPYRIGHT:       See COPYING in the top level directory
3*c2c66affSColin Finck  * PROJECT:         ReactOS Console Server DLL
4*c2c66affSColin Finck  * FILE:            win32ss/user/winsrv/concfg/settings.h
5*c2c66affSColin Finck  * PURPOSE:         Public Console Settings Management Interface
6*c2c66affSColin Finck  * PROGRAMMERS:     Johannes Anderwald
7*c2c66affSColin Finck  *                  Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8*c2c66affSColin Finck  */
9*c2c66affSColin Finck 
10*c2c66affSColin Finck #pragma once
11*c2c66affSColin Finck 
12*c2c66affSColin Finck /* STRUCTURES *****************************************************************/
13*c2c66affSColin Finck 
14*c2c66affSColin Finck /*
15*c2c66affSColin Finck  * Undocumented message and structure used by Windows' console.dll
16*c2c66affSColin Finck  * for setting console info.
17*c2c66affSColin Finck  * See http://www.catch22.net/sites/default/source/files/setconsoleinfo.c
18*c2c66affSColin Finck  * and http://www.scn.rain.com/~neighorn/PDF/MSBugPaper.pdf
19*c2c66affSColin Finck  * for more information.
20*c2c66affSColin Finck  */
21*c2c66affSColin Finck #define WM_SETCONSOLEINFO   (WM_USER + 201)
22*c2c66affSColin Finck 
23*c2c66affSColin Finck // This shared structure has alignment requirements
24*c2c66affSColin Finck // in order to be compatible with the Windows one.
25*c2c66affSColin Finck #pragma pack(push, 4)
26*c2c66affSColin Finck 
27*c2c66affSColin Finck typedef struct _CONSOLE_STATE_INFO
28*c2c66affSColin Finck {
29*c2c66affSColin Finck     ULONG       cbSize; // Real length of this structure, at least sizeof(_CONSOLE_STATE_INFO).
30*c2c66affSColin Finck                         // The real length takes into account for the real size of the console title.
31*c2c66affSColin Finck 
32*c2c66affSColin Finck     COORD       ScreenBufferSize;
33*c2c66affSColin Finck     COORD       WindowSize;
34*c2c66affSColin Finck     POINT       WindowPosition;
35*c2c66affSColin Finck 
36*c2c66affSColin Finck     COORD       FontSize;
37*c2c66affSColin Finck     ULONG       FontFamily;
38*c2c66affSColin Finck     ULONG       FontWeight;
39*c2c66affSColin Finck     WCHAR       FaceName[LF_FACESIZE];
40*c2c66affSColin Finck 
41*c2c66affSColin Finck     ULONG       CursorSize;
42*c2c66affSColin Finck     BOOL        FullScreen;
43*c2c66affSColin Finck     BOOL        QuickEdit;
44*c2c66affSColin Finck     BOOL        AutoPosition;
45*c2c66affSColin Finck     BOOL        InsertMode;
46*c2c66affSColin Finck 
47*c2c66affSColin Finck     USHORT      ScreenAttributes;
48*c2c66affSColin Finck     USHORT      PopupAttributes;
49*c2c66affSColin Finck     BOOL        HistoryNoDup;
50*c2c66affSColin Finck     ULONG       HistoryBufferSize;
51*c2c66affSColin Finck     ULONG       NumberOfHistoryBuffers;
52*c2c66affSColin Finck 
53*c2c66affSColin Finck     COLORREF    ColorTable[16];
54*c2c66affSColin Finck 
55*c2c66affSColin Finck     ULONG       CodePage;
56*c2c66affSColin Finck     HWND        hWnd;
57*c2c66affSColin Finck 
58*c2c66affSColin Finck     WCHAR       ConsoleTitle[ANYSIZE_ARRAY];
59*c2c66affSColin Finck } CONSOLE_STATE_INFO, *PCONSOLE_STATE_INFO;
60*c2c66affSColin Finck 
61*c2c66affSColin Finck #ifdef _M_IX86
62*c2c66affSColin Finck C_ASSERT(sizeof(CONSOLE_STATE_INFO) == 0xD0);
63*c2c66affSColin Finck #endif
64*c2c66affSColin Finck 
65*c2c66affSColin Finck #pragma pack(pop)
66*c2c66affSColin Finck 
67*c2c66affSColin Finck /*
68*c2c66affSColin Finck  * BYTE Foreground = LOBYTE(Attributes) & 0x0F;
69*c2c66affSColin Finck  * BYTE Background = (LOBYTE(Attributes) & 0xF0) >> 4;
70*c2c66affSColin Finck  */
71*c2c66affSColin Finck #define RGBFromAttrib(Console, Attribute)   ((Console)->Colors[(Attribute) & 0xF])
72*c2c66affSColin Finck #define TextAttribFromAttrib(Attribute)     ( !((Attribute) & COMMON_LVB_REVERSE_VIDEO) ? (Attribute) & 0xF : ((Attribute) >> 4) & 0xF )
73*c2c66affSColin Finck #define BkgdAttribFromAttrib(Attribute)     ( !((Attribute) & COMMON_LVB_REVERSE_VIDEO) ? ((Attribute) >> 4) & 0xF : (Attribute) & 0xF )
74*c2c66affSColin Finck #define MakeAttrib(TextAttrib, BkgdAttrib)  (USHORT)((((BkgdAttrib) & 0xF) << 4) | ((TextAttrib) & 0xF))
75*c2c66affSColin Finck 
76*c2c66affSColin Finck /* FUNCTIONS ******************************************************************/
77*c2c66affSColin Finck 
78*c2c66affSColin Finck BOOLEAN
79*c2c66affSColin Finck ConCfgOpenUserSettings(
80*c2c66affSColin Finck     IN  LPCWSTR ConsoleTitle,
81*c2c66affSColin Finck     OUT PHKEY phSubKey,
82*c2c66affSColin Finck     IN  REGSAM samDesired,
83*c2c66affSColin Finck     IN  BOOLEAN Create);
84*c2c66affSColin Finck 
85*c2c66affSColin Finck BOOLEAN
86*c2c66affSColin Finck ConCfgReadUserSettings(
87*c2c66affSColin Finck     IN OUT PCONSOLE_STATE_INFO ConsoleInfo,
88*c2c66affSColin Finck     IN BOOLEAN DefaultSettings);
89*c2c66affSColin Finck 
90*c2c66affSColin Finck BOOLEAN
91*c2c66affSColin Finck ConCfgWriteUserSettings(
92*c2c66affSColin Finck     IN PCONSOLE_STATE_INFO ConsoleInfo,
93*c2c66affSColin Finck     IN BOOLEAN DefaultSettings);
94*c2c66affSColin Finck 
95*c2c66affSColin Finck VOID
96*c2c66affSColin Finck ConCfgInitDefaultSettings(
97*c2c66affSColin Finck     IN OUT PCONSOLE_STATE_INFO ConsoleInfo);
98*c2c66affSColin Finck 
99*c2c66affSColin Finck VOID
100*c2c66affSColin Finck ConCfgGetDefaultSettings(
101*c2c66affSColin Finck     IN OUT PCONSOLE_STATE_INFO ConsoleInfo);
102*c2c66affSColin Finck 
103*c2c66affSColin Finck /* EOF */
104