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