[REACTOS]
[reactos.git] / reactos / win32ss / user / winsrv / consrv / include / settings.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: win32ss/user/winsrv/consrv/include/settings.h
5 * PURPOSE: Public Console Settings Management Interface
6 * PROGRAMMERS: Johannes Anderwald
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 */
9
10 #pragma once
11
12 /* STRUCTURES *****************************************************************/
13
14 #pragma pack(push, 1)
15
16 /*
17 * Structure used to hold terminal-specific information
18 */
19 typedef struct _TERMINAL_INFO
20 {
21 ULONG Size; /* Size of the memory buffer pointed by TermInfo */
22 PVOID TermInfo; /* Address (or offset when talking to console.dll) of the memory buffer holding terminal information */
23 } TERMINAL_INFO, *PTERMINAL_INFO;
24
25 /*
26 * Structure used to hold console information
27 */
28 typedef struct _CONSOLE_INFO
29 {
30 ULONG HistoryBufferSize;
31 ULONG NumberOfHistoryBuffers;
32 BOOLEAN HistoryNoDup;
33
34 BOOLEAN QuickEdit;
35 BOOLEAN InsertMode;
36 ULONG InputBufferSize;
37 COORD ScreenBufferSize;
38 COORD ConsoleSize; /* The size of the console */
39
40 BOOLEAN CursorBlinkOn;
41 BOOLEAN ForceCursorOff;
42 ULONG CursorSize;
43
44 USHORT ScreenAttrib; // CHAR_INFO ScreenFillAttrib
45 USHORT PopupAttrib;
46
47 COLORREF Colors[16]; /* Color palette */
48
49 ULONG CodePage;
50
51 WCHAR ConsoleTitle[MAX_PATH + 1];
52 } CONSOLE_INFO, *PCONSOLE_INFO;
53
54 /*
55 * BYTE Foreground = LOBYTE(Attributes) & 0x0F;
56 * BYTE Background = (LOBYTE(Attributes) & 0xF0) >> 4;
57 */
58 #define RGBFromAttrib(Console, Attribute) ((Console)->Colors[(Attribute) & 0xF])
59 #define TextAttribFromAttrib(Attribute) ( !((Attribute) & COMMON_LVB_REVERSE_VIDEO) ? (Attribute) & 0xF : ((Attribute) >> 4) & 0xF )
60 #define BkgdAttribFromAttrib(Attribute) ( !((Attribute) & COMMON_LVB_REVERSE_VIDEO) ? ((Attribute) >> 4) & 0xF : (Attribute) & 0xF )
61 #define MakeAttrib(TextAttrib, BkgdAttrib) (USHORT)((((BkgdAttrib) & 0xF) << 4) | ((TextAttrib) & 0xF))
62
63 /*
64 * Structure used to communicate with console.dll
65 *
66 * FIXME: It should overlap with the Windows' CONSOLE_STATE_INFO structure
67 * for GUI terminals!!
68 */
69 typedef struct _CONSOLE_PROPS
70 {
71 HWND hConsoleWindow;
72 BOOL ShowDefaultParams;
73
74 BOOLEAN AppliedConfig;
75 DWORD ActiveStaticControl;
76
77 CONSOLE_INFO ci; /* Console-specific informations */
78 TERMINAL_INFO TerminalInfo; /* Frontend-specific parameters */
79 } CONSOLE_PROPS, *PCONSOLE_PROPS;
80
81 #pragma pack(pop)
82
83 /* FUNCTIONS ******************************************************************/
84
85 #ifndef CONSOLE_H__ // If we aren't included by console.dll
86
87 BOOL ConSrvOpenUserSettings(DWORD ProcessId,
88 LPCWSTR ConsoleTitle,
89 PHKEY hSubKey,
90 REGSAM samDesired,
91 BOOL bCreate);
92
93 BOOL ConSrvReadUserSettings(IN OUT PCONSOLE_INFO ConsoleInfo,
94 IN DWORD ProcessId);
95 BOOL ConSrvWriteUserSettings(IN PCONSOLE_INFO ConsoleInfo,
96 IN DWORD ProcessId);
97 VOID ConSrvGetDefaultSettings(IN OUT PCONSOLE_INFO ConsoleInfo,
98 IN DWORD ProcessId);
99 VOID ConSrvApplyUserSettings(IN PCONSOLE Console,
100 IN PCONSOLE_INFO ConsoleInfo);
101
102 #endif
103
104 /* EOF */