ReactOS 0.4.16-dev-321-g63bb46a
frontendctl.c File Reference
#include "consrv.h"
#include <debug.h>
Include dependency graph for frontendctl.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 CON_API (SrvGetConsoleHardwareState, CONSOLE_GETSETHWSTATE, HardwareStateRequest)
 
 CON_API (SrvSetConsoleHardwareState, CONSOLE_GETSETHWSTATE, HardwareStateRequest)
 
 CON_API (SrvGetConsoleDisplayMode, CONSOLE_GETDISPLAYMODE, GetDisplayModeRequest)
 
 CON_API (SrvSetConsoleDisplayMode, CONSOLE_SETDISPLAYMODE, SetDisplayModeRequest)
 
 CON_API (SrvGetLargestConsoleWindowSize, CONSOLE_GETLARGESTWINDOWSIZE, GetLargestWindowSizeRequest)
 
 CON_API (SrvShowConsoleCursor, CONSOLE_SHOWCURSOR, ShowCursorRequest)
 
 CON_API (SrvSetConsoleCursor, CONSOLE_SETCURSOR, SetCursorRequest)
 
 CON_API (SrvConsoleMenuControl, CONSOLE_MENUCONTROL, MenuControlRequest)
 
 CON_API (SrvSetConsoleMenuClose, CONSOLE_SETMENUCLOSE, SetMenuCloseRequest)
 
NTSTATUS NTAPI GetThreadConsoleDesktop (IN ULONG_PTR ThreadId, OUT HDESK *ConsoleDesktop)
 
 CON_API (SrvGetConsoleWindow, CONSOLE_GETWINDOW, GetWindowRequest)
 
 CON_API (SrvSetConsoleIcon, CONSOLE_SETICON, SetIconRequest)
 
 CON_API (SrvGetConsoleSelectionInfo, CONSOLE_GETSELECTIONINFO, GetSelectionInfoRequest)
 
 CON_API (SrvGetConsoleNumberOfFonts, CONSOLE_GETNUMFONTS, GetNumFontsRequest)
 
 CON_API (SrvGetConsoleFontInfo, CONSOLE_GETFONTINFO, GetFontInfoRequest)
 
 CON_API (SrvGetConsoleFontSize, CONSOLE_GETFONTSIZE, GetFontSizeRequest)
 
 CON_API (SrvGetConsoleCurrentFont, CONSOLE_GETCURRENTFONT, GetCurrentFontRequest)
 
 CON_API (SrvSetConsoleFont, CONSOLE_SETFONT, SetFontRequest)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file frontendctl.c.

Function Documentation

◆ CON_API() [1/17]

CON_API ( SrvConsoleMenuControl  ,
CONSOLE_MENUCONTROL  ,
MenuControlRequest   
)

Definition at line 230 of file frontendctl.c.

232{
235
236 Status = ConSrvGetScreenBuffer(ProcessData,
237 MenuControlRequest->OutputHandle,
238 &Buff,
240 TRUE);
241 if (!NT_SUCCESS(Status))
242 return Status;
243
245
246 MenuControlRequest->MenuHandle = TermMenuControl(Console,
247 MenuControlRequest->CmdIdLow,
248 MenuControlRequest->CmdIdHigh);
249
251 return STATUS_SUCCESS;
252}
CConsole Console
LONG NTSTATUS
Definition: precomp.h:26
#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:26
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
#define GENERIC_WRITE
Definition: nt_native.h:90
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _CONSOLE * Console
Definition: conio.h:36
CONSOLE_IO_OBJECT Header
Definition: conio.h:58
#define TermMenuControl(Console, CmdIdLow, CmdIdHigh)
Definition: term.h:64

◆ CON_API() [2/17]

CON_API ( SrvGetConsoleCurrentFont  ,
CONSOLE_GETCURRENTFONT  ,
GetCurrentFontRequest   
)

Definition at line 385 of file frontendctl.c.

387{
390
391 Status = ConSrvGetTextModeBuffer(ProcessData,
392 GetCurrentFontRequest->OutputHandle,
393 &Buff,
395 TRUE);
396 if (!NT_SUCCESS(Status))
397 return Status;
398
400
401 // FIXME!
402 // TermGetCurrentFont(Console, ...);
403 DPRINT1("%s not yet implemented\n", __FUNCTION__);
404 GetCurrentFontRequest->FontIndex = 0;
405
407 return STATUS_SUCCESS;
408}
#define DPRINT1
Definition: precomp.h:8
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define GENERIC_READ
Definition: compat.h:135
#define __FUNCTION__
Definition: types.h:116

◆ CON_API() [3/17]

CON_API ( SrvGetConsoleDisplayMode  ,
CONSOLE_GETDISPLAYMODE  ,
GetDisplayModeRequest   
)

Definition at line 113 of file frontendctl.c.

115{
116 GetDisplayModeRequest->DisplayMode = TermGetDisplayMode(Console);
117 return STATUS_SUCCESS;
118}
#define TermGetDisplayMode(Console)
Definition: term.h:58

◆ CON_API() [4/17]

CON_API ( SrvGetConsoleFontInfo  ,
CONSOLE_GETFONTINFO  ,
GetFontInfoRequest   
)

Definition at line 334 of file frontendctl.c.

336{
339
340 Status = ConSrvGetTextModeBuffer(ProcessData,
341 GetFontInfoRequest->OutputHandle,
342 &Buff,
344 TRUE);
345 if (!NT_SUCCESS(Status))
346 return Status;
347
349
350 // FIXME!
351 // TermGetFontInfo(Console, ...);
352 DPRINT1("%s not yet implemented\n", __FUNCTION__);
353 GetFontInfoRequest->NumFonts = 0;
354
356 return STATUS_SUCCESS;
357}

◆ CON_API() [5/17]

CON_API ( SrvGetConsoleFontSize  ,
CONSOLE_GETFONTSIZE  ,
GetFontSizeRequest   
)

Definition at line 360 of file frontendctl.c.

362{
365
366 Status = ConSrvGetTextModeBuffer(ProcessData,
367 GetFontSizeRequest->OutputHandle,
368 &Buff,
370 TRUE);
371 if (!NT_SUCCESS(Status))
372 return Status;
373
375
376 // FIXME!
377 // TermGetFontSize(Console, ...);
378 DPRINT1("%s not yet implemented\n", __FUNCTION__);
379
381 return STATUS_SUCCESS;
382}

◆ CON_API() [6/17]

CON_API ( SrvGetConsoleHardwareState  ,
CONSOLE_GETSETHWSTATE  ,
HardwareStateRequest   
)

Definition at line 56 of file frontendctl.c.

58{
59#if 0
62
63 Status = ConSrvGetTextModeBuffer(ProcessData,
64 HardwareStateRequest->OutputHandle,
65 &Buff,
67 TRUE);
68 if (!NT_SUCCESS(Status))
69 return Status;
70
72
73 HardwareStateRequest->State = Console->HardwareState;
74
76 return STATUS_SUCCESS;
77#else
80#endif
81}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42

◆ CON_API() [7/17]

CON_API ( SrvGetConsoleNumberOfFonts  ,
CONSOLE_GETNUMFONTS  ,
GetNumFontsRequest   
)

Definition at line 323 of file frontendctl.c.

325{
326 // FIXME!
327 // TermGetNumberOfFonts(Console, ...);
328 DPRINT1("%s not yet implemented\n", __FUNCTION__);
329 GetNumFontsRequest->NumFonts = 0;
330 return STATUS_SUCCESS;
331}

◆ CON_API() [8/17]

CON_API ( SrvGetConsoleSelectionInfo  ,
CONSOLE_GETSELECTIONINFO  ,
GetSelectionInfoRequest   
)

Definition at line 315 of file frontendctl.c.

317{
318 return (TermGetSelectionInfo(Console, &GetSelectionInfoRequest->Info)
320}
#define TermGetSelectionInfo(Console, pSelectionInfo)
Definition: term.h:56
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

◆ CON_API() [9/17]

CON_API ( SrvGetConsoleWindow  ,
CONSOLE_GETWINDOW  ,
GetWindowRequest   
)

Definition at line 299 of file frontendctl.c.

301{
302 GetWindowRequest->WindowHandle = TermGetConsoleWindowHandle(Console);
303 return STATUS_SUCCESS;
304}
#define TermGetConsoleWindowHandle(Console)
Definition: term.h:54

◆ CON_API() [10/17]

CON_API ( SrvGetLargestConsoleWindowSize  ,
CONSOLE_GETLARGESTWINDOWSIZE  ,
GetLargestWindowSizeRequest   
)

Definition at line 152 of file frontendctl.c.

154{
157
158 Status = ConSrvGetTextModeBuffer(ProcessData,
159 GetLargestWindowSizeRequest->OutputHandle,
160 &Buff,
162 TRUE);
163 if (!NT_SUCCESS(Status))
164 return Status;
165
167
168 /*
169 * Retrieve the largest possible console window size, without
170 * taking into account the size of the console screen buffer
171 * (thus differs from ConDrvGetConsoleScreenBufferInfo).
172 */
173 TermGetLargestConsoleWindowSize(Console, &GetLargestWindowSizeRequest->Size);
174
176 return STATUS_SUCCESS;
177}
#define TermGetLargestConsoleWindowSize(Console, pSize)
Definition: term.h:34

◆ CON_API() [11/17]

CON_API ( SrvSetConsoleCursor  ,
CONSOLE_SETCURSOR  ,
SetCursorRequest   
)

Definition at line 203 of file frontendctl.c.

205{
209
210 // NOTE: Tests show that this function is used only for graphics screen buffers
211 // and otherwise it returns FALSE and sets last error to ERROR_INVALID_HANDLE.
212 // I find that behaviour is ridiculous but ok, let's accept it at the moment...
213 Status = ConSrvGetGraphicsBuffer(ProcessData,
214 SetCursorRequest->OutputHandle,
215 &Buff,
217 TRUE);
218 if (!NT_SUCCESS(Status))
219 return Status;
220
222
223 Success = TermSetMouseCursor(Console, SetCursorRequest->CursorHandle);
224
227}
#define ConSrvGetGraphicsBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:19
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TermSetMouseCursor(Console, CursorHandle)
Definition: term.h:62

◆ CON_API() [12/17]

CON_API ( SrvSetConsoleDisplayMode  ,
CONSOLE_SETDISPLAYMODE  ,
SetDisplayModeRequest   
)

Definition at line 121 of file frontendctl.c.

123{
126
127 Status = ConSrvGetScreenBuffer(ProcessData,
128 SetDisplayModeRequest->OutputHandle,
129 &Buff,
131 TRUE);
132 if (!NT_SUCCESS(Status))
133 return Status;
134
136
137 if (TermSetDisplayMode(Console, SetDisplayModeRequest->DisplayMode))
138 {
139 SetDisplayModeRequest->NewSBDim = Buff->ScreenBufferSize;
141 }
142 else
143 {
145 }
146
148 return Status;
149}
COORD ScreenBufferSize
Definition: conio.h:62
#define TermSetDisplayMode(Console, NewMode)
Definition: term.h:60
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ CON_API() [13/17]

CON_API ( SrvSetConsoleFont  ,
CONSOLE_SETFONT  ,
SetFontRequest   
)

Definition at line 411 of file frontendctl.c.

413{
416
417 Status = ConSrvGetTextModeBuffer(ProcessData,
418 SetFontRequest->OutputHandle,
419 &Buff,
421 TRUE);
422 if (!NT_SUCCESS(Status))
423 return Status;
424
426
427 // FIXME!
428 // TermSetFont(Console, ...);
429 DPRINT1("%s not yet implemented\n", __FUNCTION__);
430
432 return STATUS_SUCCESS;
433}

◆ CON_API() [14/17]

CON_API ( SrvSetConsoleHardwareState  ,
CONSOLE_GETSETHWSTATE  ,
HardwareStateRequest   
)

Definition at line 84 of file frontendctl.c.

86{
87#if 0
90
91 Status = ConSrvGetTextModeBuffer(ProcessData,
92 HardwareStateRequest->OutputHandle,
93 &Buff,
95 TRUE);
96 if (!NT_SUCCESS(Status))
97 return Status;
98
100
101 DPRINT("Setting console hardware state.\n");
102 Status = SetConsoleHardwareState(Console, HardwareStateRequest->State);
103
105 return STATUS_SUCCESS;
106#else
109#endif
110}
BOOL WINAPI SetConsoleHardwareState(HANDLE hConsoleOutput, DWORD Flags, DWORD State)
Definition: console.c:944
#define DPRINT
Definition: sndvol32.h:73

◆ CON_API() [15/17]

CON_API ( SrvSetConsoleIcon  ,
CONSOLE_SETICON  ,
SetIconRequest   
)

Definition at line 307 of file frontendctl.c.

309{
310 return (TermChangeIcon(Console, SetIconRequest->IconHandle)
312}
#define TermChangeIcon(Console, IconHandle)
Definition: term.h:50

◆ CON_API() [16/17]

CON_API ( SrvSetConsoleMenuClose  ,
CONSOLE_SETMENUCLOSE  ,
SetMenuCloseRequest   
)

Definition at line 255 of file frontendctl.c.

257{
258 return (TermSetMenuClose(Console, SetMenuCloseRequest->Enable)
260}
#define TermSetMenuClose(Console, Enable)
Definition: term.h:66

◆ CON_API() [17/17]

CON_API ( SrvShowConsoleCursor  ,
CONSOLE_SHOWCURSOR  ,
ShowCursorRequest   
)

Definition at line 180 of file frontendctl.c.

182{
185
186 Status = ConSrvGetScreenBuffer(ProcessData,
187 ShowCursorRequest->OutputHandle,
188 &Buff,
190 TRUE);
191 if (!NT_SUCCESS(Status))
192 return Status;
193
195
196 ShowCursorRequest->RefCount = TermShowMouseCursor(Console, ShowCursorRequest->Show);
197
199 return STATUS_SUCCESS;
200}
#define TermShowMouseCursor(Console, Show)
Definition: term.h:40

◆ GetThreadConsoleDesktop()

NTSTATUS NTAPI GetThreadConsoleDesktop ( IN ULONG_PTR  ThreadId,
OUT HDESK *  ConsoleDesktop 
)

Definition at line 265 of file frontendctl.c.

268{
270 PCSR_THREAD CsrThread;
272
273 /* No console desktop handle by default */
274 *ConsoleDesktop = NULL;
275
276 /* Retrieve and lock the thread */
277 Status = CsrLockThreadByClientId(ULongToHandle(ThreadId), &CsrThread);
278 if (!NT_SUCCESS(Status))
279 return Status;
280
281 ASSERT(CsrThread->Process);
282
283 /* Retrieve the console to which the process is attached, and unlock the thread */
285 &Console, TRUE);
286 CsrUnlockThread(CsrThread);
287
288 if (!NT_SUCCESS(Status))
289 return Status;
290
291 /* Retrieve the console desktop handle, and release the console */
292 *ConsoleDesktop = TermGetThreadConsoleDesktop(Console);
294
295 return STATUS_SUCCESS;
296}
#define ULongToHandle(h)
Definition: basetsd.h:81
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
NTSTATUS NTAPI CsrLockThreadByClientId(IN HANDLE Tid, OUT PCSR_THREAD *CsrThread)
Definition: thredsup.c:965
NTSTATUS NTAPI CsrUnlockThread(IN PCSR_THREAD CsrThread)
Definition: thredsup.c:1075
#define NULL
Definition: types.h:112
PCSR_PROCESS Process
Definition: csrsrv.h:69
#define TermGetThreadConsoleDesktop(Console)
Definition: term.h:52
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:316
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:291

Referenced by CSR_API().