ReactOS  0.4.13-dev-563-g0561610
console.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Console Server DLL
4  * FILE: win32ss/user/winsrv/consrv_new/console.c
5  * PURPOSE: Console Management Functions
6  * PROGRAMMERS: Gé van Geldorp
7  * Jeffrey Morlan
8  * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
9  */
10 
11 /* INCLUDES *******************************************************************/
12 
13 #include "consrv.h"
14 #include "include/conio.h"
15 #include "include/conio2.h"
16 #include "handle.h"
17 #include "procinit.h"
18 #include "alias.h"
19 #include "coninput.h"
20 #include "conoutput.h"
21 #include "lineinput.h"
22 #include "include/settings.h"
23 
24 #include "frontends/gui/guiterm.h"
25 #ifdef TUITERM_COMPILE
26 #include "frontends/tui/tuiterm.h"
27 #endif
28 
29 #include "include/console.h"
30 #include "console.h"
31 #include "resource.h"
32 
33 #define NDEBUG
34 #include <debug.h>
35 
36 
37 /* GLOBALS ********************************************************************/
38 
39 /***************/
40 #ifdef TUITERM_COMPILE
42 TuiLoadFrontEnd(IN OUT PFRONTEND FrontEnd,
44  IN OUT PVOID ExtraConsoleInfo,
47 TuiUnloadFrontEnd(IN OUT PFRONTEND FrontEnd);
48 #endif
49 
53  IN OUT PVOID ExtraConsoleInfo,
57 /***************/
58 
59 typedef
62  IN OUT PVOID ExtraConsoleInfo,
64 
65 typedef
67 
68 /*
69  * If we are not in GUI-mode, start the text-mode terminal emulator.
70  * If we fail, try to start the GUI-mode terminal emulator.
71  *
72  * Try to open the GUI-mode terminal emulator. Two cases are possible:
73  * - We are in GUI-mode, therefore GuiMode == TRUE, the previous test-case
74  * failed and we start GUI-mode terminal emulator.
75  * - We are in text-mode, therefore GuiMode == FALSE, the previous test-case
76  * succeeded BUT we failed at starting text-mode terminal emulator.
77  * Then GuiMode was switched to TRUE in order to try to open the GUI-mode
78  * terminal emulator (Win32k will automatically switch to graphical mode,
79  * therefore no additional code is needed).
80  */
81 
82 /*
83  * NOTE: Each entry of the table should be retrieved when loading a front-end
84  * (examples of the CSR servers which register some data for CSRSS).
85  */
86 struct
87 {
92 {
93 #ifdef TUITERM_COMPILE
94  {"TUI", TuiLoadFrontEnd, TuiUnloadFrontEnd},
95 #endif
97 
98 // {"Not found", 0, NULL}
99 };
100 
101 
102 /* PRIVATE FUNCTIONS **********************************************************/
103 
104 #if 0000
107 {
108  Console->PauseFlags |= Flags;
109  if (!Console->UnpauseEvent)
110  Console->UnpauseEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
111 }
112 
115 {
116  Console->PauseFlags &= ~Flags;
117 
118  // if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0)
119  if (Console->PauseFlags == 0 && Console->UnpauseEvent)
120  {
121  SetEvent(Console->UnpauseEvent);
122  CloseHandle(Console->UnpauseEvent);
123  Console->UnpauseEvent = NULL;
124 
125  CsrNotifyWait(&Console->WriteWaitQueue,
126  WaitAll,
127  NULL,
128  NULL);
129  if (!IsListEmpty(&Console->WriteWaitQueue))
130  {
131  CsrDereferenceWait(&Console->WriteWaitQueue);
132  }
133  }
134 }
135 #endif
136 
137 
140  PCONSOLE* Console,
141  BOOL LockConsole)
142 {
144  PCONSOLE ProcessConsole;
145 
146  ASSERT(Console);
147  *Console = NULL;
148 
149  // RtlEnterCriticalSection(&ProcessData->HandleTableLock);
150 
151  Status = ConDrvGetConsole(&ProcessConsole, ProcessData->ConsoleHandle, LockConsole);
152  if (NT_SUCCESS(Status)) *Console = ProcessConsole;
153 
154  // RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
155  return Status;
156 }
157 
160  BOOL WasConsoleLocked)
161 {
162  /* Just call the driver*/
163  ConDrvReleaseConsole(Console, WasConsoleLocked);
164 }
165 
166 
168 ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
169  OUT PCONSOLE* NewConsole,
170  IN OUT PCONSOLE_START_INFO ConsoleStartInfo,
171  IN ULONG ConsoleLeaderProcessId)
172 {
174  HANDLE ConsoleHandle;
177  SIZE_T Length = 0;
178  ULONG i = 0;
179  FRONTEND FrontEnd;
180 
181  if (NewConsole == NULL || ConsoleStartInfo == NULL)
183 
184  *NewConsole = NULL;
185 
186  /*
187  * Load the console settings
188  */
189 
190  /* 1. Load the default settings */
191  ConSrvGetDefaultSettings(&ConsoleInfo, ConsoleLeaderProcessId);
192 
193  /* 2. Get the title of the console (initialize ConsoleInfo.ConsoleTitle) */
194  Length = min(wcslen(ConsoleStartInfo->ConsoleTitle),
195  sizeof(ConsoleInfo.ConsoleTitle) / sizeof(ConsoleInfo.ConsoleTitle[0]) - 1);
196  wcsncpy(ConsoleInfo.ConsoleTitle, ConsoleStartInfo->ConsoleTitle, Length);
197  ConsoleInfo.ConsoleTitle[Length] = L'\0';
198 
199 
200  /*
201  * Choose an adequate terminal front-end to load, and load it
202  */
204  for (i = 0; i < sizeof(FrontEndLoadingMethods) / sizeof(FrontEndLoadingMethods[0]); ++i)
205  {
206  DPRINT("CONSRV: Trying to load %s terminal emulator...\n", FrontEndLoadingMethods[i].FrontEndName);
207  Status = FrontEndLoadingMethods[i].FrontEndLoad(&FrontEnd,
208  &ConsoleInfo,
209  ConsoleStartInfo,
210  ConsoleLeaderProcessId);
211  if (NT_SUCCESS(Status))
212  {
213  DPRINT("CONSRV: %s terminal emulator loaded successfully\n", FrontEndLoadingMethods[i].FrontEndName);
214  break;
215  }
216  else
217  {
218  DPRINT1("CONSRV: Loading %s terminal emulator failed, Status = 0x%08lx , continuing...\n", FrontEndLoadingMethods[i].FrontEndName, Status);
219  }
220  }
221 
222  if (!NT_SUCCESS(Status))
223  {
224  DPRINT1("CONSRV: Failed to initialize a frontend, Status = 0x%08lx\n", Status);
225  return Status;
226  }
227 
228  DPRINT("CONSRV: Frontend initialized\n");
229 
230 
231 /******************************************************************************/
232  /*
233  * 4. Load the remaining console settings via the registry.
234  */
235  if ((ConsoleStartInfo->dwStartupFlags & STARTF_TITLEISLINKNAME) == 0)
236  {
237  /*
238  * Either we weren't created by an app launched via a shell-link,
239  * or we failed to load shell-link console properties.
240  * Therefore, load the console infos for the application from the registry.
241  */
242  ConSrvReadUserSettings(&ConsoleInfo, ConsoleLeaderProcessId);
243 
244  /*
245  * Now, update them with the properties the user might gave to us
246  * via the STARTUPINFO structure before calling CreateProcess
247  * (and which was transmitted via the ConsoleStartInfo structure).
248  * We therefore overwrite the values read in the registry.
249  */
250  if (ConsoleStartInfo->dwStartupFlags & STARTF_USEFILLATTRIBUTE)
251  {
252  ConsoleInfo.ScreenAttrib = (USHORT)ConsoleStartInfo->FillAttribute;
253  }
254  if (ConsoleStartInfo->dwStartupFlags & STARTF_USECOUNTCHARS)
255  {
256  ConsoleInfo.ScreenBufferSize = ConsoleStartInfo->ScreenBufferSize;
257  }
258  if (ConsoleStartInfo->dwStartupFlags & STARTF_USESIZE)
259  {
260  // ConsoleInfo.ConsoleSize = ConsoleStartInfo->ConsoleWindowSize;
261  ConsoleInfo.ConsoleSize.X = (SHORT)ConsoleStartInfo->ConsoleWindowSize.cx;
262  ConsoleInfo.ConsoleSize.Y = (SHORT)ConsoleStartInfo->ConsoleWindowSize.cy;
263  }
264  }
265 
266  /* Set-up the code page */
267  ConsoleInfo.CodePage = GetOEMCP();
268 /******************************************************************************/
269 
270  Status = ConDrvInitConsole(&ConsoleHandle,
271  &Console,
272  &ConsoleInfo,
273  ConsoleLeaderProcessId);
274  if (!NT_SUCCESS(Status))
275  {
276  DPRINT1("Creating a new console failed, Status = 0x%08lx\n", Status);
277  FrontEndLoadingMethods[i].FrontEndUnload(&FrontEnd);
278  return Status;
279  }
280 
281  ASSERT(Console);
282  DPRINT("Console initialized\n");
283 
284  Status = ConDrvRegisterFrontEnd(Console, &FrontEnd);
285  if (!NT_SUCCESS(Status))
286  {
287  DPRINT1("Failed to register frontend to the given console, Status = 0x%08lx\n", Status);
289  FrontEndLoadingMethods[i].FrontEndUnload(&FrontEnd);
290  return Status;
291  }
292  DPRINT("FrontEnd registered\n");
293 
294  /* Return the newly created console to the caller and a success code too */
295  *NewConsoleHandle = ConsoleHandle;
296  *NewConsole = Console;
297  return STATUS_SUCCESS;
298 }
299 
300 VOID WINAPI
302 {
303  DPRINT("ConSrvDeleteConsole\n");
304 
305  /* Just call the driver. ConSrvDeregisterFrontEnd is called on-demand. */
307 }
308 
309 
310 /* PUBLIC SERVER APIS *********************************************************/
311 
312 CSR_API(SrvAllocConsole)
313 {
315  PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AllocConsoleRequest;
316  PCSR_PROCESS CsrProcess = CsrGetClientThread()->Process;
317  PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess);
318 
319  if (ProcessData->ConsoleHandle != NULL)
320  {
321  DPRINT1("Process already has a console\n");
322  return STATUS_ACCESS_DENIED;
323  }
324 
325  if (!CsrValidateMessageBuffer(ApiMessage,
326  (PVOID*)&AllocConsoleRequest->ConsoleStartInfo,
327  1,
328  sizeof(CONSOLE_START_INFO)))
329  {
331  }
332 
333  /* Initialize a new Console owned by the Console Leader Process */
334  Status = ConSrvAllocateConsole(ProcessData,
335  &AllocConsoleRequest->InputHandle,
336  &AllocConsoleRequest->OutputHandle,
337  &AllocConsoleRequest->ErrorHandle,
338  AllocConsoleRequest->ConsoleStartInfo);
339  if (!NT_SUCCESS(Status))
340  {
341  DPRINT1("Console allocation failed\n");
342  return Status;
343  }
344 
345  /* Return the console handle and the input wait handle to the caller */
346  AllocConsoleRequest->ConsoleHandle = ProcessData->ConsoleHandle;
347  AllocConsoleRequest->InputWaitHandle = ProcessData->ConsoleEvent;
348 
349  /* Set the Property-Dialog and Control-Dispatcher handlers */
350  ProcessData->PropDispatcher = AllocConsoleRequest->PropDispatcher;
351  ProcessData->CtrlDispatcher = AllocConsoleRequest->CtrlDispatcher;
352 
353  return STATUS_SUCCESS;
354 }
355 
356 CSR_API(SrvAttachConsole)
357 {
359  PCONSOLE_ATTACHCONSOLE AttachConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AttachConsoleRequest;
360  PCSR_PROCESS SourceProcess = NULL; // The parent process.
361  PCSR_PROCESS TargetProcess = CsrGetClientThread()->Process; // Ourselves.
362  HANDLE ProcessId = ULongToHandle(AttachConsoleRequest->ProcessId);
363  PCONSOLE_PROCESS_DATA SourceProcessData, TargetProcessData;
364 
365  TargetProcessData = ConsoleGetPerProcessData(TargetProcess);
366 
367  if (TargetProcessData->ConsoleHandle != NULL)
368  {
369  DPRINT1("Process already has a console\n");
370  return STATUS_ACCESS_DENIED;
371  }
372 
373  /* Check whether we try to attach to the parent's console */
374  if (ProcessId == ULongToHandle(ATTACH_PARENT_PROCESS))
375  {
376  PROCESS_BASIC_INFORMATION ProcessInfo;
377  ULONG Length = sizeof(ProcessInfo);
378 
379  /* Get the real parent's ID */
380 
383  &ProcessInfo,
384  Length, &Length);
385  if (!NT_SUCCESS(Status))
386  {
387  DPRINT1("SrvAttachConsole - Cannot retrieve basic process info, Status = %lu\n", Status);
388  return Status;
389  }
390 
392  }
393 
394  /* Lock the source process via its PID */
395  Status = CsrLockProcessByClientId(ProcessId, &SourceProcess);
396  if (!NT_SUCCESS(Status)) return Status;
397 
398  SourceProcessData = ConsoleGetPerProcessData(SourceProcess);
399 
400  if (SourceProcessData->ConsoleHandle == NULL)
401  {
403  goto Quit;
404  }
405 
406  /*
407  * Inherit the console from the parent,
408  * if any, otherwise return an error.
409  */
410  Status = ConSrvInheritConsole(TargetProcessData,
411  SourceProcessData->ConsoleHandle,
412  TRUE,
413  &AttachConsoleRequest->InputHandle,
414  &AttachConsoleRequest->OutputHandle,
415  &AttachConsoleRequest->ErrorHandle);
416  if (!NT_SUCCESS(Status))
417  {
418  DPRINT1("Console inheritance failed\n");
419  goto Quit;
420  }
421 
422  /* Return the console handle and the input wait handle to the caller */
423  AttachConsoleRequest->ConsoleHandle = TargetProcessData->ConsoleHandle;
424  AttachConsoleRequest->InputWaitHandle = TargetProcessData->ConsoleEvent;
425 
426  /* Set the Property-Dialog and Control-Dispatcher handlers */
427  TargetProcessData->PropDispatcher = AttachConsoleRequest->PropDispatcher;
428  TargetProcessData->CtrlDispatcher = AttachConsoleRequest->CtrlDispatcher;
429 
431 
432 Quit:
433  /* Unlock the "source" process and exit */
434  CsrUnlockProcess(SourceProcess);
435  return Status;
436 }
437 
438 CSR_API(SrvFreeConsole)
439 {
441  return STATUS_SUCCESS;
442 }
443 
447  OUT PULONG ConsoleMode);
448 CSR_API(SrvGetConsoleMode)
449 {
451  PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
453 
455  ConsoleModeRequest->ConsoleHandle,
456  &Object, NULL, GENERIC_READ, TRUE, 0);
457  if (!NT_SUCCESS(Status)) return Status;
458 
460  &ConsoleModeRequest->ConsoleMode);
461 
463  return Status;
464 }
465 
469  IN ULONG ConsoleMode);
470 CSR_API(SrvSetConsoleMode)
471 {
473  PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
475 
477  ConsoleModeRequest->ConsoleHandle,
478  &Object, NULL, GENERIC_WRITE, TRUE, 0);
479  if (!NT_SUCCESS(Status)) return Status;
480 
482  ConsoleModeRequest->ConsoleMode);
483 
485  return Status;
486 }
487 
490  IN OUT PWCHAR Title,
491  IN OUT PULONG BufLength);
492 CSR_API(SrvGetConsoleTitle)
493 {
495  PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
497 
498  if (!CsrValidateMessageBuffer(ApiMessage,
499  (PVOID)&TitleRequest->Title,
500  TitleRequest->Length,
501  sizeof(BYTE)))
502  {
504  }
505 
507  if (!NT_SUCCESS(Status))
508  {
509  DPRINT1("Can't get console, status %lx\n", Status);
510  return Status;
511  }
512 
514  TitleRequest->Title,
515  &TitleRequest->Length);
516 
518  return Status;
519 }
520 
523  IN PWCHAR Title,
524  IN ULONG BufLength);
525 CSR_API(SrvSetConsoleTitle)
526 {
528  PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
530 
531  if (!CsrValidateMessageBuffer(ApiMessage,
532  (PVOID)&TitleRequest->Title,
533  TitleRequest->Length,
534  sizeof(BYTE)))
535  {
537  }
538 
540  if (!NT_SUCCESS(Status))
541  {
542  DPRINT1("Can't get console, status %lx\n", Status);
543  return Status;
544  }
545 
547  TitleRequest->Title,
548  TitleRequest->Length);
549 
551 
553  return Status;
554 }
555 
558  OUT PUINT CodePage,
559  IN BOOLEAN InputCP);
560 CSR_API(SrvGetConsoleCP)
561 {
563  PCONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest;
565 
566  DPRINT("SrvGetConsoleCP, getting %s Code Page\n",
567  ConsoleCPRequest->InputCP ? "Input" : "Output");
568 
570  if (!NT_SUCCESS(Status)) return Status;
571 
573  &ConsoleCPRequest->CodePage,
574  ConsoleCPRequest->InputCP);
575 
577  return Status;
578 }
579 
582  IN UINT CodePage,
583  IN BOOLEAN InputCP);
584 CSR_API(SrvSetConsoleCP)
585 {
587  PCONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest;
589 
590  DPRINT("SrvSetConsoleCP, setting %s Code Page\n",
591  ConsoleCPRequest->InputCP ? "Input" : "Output");
592 
594  if (!NT_SUCCESS(Status)) return Status;
595 
597  ConsoleCPRequest->CodePage,
598  ConsoleCPRequest->InputCP);
599 
601  return Status;
602 }
603 
606  IN OUT PULONG ProcessIdsList,
607  IN ULONG MaxIdListItems,
608  OUT PULONG ProcessIdsTotal);
609 CSR_API(SrvGetConsoleProcessList)
610 {
612  PCONSOLE_GETPROCESSLIST GetProcessListRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetProcessListRequest;
614 
615  if (!CsrValidateMessageBuffer(ApiMessage,
616  (PVOID)&GetProcessListRequest->pProcessIds,
617  GetProcessListRequest->nMaxIds,
618  sizeof(DWORD)))
619  {
621  }
622 
624  if (!NT_SUCCESS(Status)) return Status;
625 
627  GetProcessListRequest->pProcessIds,
628  GetProcessListRequest->nMaxIds,
629  &GetProcessListRequest->nProcessIdsTotal);
630 
632  return Status;
633 }
634 
635 CSR_API(SrvGenerateConsoleCtrlEvent)
636 {
638  PCONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GenerateCtrlEventRequest;
640 
642  if (!NT_SUCCESS(Status)) return Status;
643 
645  GenerateCtrlEventRequest->ProcessGroup,
646  GenerateCtrlEventRequest->Event);
647 
649  return Status;
650 }
651 
652 /* EOF */
#define CreateEvent
Definition: winbase.h:3562
HANDLE ConsoleHandle
Definition: consrv.h:45
#define IN
Definition: typedefs.h:38
#define ULongToHandle(h)
Definition: basetsd.h:81
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
NTSTATUS NTAPI ConDrvConsoleProcessCtrlEvent(IN PCONSOLE Console, IN ULONG ProcessGroupId, IN ULONG Event)
Definition: console.c:1069
#define ConioChangeTitle(Console)
Definition: conio2.h:29
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI ConDrvGetConsoleTitle(IN PCONSOLE Console, IN OUT PWCHAR Title, IN OUT PULONG BufLength)
Definition: console.c:960
#define CloseHandle
Definition: compat.h:398
VOID ConioUnpause(PCONSRV_CONSOLE Console, UINT Flags)
Definition: console.c:250
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
char CHAR
Definition: xmlstorage.h:175
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
NTSTATUS NTAPI ConDrvGetConsoleProcessList(IN PCONSOLE Console, IN OUT PULONG ProcessIdsList, IN ULONG MaxIdListItems, OUT PULONG ProcessIdsTotal)
Definition: console.c:1040
FRONTEND_LOAD FrontEndLoad
Definition: console.c:89
#define STARTF_USEFILLATTRIBUTE
Definition: winbase.h:476
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
CSR_API(SrvAllocConsole)
Definition: console.c:986
uint16_t * PWCHAR
Definition: typedefs.h:54
NTSTATUS NTAPI ConDrvGetConsoleMode(IN PCONSOLE Console, IN PCONSOLE_IO_OBJECT Object, OUT PULONG ConsoleMode)
Definition: console.c:426
NTSTATUS(NTAPI * FRONTEND_UNLOAD)(IN OUT PFRONTEND FrontEnd)
Definition: console.c:66
#define FASTCALL
Definition: nt_native.h:50
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
VOID NTAPI ConDrvReleaseConsole(IN PCONSOLE Console, IN BOOLEAN WasConsoleLocked)
Definition: console.c:402
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
BOOLEAN NTAPI CsrNotifyWait(IN PLIST_ENTRY WaitList, IN BOOLEAN NotifyAll, IN PVOID WaitArgument1, IN PVOID WaitArgument2)
Definition: wait.c:388
NTSTATUS ConSrvInheritConsole(PCONSOLE_PROCESS_DATA ProcessData, HANDLE ConsoleHandle, BOOLEAN CreateNewHandlesTable, PHANDLE pInputHandle, PHANDLE pOutputHandle, PHANDLE pErrorHandle, PCONSOLE_START_INFO ConsoleStartInfo)
Definition: handle.c:605
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
NTSTATUS NTAPI ConDrvSetConsoleMode(IN PCONSOLE Console, IN PCONSOLE_IO_OBJECT Object, IN ULONG ConsoleMode)
Definition: console.c:459
NTSTATUS NTAPI ConDrvRegisterFrontEnd(IN PCONSOLE Console, IN PFRONTEND FrontEnd)
Definition: console.c:667
LPTHREAD_START_ROUTINE CtrlDispatcher
Definition: consrv.h:73
VOID NTAPI ConDrvDeleteConsole(IN PCONSOLE Console)
Definition: console.c:327
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
struct @4135 FrontEndLoadingMethods[]
BOOL ConSrvReadUserSettings(IN OUT PCONSOLE_INFO ConsoleInfo, IN DWORD ProcessId)
Definition: settings.c:194
unsigned int BOOL
Definition: ntddk_ex.h:94
short SHORT
Definition: pedump.c:59
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSTATUS ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData)
Definition: handle.c:735
HANDLE ProcessHandle
Definition: csrsrv.h:46
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI CsrLockProcessByClientId(IN HANDLE Pid, OUT PCSR_PROCESS *CsrProcess OPTIONAL)
void DPRINT(...)
Definition: polytest.cpp:61
ULONG_PTR InheritedFromUniqueProcessId
Definition: pstypes.h:340
NTSTATUS NTAPI ConSrvInitConsole(OUT PHANDLE NewConsoleHandle, OUT PCONSRV_CONSOLE *NewConsole, IN OUT PCONSOLE_INIT_INFO ConsoleInitInfo, IN PCSR_PROCESS ConsoleLeaderProcess)
Definition: console.c:511
static const WCHAR Title[]
Definition: oid.c:1259
static DWORD
Definition: console.c:27
NTSTATUS NTAPI ConDrvSetConsoleTitle(IN PCONSOLE Console, IN PWCHAR Title, IN ULONG BufLength)
Definition: console.c:983
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define WINAPI
Definition: msvc.h:8
FRONTEND_UNLOAD FrontEndUnload
Definition: console.c:90
NTSTATUS NTAPI GuiUnloadFrontEnd(IN OUT PFRONTEND FrontEnd)
Definition: guiterm.c:1307
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static IUnknown Object
Definition: main.c:512
VOID NTAPI CsrDereferenceWait(IN PLIST_ENTRY WaitList)
Definition: wait.c:266
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
#define NTSTATUS
Definition: precomp.h:20
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
unsigned char BYTE
Definition: mem.h:68
#define GENERIC_READ
Definition: compat.h:124
CHAR FrontEndName[80]
Definition: console.c:88
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
NTSTATUS ConSrvGetObject(IN PCONSOLE_PROCESS_DATA ProcessData, IN HANDLE Handle, OUT PCONSOLE_IO_OBJECT *Object, OUT PVOID *Entry OPTIONAL, IN ULONG Access, IN BOOLEAN LockConsole, IN CONSOLE_IO_OBJECT_TYPE Type)
Definition: handle.c:401
NTSTATUS NTAPI ConDrvSetConsoleCP(IN PCONSOLE Console, IN UINT CodePage, IN BOOLEAN OutputCP)
Definition: console.c:526
#define STARTF_USECOUNTCHARS
Definition: winbase.h:475
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
HANDLE ConsoleEvent
Definition: consrv.h:62
unsigned short USHORT
Definition: pedump.c:61
static CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
Definition: video.c:47
unsigned int * PULONG
Definition: retypes.h:1
#define min(a, b)
Definition: monoChain.cc:55
NTSTATUS NTAPI ConDrvGetConsoleCP(IN PCONSOLE Console, OUT PUINT CodePage, IN BOOLEAN OutputCP)
Definition: console.c:513
#define STARTF_USESIZE
Definition: winbase.h:473
unsigned int UINT
Definition: ndis.h:50
LPTHREAD_START_ROUTINE PropDispatcher
Definition: consrv.h:74
VOID NTAPI ConSrvDeleteConsole(PCONSRV_CONSOLE Console)
Definition: console.c:771
CConsole Console
#define DPRINT1
Definition: precomp.h:8
NTSTATUS ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData, PHANDLE pInputHandle, PHANDLE pOutputHandle, PHANDLE pErrorHandle, PCONSOLE_INIT_INFO ConsoleInitInfo)
Definition: handle.c:474
VOID ConioPause(PCONSRV_CONSOLE Console, UINT Flags)
Definition: console.c:243
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI ConDrvInitConsole(OUT PCONSOLE *NewConsole, IN PCONSOLE_INFO ConsoleInfo)
Definition: console.c:163
#define OUT
Definition: typedefs.h:39
VOID ConSrvReleaseObject(IN PCONSOLE_IO_OBJECT Object, IN BOOLEAN IsConsoleLocked)
Definition: handle.c:465
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI GuiLoadFrontEnd(IN OUT PFRONTEND FrontEnd, IN OUT PCONSOLE_INFO ConsoleInfo, IN OUT PVOID ExtraConsoleInfo, IN ULONG ProcessId)
Definition: guiterm.c:2900
NTSTATUS(NTAPI * FRONTEND_LOAD)(IN OUT PFRONTEND FrontEnd, IN OUT PCONSOLE_INFO ConsoleInfo, IN OUT PVOID ExtraConsoleInfo, IN ULONG ProcessId)
Definition: console.c:60
return STATUS_SUCCESS
Definition: btrfs.c:2777
NTSTATUS NTAPI ConDrvGetConsole(OUT PCONSOLE *Console, IN HANDLE ConsoleHandle, IN BOOLEAN LockConsole)
Definition: console.c:378
NTSTATUS NTAPI CsrUnlockProcess(IN PCSR_PROCESS CsrProcess)
Definition: procsup.c:1398
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
unsigned int * PUINT
Definition: ndis.h:50
VOID ConSrvGetDefaultSettings(IN OUT PCONSOLE_INFO ConsoleInfo, IN DWORD ProcessId)
Definition: settings.c:393
PCONSOLE_START_INFO ConsoleStartInfo
Definition: conmsg.h:274
UINT WINAPI GetOEMCP(VOID)
Definition: nls.c:2184