[WIN32SS/USER32]

- Use the new subsystems header winmsg.h
- Use the new USER_API_MESSAGE structure, and adapt co_CsrNotify in consequence.
- Code formatting.

[KERNEL32]
- Use the new subsystems headers basemsg.h, conmsg.h, winmsg.h, etc...

[NTDLL]
- Code formatting only.

svn path=/branches/ros-csrss/; revision=57628
This commit is contained in:
Hermès Bélusca-Maïto 2012-10-27 23:52:28 +00:00
parent c4ebd157cf
commit 3cb1779934
10 changed files with 68 additions and 56 deletions

View file

@ -60,7 +60,7 @@ CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage,
ApiMessage->Header.u2.ZeroInit = 0;
ApiMessage->Header.u1.s1.TotalLength =
FIELD_OFFSET(CSR_API_MESSAGE, Data) + DataLength;
/* FIELD_OFFSET(CSR_API_MESSAGE, Data) <= sizeof(CSR_API_MESSAGE) - sizeof(ApiMessage->Data) */
/* FIELD_OFFSET(CSR_API_MESSAGE, Data) <= sizeof(CSR_API_MESSAGE) - sizeof(ApiMessage->Data) */
ApiMessage->Header.u1.s1.DataLength =
ApiMessage->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE);

View file

@ -37,6 +37,10 @@
/* CSRSS Header */
#include <csr/csr.h>
#include <win/base.h>
#include <win/basemsg.h>
#include <win/conmsg.h>
#include <win/winmsg.h>
//#include <csr/csrss.h> // FIXME: data header.
/* C Headers */

View file

@ -71,8 +71,8 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
#include <pseh/pseh2.h>
/* CSRSS Header */
#include <csrss/client.h>
#include <csrss/csrss.h> // FIXME: data header.
#include <csr/csr.h>
#include <csr/csrss.h> // FIXME: data header.
/* Public Win32K headers */
#include <include/callback.h>

View file

@ -46,46 +46,51 @@ CsrInit(void)
NTSTATUS FASTCALL
co_CsrNotify(PCSR_API_MESSAGE Request)
co_CsrNotify(IN OUT PCSR_API_MESSAGE ApiMessage,
IN ULONG DataLength)
{
NTSTATUS Status;
PEPROCESS OldProcess;
NTSTATUS Status;
PEPROCESS OldProcess;
if (NULL == CsrProcess)
{
return STATUS_INVALID_PORT_HANDLE;
}
if (NULL == CsrProcess)
{
return STATUS_INVALID_PORT_HANDLE;
}
Request->Header.u2.ZeroInit = 0;
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
/* Fill out the Port Message Header */
ApiMessage->Header.u2.ZeroInit = 0;
ApiMessage->Header.u1.s1.TotalLength =
FIELD_OFFSET(CSR_API_MESSAGE, Data) + DataLength;
/* FIELD_OFFSET(CSR_API_MESSAGE, Data) <= sizeof(CSR_API_MESSAGE) - sizeof(ApiMessage->Data) */
ApiMessage->Header.u1.s1.DataLength =
ApiMessage->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE);
/* Switch to the process in which the WindowsApiPort handle is valid */
OldProcess = PsGetCurrentProcess();
if (CsrProcess != OldProcess)
{
KeAttachProcess(&CsrProcess->Pcb);
}
/* Switch to the process in which the WindowsApiPort handle is valid */
OldProcess = PsGetCurrentProcess();
if (CsrProcess != OldProcess)
{
KeAttachProcess(&CsrProcess->Pcb);
}
UserLeaveCo();
UserLeaveCo();
Status = ZwRequestWaitReplyPort(WindowsApiPort,
&Request->Header,
&Request->Header);
Status = ZwRequestWaitReplyPort(WindowsApiPort,
&ApiMessage->Header,
&ApiMessage->Header);
UserEnterCo();
UserEnterCo();
if (CsrProcess != OldProcess)
{
KeDetachProcess();
}
if (CsrProcess != OldProcess)
{
KeDetachProcess();
}
if (NT_SUCCESS(Status))
{
Status = Request->Status;
}
if (NT_SUCCESS(Status))
{
Status = ApiMessage->Status;
}
return Status;
return Status;
}

View file

@ -12,7 +12,8 @@
extern PEPROCESS CsrProcess;
NTSTATUS FASTCALL CsrInit(void);
NTSTATUS FASTCALL co_CsrNotify(PCSR_API_MESSAGE Request);
NTSTATUS FASTCALL co_CsrNotify(IN OUT PCSR_API_MESSAGE ApiMessage,
IN ULONG DataLength);
NTSTATUS FASTCALL CsrCloseHandle(HANDLE Handle);
NTSTATUS WINAPI CsrInsertObject(HANDLE ObjectHandle,
ACCESS_MASK DesiredAccess,

View file

@ -1220,7 +1220,8 @@ NtUserCreateDesktop(
RETURN( NULL);
}
Status = co_CsrNotify(&Request);
Status = co_CsrNotify((PCSR_API_MESSAGE)&Request,
sizeof(CSR_API_MESSAGE));
if (! NT_SUCCESS(Status))
{
CsrCloseHandle(Request.Data.CreateDesktopRequest.DesktopHandle);

View file

@ -17,7 +17,7 @@ co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
{
PEPROCESS Process;
NTSTATUS Status;
CSR_API_MESSAGE Request;
USER_API_MESSAGE Request;
Status = PsLookupProcessByProcessId(ProcessId,
&Process);
@ -52,12 +52,13 @@ co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
ObDereferenceObject(Process);
Request.ApiNumber = CSR_CREATE_API_NUMBER(CSR_GUI, REGISTER_LOGON_PROCESS);
Request.ApiNumber = CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpRegisterLogonProcess);
Request.Data.RegisterLogonProcessRequest.ProcessId = ProcessId;
Request.Data.RegisterLogonProcessRequest.Register = Register;
Status = co_CsrNotify(&Request);
if (! NT_SUCCESS(Status))
Status = co_CsrNotify((PCSR_API_MESSAGE)&Request,
sizeof(CSRSS_REGISTER_LOGON_PROCESS));
if (!NT_SUCCESS(Status))
{
ERR("Failed to register logon process with CSRSS\n");
return FALSE;

View file

@ -30,8 +30,8 @@
#include <ndk/umfuncs.h>
/* CSRSS Header */
#include <csrss/client.h>
#include <csrss/csrss.h> // FIXME: data header.
#include <csr/csr.h>
#include <win/winmsg.h>
/* Public Win32K Headers */
#include <ntusrtyp.h>

View file

@ -67,17 +67,17 @@ BOOL WINAPI
ExitWindowsEx(UINT uFlags,
DWORD dwReserved)
{
CSR_API_MESSAGE Request;
USER_API_MESSAGE ApiMessage;
NTSTATUS Status;
Request.Data.ExitReactosRequest.Flags = uFlags;
Request.Data.ExitReactosRequest.Reserved = dwReserved;
ApiMessage.Data.ExitReactosRequest.Flags = uFlags;
ApiMessage.Data.ExitReactosRequest.Reserved = dwReserved;
Status = CsrClientCallServer(&Request,
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL,
CSR_CREATE_API_NUMBER(CSR_GUI, EXIT_REACTOS),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpExitWindowsEx),
sizeof(CSRSS_EXIT_REACTOS));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;
@ -93,16 +93,16 @@ ExitWindowsEx(UINT uFlags,
BOOL WINAPI
RegisterServicesProcess(DWORD ServicesProcessId)
{
CSR_API_MESSAGE Request;
USER_API_MESSAGE ApiMessage;
NTSTATUS Status;
Request.Data.RegisterServicesProcessRequest.ProcessId = UlongToHandle(ServicesProcessId);
ApiMessage.Data.RegisterServicesProcessRequest.ProcessId = UlongToHandle(ServicesProcessId);
Status = CsrClientCallServer(&Request,
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL,
CSR_CREATE_API_NUMBER(CSR_GUI, REGISTER_SERVICES_PROCESS),
sizeof(CSR_API_MESSAGE));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
CSR_CREATE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpRegisterServicesProcess),
sizeof(CSRSS_REGISTER_SERVICES_PROCESS));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
{
SetLastError(RtlNtStatusToDosError(Status));
return FALSE;

View file

@ -42,7 +42,7 @@ BOOL
WINAPI
RegisterLogonProcess(DWORD dwProcessId, BOOL bRegister)
{
return NtUserxRegisterLogonProcess(dwProcessId,bRegister);
return NtUserxRegisterLogonProcess(dwProcessId, bRegister);
}
/*
@ -50,7 +50,7 @@ RegisterLogonProcess(DWORD dwProcessId, BOOL bRegister)
*/
BOOL
WINAPI
SetLogonNotifyWindow (HWND Wnd, HWINSTA WinSta)
SetLogonNotifyWindow(HWND Wnd, HWINSTA WinSta)
{
/* Maybe we should call NtUserSetLogonNotifyWindow and let that one inform CSRSS??? */
CSR_API_MESSAGE Request;