ReactOS  0.4.14-dev-995-g774a425
subsysreg.c File Reference
#include "consrv.h"
#include <debug.h>
Include dependency graph for subsysreg.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 CSR_API (SrvRegisterConsoleVDM)
 
 CSR_API (SrvVDMConsoleOperation)
 
 CSR_API (SrvRegisterConsoleOS2)
 
 CSR_API (SrvSetConsoleOS2OemFormat)
 
 CSR_API (SrvRegisterConsoleIME)
 
 CSR_API (SrvUnregisterConsoleIME)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file subsysreg.c.

Function Documentation

◆ CSR_API() [1/6]

CSR_API ( SrvRegisterConsoleVDM  )

Definition at line 23 of file subsysreg.c.

24 {
26  PCONSOLE_REGISTERVDM RegisterVDMRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.RegisterVDMRequest;
28 
29  DPRINT1("SrvRegisterConsoleVDM(%d)\n", RegisterVDMRequest->RegisterFlags);
30 
32  &Console, TRUE);
33  if (!NT_SUCCESS(Status))
34  {
35  DPRINT1("Can't get console, status %lx\n", Status);
36  return Status;
37  }
38 
39  if (RegisterVDMRequest->RegisterFlags != 0)
40  {
41  LARGE_INTEGER SectionSize;
42  SIZE_T Size, ViewSize = 0;
44 
45  /*
46  * Remember the handle to the process so that we can close or unmap
47  * correctly the allocated resources when the client releases the
48  * screen buffer.
49  */
50  ProcessHandle = CsrGetClientThread()->Process->ProcessHandle;
51  Console->VDMClientProcess = ProcessHandle;
52 
53  Console->VDMBufferSize = RegisterVDMRequest->VDMBufferSize;
54 
55  Size = Console->VDMBufferSize.X * Console->VDMBufferSize.Y
56  * sizeof(CHAR_CELL);
57 
58  /*
59  * Create a memory section for the VDM buffer, to share with the client.
60  */
61  SectionSize.QuadPart = Size;
62  Status = NtCreateSection(&Console->VDMBufferSection,
64  NULL,
65  &SectionSize,
67  SEC_COMMIT,
68  NULL);
69  if (!NT_SUCCESS(Status))
70  {
71  DPRINT1("Error: Impossible to create a shared section, Status = 0x%08lx\n", Status);
72  goto Quit;
73  }
74 
75  /*
76  * Create a view for our needs.
77  */
78  ViewSize = 0;
79  Console->VDMBuffer = NULL;
80  Status = NtMapViewOfSection(Console->VDMBufferSection,
82  (PVOID*)&Console->VDMBuffer,
83  0,
84  0,
85  NULL,
86  &ViewSize,
87  ViewUnmap,
88  0,
90  if (!NT_SUCCESS(Status))
91  {
92  DPRINT1("Error: Impossible to map the shared section, Status = 0x%08lx\n", Status);
93  NtClose(Console->VDMBufferSection);
94  goto Quit;
95  }
96 
97  /*
98  * Create a view for the client. We must keep a trace of it so that
99  * we can unmap it when the client releases the VDM buffer.
100  */
101  ViewSize = 0;
102  Console->ClientVDMBuffer = NULL;
103  Status = NtMapViewOfSection(Console->VDMBufferSection,
105  (PVOID*)&Console->ClientVDMBuffer,
106  0,
107  0,
108  NULL,
109  &ViewSize,
110  ViewUnmap,
111  0,
113  if (!NT_SUCCESS(Status))
114  {
115  DPRINT1("Error: Impossible to map the shared section, Status = 0x%08lx\n", Status);
117  NtClose(Console->VDMBufferSection);
118  goto Quit;
119  }
120 
121  // TODO: Duplicate the event handles.
122 
123  RegisterVDMRequest->VDMBuffer = Console->ClientVDMBuffer;
124 
126  }
127  else
128  {
129  /* RegisterFlags == 0 means we are unregistering the VDM */
130 
131  // TODO: Close the duplicated handles.
132 
133  if (Console->VDMBuffer)
134  {
135  /*
136  * Uninitialize the graphics screen buffer
137  * in the reverse way we initialized it.
138  */
139  NtUnmapViewOfSection(Console->VDMClientProcess, Console->ClientVDMBuffer);
141  NtClose(Console->VDMBufferSection);
142  }
143  Console->VDMBuffer = Console->ClientVDMBuffer = NULL;
144 
145  Console->VDMBufferSize.X = Console->VDMBufferSize.Y = 0;
146  }
147 
148 Quit:
150  return Status;
151 }
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
Definition: section.c:3782
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
Definition: section.c:3373
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
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
#define SEC_COMMIT
Definition: mmtypes.h:99
NTSTATUS NTAPI NtMapViewOfSection(IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
Definition: section.c:3554
smooth NULL
Definition: ftsmooth.c:416
#define NtCurrentProcess()
Definition: nt_native.h:1657
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:79
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
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:404
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
return STATUS_SUCCESS
Definition: btrfs.c:2938
struct _CHAR_CELL CHAR_CELL
LONGLONG QuadPart
Definition: typedefs.h:113
#define PAGE_READWRITE
Definition: nt_native.h:1304

◆ CSR_API() [2/6]

CSR_API ( SrvVDMConsoleOperation  )

Definition at line 154 of file subsysreg.c.

155 {
156  DPRINT1("%s not yet implemented\n", __FUNCTION__);
157  return STATUS_NOT_IMPLEMENTED;
158 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [3/6]

CSR_API ( SrvRegisterConsoleOS2  )

Definition at line 166 of file subsysreg.c.

167 {
168  DPRINT1("%s not yet implemented\n", __FUNCTION__);
169  return STATUS_NOT_IMPLEMENTED;
170 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [4/6]

CSR_API ( SrvSetConsoleOS2OemFormat  )

Definition at line 173 of file subsysreg.c.

174 {
175  DPRINT1("%s not yet implemented\n", __FUNCTION__);
176  return STATUS_NOT_IMPLEMENTED;
177 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [5/6]

CSR_API ( SrvRegisterConsoleIME  )

Definition at line 185 of file subsysreg.c.

186 {
187  DPRINT1("%s not yet implemented\n", __FUNCTION__);
188  return STATUS_NOT_IMPLEMENTED;
189 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112

◆ CSR_API() [6/6]

CSR_API ( SrvUnregisterConsoleIME  )

Definition at line 192 of file subsysreg.c.

193 {
194  DPRINT1("%s not yet implemented\n", __FUNCTION__);
195  return STATUS_NOT_IMPLEMENTED;
196 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8
#define __FUNCTION__
Definition: types.h:112