- Code formatting.
- Fix CSR message length computation.

[CSR]
- Remove unneeded comments.
- Correct arguments names.

svn path=/branches/ros-csrss/; revision=57625
This commit is contained in:
Hermès Bélusca-Maïto 2012-10-27 19:05:10 +00:00
parent ec451b5d49
commit 5a3ba45059
5 changed files with 32 additions and 38 deletions

View file

@ -6,16 +6,16 @@
* PROGRAMMER: Alex Ionescu (alex@relsoft.net) * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES *******************************************************************/
#include <ntdll.h> #include <ntdll.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* GLOBALS *******************************************************************/ /* GLOBALS ********************************************************************/
extern HANDLE CsrApiPort; extern HANDLE CsrApiPort;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS ******************************************************************/
/* /*
* @implemented * @implemented
@ -78,7 +78,7 @@ CsrIdentifyAlertableThread(VOID)
Status = CsrClientCallServer(&ApiMessage, Status = CsrClientCallServer(&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpIdentifyAlertable), CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpIdentifyAlertable),
sizeof(CSR_SET_PRIORITY_CLASS)); sizeof(CSR_IDENTIFY_ALTERTABLE_THREAD));
/* Return to caller */ /* Return to caller */
return Status; return Status;

View file

@ -6,16 +6,16 @@
* PROGRAMMER: Alex Ionescu (alex@relsoft.net) * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES *******************************************************************/
#include <ntdll.h> #include <ntdll.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* GLOBALS *******************************************************************/ /* GLOBALS ********************************************************************/
extern HANDLE CsrPortHeap; extern HANDLE CsrPortHeap;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS ******************************************************************/
/* /*
* @implemented * @implemented

View file

@ -6,13 +6,13 @@
* PROGRAMMER: Alex Ionescu (alex@relsoft.net) * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES *******************************************************************/
#include <ntdll.h> #include <ntdll.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
/* GLOBALS *******************************************************************/ /* GLOBALS ********************************************************************/
HANDLE CsrApiPort; HANDLE CsrApiPort;
HANDLE CsrProcessId; HANDLE CsrProcessId;
@ -28,7 +28,7 @@ PCSR_SERVER_API_ROUTINE CsrServerApiRoutine;
#define UNICODE_PATH_SEP L"\\" #define UNICODE_PATH_SEP L"\\"
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS ******************************************************************/
/* /*
* @implemented * @implemented
@ -45,10 +45,10 @@ CsrGetProcessId(VOID)
*/ */
NTSTATUS NTSTATUS
NTAPI NTAPI
CsrClientCallServer(PCSR_API_MESSAGE ApiMessage, CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage,
PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL, IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL,
CSR_API_NUMBER ApiNumber, IN CSR_API_NUMBER ApiNumber,
ULONG RequestLength) IN ULONG DataLength)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG PointerCount; ULONG PointerCount;
@ -58,8 +58,11 @@ CsrClientCallServer(PCSR_API_MESSAGE ApiMessage,
/* Fill out the Port Message Header */ /* Fill out the Port Message Header */
ApiMessage->Header.u2.ZeroInit = 0; ApiMessage->Header.u2.ZeroInit = 0;
ApiMessage->Header.u1.s1.DataLength = RequestLength - sizeof(PORT_MESSAGE); ApiMessage->Header.u1.s1.TotalLength =
ApiMessage->Header.u1.s1.TotalLength = RequestLength; 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);
/* Fill out the CSR Header */ /* Fill out the CSR Header */
ApiMessage->ApiNumber = ApiNumber; ApiMessage->ApiNumber = ApiNumber;
@ -113,7 +116,7 @@ CsrClientCallServer(PCSR_API_MESSAGE ApiMessage,
/* Check if we got a a Capture Buffer */ /* Check if we got a a Capture Buffer */
if (CaptureBuffer) if (CaptureBuffer)
{ {
/* We have to convert from the remote view to our remote view */ /* We have to convert back from the remote view to our local view */
DPRINT("Reconverting CaptureBuffer\n"); DPRINT("Reconverting CaptureBuffer\n");
ApiMessage->CsrCaptureData = (PVOID)((ULONG_PTR) ApiMessage->CsrCaptureData = (PVOID)((ULONG_PTR)
ApiMessage->CsrCaptureData - ApiMessage->CsrCaptureData -
@ -168,7 +171,7 @@ CsrClientCallServer(PCSR_API_MESSAGE ApiMessage,
NTSTATUS NTSTATUS
NTAPI NTAPI
CsrConnectToServer(IN PWSTR ObjectDirectory) CsrpConnectToServer(IN PWSTR ObjectDirectory)
{ {
ULONG PortNameLength; ULONG PortNameLength;
UNICODE_STRING PortName; UNICODE_STRING PortName;
@ -318,11 +321,11 @@ CsrConnectToServer(IN PWSTR ObjectDirectory)
*/ */
NTSTATUS NTSTATUS
NTAPI NTAPI
CsrClientConnectToServer(PWSTR ObjectDirectory, CsrClientConnectToServer(IN PWSTR ObjectDirectory,
ULONG ServerId, IN ULONG ServerId,
PVOID ConnectionInfo, IN PVOID ConnectionInfo,
PULONG ConnectionInfoSize, IN OUT PULONG ConnectionInfoSize,
PBOOLEAN ServerToServerCall) OUT PBOOLEAN ServerToServerCall)
{ {
NTSTATUS Status; NTSTATUS Status;
PIMAGE_NT_HEADERS NtHeader; PIMAGE_NT_HEADERS NtHeader;
@ -397,7 +400,7 @@ CsrClientConnectToServer(PWSTR ObjectDirectory,
if (!CsrApiPort) if (!CsrApiPort)
{ {
/* No, set it up now */ /* No, set it up now */
if (!NT_SUCCESS(Status = CsrConnectToServer(ObjectDirectory))) if (!NT_SUCCESS(Status = CsrpConnectToServer(ObjectDirectory)))
{ {
/* Failed */ /* Failed */
DPRINT1("Failure to connect to CSR\n"); DPRINT1("Failure to connect to CSR\n");
@ -410,8 +413,7 @@ CsrClientConnectToServer(PWSTR ObjectDirectory,
ClientConnect->ConnectionInfoSize = *ConnectionInfoSize; ClientConnect->ConnectionInfoSize = *ConnectionInfoSize;
/* Setup a buffer for the connection info */ /* Setup a buffer for the connection info */
CaptureBuffer = CsrAllocateCaptureBuffer(1, CaptureBuffer = CsrAllocateCaptureBuffer(1, ClientConnect->ConnectionInfoSize);
ClientConnect->ConnectionInfoSize);
if (CaptureBuffer == NULL) if (CaptureBuffer == NULL)
{ {
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
@ -435,12 +437,6 @@ CsrClientConnectToServer(PWSTR ObjectDirectory,
CaptureBuffer, CaptureBuffer,
CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpClientConnect), CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpClientConnect),
sizeof(CSR_CLIENT_CONNECT)); sizeof(CSR_CLIENT_CONNECT));
/*
Status = CsrClientCallServer(&ApiMessage,
CaptureBuffer,
CSR_CREATE_API_NUMBER(CSR_NATIVE, CONNECT_PROCESS),
sizeof(CSR_API_MESSAGE));
*/
} }
else else
{ {

View file

@ -33,10 +33,10 @@ CsrClientConnectToServer(IN PWSTR ObjectDirectory,
NTSTATUS NTSTATUS
NTAPI NTAPI
CsrClientCallServer(IN OUT PCSR_API_MESSAGE Request, CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage,
IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL, IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL,
IN ULONG ApiNumber, IN CSR_API_NUMBER ApiNumber,
IN ULONG RequestLength); IN ULONG DataLength);
PVOID PVOID
NTAPI NTAPI

View file

@ -94,7 +94,7 @@ typedef struct _CSR_CAPTURE_BUFFER
struct _CSR_CAPTURE_BUFFER *PreviousCaptureBuffer; struct _CSR_CAPTURE_BUFFER *PreviousCaptureBuffer;
ULONG PointerCount; ULONG PointerCount;
ULONG_PTR BufferEnd; ULONG_PTR BufferEnd;
ULONG_PTR PointerArray[1]; // MessagePointerOffsets // Offsets within CSR_API_MSG of pointers ULONG_PTR PointerArray[1];
} CSR_CAPTURE_BUFFER, *PCSR_CAPTURE_BUFFER; } CSR_CAPTURE_BUFFER, *PCSR_CAPTURE_BUFFER;
@ -122,8 +122,6 @@ typedef struct _CSR_API_MESSAGE
CSR_SET_PRIORITY_CLASS SetPriorityClass; CSR_SET_PRIORITY_CLASS SetPriorityClass;
CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread; CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread;
// ULONG_PTR ApiMessageData[39]; //// what to do ????
/*** win32csr thingies to remove. ***/ /*** win32csr thingies to remove. ***/
#if 1 #if 1
CSRSS_CREATE_DESKTOP CreateDesktopRequest; CSRSS_CREATE_DESKTOP CreateDesktopRequest;