2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: win32ss/user/winsrv/consrv/subsysreg.c
5 * PURPOSE: Registration APIs for VDM, OS2 and IME subsystems
6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
9 /* INCLUDES *******************************************************************/
16 /* PUBLIC SERVER APIS *********************************************************/
22 CSR_API(SrvRegisterConsoleVDM
)
25 PCONSOLE_REGISTERVDM RegisterVDMRequest
= &((PCONSOLE_API_MESSAGE
)ApiMessage
)->Data
.RegisterVDMRequest
;
26 PCONSRV_CONSOLE Console
;
28 DPRINT1("SrvRegisterConsoleVDM(%d)\n", RegisterVDMRequest
->RegisterFlags
);
30 Status
= ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process
),
32 if (!NT_SUCCESS(Status
))
34 DPRINT1("Can't get console, status %lx\n", Status
);
38 if (RegisterVDMRequest
->RegisterFlags
!= 0)
40 LARGE_INTEGER SectionSize
;
41 SIZE_T Size
, ViewSize
= 0;
45 * Remember the handle to the process so that we can close or unmap
46 * correctly the allocated resources when the client releases the
49 ProcessHandle
= CsrGetClientThread()->Process
->ProcessHandle
;
50 Console
->VDMClientProcess
= ProcessHandle
;
52 Console
->VDMBufferSize
= RegisterVDMRequest
->VDMBufferSize
;
54 Size
= Console
->VDMBufferSize
.X
* Console
->VDMBufferSize
.Y
58 * Create a memory section for the VDM buffer, to share with the client.
60 SectionSize
.QuadPart
= Size
;
61 Status
= NtCreateSection(&Console
->VDMBufferSection
,
68 if (!NT_SUCCESS(Status
))
70 DPRINT1("Error: Impossible to create a shared section, Status = 0x%08lx\n", Status
);
75 * Create a view for our needs.
78 Console
->VDMBuffer
= NULL
;
79 Status
= NtMapViewOfSection(Console
->VDMBufferSection
,
81 (PVOID
*)&Console
->VDMBuffer
,
89 if (!NT_SUCCESS(Status
))
91 DPRINT1("Error: Impossible to map the shared section, Status = 0x%08lx\n", Status
);
92 NtClose(Console
->VDMBufferSection
);
97 * Create a view for the client. We must keep a trace of it so that
98 * we can unmap it when the client releases the VDM buffer.
101 Console
->ClientVDMBuffer
= NULL
;
102 Status
= NtMapViewOfSection(Console
->VDMBufferSection
,
104 (PVOID
*)&Console
->ClientVDMBuffer
,
112 if (!NT_SUCCESS(Status
))
114 DPRINT1("Error: Impossible to map the shared section, Status = 0x%08lx\n", Status
);
115 NtUnmapViewOfSection(NtCurrentProcess(), Console
->VDMBuffer
);
116 NtClose(Console
->VDMBufferSection
);
120 // TODO: Duplicate the event handles.
122 RegisterVDMRequest
->VDMBuffer
= Console
->ClientVDMBuffer
;
124 Status
= STATUS_SUCCESS
;
128 /* RegisterFlags == 0 means we are unregistering the VDM */
130 // TODO: Close the duplicated handles.
132 if (Console
->VDMBuffer
)
135 * Uninitialize the graphics screen buffer
136 * in the reverse way we initialized it.
138 NtUnmapViewOfSection(Console
->VDMClientProcess
, Console
->ClientVDMBuffer
);
139 NtUnmapViewOfSection(NtCurrentProcess(), Console
->VDMBuffer
);
140 NtClose(Console
->VDMBufferSection
);
142 Console
->VDMBuffer
= Console
->ClientVDMBuffer
= NULL
;
144 Console
->VDMBufferSize
.X
= Console
->VDMBufferSize
.Y
= 0;
148 ConSrvReleaseConsole(Console
, TRUE
);
152 CSR_API(SrvVDMConsoleOperation
)
154 DPRINT1("%s not yet implemented\n", __FUNCTION__
);
155 return STATUS_NOT_IMPLEMENTED
;
163 CSR_API(SrvRegisterConsoleOS2
)
165 DPRINT1("%s not yet implemented\n", __FUNCTION__
);
166 return STATUS_NOT_IMPLEMENTED
;
169 CSR_API(SrvSetConsoleOS2OemFormat
)
171 DPRINT1("%s not yet implemented\n", __FUNCTION__
);
172 return STATUS_NOT_IMPLEMENTED
;
180 CSR_API(SrvRegisterConsoleIME
)
182 DPRINT1("%s not yet implemented\n", __FUNCTION__
);
183 return STATUS_NOT_IMPLEMENTED
;
186 CSR_API(SrvUnregisterConsoleIME
)
188 DPRINT1("%s not yet implemented\n", __FUNCTION__
);
189 return STATUS_NOT_IMPLEMENTED
;