From 5a3ba45059d5879bd4ed8ff9754c44ca03ab539c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 27 Oct 2012 19:05:10 +0000 Subject: [PATCH] [NTDLL] - Code formatting. - Fix CSR message length computation. [CSR] - Remove unneeded comments. - Correct arguments names. svn path=/branches/ros-csrss/; revision=57625 --- dll/ntdll/csr/api.c | 8 ++--- dll/ntdll/csr/capture.c | 6 ++-- dll/ntdll/csr/connect.c | 46 +++++++++++++---------------- include/reactos/subsys/csr/csr.h | 6 ++-- include/reactos/subsys/csr/csrmsg.h | 4 +-- 5 files changed, 32 insertions(+), 38 deletions(-) diff --git a/dll/ntdll/csr/api.c b/dll/ntdll/csr/api.c index 9b5b054adf1..26fec9c1569 100644 --- a/dll/ntdll/csr/api.c +++ b/dll/ntdll/csr/api.c @@ -6,16 +6,16 @@ * PROGRAMMER: Alex Ionescu (alex@relsoft.net) */ -/* INCLUDES *****************************************************************/ +/* INCLUDES *******************************************************************/ #include #define NDEBUG #include -/* GLOBALS *******************************************************************/ +/* GLOBALS ********************************************************************/ extern HANDLE CsrApiPort; -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ /* * @implemented @@ -78,7 +78,7 @@ CsrIdentifyAlertableThread(VOID) Status = CsrClientCallServer(&ApiMessage, NULL, CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpIdentifyAlertable), - sizeof(CSR_SET_PRIORITY_CLASS)); + sizeof(CSR_IDENTIFY_ALTERTABLE_THREAD)); /* Return to caller */ return Status; diff --git a/dll/ntdll/csr/capture.c b/dll/ntdll/csr/capture.c index b147dcf3f3b..97215d7a422 100644 --- a/dll/ntdll/csr/capture.c +++ b/dll/ntdll/csr/capture.c @@ -6,16 +6,16 @@ * PROGRAMMER: Alex Ionescu (alex@relsoft.net) */ -/* INCLUDES *****************************************************************/ +/* INCLUDES *******************************************************************/ #include #define NDEBUG #include -/* GLOBALS *******************************************************************/ +/* GLOBALS ********************************************************************/ extern HANDLE CsrPortHeap; -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ /* * @implemented diff --git a/dll/ntdll/csr/connect.c b/dll/ntdll/csr/connect.c index 2303aaaf0ef..90e9614ab48 100644 --- a/dll/ntdll/csr/connect.c +++ b/dll/ntdll/csr/connect.c @@ -6,13 +6,13 @@ * PROGRAMMER: Alex Ionescu (alex@relsoft.net) */ -/* INCLUDES *****************************************************************/ +/* INCLUDES *******************************************************************/ #include #define NDEBUG #include -/* GLOBALS *******************************************************************/ +/* GLOBALS ********************************************************************/ HANDLE CsrApiPort; HANDLE CsrProcessId; @@ -28,7 +28,7 @@ PCSR_SERVER_API_ROUTINE CsrServerApiRoutine; #define UNICODE_PATH_SEP L"\\" -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ /* * @implemented @@ -45,10 +45,10 @@ CsrGetProcessId(VOID) */ NTSTATUS NTAPI -CsrClientCallServer(PCSR_API_MESSAGE ApiMessage, - PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL, - CSR_API_NUMBER ApiNumber, - ULONG RequestLength) +CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage, + IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL, + IN CSR_API_NUMBER ApiNumber, + IN ULONG DataLength) { NTSTATUS Status; ULONG PointerCount; @@ -58,8 +58,11 @@ CsrClientCallServer(PCSR_API_MESSAGE ApiMessage, /* Fill out the Port Message Header */ ApiMessage->Header.u2.ZeroInit = 0; - ApiMessage->Header.u1.s1.DataLength = RequestLength - sizeof(PORT_MESSAGE); - ApiMessage->Header.u1.s1.TotalLength = RequestLength; + 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); /* Fill out the CSR Header */ ApiMessage->ApiNumber = ApiNumber; @@ -113,7 +116,7 @@ CsrClientCallServer(PCSR_API_MESSAGE ApiMessage, /* Check if we got a a Capture Buffer */ 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"); ApiMessage->CsrCaptureData = (PVOID)((ULONG_PTR) ApiMessage->CsrCaptureData - @@ -168,7 +171,7 @@ CsrClientCallServer(PCSR_API_MESSAGE ApiMessage, NTSTATUS NTAPI -CsrConnectToServer(IN PWSTR ObjectDirectory) +CsrpConnectToServer(IN PWSTR ObjectDirectory) { ULONG PortNameLength; UNICODE_STRING PortName; @@ -318,11 +321,11 @@ CsrConnectToServer(IN PWSTR ObjectDirectory) */ NTSTATUS NTAPI -CsrClientConnectToServer(PWSTR ObjectDirectory, - ULONG ServerId, - PVOID ConnectionInfo, - PULONG ConnectionInfoSize, - PBOOLEAN ServerToServerCall) +CsrClientConnectToServer(IN PWSTR ObjectDirectory, + IN ULONG ServerId, + IN PVOID ConnectionInfo, + IN OUT PULONG ConnectionInfoSize, + OUT PBOOLEAN ServerToServerCall) { NTSTATUS Status; PIMAGE_NT_HEADERS NtHeader; @@ -397,7 +400,7 @@ CsrClientConnectToServer(PWSTR ObjectDirectory, if (!CsrApiPort) { /* No, set it up now */ - if (!NT_SUCCESS(Status = CsrConnectToServer(ObjectDirectory))) + if (!NT_SUCCESS(Status = CsrpConnectToServer(ObjectDirectory))) { /* Failed */ DPRINT1("Failure to connect to CSR\n"); @@ -410,8 +413,7 @@ CsrClientConnectToServer(PWSTR ObjectDirectory, ClientConnect->ConnectionInfoSize = *ConnectionInfoSize; /* Setup a buffer for the connection info */ - CaptureBuffer = CsrAllocateCaptureBuffer(1, - ClientConnect->ConnectionInfoSize); + CaptureBuffer = CsrAllocateCaptureBuffer(1, ClientConnect->ConnectionInfoSize); if (CaptureBuffer == NULL) { return STATUS_INSUFFICIENT_RESOURCES; @@ -435,12 +437,6 @@ CsrClientConnectToServer(PWSTR ObjectDirectory, CaptureBuffer, CSR_CREATE_API_NUMBER(CSRSRV_SERVERDLL_INDEX, CsrpClientConnect), sizeof(CSR_CLIENT_CONNECT)); -/* - Status = CsrClientCallServer(&ApiMessage, - CaptureBuffer, - CSR_CREATE_API_NUMBER(CSR_NATIVE, CONNECT_PROCESS), - sizeof(CSR_API_MESSAGE)); -*/ } else { diff --git a/include/reactos/subsys/csr/csr.h b/include/reactos/subsys/csr/csr.h index fcc415f2ee3..7586c3917df 100644 --- a/include/reactos/subsys/csr/csr.h +++ b/include/reactos/subsys/csr/csr.h @@ -33,10 +33,10 @@ CsrClientConnectToServer(IN PWSTR ObjectDirectory, NTSTATUS NTAPI -CsrClientCallServer(IN OUT PCSR_API_MESSAGE Request, +CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage, IN OUT PCSR_CAPTURE_BUFFER CaptureBuffer OPTIONAL, - IN ULONG ApiNumber, - IN ULONG RequestLength); + IN CSR_API_NUMBER ApiNumber, + IN ULONG DataLength); PVOID NTAPI diff --git a/include/reactos/subsys/csr/csrmsg.h b/include/reactos/subsys/csr/csrmsg.h index cfb19535eb6..a870b2d2361 100644 --- a/include/reactos/subsys/csr/csrmsg.h +++ b/include/reactos/subsys/csr/csrmsg.h @@ -94,7 +94,7 @@ typedef struct _CSR_CAPTURE_BUFFER struct _CSR_CAPTURE_BUFFER *PreviousCaptureBuffer; ULONG PointerCount; 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; @@ -122,8 +122,6 @@ typedef struct _CSR_API_MESSAGE CSR_SET_PRIORITY_CLASS SetPriorityClass; CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread; - // ULONG_PTR ApiMessageData[39]; //// what to do ???? - /*** win32csr thingies to remove. ***/ #if 1 CSRSS_CREATE_DESKTOP CreateDesktopRequest;