ReactOS  0.4.14-dev-1115-gebeeb9d
api.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 CSR_API (SrvAddConsoleAlias)
 
 CSR_API (SrvGetConsoleAlias)
 
 CSR_API (SrvGetConsoleAliases)
 
 CSR_API (SrvGetConsoleAliasesLength)
 
 CSR_API (SrvGetConsoleAliasExes)
 
 CSR_API (SrvGetConsoleAliasExesLength)
 
 CSR_API (SrvReadConsole)
 
 CSR_API (SrvGetConsoleInput)
 
 CSR_API (SrvWriteConsoleInput)
 
 CSR_API (SrvFlushConsoleInputBuffer)
 
 CSR_API (SrvGetConsoleNumberOfInputEvents)
 
 CSR_API (SrvInvalidateBitMapRect)
 
 CSR_API (SrvSetConsolePalette)
 
 CSR_API (SrvReadConsoleOutput)
 
 CSR_API (SrvWriteConsole)
 
 CSR_API (SrvWriteConsoleOutput)
 
 CSR_API (SrvReadConsoleOutputString)
 
 CSR_API (SrvWriteConsoleOutputString)
 
 CSR_API (SrvFillConsoleOutput)
 
 CSR_API (SrvGetConsoleCursorInfo)
 
 CSR_API (SrvSetConsoleCursorInfo)
 
 CSR_API (SrvSetConsoleCursorPosition)
 
 CSR_API (SrvSetConsoleTextAttribute)
 
 CSR_API (SrvCreateConsoleScreenBuffer)
 
 CSR_API (SrvGetConsoleScreenBufferInfo)
 
 CSR_API (SrvSetConsoleActiveScreenBuffer)
 
 CSR_API (SrvSetConsoleScreenBufferSize)
 
 CSR_API (SrvScrollConsoleScreenBuffer)
 
 CSR_API (SrvSetConsoleWindowInfo)
 
 CSR_API (SrvAllocConsole)
 
 CSR_API (SrvAttachConsole)
 
 CSR_API (SrvFreeConsole)
 
 CSR_API (SrvGetConsoleMode)
 
 CSR_API (SrvSetConsoleMode)
 
 CSR_API (SrvGetConsoleTitle)
 
 CSR_API (SrvSetConsoleTitle)
 
 CSR_API (SrvGetConsoleCP)
 
 CSR_API (SrvSetConsoleCP)
 
 CSR_API (SrvGetConsoleProcessList)
 
 CSR_API (SrvGenerateConsoleCtrlEvent)
 
 CSR_API (SrvConsoleNotifyLastClose)
 
 CSR_API (SrvGetConsoleMouseInfo)
 
 CSR_API (SrvSetConsoleKeyShortcuts)
 
 CSR_API (SrvGetConsoleKeyboardLayoutName)
 
 CSR_API (SrvGetConsoleCharType)
 
 CSR_API (SrvSetConsoleLocalEUDC)
 
 CSR_API (SrvSetConsoleCursorMode)
 
 CSR_API (SrvGetConsoleCursorMode)
 
 CSR_API (SrvGetConsoleNlsMode)
 
 CSR_API (SrvSetConsoleNlsMode)
 
 CSR_API (SrvGetConsoleLangId)
 
 CSR_API (SrvGetConsoleHardwareState)
 
 CSR_API (SrvSetConsoleHardwareState)
 
 CSR_API (SrvGetConsoleDisplayMode)
 
 CSR_API (SrvSetConsoleDisplayMode)
 
 CSR_API (SrvGetLargestConsoleWindowSize)
 
 CSR_API (SrvShowConsoleCursor)
 
 CSR_API (SrvSetConsoleCursor)
 
 CSR_API (SrvConsoleMenuControl)
 
 CSR_API (SrvSetConsoleMenuClose)
 
NTSTATUS NTAPI GetThreadConsoleDesktop (IN ULONG_PTR ThreadId, OUT HDESK *ConsoleDesktop)
 
 CSR_API (SrvGetConsoleWindow)
 
 CSR_API (SrvSetConsoleIcon)
 
 CSR_API (SrvGetConsoleSelectionInfo)
 
 CSR_API (SrvGetConsoleNumberOfFonts)
 
 CSR_API (SrvGetConsoleFontInfo)
 
 CSR_API (SrvGetConsoleFontSize)
 
 CSR_API (SrvGetConsoleCurrentFont)
 
 CSR_API (SrvSetConsoleFont)
 
 CSR_API (SrvOpenConsole)
 
 CSR_API (SrvDuplicateHandle)
 
 CSR_API (SrvGetHandleInformation)
 
 CSR_API (SrvSetHandleInformation)
 
 CSR_API (SrvCloseHandle)
 
 CSR_API (SrvVerifyConsoleIoHandle)
 
 CSR_API (SrvGetConsoleCommandHistory)
 
 CSR_API (SrvGetConsoleCommandHistoryLength)
 
 CSR_API (SrvExpungeConsoleCommandHistory)
 
 CSR_API (SrvSetConsoleNumberOfCommands)
 
 CSR_API (SrvGetConsoleHistory)
 
 CSR_API (SrvSetConsoleHistory)
 
 CSR_API (SrvSetConsoleCommandHistoryMode)
 
 CSR_API (SrvRegisterConsoleVDM)
 
 CSR_API (SrvVDMConsoleOperation)
 
 CSR_API (SrvRegisterConsoleOS2)
 
 CSR_API (SrvSetConsoleOS2OemFormat)
 
 CSR_API (SrvRegisterConsoleIME)
 
 CSR_API (SrvUnregisterConsoleIME)
 

Function Documentation

◆ CSR_API() [1/87]

CSR_API ( SrvAddConsoleAlias  )

Definition at line 449 of file alias.c.

450 {
452  PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleAliasRequest;
456  PVOID lpTarget;
457 
458  DPRINT("SrvAddConsoleAlias entered ApiMessage %p\n", ApiMessage);
459 
460  if ( !CsrValidateMessageBuffer(ApiMessage,
461  (PVOID*)&ConsoleAliasRequest->Source,
462  ConsoleAliasRequest->SourceLength,
463  sizeof(BYTE)) ||
464  !CsrValidateMessageBuffer(ApiMessage,
465  (PVOID*)&ConsoleAliasRequest->Target,
466  ConsoleAliasRequest->TargetLength,
467  sizeof(BYTE)) ||
468  !CsrValidateMessageBuffer(ApiMessage,
469  (PVOID*)&ConsoleAliasRequest->ExeName,
470  ConsoleAliasRequest->ExeLength,
471  sizeof(BYTE)) )
472  {
474  }
475 
476  lpTarget = (ConsoleAliasRequest->TargetLength != 0 ? ConsoleAliasRequest->Target : NULL);
477 
479  &Console, TRUE);
480  if (!NT_SUCCESS(Status)) return Status;
481 
483 
485  ConsoleAliasRequest->ExeName,
486  ConsoleAliasRequest->ExeLength,
487  ConsoleAliasRequest->Unicode2);
488  if (!Header && lpTarget != NULL)
489  {
491  ConsoleAliasRequest->ExeName,
492  ConsoleAliasRequest->ExeLength,
493  ConsoleAliasRequest->Unicode2);
494  if (!Header)
495  {
497  goto Quit;
498  }
499 
500  IntInsertAliasHeader(&Console->Aliases, Header);
501  }
502 
503  if (lpTarget == NULL) // Delete the entry
504  {
506  ConsoleAliasRequest->Source,
507  ConsoleAliasRequest->SourceLength,
508  ConsoleAliasRequest->Unicode);
509  if (!Entry)
510  {
512  goto Quit;
513  }
514 
516  }
517  else // Add the entry
518  {
520  ConsoleAliasRequest->Source,
521  ConsoleAliasRequest->SourceLength,
522  ConsoleAliasRequest->Target,
523  ConsoleAliasRequest->TargetLength,
524  ConsoleAliasRequest->Unicode);
525  if (!Entry)
526  {
528  goto Quit;
529  }
530 
532  }
533 
534 Quit:
536  return Status;
537 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:627
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
static PALIAS_ENTRY IntCreateAliasEntry(PCONSRV_CONSOLE Console, PVOID Source, USHORT SourceLength, PVOID Target, USHORT TargetLength, BOOLEAN Unicode)
Definition: alias.c:269
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
BOOLEAN Unicode2
Definition: conmsg.h:738
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
Definition: Header.h:8
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static VOID IntInsertAliasHeader(PALIAS_HEADER *RootHeader, PALIAS_HEADER NewHeader)
Definition: alias.c:200
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
USHORT SourceLength
Definition: conmsg.h:731
static VOID IntDeleteAliasEntry(PALIAS_HEADER Header, PALIAS_ENTRY Entry)
Definition: alias.c:362
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
unsigned char BYTE
Definition: mem.h:68
Definition: alias.c:19
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
static PALIAS_ENTRY IntGetAliasEntry(PCONSRV_CONSOLE Console, PALIAS_HEADER Header, PVOID Source, USHORT SourceLength, BOOLEAN Unicode)
Definition: alias.c:220
USHORT TargetLength
Definition: conmsg.h:732
static PALIAS_HEADER IntCreateAliasHeader(PCONSRV_CONSOLE Console, PVOID ExeName, USHORT ExeLength, BOOLEAN UnicodeExe)
Definition: alias.c:152
return STATUS_SUCCESS
Definition: btrfs.c:2938
static VOID IntInsertAliasEntry(PALIAS_HEADER Header, PALIAS_ENTRY NewEntry)
Definition: alias.c:342
base of all file and directory entries
Definition: entries.h:82
static PALIAS_HEADER IntFindAliasHeader(PCONSRV_CONSOLE Console, PVOID ExeName, USHORT ExeLength, BOOLEAN UnicodeExe)
Definition: alias.c:105

◆ CSR_API() [2/87]

CSR_API ( SrvGetConsoleAlias  )

Definition at line 540 of file alias.c.

541 {
543  PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleAliasRequest;
547  UINT Length;
548  PVOID lpTarget;
549 
550  DPRINT("SrvGetConsoleAlias entered ApiMessage %p\n", ApiMessage);
551 
552  if ( !CsrValidateMessageBuffer(ApiMessage,
553  (PVOID*)&ConsoleAliasRequest->Source,
554  ConsoleAliasRequest->SourceLength,
555  sizeof(BYTE)) ||
556  !CsrValidateMessageBuffer(ApiMessage,
557  (PVOID*)&ConsoleAliasRequest->Target,
558  ConsoleAliasRequest->TargetLength,
559  sizeof(BYTE)) ||
560  !CsrValidateMessageBuffer(ApiMessage,
561  (PVOID*)&ConsoleAliasRequest->ExeName,
562  ConsoleAliasRequest->ExeLength,
563  sizeof(BYTE)) )
564  {
566  }
567 
568  lpTarget = ConsoleAliasRequest->Target;
569 
570  if (ConsoleAliasRequest->ExeLength == 0 || lpTarget == NULL ||
571  ConsoleAliasRequest->TargetLength == 0 || ConsoleAliasRequest->SourceLength == 0)
572  {
574  }
575 
577  &Console, TRUE);
578  if (!NT_SUCCESS(Status)) return Status;
579 
581  ConsoleAliasRequest->ExeName,
582  ConsoleAliasRequest->ExeLength,
583  ConsoleAliasRequest->Unicode2);
584  if (!Header)
585  {
587  goto Quit;
588  }
589 
591  ConsoleAliasRequest->Source,
592  ConsoleAliasRequest->SourceLength,
593  ConsoleAliasRequest->Unicode);
594  if (!Entry)
595  {
597  goto Quit;
598  }
599 
600  if (ConsoleAliasRequest->Unicode)
601  {
602  Length = Entry->Target.Length + sizeof(WCHAR);
603  if (Length > ConsoleAliasRequest->TargetLength) // FIXME: Refine computation.
604  {
606  goto Quit;
607  }
608 
609  RtlCopyMemory(lpTarget, Entry->Target.Buffer, Entry->Target.Length);
610  ConsoleAliasRequest->TargetLength = Length;
611  }
612  else
613  {
614  Length = (Entry->Target.Length + sizeof(WCHAR)) / sizeof(WCHAR);
615  if (Length > ConsoleAliasRequest->TargetLength) // FIXME: Refine computation.
616  {
618  goto Quit;
619  }
620 
622  Entry->Target.Buffer, Entry->Target.Length,
623  lpTarget, Entry->Target.Length / sizeof(WCHAR));
624  ConsoleAliasRequest->TargetLength = Length;
625  }
626 
627 Quit:
629  return Status;
630 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _Entry Entry
Definition: kefuncs.h:627
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
BOOLEAN Unicode2
Definition: conmsg.h:738
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
Definition: Header.h:8
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
USHORT SourceLength
Definition: conmsg.h:731
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
unsigned char BYTE
Definition: mem.h:68
Definition: alias.c:19
Status
Definition: gdiplustypes.h:24
unsigned int UINT
Definition: ndis.h:50
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
BOOLEAN ConvertInputUnicodeToAnsi(PCONSRV_CONSOLE Console, PVOID Source, USHORT SourceLength, PCHAR Target, USHORT TargetLength)
Definition: alias.c:64
static PALIAS_ENTRY IntGetAliasEntry(PCONSRV_CONSOLE Console, PALIAS_HEADER Header, PVOID Source, USHORT SourceLength, BOOLEAN Unicode)
Definition: alias.c:220
USHORT TargetLength
Definition: conmsg.h:732
base of all file and directory entries
Definition: entries.h:82
static PALIAS_HEADER IntFindAliasHeader(PCONSRV_CONSOLE Console, PVOID ExeName, USHORT ExeLength, BOOLEAN UnicodeExe)
Definition: alias.c:105

◆ CSR_API() [3/87]

CSR_API ( SrvGetConsoleAliases  )

Definition at line 633 of file alias.c.

634 {
636  PCONSOLE_GETALLALIASES GetAllAliasesRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllAliasesRequest;
638  ULONG BytesWritten = 0;
640 
641  DPRINT("SrvGetConsoleAliases entered ApiMessage %p\n", ApiMessage);
642 
643  if ( !CsrValidateMessageBuffer(ApiMessage,
644  (PVOID)&GetAllAliasesRequest->ExeName,
645  GetAllAliasesRequest->ExeLength,
646  sizeof(BYTE)) ||
647  !CsrValidateMessageBuffer(ApiMessage,
648  (PVOID)&GetAllAliasesRequest->AliasesBuffer,
649  GetAllAliasesRequest->AliasesBufferLength,
650  sizeof(BYTE)) )
651  {
653  }
654 
656  &Console, TRUE);
657  if (!NT_SUCCESS(Status)) return Status;
658 
660  GetAllAliasesRequest->ExeName,
661  GetAllAliasesRequest->ExeLength,
662  GetAllAliasesRequest->Unicode2);
663  if (!Header) goto Quit;
664 
665  if (IntGetAllConsoleAliasesLength(Header, GetAllAliasesRequest->Unicode) > GetAllAliasesRequest->AliasesBufferLength)
666  {
668  goto Quit;
669  }
670 
671  {
672  LPSTR TargetBufferA;
673  LPWSTR TargetBufferW;
674  UINT TargetBufferLength = GetAllAliasesRequest->AliasesBufferLength;
675 
676  PALIAS_ENTRY CurEntry = Header->Data;
677  UINT Offset = 0;
678  UINT SourceLength, TargetLength;
679 
680  if (GetAllAliasesRequest->Unicode)
681  {
682  TargetBufferW = GetAllAliasesRequest->AliasesBuffer;
683  TargetBufferLength /= sizeof(WCHAR);
684  }
685  else
686  {
687  TargetBufferA = GetAllAliasesRequest->AliasesBuffer;
688  }
689 
690  while (CurEntry)
691  {
692  SourceLength = CurEntry->Source.Length / sizeof(WCHAR);
693  TargetLength = CurEntry->Target.Length / sizeof(WCHAR);
694  if (Offset + TargetLength + SourceLength + 2 > TargetBufferLength)
695  {
697  break;
698  }
699 
700  if (GetAllAliasesRequest->Unicode)
701  {
702  RtlCopyMemory(&TargetBufferW[Offset], CurEntry->Source.Buffer, SourceLength * sizeof(WCHAR));
703  Offset += SourceLength;
704  TargetBufferW[Offset++] = L'=';
705  RtlCopyMemory(&TargetBufferW[Offset], CurEntry->Target.Buffer, TargetLength * sizeof(WCHAR));
706  Offset += TargetLength;
707  TargetBufferW[Offset++] = L'\0';
708  }
709  else
710  {
712  CurEntry->Source.Buffer, SourceLength * sizeof(WCHAR),
713  &TargetBufferA[Offset], SourceLength);
714  Offset += SourceLength;
715  TargetBufferA[Offset++] = '=';
717  CurEntry->Target.Buffer, TargetLength * sizeof(WCHAR),
718  &TargetBufferA[Offset], TargetLength);
719  Offset += TargetLength;
720  TargetBufferA[Offset++] = '\0';
721  }
722 
723  CurEntry = CurEntry->Next;
724  }
725 
726  if (GetAllAliasesRequest->Unicode)
727  BytesWritten = Offset * sizeof(WCHAR);
728  else
730  }
731 
732 Quit:
733  GetAllAliasesRequest->AliasesBufferLength = BytesWritten;
734 
736  return Status;
737 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
#define PCONSRV_CONSOLE
Definition: conio.h:27
char * LPSTR
Definition: xmlstorage.h:182
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: Header.h:8
ULONG AliasesBufferLength
Definition: conmsg.h:748
void DPRINT(...)
Definition: polytest.cpp:61
UNICODE_STRING Target
Definition: alias.c:23
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
UNICODE_STRING Source
Definition: alias.c:22
Definition: alias.c:19
Status
Definition: gdiplustypes.h:24
struct _ALIAS_ENTRY * Next
Definition: alias.c:21
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned int UINT
Definition: ndis.h:50
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
BOOLEAN ConvertInputUnicodeToAnsi(PCONSRV_CONSOLE Console, PVOID Source, USHORT SourceLength, PCHAR Target, USHORT TargetLength)
Definition: alias.c:64
static UINT IntGetAllConsoleAliasesLength(PALIAS_HEADER Header, BOOLEAN IsUnicode)
Definition: alias.c:403
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static PALIAS_HEADER IntFindAliasHeader(PCONSRV_CONSOLE Console, PVOID ExeName, USHORT ExeLength, BOOLEAN UnicodeExe)
Definition: alias.c:105

◆ CSR_API() [4/87]

CSR_API ( SrvGetConsoleAliasesLength  )

Definition at line 740 of file alias.c.

741 {
743  PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllAliasesLengthRequest;
746 
747  DPRINT("SrvGetConsoleAliasesLength entered ApiMessage %p\n", ApiMessage);
748 
749  if (!CsrValidateMessageBuffer(ApiMessage,
750  (PVOID)&GetAllAliasesLengthRequest->ExeName,
751  GetAllAliasesLengthRequest->ExeLength,
752  sizeof(BYTE)))
753  {
755  }
756 
758  &Console, TRUE);
759  if (!NT_SUCCESS(Status)) return Status;
760 
762  GetAllAliasesLengthRequest->ExeName,
763  GetAllAliasesLengthRequest->ExeLength,
764  GetAllAliasesLengthRequest->Unicode2);
765  if (Header)
766  {
767  GetAllAliasesLengthRequest->Length =
769  GetAllAliasesLengthRequest->Unicode);
771  }
772  else
773  {
774  GetAllAliasesLengthRequest->Length = 0;
775  }
776 
778  return Status;
779 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
Definition: Header.h:8
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
unsigned char BYTE
Definition: mem.h:68
Status
Definition: gdiplustypes.h:24
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
static UINT IntGetAllConsoleAliasesLength(PALIAS_HEADER Header, BOOLEAN IsUnicode)
Definition: alias.c:403
return STATUS_SUCCESS
Definition: btrfs.c:2938
static PALIAS_HEADER IntFindAliasHeader(PCONSRV_CONSOLE Console, PVOID ExeName, USHORT ExeLength, BOOLEAN UnicodeExe)
Definition: alias.c:105

◆ CSR_API() [5/87]

CSR_API ( SrvGetConsoleAliasExes  )

Definition at line 782 of file alias.c.

783 {
785  PCONSOLE_GETALIASESEXES GetAliasesExesRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAliasesExesRequest;
787  UINT BytesWritten = 0;
788 
789  DPRINT("SrvGetConsoleAliasExes entered\n");
790 
791  if (!CsrValidateMessageBuffer(ApiMessage,
792  (PVOID*)&GetAliasesExesRequest->ExeNames,
793  GetAliasesExesRequest->Length,
794  sizeof(BYTE)))
795  {
797  }
798 
800  &Console, TRUE);
801  if (!NT_SUCCESS(Status)) return Status;
802 
803  if (IntGetConsoleAliasesExesLength(Console->Aliases, GetAliasesExesRequest->Unicode) > GetAliasesExesRequest->Length)
804  {
806  goto Quit;
807  }
808 
809  {
810  PALIAS_HEADER RootHeader = Console->Aliases;
811 
812  LPSTR TargetBufferA;
813  LPWSTR TargetBufferW;
814  UINT TargetBufferSize = GetAliasesExesRequest->Length;
815 
816  UINT Offset = 0;
817  UINT Length;
818 
819  if (GetAliasesExesRequest->Unicode)
820  {
821  TargetBufferW = GetAliasesExesRequest->ExeNames;
822  TargetBufferSize /= sizeof(WCHAR);
823  }
824  else
825  {
826  TargetBufferA = GetAliasesExesRequest->ExeNames;
827  }
828 
829  while (RootHeader)
830  {
831  Length = RootHeader->ExeName.Length / sizeof(WCHAR);
832  if (Offset + Length + 1 > TargetBufferSize)
833  {
835  break;
836  }
837 
838  if (GetAliasesExesRequest->Unicode)
839  {
840  RtlCopyMemory(&TargetBufferW[Offset], RootHeader->ExeName.Buffer, Length * sizeof(WCHAR));
841  Offset += Length;
842  TargetBufferW[Offset++] = L'\0';
843  }
844  else
845  {
847  RootHeader->ExeName.Buffer, Length * sizeof(WCHAR),
848  &TargetBufferA[Offset], Length);
849  Offset += Length;
850  TargetBufferA[Offset++] = '\0';
851  }
852 
853  RootHeader = RootHeader->Next;
854  }
855 
856  if (GetAliasesExesRequest->Unicode)
857  BytesWritten = Offset * sizeof(WCHAR);
858  else
860  }
861 
862 Quit:
863  GetAliasesExesRequest->Length = BytesWritten;
864 
866  return Status;
867 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
#define PCONSRV_CONSOLE
Definition: conio.h:27
char * LPSTR
Definition: xmlstorage.h:182
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
void DPRINT(...)
Definition: polytest.cpp:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static const WCHAR L[]
Definition: oid.c:1250
UNICODE_STRING ExeName
Definition: alias.c:29
unsigned char BYTE
Definition: mem.h:68
Status
Definition: gdiplustypes.h:24
struct _ALIAS_HEADER * Next
Definition: alias.c:28
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned int UINT
Definition: ndis.h:50
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
BOOLEAN ConvertInputUnicodeToAnsi(PCONSRV_CONSOLE Console, PVOID Source, USHORT SourceLength, PCHAR Target, USHORT TargetLength)
Definition: alias.c:64
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static UINT IntGetConsoleAliasesExesLength(PALIAS_HEADER RootHeader, BOOLEAN IsUnicode)
Definition: alias.c:381

◆ CSR_API() [6/87]

CSR_API ( SrvGetConsoleAliasExesLength  )

Definition at line 870 of file alias.c.

871 {
873  PCONSOLE_GETALIASESEXESLENGTH GetAliasesExesLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAliasesExesLengthRequest;
875 
876  DPRINT("SrvGetConsoleAliasExesLength entered ApiMessage %p\n", ApiMessage);
877 
879  &Console, TRUE);
880  if (!NT_SUCCESS(Status)) return Status;
881 
882  GetAliasesExesLengthRequest->Length =
884  GetAliasesExesLengthRequest->Unicode);
885 
887  return Status;
888 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
Status
Definition: gdiplustypes.h:24
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
static UINT IntGetConsoleAliasesExesLength(PALIAS_HEADER RootHeader, BOOLEAN IsUnicode)
Definition: alias.c:381

◆ CSR_API() [7/87]

CSR_API ( SrvReadConsole  )

Definition at line 558 of file coninput.c.

559 {
561  PCONSOLE_READCONSOLE ReadConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadConsoleRequest;
563  PVOID HandleEntry;
565  GET_INPUT_INFO InputInfo;
566 
567  DPRINT("SrvReadConsole\n");
568 
569  /*
570  * For optimization purposes, Windows (and hence ReactOS, too, for
571  * compatibility reasons) uses a static buffer if no more than eighty
572  * bytes are read. Otherwise a new buffer is used.
573  * The client-side expects that we know this behaviour.
574  */
575  if (ReadConsoleRequest->CaptureBufferSize <= sizeof(ReadConsoleRequest->StaticBuffer))
576  {
577  /*
578  * Adjust the internal pointer, because its old value points to
579  * the static buffer in the original ApiMessage structure.
580  */
581  // ReadConsoleRequest->Buffer = ReadConsoleRequest->StaticBuffer;
582  }
583  else
584  {
585  if (!CsrValidateMessageBuffer(ApiMessage,
586  (PVOID*)&ReadConsoleRequest->Buffer,
587  ReadConsoleRequest->CaptureBufferSize,
588  sizeof(BYTE)))
589  {
591  }
592  }
593 
594  if (ReadConsoleRequest->InitialNumBytes > ReadConsoleRequest->NumBytes)
595  {
597  }
598 
599  Status = ConSrvGetInputBufferAndHandleEntry(ProcessData, ReadConsoleRequest->InputHandle, &InputBuffer, &HandleEntry, GENERIC_READ, TRUE);
600  if (!NT_SUCCESS(Status)) return Status;
601 
602  InputInfo.CallingThread = CsrGetClientThread();
603  InputInfo.HandleEntry = HandleEntry;
604  InputInfo.InputBuffer = InputBuffer;
605 
606  Status = ReadChars(&InputInfo, ApiMessage, TRUE);
607 
609 
610  if (Status == STATUS_PENDING) *ReplyCode = CsrReplyPending;
611 
612  return Status;
613 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
HANDLE InputHandle
Definition: conmsg.h:256
PVOID HandleEntry
Definition: coninput.c:53
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
PCSR_THREAD CallingThread
Definition: coninput.c:52
CHAR StaticBuffer[80]
Definition: conmsg.h:260
CHAR InputBuffer[80]
Definition: conmgr.c:33
ULONG CaptureBufferSize
Definition: conmsg.h:264
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
ULONG InitialNumBytes
Definition: conmsg.h:266
unsigned char BYTE
Definition: mem.h:68
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
#define ConSrvGetInputBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access, LockConsole)
Definition: coninput.c:23
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
PCONSOLE_INPUT_BUFFER InputBuffer
Definition: coninput.c:54
#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked)
Definition: coninput.c:27
static NTSTATUS ReadChars(IN PGET_INPUT_INFO InputInfo, IN PCSR_API_MESSAGE ApiMessage, IN BOOLEAN CreateWaitBlock OPTIONAL)
Definition: coninput.c:318

◆ CSR_API() [8/87]

CSR_API ( SrvGetConsoleInput  )

Definition at line 616 of file coninput.c.

617 {
619  PCONSOLE_GETINPUT GetInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetInputRequest;
621  PVOID HandleEntry;
623  GET_INPUT_INFO InputInfo;
624 
625  DPRINT("SrvGetConsoleInput\n");
626 
627  if (GetInputRequest->Flags & ~(CONSOLE_READ_KEEPEVENT | CONSOLE_READ_CONTINUE))
629 
630  /*
631  * For optimization purposes, Windows (and hence ReactOS, too, for
632  * compatibility reasons) uses a static buffer if no more than five
633  * input records are read. Otherwise a new buffer is used.
634  * The client-side expects that we know this behaviour.
635  */
636  if (GetInputRequest->NumRecords <= sizeof(GetInputRequest->RecordStaticBuffer)/sizeof(INPUT_RECORD))
637  {
638  /*
639  * Adjust the internal pointer, because its old value points to
640  * the static buffer in the original ApiMessage structure.
641  */
642  // GetInputRequest->RecordBufPtr = GetInputRequest->RecordStaticBuffer;
643  }
644  else
645  {
646  if (!CsrValidateMessageBuffer(ApiMessage,
647  (PVOID*)&GetInputRequest->RecordBufPtr,
648  GetInputRequest->NumRecords,
649  sizeof(INPUT_RECORD)))
650  {
652  }
653  }
654 
655  Status = ConSrvGetInputBufferAndHandleEntry(ProcessData, GetInputRequest->InputHandle, &InputBuffer, &HandleEntry, GENERIC_READ, TRUE);
656  if (!NT_SUCCESS(Status)) return Status;
657 
658  InputInfo.CallingThread = CsrGetClientThread();
659  InputInfo.HandleEntry = HandleEntry;
660  InputInfo.InputBuffer = InputBuffer;
661 
662  Status = ReadInputBuffer(&InputInfo, ApiMessage, TRUE);
663 
665 
666  if (Status == STATUS_PENDING) *ReplyCode = CsrReplyPending;
667 
668  return Status;
669 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
ULONG NumRecords
Definition: conmsg.h:568
#define TRUE
Definition: types.h:120
PVOID HandleEntry
Definition: coninput.c:53
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
PCSR_THREAD CallingThread
Definition: coninput.c:52
INPUT_RECORD RecordStaticBuffer[5]
Definition: conmsg.h:566
HANDLE InputHandle
Definition: conmsg.h:565
CHAR InputBuffer[80]
Definition: conmgr.c:33
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
PINPUT_RECORD RecordBufPtr
Definition: conmsg.h:567
#define GENERIC_READ
Definition: compat.h:124
#define CONSOLE_READ_KEEPEVENT
Definition: wincon.h:122
Status
Definition: gdiplustypes.h:24
#define CONSOLE_READ_CONTINUE
Definition: wincon.h:123
#define ConSrvGetInputBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access, LockConsole)
Definition: coninput.c:23
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
PCONSOLE_INPUT_BUFFER InputBuffer
Definition: coninput.c:54
static NTSTATUS ReadInputBuffer(IN PGET_INPUT_INFO InputInfo, IN PCSR_API_MESSAGE ApiMessage, IN BOOLEAN CreateWaitBlock OPTIONAL)
Definition: coninput.c:481
#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked)
Definition: coninput.c:27

◆ CSR_API() [9/87]

CSR_API ( SrvWriteConsoleInput  )

Definition at line 682 of file coninput.c.

683 {
685  PCONSOLE_WRITEINPUT WriteInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteInputRequest;
687  ULONG NumEventsWritten;
688 
689  PINPUT_RECORD InputRecord;
690 
691  DPRINT("SrvWriteConsoleInput\n");
692 
693  /*
694  * For optimization purposes, Windows (and hence ReactOS, too, for
695  * compatibility reasons) uses a static buffer if no more than five
696  * input records are written. Otherwise a new buffer is used.
697  * The client-side expects that we know this behaviour.
698  */
699  if (WriteInputRequest->NumRecords <= sizeof(WriteInputRequest->RecordStaticBuffer)/sizeof(INPUT_RECORD))
700  {
701  /*
702  * Adjust the internal pointer, because its old value points to
703  * the static buffer in the original ApiMessage structure.
704  */
705  // WriteInputRequest->RecordBufPtr = WriteInputRequest->RecordStaticBuffer;
706  InputRecord = WriteInputRequest->RecordStaticBuffer;
707  }
708  else
709  {
710  if (!CsrValidateMessageBuffer(ApiMessage,
711  (PVOID*)&WriteInputRequest->RecordBufPtr,
712  WriteInputRequest->NumRecords,
713  sizeof(INPUT_RECORD)))
714  {
716  }
717 
718  InputRecord = WriteInputRequest->RecordBufPtr;
719  }
720 
722  WriteInputRequest->InputHandle,
724  if (!NT_SUCCESS(Status))
725  {
726  WriteInputRequest->NumRecords = 0;
727  return Status;
728  }
729 
730  /* First translate everything to UNICODE */
731  if (!WriteInputRequest->Unicode)
732  {
733  ULONG i;
734  for (i = 0; i < WriteInputRequest->NumRecords; ++i)
735  {
736  ConioInputEventToUnicode(InputBuffer->Header.Console, &InputRecord[i]);
737  }
738  }
739 
740  /* Now, add the events */
741  NumEventsWritten = 0;
743  // InputBuffer,
744  InputRecord,
745  WriteInputRequest->NumRecords,
746  &NumEventsWritten,
747  WriteInputRequest->AppendToEnd);
748 
749  // Status = ConDrvWriteConsoleInput(InputBuffer->Header.Console,
750  // InputBuffer,
751  // WriteInputRequest->AppendToEnd,
752  // InputRecord,
753  // WriteInputRequest->NumRecords,
754  // &NumEventsWritten);
755 
756  WriteInputRequest->NumRecords = NumEventsWritten;
757 
759  return Status;
760 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
HANDLE InputHandle
Definition: conmsg.h:576
static VOID ConioInputEventToUnicode(PCONSOLE Console, PINPUT_RECORD InputEvent)
Definition: coninput.c:74
#define PCONSRV_CONSOLE
Definition: conio.h:27
CHAR InputBuffer[80]
Definition: conmgr.c:33
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
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
PINPUT_RECORD RecordBufPtr
Definition: conmsg.h:578
INPUT_RECORD RecordStaticBuffer[5]
Definition: conmsg.h:577
BOOLEAN AppendToEnd
Definition: conmsg.h:581
static NTSTATUS ConioAddInputEvents(PCONSRV_CONSOLE Console, PINPUT_RECORD InputRecords, ULONG NumEventsToWrite, PULONG NumEventsWritten, BOOLEAN AppendToEnd)
Definition: coninput.c:167
Status
Definition: gdiplustypes.h:24
BOOLEAN Unicode
Definition: conmsg.h:580
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define ConSrvGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: coninput.c:19
unsigned int ULONG
Definition: retypes.h:1
#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked)
Definition: coninput.c:27

◆ CSR_API() [10/87]

CSR_API ( SrvFlushConsoleInputBuffer  )

Definition at line 766 of file coninput.c.

767 {
769  PCONSOLE_FLUSHINPUTBUFFER FlushInputBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FlushInputBufferRequest;
771 
772  DPRINT("SrvFlushConsoleInputBuffer\n");
773 
775  FlushInputBufferRequest->InputHandle,
777  if (!NT_SUCCESS(Status)) return Status;
778 
780  InputBuffer);
781 
783  return Status;
784 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
CHAR InputBuffer[80]
Definition: conmgr.c:33
NTSTATUS NTAPI ConDrvFlushConsoleInputBuffer(IN PCONSOLE Console, IN PCONSOLE_INPUT_BUFFER InputBuffer)
Definition: coninput.c:357
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define ConSrvGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: coninput.c:19
#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked)
Definition: coninput.c:27

◆ CSR_API() [11/87]

CSR_API ( SrvGetConsoleNumberOfInputEvents  )

Definition at line 791 of file coninput.c.

792 {
794  PCONSOLE_GETNUMINPUTEVENTS GetNumInputEventsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetNumInputEventsRequest;
796 
797  DPRINT("SrvGetConsoleNumberOfInputEvents\n");
798 
800  GetNumInputEventsRequest->InputHandle,
802  if (!NT_SUCCESS(Status)) return Status;
803 
805  InputBuffer,
806  &GetNumInputEventsRequest->NumberOfEvents);
807 
809  return Status;
810 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
CHAR InputBuffer[80]
Definition: conmgr.c:33
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define ConSrvGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: coninput.c:19
NTSTATUS NTAPI ConDrvGetConsoleNumberOfInputEvents(IN PCONSOLE Console, IN PCONSOLE_INPUT_BUFFER InputBuffer, OUT PULONG NumberOfEvents)
Definition: coninput.c:374
#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked)
Definition: coninput.c:27

◆ CSR_API() [12/87]

CSR_API ( SrvInvalidateBitMapRect  )

Definition at line 34 of file conoutput.c.

35 {
37  PCONSOLE_INVALIDATEDIBITS InvalidateDIBitsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.InvalidateDIBitsRequest;
39 
40  DPRINT("SrvInvalidateBitMapRect\n");
41 
43  InvalidateDIBitsRequest->OutputHandle,
45  if (!NT_SUCCESS(Status)) return Status;
46 
47  /* In text-mode only, draw the VDM buffer if present */
48  if (GetType(Buffer) == TEXTMODE_BUFFER && Buffer->Header.Console->VDMBuffer)
49  {
51 
52  /*Status =*/ ConDrvWriteConsoleOutputVDM(Buffer->Header.Console,
53  TextBuffer,
54  Buffer->Header.Console->VDMBuffer,
55  Buffer->Header.Console->VDMBufferSize,
56  &InvalidateDIBitsRequest->Region);
57  }
58 
59  Status = ConDrvInvalidateBitMapRect(Buffer->Header.Console,
60  Buffer,
61  &InvalidateDIBitsRequest->Region);
62 
64  return Status;
65 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define TEXTMODE_BUFFER
Definition: pccons.c:21
NTSTATUS NTAPI ConDrvWriteConsoleOutputVDM(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCHAR_CELL CharInfo, IN COORD CharInfoSize, IN PSMALL_RECT WriteRegion)
Definition: text.c:721
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:26
INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
Definition: gettype.c:129
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI ConDrvInvalidateBitMapRect(IN PCONSOLE Console, IN PCONSOLE_SCREEN_BUFFER Buffer, IN PSMALL_RECT Region)
Definition: conoutput.c:202
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
char TextBuffer[BUFFERLEN]
Definition: combotst.c:45
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
struct _TEXTMODE_SCREEN_BUFFER * PTEXTMODE_SCREEN_BUFFER

◆ CSR_API() [13/87]

CSR_API ( SrvSetConsolePalette  )

Definition at line 74 of file conoutput.c.

75 {
77  PCONSOLE_SETPALETTE SetPaletteRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetPaletteRequest;
78  // PGRAPHICS_SCREEN_BUFFER Buffer;
80 
81  DPRINT("SrvSetConsolePalette\n");
82 
83  // NOTE: Tests show that this function is used only for graphics screen buffers
84  // and otherwise it returns FALSE + sets last error to invalid handle.
85  // I think it's ridiculous, because if you are in text mode, simulating
86  // a change of VGA palette via DAC registers (done by a call to SetConsolePalette)
87  // cannot be done... So I allow it in ReactOS !
88  /*
89  Status = ConSrvGetGraphicsBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
90  SetPaletteRequest->OutputHandle,
91  &Buffer, GENERIC_WRITE, TRUE);
92  */
94  SetPaletteRequest->OutputHandle,
96  if (!NT_SUCCESS(Status)) return Status;
97 
98  /*
99  * Make the palette handle public, so that it can be
100  * used by other threads calling GDI functions on it.
101  * Indeed, the palette handle comes from a console app
102  * calling ourselves, running in CSRSS.
103  */
105  &SetPaletteRequest->PaletteHandle,
106  sizeof(SetPaletteRequest->PaletteHandle));
107 
108  Status = ConDrvSetConsolePalette(Buffer->Header.Console,
109  Buffer,
110  SetPaletteRequest->PaletteHandle,
111  SetPaletteRequest->Usage);
112 
114  return Status;
115 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
HPALETTE PaletteHandle
Definition: conmsg.h:479
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
HANDLE OutputHandle
Definition: conmsg.h:478
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSTATUS APIENTRY NtUserConsoleControl(IN CONSOLECONTROL ConsoleCtrl, IN PVOID ConsoleCtrlInfo, IN ULONG ConsoleCtrlInfoLength)
Definition: console.c:14
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
NTSTATUS NTAPI ConDrvSetConsolePalette(IN PCONSOLE Console, IN PCONSOLE_SCREEN_BUFFER Buffer, IN HPALETTE PaletteHandle, IN UINT PaletteUsage)
Definition: conoutput.c:219
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:26
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [14/87]

CSR_API ( SrvReadConsoleOutput  )

Definition at line 493 of file conoutput.c.

494 {
496  PCONSOLE_READOUTPUT ReadOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputRequest;
498 
499  ULONG NumCells;
500  PCHAR_INFO CharInfo;
501 
502  DPRINT("SrvReadConsoleOutput\n");
503 
504  NumCells = ConioRectWidth(&ReadOutputRequest->ReadRegion) *
505  ConioRectHeight(&ReadOutputRequest->ReadRegion);
506 
507  /*
508  * For optimization purposes, Windows (and hence ReactOS, too, for
509  * compatibility reasons) uses a static buffer if no more than one
510  * cell is read. Otherwise a new buffer is used.
511  * The client-side expects that we know this behaviour.
512  */
513  if (NumCells <= 1)
514  {
515  /*
516  * Adjust the internal pointer, because its old value points to
517  * the static buffer in the original ApiMessage structure.
518  */
519  // ReadOutputRequest->CharInfo = &ReadOutputRequest->StaticBuffer;
520  CharInfo = &ReadOutputRequest->StaticBuffer;
521  }
522  else
523  {
524  if (!CsrValidateMessageBuffer(ApiMessage,
525  (PVOID*)&ReadOutputRequest->CharInfo,
526  NumCells,
527  sizeof(CHAR_INFO)))
528  {
530  }
531 
532  CharInfo = ReadOutputRequest->CharInfo;
533  }
534 
536  ReadOutputRequest->OutputHandle,
538  if (!NT_SUCCESS(Status)) return Status;
539 
540  Status = ConDrvReadConsoleOutput(Buffer->Header.Console,
541  Buffer,
542  ReadOutputRequest->Unicode,
543  CharInfo,
544  &ReadOutputRequest->ReadRegion);
545 
547  return Status;
548 }
HANDLE OutputHandle
Definition: conmsg.h:587
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
BOOLEAN Unicode
Definition: conmsg.h:593
#define ConioRectWidth(Rect)
Definition: readwrite.c:24
#define ConioRectHeight(Rect)
Definition: readwrite.c:22
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
PCHAR_INFO CharInfo
Definition: conmsg.h:590
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
SMALL_RECT ReadRegion
Definition: conmsg.h:592
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI ConDrvReadConsoleOutput(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Unicode, OUT PCHAR_INFO CharInfo, IN OUT PSMALL_RECT ReadRegion)
Definition: text.c:582
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
CHAR_INFO StaticBuffer
Definition: conmsg.h:589

◆ CSR_API() [15/87]

CSR_API ( SrvWriteConsole  )

Definition at line 656 of file conoutput.c.

657 {
659  PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest;
660 
661  DPRINT("SrvWriteConsole\n");
662 
663  /*
664  * For optimization purposes, Windows (and hence ReactOS, too, for
665  * compatibility reasons) uses a static buffer if no more than eighty
666  * bytes are written. Otherwise a new buffer is used.
667  * The client-side expects that we know this behaviour.
668  */
669  if (WriteConsoleRequest->UsingStaticBuffer &&
670  WriteConsoleRequest->NumBytes <= sizeof(WriteConsoleRequest->StaticBuffer))
671  {
672  /*
673  * Adjust the internal pointer, because its old value points to
674  * the static buffer in the original ApiMessage structure.
675  */
676  // WriteConsoleRequest->Buffer = WriteConsoleRequest->StaticBuffer;
677  }
678  else
679  {
680  if (!CsrValidateMessageBuffer(ApiMessage,
681  (PVOID)&WriteConsoleRequest->Buffer,
682  WriteConsoleRequest->NumBytes,
683  sizeof(BYTE)))
684  {
686  }
687  }
688 
689  Status = DoWriteConsole(ApiMessage, CsrGetClientThread(), TRUE);
690 
691  if (Status == STATUS_PENDING) *ReplyCode = CsrReplyPending;
692 
693  return Status;
694 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
static NTSTATUS DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, IN PCSR_THREAD ClientThread, IN BOOLEAN CreateWaitBlock OPTIONAL)
Definition: conoutput.c:403
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
void DPRINT(...)
Definition: polytest.cpp:61
#define STATUS_PENDING
Definition: ntstatus.h:82
unsigned char BYTE
Definition: mem.h:68
Status
Definition: gdiplustypes.h:24
BOOLEAN UsingStaticBuffer
Definition: conmsg.h:246
CHAR StaticBuffer[80]
Definition: conmsg.h:239

◆ CSR_API() [16/87]

CSR_API ( SrvWriteConsoleOutput  )

Definition at line 557 of file conoutput.c.

558 {
560  PCONSOLE_WRITEOUTPUT WriteOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputRequest;
563 
564  ULONG NumCells;
565  PCHAR_INFO CharInfo;
566 
567  DPRINT("SrvWriteConsoleOutput\n");
568 
569  NumCells = ConioRectWidth(&WriteOutputRequest->WriteRegion) *
570  ConioRectHeight(&WriteOutputRequest->WriteRegion);
571 
573  WriteOutputRequest->OutputHandle,
575  if (!NT_SUCCESS(Status)) return Status;
576 
577  /*
578  * Validate the message buffer if we do not use a process' heap buffer
579  * (CsrAllocateCaptureBuffer succeeded because we haven't allocated
580  * a too large (>= 64 kB, size of the CSR heap) data buffer).
581  */
582  if (!WriteOutputRequest->UseVirtualMemory)
583  {
584  /*
585  * For optimization purposes, Windows (and hence ReactOS, too, for
586  * compatibility reasons) uses a static buffer if no more than one
587  * cell is written. Otherwise a new buffer is used.
588  * The client-side expects that we know this behaviour.
589  */
590  if (NumCells <= 1)
591  {
592  /*
593  * Adjust the internal pointer, because its old value points to
594  * the static buffer in the original ApiMessage structure.
595  */
596  // WriteOutputRequest->CharInfo = &WriteOutputRequest->StaticBuffer;
597  CharInfo = &WriteOutputRequest->StaticBuffer;
598  }
599  else
600  {
601  if (!CsrValidateMessageBuffer(ApiMessage,
602  (PVOID*)&WriteOutputRequest->CharInfo,
603  NumCells,
604  sizeof(CHAR_INFO)))
605  {
607  goto Quit;
608  }
609 
610  CharInfo = WriteOutputRequest->CharInfo;
611  }
612  }
613  else
614  {
615  /*
616  * This was not the case: we use a heap buffer. Retrieve its contents.
617  */
618  ULONG Size = NumCells * sizeof(CHAR_INFO);
619 
621  if (CharInfo == NULL)
622  {
624  goto Quit;
625  }
626 
627  Status = NtReadVirtualMemory(Process->ProcessHandle,
628  WriteOutputRequest->CharInfo,
629  CharInfo,
630  Size,
631  NULL);
632  if (!NT_SUCCESS(Status))
633  {
634  ConsoleFreeHeap(CharInfo);
635  // Status = STATUS_NO_MEMORY;
636  goto Quit;
637  }
638  }
639 
640  Status = ConDrvWriteConsoleOutput(Buffer->Header.Console,
641  Buffer,
642  WriteOutputRequest->Unicode,
643  CharInfo,
644  &WriteOutputRequest->WriteRegion);
645 
646  /* Free the temporary buffer if we used the process' heap buffer */
647  if (WriteOutputRequest->UseVirtualMemory && CharInfo)
648  ConsoleFreeHeap(CharInfo);
649 
650 Quit:
652  return Status;
653 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
#define ConsoleAllocHeap(Flags, Size)
Definition: heap.h:14
BOOLEAN UseVirtualMemory
Definition: conmsg.h:612
#define ConioRectWidth(Rect)
Definition: readwrite.c:24
#define GENERIC_WRITE
Definition: nt_native.h:90
struct _CHAR_INFO CHAR_INFO
smooth NULL
Definition: ftsmooth.c:416
#define ConioRectHeight(Rect)
Definition: readwrite.c:22
void DPRINT(...)
Definition: polytest.cpp:61
HANDLE OutputHandle
Definition: conmsg.h:599
Definition: bufpool.h:45
NTSTATUS NTAPI ConDrvWriteConsoleOutput(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Unicode, IN PCHAR_INFO CharInfo, IN OUT PSMALL_RECT WriteRegion)
Definition: text.c:651
CHAR_INFO StaticBuffer
Definition: conmsg.h:601
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
SMALL_RECT WriteRegion
Definition: conmsg.h:604
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
NTSTATUS NTAPI NtReadVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, OUT PVOID Buffer, IN SIZE_T NumberOfBytesToRead, OUT PSIZE_T NumberOfBytesRead OPTIONAL)
Definition: virtual.c:2691
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define ConsoleFreeHeap(HeapBase)
Definition: heap.h:15
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
PCHAR_INFO CharInfo
Definition: conmsg.h:602

◆ CSR_API() [17/87]

CSR_API ( SrvReadConsoleOutputString  )

Definition at line 706 of file conoutput.c.

707 {
709  PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputCodeRequest;
711  ULONG CodeSize;
712 
713  PVOID pCode;
714 
715  DPRINT("SrvReadConsoleOutputString\n");
716 
717  switch (ReadOutputCodeRequest->CodeType)
718  {
719  case CODE_ASCII:
720  CodeSize = RTL_FIELD_SIZE(CODE_ELEMENT, AsciiChar);
721  break;
722 
723  case CODE_UNICODE:
724  CodeSize = RTL_FIELD_SIZE(CODE_ELEMENT, UnicodeChar);
725  break;
726 
727  case CODE_ATTRIBUTE:
728  CodeSize = RTL_FIELD_SIZE(CODE_ELEMENT, Attribute);
729  break;
730 
731  default:
733  }
734 
735  /*
736  * For optimization purposes, Windows (and hence ReactOS, too, for
737  * compatibility reasons) uses a static buffer if no more than eighty
738  * bytes are read. Otherwise a new buffer is used.
739  * The client-side expects that we know this behaviour.
740  */
741  if (ReadOutputCodeRequest->NumCodes * CodeSize <= sizeof(ReadOutputCodeRequest->CodeStaticBuffer))
742  {
743  /*
744  * Adjust the internal pointer, because its old value points to
745  * the static buffer in the original ApiMessage structure.
746  */
747  // ReadOutputCodeRequest->pCode = ReadOutputCodeRequest->CodeStaticBuffer;
748  pCode = ReadOutputCodeRequest->CodeStaticBuffer;
749  }
750  else
751  {
752  if (!CsrValidateMessageBuffer(ApiMessage,
753  (PVOID*)&ReadOutputCodeRequest->pCode,
754  ReadOutputCodeRequest->NumCodes,
755  CodeSize))
756  {
758  }
759 
760  pCode = ReadOutputCodeRequest->pCode;
761  }
762 
764  ReadOutputCodeRequest->OutputHandle,
766  if (!NT_SUCCESS(Status))
767  {
768  ReadOutputCodeRequest->NumCodes = 0;
769  return Status;
770  }
771 
772  Status = ConDrvReadConsoleOutputString(Buffer->Header.Console,
773  Buffer,
774  ReadOutputCodeRequest->CodeType,
775  pCode,
776  ReadOutputCodeRequest->NumCodes,
777  &ReadOutputCodeRequest->Coord,
778  // &ReadOutputCodeRequest->EndCoord,
779  &ReadOutputCodeRequest->NumCodes);
780 
782  return Status;
783 }
#define RTL_FIELD_SIZE(type, field)
Definition: kdb_expr.c:84
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
CODE_TYPE CodeType
Definition: conmsg.h:535
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
CHAR CodeStaticBuffer[80]
Definition: conmsg.h:536
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
unsigned int ULONG
Definition: retypes.h:1
HANDLE OutputHandle
Definition: conmsg.h:532
NTSTATUS NTAPI ConDrvReadConsoleOutputString(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN CODE_TYPE CodeType, OUT PVOID StringBuffer, IN ULONG NumCodesToRead, IN PCOORD ReadCoord, OUT PULONG NumCodesRead OPTIONAL)
Definition: text.c:955
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [18/87]

CSR_API ( SrvWriteConsoleOutputString  )

Definition at line 795 of file conoutput.c.

796 {
798  PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputCodeRequest;
800  ULONG CodeSize;
801 
802  PVOID pCode;
803 
804  DPRINT("SrvWriteConsoleOutputString\n");
805 
806  switch (WriteOutputCodeRequest->CodeType)
807  {
808  case CODE_ASCII:
809  CodeSize = RTL_FIELD_SIZE(CODE_ELEMENT, AsciiChar);
810  break;
811 
812  case CODE_UNICODE:
813  CodeSize = RTL_FIELD_SIZE(CODE_ELEMENT, UnicodeChar);
814  break;
815 
816  case CODE_ATTRIBUTE:
817  CodeSize = RTL_FIELD_SIZE(CODE_ELEMENT, Attribute);
818  break;
819 
820  default:
822  }
823 
824  /*
825  * For optimization purposes, Windows (and hence ReactOS, too, for
826  * compatibility reasons) uses a static buffer if no more than eighty
827  * bytes are written. Otherwise a new buffer is used.
828  * The client-side expects that we know this behaviour.
829  */
830  if (WriteOutputCodeRequest->NumCodes * CodeSize <= sizeof(WriteOutputCodeRequest->CodeStaticBuffer))
831  {
832  /*
833  * Adjust the internal pointer, because its old value points to
834  * the static buffer in the original ApiMessage structure.
835  */
836  // WriteOutputCodeRequest->pCode = WriteOutputCodeRequest->CodeStaticBuffer;
837  pCode = WriteOutputCodeRequest->CodeStaticBuffer;
838  }
839  else
840  {
841  if (!CsrValidateMessageBuffer(ApiMessage,
842  (PVOID*)&WriteOutputCodeRequest->pCode,
843  WriteOutputCodeRequest->NumCodes,
844  CodeSize))
845  {
847  }
848 
849  pCode = WriteOutputCodeRequest->pCode;
850  }
851 
853  WriteOutputCodeRequest->OutputHandle,
855  if (!NT_SUCCESS(Status))
856  {
857  WriteOutputCodeRequest->NumCodes = 0;
858  return Status;
859  }
860 
861  Status = ConDrvWriteConsoleOutputString(Buffer->Header.Console,
862  Buffer,
863  WriteOutputCodeRequest->CodeType,
864  pCode,
865  WriteOutputCodeRequest->NumCodes,
866  &WriteOutputCodeRequest->Coord,
867  // &WriteOutputCodeRequest->EndCoord,
868  &WriteOutputCodeRequest->NumCodes);
869 
871  return Status;
872 }
#define RTL_FIELD_SIZE(type, field)
Definition: kdb_expr.c:84
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
CODE_TYPE CodeType
Definition: conmsg.h:535
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSTATUS NTAPI ConDrvWriteConsoleOutputString(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN CODE_TYPE CodeType, IN PVOID StringBuffer, IN ULONG NumCodesToWrite, IN PCOORD WriteCoord, OUT PULONG NumCodesWritten OPTIONAL)
Definition: text.c:1174
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
CHAR CodeStaticBuffer[80]
Definition: conmsg.h:536
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
unsigned int ULONG
Definition: retypes.h:1
HANDLE OutputHandle
Definition: conmsg.h:532
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [19/87]

CSR_API ( SrvFillConsoleOutput  )

Definition at line 883 of file conoutput.c.

884 {
886  PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FillOutputRequest;
888  CODE_TYPE CodeType = FillOutputRequest->CodeType;
889 
890  DPRINT("SrvFillConsoleOutput\n");
891 
892  if ( (CodeType != CODE_ASCII ) &&
893  (CodeType != CODE_UNICODE ) &&
894  (CodeType != CODE_ATTRIBUTE) )
895  {
897  }
898 
900  FillOutputRequest->OutputHandle,
902  if (!NT_SUCCESS(Status))
903  {
904  FillOutputRequest->NumCodes = 0;
905  return Status;
906  }
907 
908  Status = ConDrvFillConsoleOutput(Buffer->Header.Console,
909  Buffer,
910  CodeType,
911  FillOutputRequest->Code,
912  FillOutputRequest->NumCodes,
913  &FillOutputRequest->WriteCoord,
914  &FillOutputRequest->NumCodes);
915 
917  return Status;
918 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
CODE_ELEMENT Code
Definition: conmsg.h:557
CODE_TYPE CodeType
Definition: conmsg.h:556
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
enum _CODE_TYPE CODE_TYPE
NTSTATUS NTAPI ConDrvFillConsoleOutput(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN CODE_TYPE CodeType, IN CODE_ELEMENT Code, IN ULONG NumCodesToWrite, IN PCOORD WriteCoord, OUT PULONG NumCodesWritten OPTIONAL)
Definition: text.c:1264

◆ CSR_API() [20/87]

CSR_API ( SrvGetConsoleCursorInfo  )

Definition at line 122 of file conoutput.c.

123 {
125  PCONSOLE_GETSETCURSORINFO CursorInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CursorInfoRequest;
127 
128  DPRINT("SrvGetConsoleCursorInfo\n");
129 
131  CursorInfoRequest->OutputHandle,
133  if (!NT_SUCCESS(Status)) return Status;
134 
135  Status = ConDrvGetConsoleCursorInfo(Buffer->Header.Console,
136  Buffer,
137  &CursorInfoRequest->Info);
138 
140  return Status;
141 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI ConDrvGetConsoleCursorInfo(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, OUT PCONSOLE_CURSOR_INFO CursorInfo)
Definition: conoutput.c:263
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
CONSOLE_CURSOR_INFO Info
Definition: conmsg.h:346
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [21/87]

CSR_API ( SrvSetConsoleCursorInfo  )

Definition at line 148 of file conoutput.c.

149 {
151  PCONSOLE_GETSETCURSORINFO CursorInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CursorInfoRequest;
153 
154  DPRINT("SrvSetConsoleCursorInfo\n");
155 
157  CursorInfoRequest->OutputHandle,
159  if (!NT_SUCCESS(Status)) return Status;
160 
161  Status = ConDrvSetConsoleCursorInfo(Buffer->Header.Console,
162  Buffer,
163  &CursorInfoRequest->Info);
164 
166  return Status;
167 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
CONSOLE_CURSOR_INFO Info
Definition: conmsg.h:346
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
NTSTATUS NTAPI ConDrvSetConsoleCursorInfo(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCONSOLE_CURSOR_INFO CursorInfo)
Definition: conoutput.c:281
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [22/87]

CSR_API ( SrvSetConsoleCursorPosition  )

Definition at line 174 of file conoutput.c.

175 {
177  PCONSOLE_SETCURSORPOSITION SetCursorPositionRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorPositionRequest;
179 
180  DPRINT("SrvSetConsoleCursorPosition\n");
181 
183  SetCursorPositionRequest->OutputHandle,
185  if (!NT_SUCCESS(Status)) return Status;
186 
187  Status = ConDrvSetConsoleCursorPosition(Buffer->Header.Console,
188  Buffer,
189  &SetCursorPositionRequest->Position);
190 
192  return Status;
193 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
NTSTATUS NTAPI ConDrvSetConsoleCursorPosition(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCOORD Position)
Definition: conoutput.c:311
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [23/87]

CSR_API ( SrvSetConsoleTextAttribute  )

Definition at line 961 of file conoutput.c.

962 {
964  PCONSOLE_SETTEXTATTRIB SetTextAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetTextAttribRequest;
966 
967  DPRINT("SrvSetConsoleTextAttribute\n");
968 
970  SetTextAttribRequest->OutputHandle,
972  if (!NT_SUCCESS(Status)) return Status;
973 
974  Status = ConDrvSetConsoleTextAttribute(Buffer->Header.Console,
975  Buffer,
976  SetTextAttribRequest->Attributes);
977 
979  return Status;
980 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI ConDrvSetConsoleTextAttribute(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN WORD Attributes)
Definition: text.c:1433
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [24/87]

CSR_API ( SrvCreateConsoleScreenBuffer  )

Definition at line 196 of file conoutput.c.

197 {
199  PCONSOLE_CREATESCREENBUFFER CreateScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CreateScreenBufferRequest;
204 
206  TEXTMODE_BUFFER_INFO TextModeInfo = {{80, 25},
207  {80, 25},
210  TRUE,
212  GRAPHICS_BUFFER_INFO GraphicsInfo;
213  GraphicsInfo.Info = CreateScreenBufferRequest->GraphicsBufferInfo; // HACK for MSVC
214 
215  DPRINT("SrvCreateConsoleScreenBuffer\n");
216 
217  Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
218  if (!NT_SUCCESS(Status)) return Status;
219 
220  if (CreateScreenBufferRequest->ScreenBufferType == CONSOLE_TEXTMODE_BUFFER)
221  {
222  ScreenBufferInfo = &TextModeInfo;
223 
224  /*
225  * This is Windows behaviour, as described by MSDN and verified manually:
226  *
227  * The newly created screen buffer will copy some properties from the
228  * active screen buffer at the time that this function is called.
229  * The behavior is as follows:
230  * Font - copied from active screen buffer.
231  * Display Window Size - copied from active screen buffer.
232  * Buffer Size - matched to Display Window Size (NOT copied).
233  * Default Attributes (colors) - copied from active screen buffer.
234  * Default Popup Attributes (colors) - copied from active screen buffer.
235  */
236 
237  /* If we have an active screen buffer, use its attributes as the new ones */
238  if (Console->ActiveBuffer && GetType(Console->ActiveBuffer) == TEXTMODE_BUFFER)
239  {
241 
242  TextModeInfo.ScreenAttrib = Buffer->ScreenDefaultAttrib;
243  TextModeInfo.PopupAttrib = Buffer->PopupDefaultAttrib;
244 
245  TextModeInfo.CursorSize = Buffer->CursorInfo.dwSize;
246  TextModeInfo.IsCursorVisible = Buffer->CursorInfo.bVisible;
247 
248  /* Use the current view size */
249  TextModeInfo.ScreenBufferSize = Buffer->ViewSize;
250  TextModeInfo.ViewSize = Buffer->ViewSize;
251  }
252  else
253  {
254  /* Use the current console size */
255  TextModeInfo.ScreenBufferSize = Console->ConsoleSize;
256  TextModeInfo.ViewSize = Console->ConsoleSize;
257  }
258 
259  /* Normalize the screen buffer size if needed */
260  if (TextModeInfo.ScreenBufferSize.X == 0) TextModeInfo.ScreenBufferSize.X = 1;
261  if (TextModeInfo.ScreenBufferSize.Y == 0) TextModeInfo.ScreenBufferSize.Y = 1;
262  }
263  else if (CreateScreenBufferRequest->ScreenBufferType == CONSOLE_GRAPHICS_BUFFER)
264  {
265  /* Get information from the graphics buffer information structure */
266  if (!CsrValidateMessageBuffer(ApiMessage,
267  (PVOID*)&CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMapInfo,
268  CreateScreenBufferRequest->GraphicsBufferInfo.dwBitMapInfoLength,
269  sizeof(BYTE)))
270  {
272  goto Quit;
273  }
274 
275  ScreenBufferInfo = &GraphicsInfo;
276 
277  /* Initialize shared variables */
278  // CreateScreenBufferRequest->GraphicsBufferInfo.hMutex
279  CreateScreenBufferRequest->hMutex = GraphicsInfo.Info.hMutex = INVALID_HANDLE_VALUE;
280  // CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap
281  CreateScreenBufferRequest->lpBitMap = GraphicsInfo.Info.lpBitMap = NULL;
282 
283  /* A graphics screen buffer is never inheritable */
284  CreateScreenBufferRequest->InheritHandle = FALSE;
285  }
286 
288  (PCONSOLE)Console,
289  Process->ProcessHandle,
290  CreateScreenBufferRequest->ScreenBufferType,
292  if (!NT_SUCCESS(Status)) goto Quit;
293 
294  /* Insert the new handle inside the process handles table */
296 
297  Status = ConSrvInsertObject(ProcessData,
298  &CreateScreenBufferRequest->OutputHandle,
299  &Buff->Header,
300  CreateScreenBufferRequest->DesiredAccess,
301  CreateScreenBufferRequest->InheritHandle,
302  CreateScreenBufferRequest->ShareMode);
303 
305 
306  if (!NT_SUCCESS(Status)) goto Quit;
307 
308  if (CreateScreenBufferRequest->ScreenBufferType == CONSOLE_GRAPHICS_BUFFER)
309  {
311  /*
312  * Initialize the graphics buffer information structure
313  * and give it back to the client.
314  */
315  // CreateScreenBufferRequest->GraphicsBufferInfo.hMutex
316  CreateScreenBufferRequest->hMutex = Buffer->ClientMutex;
317  // CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap
318  CreateScreenBufferRequest->lpBitMap = Buffer->ClientBitMap;
319  }
320 
321 Quit:
323  return Status;
324 }
CONSOLE_GRAPHICS_BUFFER_INFO Info
Definition: conio.h:168
#define DEFAULT_SCREEN_ATTRIB
Definition: settings.c:29
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
CONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo
Definition: notevil.c:38
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
BOOLEAN IsCursorVisible
Definition: conio.h:148
NTSTATUS ConDrvCreateScreenBuffer(OUT PCONSOLE_SCREEN_BUFFER *Buffer, IN PCONSOLE Console, IN HANDLE ProcessHandle OPTIONAL, IN ULONG BufferType, IN PVOID ScreenBufferInfo)
Definition: conoutput.c:79
#define TEXTMODE_BUFFER
Definition: pccons.c:21
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
CONSOLE_IO_OBJECT Header
Definition: conio.h:82
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
ULONG X
Definition: bl.h:1340
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define CSR_DEFAULT_CURSOR_SIZE
Definition: settings.c:26
struct _GRAPHICS_SCREEN_BUFFER * PGRAPHICS_SCREEN_BUFFER
LPBITMAPINFO lpBitMapInfo
Definition: wincon.h:230
INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
Definition: gettype.c:129
CONSOLE_GRAPHICS_BUFFER_INFO GraphicsBufferInfo
Definition: conmsg.h:456
unsigned char BYTE
Definition: mem.h:68
USHORT PopupAttrib
Definition: conio.h:146
Status
Definition: gdiplustypes.h:24
#define DEFAULT_POPUP_ATTRIB
Definition: settings.c:30
#define CONSOLE_TEXTMODE_BUFFER
Definition: wincon.h:62
#define CONSOLE_GRAPHICS_BUFFER
Definition: wincon.h:63
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS ConSrvInsertObject(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PHANDLE Handle, IN PCONSOLE_IO_OBJECT Object, IN ULONG Access, IN BOOLEAN Inheritable, IN ULONG ShareMode)
Definition: handle.c:310
ULONG Y
Definition: bl.h:1341
struct _TEXTMODE_SCREEN_BUFFER * PTEXTMODE_SCREEN_BUFFER
COORD ScreenBufferSize
Definition: conio.h:143
USHORT ScreenAttrib
Definition: conio.h:145
RTL_CRITICAL_SECTION HandleTableLock
Definition: consrv.h:48

◆ CSR_API() [25/87]

CSR_API ( SrvGetConsoleScreenBufferInfo  )

Definition at line 930 of file conoutput.c.

931 {
933  PCONSOLE_GETSCREENBUFFERINFO ScreenBufferInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScreenBufferInfoRequest;
935 
936  DPRINT("SrvGetConsoleScreenBufferInfo\n");
937 
939  ScreenBufferInfoRequest->OutputHandle,
941  if (!NT_SUCCESS(Status)) return Status;
942 
944  Buffer,
945  &ScreenBufferInfoRequest->ScreenBufferSize,
946  &ScreenBufferInfoRequest->CursorPosition,
947  &ScreenBufferInfoRequest->ViewOrigin,
948  &ScreenBufferInfoRequest->ViewSize,
949  &ScreenBufferInfoRequest->MaximumViewSize,
950  &ScreenBufferInfoRequest->Attributes);
951 
953  return Status;
954 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI ConDrvGetConsoleScreenBufferInfo(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, OUT PCOORD ScreenBufferSize, OUT PCOORD CursorPosition, OUT PCOORD ViewOrigin, OUT PCOORD ViewSize, OUT PCOORD MaximumViewSize, OUT PWORD Attributes)
Definition: text.c:1393
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [26/87]

CSR_API ( SrvSetConsoleActiveScreenBuffer  )

Definition at line 330 of file conoutput.c.

331 {
333  PCONSOLE_SETACTIVESCREENBUFFER SetScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferRequest;
335 
336  DPRINT("SrvSetConsoleActiveScreenBuffer\n");
337 
339  SetScreenBufferRequest->OutputHandle,
341  if (!NT_SUCCESS(Status)) return Status;
342 
344  Buffer);
345 
347  return Status;
348 }
NTSTATUS NTAPI ConDrvSetConsoleActiveScreenBuffer(IN PCONSOLE Console, IN PCONSOLE_SCREEN_BUFFER Buffer)
Definition: conoutput.c:170
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:26
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [27/87]

CSR_API ( SrvSetConsoleScreenBufferSize  )

Definition at line 987 of file conoutput.c.

988 {
990  PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSizeRequest;
992 
993  DPRINT("SrvSetConsoleScreenBufferSize\n");
994 
996  SetScreenBufferSizeRequest->OutputHandle,
998  if (!NT_SUCCESS(Status)) return Status;
999 
1001  Buffer,
1002  &SetScreenBufferSizeRequest->Size);
1003 
1005  return Status;
1006 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI ConDrvSetConsoleScreenBufferSize(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCOORD Size)
Definition: text.c:1448
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [28/87]

CSR_API ( SrvScrollConsoleScreenBuffer  )

Definition at line 1018 of file conoutput.c.

1019 {
1020  NTSTATUS Status;
1021  PCONSOLE_SCROLLSCREENBUFFER ScrollScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScrollScreenBufferRequest;
1023 
1024  DPRINT("SrvScrollConsoleScreenBuffer\n");
1025 
1027  ScrollScreenBufferRequest->OutputHandle,
1029  if (!NT_SUCCESS(Status)) return Status;
1030 
1031  Status = ConDrvScrollConsoleScreenBuffer(Buffer->Header.Console,
1032  Buffer,
1033  ScrollScreenBufferRequest->Unicode,
1034  &ScrollScreenBufferRequest->ScrollRectangle,
1035  ScrollScreenBufferRequest->UseClipRectangle,
1036  &ScrollScreenBufferRequest->ClipRectangle,
1037  &ScrollScreenBufferRequest->DestinationOrigin,
1038  ScrollScreenBufferRequest->Fill);
1039 
1041  return Status;
1042 }
SMALL_RECT ScrollRectangle
Definition: conmsg.h:501
SMALL_RECT ClipRectangle
Definition: conmsg.h:502
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI ConDrvScrollConsoleScreenBuffer(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Unicode, IN PSMALL_RECT ScrollRectangle, IN BOOLEAN UseClipRectangle, IN PSMALL_RECT ClipRectangle OPTIONAL, IN PCOORD DestinationOrigin, IN CHAR_INFO FillChar)
Definition: text.c:1467
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [29/87]

CSR_API ( SrvSetConsoleWindowInfo  )

Definition at line 1050 of file conoutput.c.

1051 {
1052  NTSTATUS Status;
1053  PCONSOLE_SETWINDOWINFO SetWindowInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetWindowInfoRequest;
1054  // PCONSOLE_SCREEN_BUFFER Buffer;
1056 
1057  DPRINT("SrvSetConsoleWindowInfo(0x%08x, %d, {L%d, T%d, R%d, B%d}) called\n",
1058  SetWindowInfoRequest->OutputHandle, SetWindowInfoRequest->Absolute,
1059  SetWindowInfoRequest->WindowRect.Left ,
1060  SetWindowInfoRequest->WindowRect.Top ,
1061  SetWindowInfoRequest->WindowRect.Right,
1062  SetWindowInfoRequest->WindowRect.Bottom);
1063 
1064  // ConSrvGetScreenBuffer
1066  SetWindowInfoRequest->OutputHandle,
1067  &Buffer, GENERIC_READ, TRUE);
1068  if (!NT_SUCCESS(Status)) return Status;
1069 
1070  Status = ConDrvSetConsoleWindowInfo(Buffer->Header.Console,
1071  Buffer,
1072  SetWindowInfoRequest->Absolute,
1073  &SetWindowInfoRequest->WindowRect);
1074 
1076  return Status;
1077 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
SMALL_RECT WindowRect
Definition: conmsg.h:710
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
SHORT Left
Definition: blue.h:32
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
SHORT Bottom
Definition: blue.h:35
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
SHORT Top
Definition: blue.h:33
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI ConDrvSetConsoleWindowInfo(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Absolute, IN PSMALL_RECT WindowRect)
Definition: text.c:1592
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
SHORT Right
Definition: blue.h:34
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [30/87]

CSR_API ( SrvAllocConsole  )

Definition at line 987 of file console.c.

988 {
990  PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AllocConsoleRequest;
993  CONSOLE_INIT_INFO ConsoleInitInfo;
994 
995  if (ProcessData->ConsoleHandle != NULL)
996  {
997  DPRINT1("Process already has a console\n");
998  return STATUS_ACCESS_DENIED;
999  }
1000 
1001  if ( !CsrValidateMessageBuffer(ApiMessage,
1002  (PVOID*)&AllocConsoleRequest->ConsoleStartInfo,
1003  1,
1004  sizeof(CONSOLE_START_INFO)) ||
1005  !CsrValidateMessageBuffer(ApiMessage,
1006  (PVOID*)&AllocConsoleRequest->ConsoleTitle,
1007  AllocConsoleRequest->TitleLength,
1008  sizeof(BYTE)) ||
1009  !CsrValidateMessageBuffer(ApiMessage,
1010  (PVOID*)&AllocConsoleRequest->Desktop,
1011  AllocConsoleRequest->DesktopLength,
1012  sizeof(BYTE)) ||
1013  !CsrValidateMessageBuffer(ApiMessage,
1014  (PVOID*)&AllocConsoleRequest->CurDir,
1015  AllocConsoleRequest->CurDirLength,
1016  sizeof(BYTE)) ||
1017  !CsrValidateMessageBuffer(ApiMessage,
1018  (PVOID*)&AllocConsoleRequest->AppName,
1019  AllocConsoleRequest->AppNameLength,
1020  sizeof(BYTE)) )
1021  {
1022  return STATUS_INVALID_PARAMETER;
1023  }
1024 
1025  /* Initialize the console initialization info structure */
1026  ConsoleInitInfo.ConsoleStartInfo = AllocConsoleRequest->ConsoleStartInfo;
1027  ConsoleInitInfo.IsWindowVisible = TRUE; // The console window is always visible.
1028  ConsoleInitInfo.TitleLength = AllocConsoleRequest->TitleLength;
1029  ConsoleInitInfo.ConsoleTitle = AllocConsoleRequest->ConsoleTitle;
1030  ConsoleInitInfo.DesktopLength = AllocConsoleRequest->DesktopLength;
1031  ConsoleInitInfo.Desktop = AllocConsoleRequest->Desktop;
1032  ConsoleInitInfo.AppNameLength = AllocConsoleRequest->AppNameLength;
1033  ConsoleInitInfo.AppName = AllocConsoleRequest->AppName;
1034  ConsoleInitInfo.CurDirLength = AllocConsoleRequest->CurDirLength;
1035  ConsoleInitInfo.CurDir = AllocConsoleRequest->CurDir;
1036 
1037  /* Initialize a new Console owned by the Console Leader Process */
1038  Status = ConSrvAllocateConsole(ProcessData,
1039  &AllocConsoleRequest->ConsoleStartInfo->InputHandle,
1040  &AllocConsoleRequest->ConsoleStartInfo->OutputHandle,
1041  &AllocConsoleRequest->ConsoleStartInfo->ErrorHandle,
1042  &ConsoleInitInfo);
1043  if (!NT_SUCCESS(Status))
1044  {
1045  DPRINT1("Console allocation failed\n");
1046  return Status;
1047  }
1048 
1049  /* Set the Property-Dialog and Control-Dispatcher handlers */
1050  ProcessData->PropRoutine = AllocConsoleRequest->PropRoutine;
1051  ProcessData->CtrlRoutine = AllocConsoleRequest->CtrlRoutine;
1052 
1053  return STATUS_SUCCESS;
1054 }
HANDLE OutputHandle
Definition: conmsg.h:173
HANDLE ErrorHandle
Definition: conmsg.h:174
HANDLE ConsoleHandle
Definition: consrv.h:45
PWCHAR Desktop
Definition: console.h:19
PCONSOLE_START_INFO ConsoleStartInfo
Definition: console.h:13
#define CsrGetClientThread()
Definition: csrsrv.h:77
LPTHREAD_START_ROUTINE PropRoutine
Definition: conmsg.h:286
#define TRUE
Definition: types.h:120
ULONG CurDirLength
Definition: console.h:22
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LPTHREAD_START_ROUTINE CtrlRoutine
Definition: consrv.h:52
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
LPTHREAD_START_ROUTINE CtrlRoutine
Definition: conmsg.h:285
PKPROCESS CsrProcess
Definition: videoprt.c:37
ULONG AppNameLength
Definition: console.h:20
PWCHAR AppName
Definition: console.h:21
ULONG TitleLength
Definition: console.h:16
smooth NULL
Definition: ftsmooth.c:416
PWCHAR ConsoleTitle
Definition: console.h:17
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
LPTHREAD_START_ROUTINE PropRoutine
Definition: consrv.h:53
unsigned char BYTE
Definition: mem.h:68
ULONG DesktopLength
Definition: console.h:18
Status
Definition: gdiplustypes.h:24
BOOLEAN IsWindowVisible
Definition: console.h:14
HANDLE InputHandle
Definition: conmsg.h:172
#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
return STATUS_SUCCESS
Definition: btrfs.c:2938
PCONSOLE_START_INFO ConsoleStartInfo
Definition: conmsg.h:274

◆ CSR_API() [31/87]

CSR_API ( SrvAttachConsole  )

Definition at line 1057 of file console.c.

1058 {
1060  PCONSOLE_ATTACHCONSOLE AttachConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AttachConsoleRequest;
1061  PCSR_PROCESS SourceProcess = NULL; // The parent process.
1062  PCSR_PROCESS TargetProcess = CsrGetClientThread()->Process; // Ourselves.
1063  HANDLE ProcessId = ULongToHandle(AttachConsoleRequest->ProcessId);
1064  PCONSOLE_PROCESS_DATA SourceProcessData, TargetProcessData;
1065 
1066  TargetProcessData = ConsoleGetPerProcessData(TargetProcess);
1067 
1068  if (TargetProcessData->ConsoleHandle != NULL)
1069  {
1070  DPRINT1("Process already has a console\n");
1071  return STATUS_ACCESS_DENIED;
1072  }
1073 
1074  if (!CsrValidateMessageBuffer(ApiMessage,
1075  (PVOID*)&AttachConsoleRequest->ConsoleStartInfo,
1076  1,
1077  sizeof(CONSOLE_START_INFO)))
1078  {
1079  return STATUS_INVALID_PARAMETER;
1080  }
1081 
1082  /* Check whether we try to attach to the parent's console */
1084  {
1085  PROCESS_BASIC_INFORMATION ProcessInfo;
1086  ULONG Length = sizeof(ProcessInfo);
1087 
1088  /* Get the real parent's PID */
1089 
1092  &ProcessInfo,
1093  Length, &Length);
1094  if (!NT_SUCCESS(Status))
1095  {
1096  DPRINT1("SrvAttachConsole - Cannot retrieve basic process info, Status = 0x%08lx\n", Status);
1097  return Status;
1098  }
1099 
1101  }
1102 
1103  /* Lock the source process via its PID */
1104  Status = CsrLockProcessByClientId(ProcessId, &SourceProcess);
1105  if (!NT_SUCCESS(Status)) return Status;
1106 
1107  SourceProcessData = ConsoleGetPerProcessData(SourceProcess);
1108 
1109  if (SourceProcessData->ConsoleHandle == NULL)
1110  {
1112  goto Quit;
1113  }
1114 
1115  /*
1116  * Inherit the console from the parent,
1117  * if any, otherwise return an error.
1118  */
1119  Status = ConSrvInheritConsole(TargetProcessData,
1120  SourceProcessData->ConsoleHandle,
1121  TRUE,
1122  &AttachConsoleRequest->ConsoleStartInfo->InputHandle,
1123  &AttachConsoleRequest->ConsoleStartInfo->OutputHandle,
1124  &AttachConsoleRequest->ConsoleStartInfo->ErrorHandle,
1125  AttachConsoleRequest->ConsoleStartInfo);
1126  if (!NT_SUCCESS(Status))
1127  {
1128  DPRINT1("Console inheritance failed\n");
1129  goto Quit;
1130  }
1131 
1132  /* Set the Property-Dialog and Control-Dispatcher handlers */
1133  TargetProcessData->PropRoutine = AttachConsoleRequest->PropRoutine;
1134  TargetProcessData->CtrlRoutine = AttachConsoleRequest->CtrlRoutine;
1135 
1137 
1138 Quit:
1139  /* Unlock the "source" process and exit */
1140  CsrUnlockProcess(SourceProcess);
1141  return Status;
1142 }
HANDLE OutputHandle
Definition: conmsg.h:173
HANDLE ErrorHandle
Definition: conmsg.h:174
HANDLE ConsoleHandle
Definition: consrv.h:45
#define ULongToHandle(h)
Definition: basetsd.h:81
#define CsrGetClientThread()
Definition: csrsrv.h:77
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define TRUE
Definition: types.h:120
LPTHREAD_START_ROUTINE CtrlRoutine
Definition: conmsg.h:299
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LPTHREAD_START_ROUTINE CtrlRoutine
Definition: consrv.h:52
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 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
HANDLE ProcessHandle
Definition: csrsrv.h:46
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI CsrLockProcessByClientId(IN HANDLE Pid, OUT PCSR_PROCESS *CsrProcess OPTIONAL)
ULONG_PTR InheritedFromUniqueProcessId
Definition: pstypes.h:340
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
LPTHREAD_START_ROUTINE PropRoutine
Definition: consrv.h:53
LPTHREAD_START_ROUTINE PropRoutine
Definition: conmsg.h:300
Status
Definition: gdiplustypes.h:24
HANDLE InputHandle
Definition: conmsg.h:172
#define ATTACH_PARENT_PROCESS
Definition: wincon.h:21
#define DPRINT1
Definition: precomp.h:8
PCONSOLE_START_INFO ConsoleStartInfo
Definition: conmsg.h:297
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938
NTSTATUS NTAPI CsrUnlockProcess(IN PCSR_PROCESS CsrProcess)
Definition: procsup.c:1398

◆ CSR_API() [32/87]

CSR_API ( SrvFreeConsole  )

Definition at line 1145 of file console.c.

1146 {
1148 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
NTSTATUS ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData)
Definition: handle.c:735
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219

◆ CSR_API() [33/87]

CSR_API ( SrvGetConsoleMode  )

Definition at line 1155 of file console.c.

1156 {
1157  NTSTATUS Status;
1158  PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
1160 
1161  PULONG ConsoleMode = &ConsoleModeRequest->Mode;
1162 
1164  ConsoleModeRequest->Handle,
1165  &Object, NULL, GENERIC_READ, TRUE, 0);
1166  if (!NT_SUCCESS(Status)) return Status;
1167 
1168  /* Get the standard console modes */
1170  ConsoleMode);
1171  if (NT_SUCCESS(Status))
1172  {
1173  /*
1174  * If getting the console modes succeeds, then retrieve
1175  * the extended CONSRV-specific input modes.
1176  */
1177  if (INPUT_BUFFER == Object->Type)
1178  {
1179  if (Object->Console->InsertMode || Object->Console->QuickEdit)
1180  {
1181  /* Windows also adds ENABLE_EXTENDED_FLAGS, even if it's not documented on MSDN */
1182  *ConsoleMode |= ENABLE_EXTENDED_FLAGS;
1183 
1184  if (Object->Console->InsertMode) *ConsoleMode |= ENABLE_INSERT_MODE;
1185  if (Object->Console->QuickEdit ) *ConsoleMode |= ENABLE_QUICK_EDIT_MODE;
1186  }
1187  }
1188  }
1189 
1191  return Status;
1192 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI ConDrvGetConsoleMode(IN PCONSOLE Console, IN PCONSOLE_IO_OBJECT Object, OUT PULONG ConsoleMode)
Definition: console.c:431
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
static IUnknown Object
Definition: main.c:512
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
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
#define ENABLE_INSERT_MODE
Definition: wincon.h:83
#define ENABLE_EXTENDED_FLAGS
Definition: wincon.h:85
unsigned int * PULONG
Definition: retypes.h:1
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
VOID ConSrvReleaseObject(IN PCONSOLE_IO_OBJECT Object, IN BOOLEAN IsConsoleLocked)
Definition: handle.c:465
#define ENABLE_QUICK_EDIT_MODE
Definition: wincon.h:84

◆ CSR_API() [34/87]

CSR_API ( SrvSetConsoleMode  )

Definition at line 1199 of file console.c.

1200 {
1201 #define CONSOLE_VALID_CONTROL_MODES ( ENABLE_EXTENDED_FLAGS | \
1202  ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE )
1203 // NOTE: Vista+ ENABLE_AUTO_POSITION is also a control mode.
1204 
1205  NTSTATUS Status;
1206  PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
1208 
1209  ULONG ConsoleMode = ConsoleModeRequest->Mode;
1210 
1212  ConsoleModeRequest->Handle,
1213  &Object, NULL, GENERIC_WRITE, TRUE, 0);
1214  if (!NT_SUCCESS(Status)) return Status;
1215 
1216  /* Set the standard console modes (without the CONSRV-specific input modes) */
1217  ConsoleMode &= ~CONSOLE_VALID_CONTROL_MODES; // Remove CONSRV-specific input modes.
1219  ConsoleMode);
1220  if (NT_SUCCESS(Status))
1221  {
1222  /*
1223  * If setting the console modes succeeds, then set
1224  * the extended CONSRV-specific input modes.
1225  */
1226  if (INPUT_BUFFER == Object->Type)
1227  {
1228  ConsoleMode = ConsoleModeRequest->Mode;
1229 
1230  if (ConsoleMode & CONSOLE_VALID_CONTROL_MODES)
1231  {
1232  /*
1233  * If we use control mode flags without ENABLE_EXTENDED_FLAGS,
1234  * then consider the flags invalid.
1235  */
1236  if ((ConsoleMode & ENABLE_EXTENDED_FLAGS) == 0)
1237  {
1239  }
1240  else
1241  {
1242  Object->Console->InsertMode = !!(ConsoleMode & ENABLE_INSERT_MODE);
1243  Object->Console->QuickEdit = !!(ConsoleMode & ENABLE_QUICK_EDIT_MODE);
1244  }
1245  }
1246  }
1247  }
1248 
1250  return Status;
1251 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI ConDrvSetConsoleMode(IN PCONSOLE Console, IN PCONSOLE_IO_OBJECT Object, IN ULONG ConsoleMode)
Definition: console.c:464
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define CONSOLE_VALID_CONTROL_MODES
static IUnknown Object
Definition: main.c:512
Status
Definition: gdiplustypes.h:24
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
#define ENABLE_INSERT_MODE
Definition: wincon.h:83
#define ENABLE_EXTENDED_FLAGS
Definition: wincon.h:85
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
VOID ConSrvReleaseObject(IN PCONSOLE_IO_OBJECT Object, IN BOOLEAN IsConsoleLocked)
Definition: handle.c:465
unsigned int ULONG
Definition: retypes.h:1
#define ENABLE_QUICK_EDIT_MODE
Definition: wincon.h:84

◆ CSR_API() [35/87]

CSR_API ( SrvGetConsoleTitle  )

Definition at line 1254 of file console.c.

1255 {
1256  NTSTATUS Status;
1257  PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
1259  ULONG Length;
1260 
1261  if (!CsrValidateMessageBuffer(ApiMessage,
1262  (PVOID)&TitleRequest->Title,
1263  TitleRequest->Length,
1264  sizeof(BYTE)))
1265  {
1266  return STATUS_INVALID_PARAMETER;
1267  }
1268 
1270  if (!NT_SUCCESS(Status))
1271  {
1272  DPRINT1("Can't get console, status %lx\n", Status);
1273  return Status;
1274  }
1275 
1276  /* Copy title of the console to the user title buffer */
1277  if (TitleRequest->Unicode)
1278  {
1279  if (TitleRequest->Length >= sizeof(WCHAR))
1280  {
1281  Length = min(TitleRequest->Length - sizeof(WCHAR), Console->Title.Length);
1282  RtlCopyMemory(TitleRequest->Title, Console->Title.Buffer, Length);
1283  ((PWCHAR)TitleRequest->Title)[Length / sizeof(WCHAR)] = UNICODE_NULL;
1284  TitleRequest->Length = Length;
1285  }
1286  else
1287  {
1288  TitleRequest->Length = Console->Title.Length;
1289  }
1290  }
1291  else
1292  {
1293  if (TitleRequest->Length >= sizeof(CHAR))
1294  {
1295  Length = min(TitleRequest->Length - sizeof(CHAR), Console->Title.Length / sizeof(WCHAR));
1296  Length = WideCharToMultiByte(Console->InputCodePage, 0,
1297  Console->Title.Buffer, Length,
1298  TitleRequest->Title, Length,
1299  NULL, NULL);
1300  ((PCHAR)TitleRequest->Title)[Length] = ANSI_NULL;
1301  TitleRequest->Length = Length;
1302  }
1303  else
1304  {
1305  TitleRequest->Length = Console->Title.Length / sizeof(WCHAR);
1306  }
1307  }
1308 
1310  return Status;
1311 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define WideCharToMultiByte
Definition: compat.h:101
#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
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
uint16_t * PWCHAR
Definition: typedefs.h:55
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
#define UNICODE_NULL
#define ANSI_NULL
smooth NULL
Definition: ftsmooth.c:416
#define PCHAR
Definition: match.c:90
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char BYTE
Definition: mem.h:68
Status
Definition: gdiplustypes.h:24
#define min(a, b)
Definition: monoChain.cc:55
CConsole Console
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
unsigned int ULONG
Definition: retypes.h:1

◆ CSR_API() [36/87]

CSR_API ( SrvSetConsoleTitle  )

Definition at line 1314 of file console.c.

1315 {
1316  NTSTATUS Status;
1317  PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
1319 
1320  PWCHAR Buffer;
1321  ULONG Length;
1322 
1323  if (!CsrValidateMessageBuffer(ApiMessage,
1324  (PVOID)&TitleRequest->Title,
1325  TitleRequest->Length,
1326  sizeof(BYTE)))
1327  {
1328  return STATUS_INVALID_PARAMETER;
1329  }
1330 
1332  if (!NT_SUCCESS(Status))
1333  {
1334  DPRINT1("Can't get console, status %lx\n", Status);
1335  return Status;
1336  }
1337 
1338  if (TitleRequest->Unicode)
1339  {
1340  /* Length is in bytes */
1341  Length = TitleRequest->Length;
1342  }
1343  else
1344  {
1345  /* Use the console input CP for the conversion */
1346  Length = MultiByteToWideChar(Console->InputCodePage, 0,
1347  TitleRequest->Title, TitleRequest->Length,
1348  NULL, 0);
1349  /* The returned Length was in number of wchars, convert it in bytes */
1350  Length *= sizeof(WCHAR);
1351  }
1352 
1353  /* Allocate a new buffer to hold the new title (NULL-terminated) */
1355  if (!Buffer)
1356  {
1358  goto Quit;
1359  }
1360 
1361  /* Free the old title */
1363 
1364  /* Copy title to console */
1365  Console->Title.Buffer = Buffer;
1366  Console->Title.Length = Length;
1367  Console->Title.MaximumLength = Console->Title.Length + sizeof(WCHAR);
1368 
1369  if (TitleRequest->Unicode)
1370  {
1371  RtlCopyMemory(Console->Title.Buffer, TitleRequest->Title, Console->Title.Length);
1372  }
1373  else
1374  {
1375  MultiByteToWideChar(Console->InputCodePage, 0,
1376  TitleRequest->Title, TitleRequest->Length,
1377  Console->Title.Buffer,
1378  Console->Title.Length / sizeof(WCHAR));
1379  }
1380 
1381  /* NULL-terminate */
1382  Console->Title.Buffer[Console->Title.Length / sizeof(WCHAR)] = UNICODE_NULL;
1383 
1386 
1387 Quit:
1389  return Status;
1390 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
static VOID ConsoleFreeUnicodeString(IN PUNICODE_STRING UnicodeString)
Definition: console.c:233
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
#define ConsoleAllocHeap(Flags, Size)
Definition: heap.h:14
uint16_t * PWCHAR
Definition: typedefs.h:55
#define TermChangeTitle(Console)
Definition: term.h:46
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
#define UNICODE_NULL
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char BYTE
Definition: mem.h:68
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define MultiByteToWideChar
Definition: compat.h:100
CConsole Console
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ CSR_API() [37/87]

CSR_API ( SrvGetConsoleCP  )

Definition at line 1397 of file console.c.

1398 {
1399  NTSTATUS Status;
1400  PCONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleCPRequest;
1402 
1403  DPRINT("SrvGetConsoleCP, getting %s Code Page\n",
1404  GetConsoleCPRequest->OutputCP ? "Output" : "Input");
1405 
1407  if (!NT_SUCCESS(Status)) return Status;
1408 
1410  &GetConsoleCPRequest->CodePage,
1411  GetConsoleCPRequest->OutputCP);
1412 
1414  return Status;
1415 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI ConDrvGetConsoleCP(IN PCONSOLE Console, OUT PUINT CodePage, IN BOOLEAN OutputCP)
Definition: console.c:518
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219

◆ CSR_API() [38/87]

CSR_API ( SrvSetConsoleCP  )

Definition at line 1422 of file console.c.

1423 {
1425  PCONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleCPRequest;
1427 
1428  DPRINT("SrvSetConsoleCP, setting %s Code Page\n",
1429  SetConsoleCPRequest->OutputCP ? "Output" : "Input");
1430 
1432  if (!NT_SUCCESS(Status)) return Status;
1433 
1435  SetConsoleCPRequest->CodePage,
1436  SetConsoleCPRequest->OutputCP);
1437 
1439  return Status;
1440 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI ConDrvSetConsoleCP(IN PCONSOLE Console, IN UINT CodePage, IN BOOLEAN OutputCP)
Definition: console.c:531
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219

◆ CSR_API() [39/87]

CSR_API ( SrvGetConsoleProcessList  )

Definition at line 1443 of file console.c.

1444 {
1445  NTSTATUS Status;
1446  PCONSOLE_GETPROCESSLIST GetProcessListRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetProcessListRequest;
1448 
1449  if (!CsrValidateMessageBuffer(ApiMessage,
1450  (PVOID)&GetProcessListRequest->ProcessIdsList,
1451  GetProcessListRequest->ProcessCount,
1452  sizeof(DWORD)))
1453  {
1454  return STATUS_INVALID_PARAMETER;
1455  }
1456 
1458  if (!NT_SUCCESS(Status)) return Status;
1459 
1461  GetProcessListRequest->ProcessIdsList,
1462  GetProcessListRequest->ProcessCount,
1463  &GetProcessListRequest->ProcessCount);
1464 
1466  return Status;
1467 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
NTSTATUS NTAPI ConSrvGetConsoleProcessList(IN PCONSRV_CONSOLE Console, IN OUT PULONG ProcessIdsList, IN ULONG MaxIdListItems, OUT PULONG ProcessIdsTotal)
Definition: console.c:877
static DWORD
Definition: console.c:27
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
Status
Definition: gdiplustypes.h:24
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219

◆ CSR_API() [40/87]

CSR_API ( SrvGenerateConsoleCtrlEvent  )

Definition at line 1470 of file console.c.

1471 {
1472  NTSTATUS Status;
1473  PCONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GenerateCtrlEventRequest;
1475 
1477  if (!NT_SUCCESS(Status)) return Status;
1478 
1480  GenerateCtrlEventRequest->ProcessGroupId,
1481  GenerateCtrlEventRequest->CtrlEvent);
1482 
1484  return Status;
1485 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
NTSTATUS NTAPI ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console, IN ULONG ProcessGroupId, IN ULONG CtrlEvent)
Definition: console.c:906
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
Status
Definition: gdiplustypes.h:24
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219

◆ CSR_API() [41/87]

CSR_API ( SrvConsoleNotifyLastClose  )

Definition at line 1488 of file console.c.

1489 {
1490  NTSTATUS Status;
1493 
1494  Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
1495  if (!NT_SUCCESS(Status)) return Status;
1496 
1497  /* Only one process is allowed to be registered for last close notification */
1498  if (!Console->NotifyLastClose)
1499  {
1500  Console->NotifyLastClose = TRUE;
1501  Console->NotifiedLastCloseProcess = ProcessData;
1503  }
1504  else
1505  {
1507  }
1508 
1510  return Status;
1511 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
Status
Definition: gdiplustypes.h:24
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ CSR_API() [42/87]

CSR_API ( SrvGetConsoleMouseInfo  )

Definition at line 1514 of file console.c.

1515 {
1516  NTSTATUS Status;
1517  PCONSOLE_GETMOUSEINFO GetMouseInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetMouseInfoRequest;
1519 
1521  if (!NT_SUCCESS(Status)) return Status;
1522 
1523  /* Just retrieve the number of buttons of the mouse attached to this console */
1524  GetMouseInfoRequest->NumButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
1525 
1527  return STATUS_SUCCESS;
1528 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define SM_CMOUSEBUTTONS
Definition: winuser.h:996
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
int WINAPI GetSystemMetrics(_In_ int)
Status
Definition: gdiplustypes.h:24
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ CSR_API() [43/87]

CSR_API ( SrvSetConsoleKeyShortcuts  )

Definition at line 1531 of file console.c.

1532 {
1533  DPRINT1("%s not yet implemented\n", __FUNCTION__);
1534  return STATUS_NOT_IMPLEMENTED;
1535 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [44/87]

CSR_API ( SrvGetConsoleKeyboardLayoutName  )

Definition at line 1538 of file console.c.

1539 {
1540  NTSTATUS Status;
1541  PCONSOLE_GETKBDLAYOUTNAME GetKbdLayoutNameRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetKbdLayoutNameRequest;
1543 
1545  if (!NT_SUCCESS(Status)) return Status;
1546 
1547  /* Retrieve the keyboard layout name of the system */
1548  if (GetKbdLayoutNameRequest->Ansi)
1549  GetKeyboardLayoutNameA((PCHAR)GetKbdLayoutNameRequest->LayoutBuffer);
1550  else
1551  GetKeyboardLayoutNameW((PWCHAR)GetKbdLayoutNameRequest->LayoutBuffer);
1552 
1554  return STATUS_SUCCESS;
1555 }
signed char * PCHAR
Definition: retypes.h:7
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
BOOL WINAPI GetKeyboardLayoutNameW(_Out_writes_(KL_NAMELENGTH) LPWSTR)
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOL WINAPI GetKeyboardLayoutNameA(_Out_writes_(KL_NAMELENGTH) LPSTR)
uint16_t * PWCHAR
Definition: typedefs.h:55
#define PCONSRV_CONSOLE
Definition: conio.h:27
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
Status
Definition: gdiplustypes.h:24
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
return STATUS_SUCCESS
Definition: btrfs.c:2938
CHAR LayoutBuffer[KL_NAMELENGTH *sizeof(WCHAR)]
Definition: conmsg.h:865

◆ CSR_API() [45/87]

CSR_API ( SrvGetConsoleCharType  )

Definition at line 1558 of file console.c.

1559 {
1560  DPRINT1("%s not yet implemented\n", __FUNCTION__);
1561  return STATUS_NOT_IMPLEMENTED;
1562 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [46/87]

CSR_API ( SrvSetConsoleLocalEUDC  )

Definition at line 1565 of file console.c.

1566 {
1567  DPRINT1("%s not yet implemented\n", __FUNCTION__);
1568  return STATUS_NOT_IMPLEMENTED;
1569 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [47/87]

CSR_API ( SrvSetConsoleCursorMode  )

Definition at line 1572 of file console.c.

1573 {
1574  DPRINT1("%s not yet implemented\n", __FUNCTION__);
1575  return STATUS_NOT_IMPLEMENTED;
1576 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [48/87]

CSR_API ( SrvGetConsoleCursorMode  )

Definition at line 1579 of file console.c.

1580 {
1581  DPRINT1("%s not yet implemented\n", __FUNCTION__);
1582  return STATUS_NOT_IMPLEMENTED;
1583 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [49/87]

CSR_API ( SrvGetConsoleNlsMode  )

Definition at line 1586 of file console.c.

1587 {
1588  DPRINT1("%s not yet implemented\n", __FUNCTION__);
1589  return STATUS_NOT_IMPLEMENTED;
1590 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [50/87]

CSR_API ( SrvSetConsoleNlsMode  )

Definition at line 1593 of file console.c.

1594 {
1595  DPRINT1("%s not yet implemented\n", __FUNCTION__);
1596  return STATUS_NOT_IMPLEMENTED;
1597 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [51/87]

CSR_API ( SrvGetConsoleLangId  )

Definition at line 1600 of file console.c.

1601 {
1602  DPRINT1("%s not yet implemented\n", __FUNCTION__);
1603  return STATUS_NOT_IMPLEMENTED;
1604 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [52/87]

CSR_API ( SrvGetConsoleHardwareState  )

Definition at line 56 of file frontendctl.c.

57 {
58 #if 0
60  PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest;
63 
65  HardwareStateRequest->OutputHandle,
66  &Buff,
68  TRUE);
69  if (!NT_SUCCESS(Status))
70  {
71  DPRINT1("Failed to get console handle in SrvGetConsoleHardwareState\n");
72  return Status;
73  }
74 
75  Console = Buff->Header.Console;
76  HardwareStateRequest->State = Console->HardwareState;
77 
79  return Status;
80 #else
83 #endif
84 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE * Console
Definition: conio.h:52
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define PCONSRV_CONSOLE
Definition: conio.h:27
CONSOLE_IO_OBJECT Header
Definition: conio.h:82
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
CConsole Console
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CSR_API() [53/87]

CSR_API ( SrvSetConsoleHardwareState  )

Definition at line 87 of file frontendctl.c.

88 {
89 #if 0
91  PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest;
94 
96  HardwareStateRequest->OutputHandle,
97  &Buff,
99  TRUE);
100  if (!NT_SUCCESS(Status))
101  {
102  DPRINT1("Failed to get console handle in SrvSetConsoleHardwareState\n");
103  return Status;
104  }
105 
106  DPRINT("Setting console hardware state.\n");
107  Console = Buff->Header.Console;
108  Status = SetConsoleHardwareState(Console, HardwareStateRequest->State);
109 
111  return Status;
112 #else
114  return STATUS_NOT_IMPLEMENTED;
115 #endif
116 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE * Console
Definition: conio.h:52
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define PCONSRV_CONSOLE
Definition: conio.h:27
CONSOLE_IO_OBJECT Header
Definition: conio.h:82
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI SetConsoleHardwareState(HANDLE hConsoleOutput, DWORD Flags, DWORD State)
Definition: console.c:944
void DPRINT(...)
Definition: polytest.cpp:61
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
CConsole Console
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CSR_API() [54/87]

CSR_API ( SrvGetConsoleDisplayMode  )

Definition at line 119 of file frontendctl.c.

120 {
122  PCONSOLE_GETDISPLAYMODE GetDisplayModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetDisplayModeRequest;