[CSRLIB] Add comments regarding the calculation of the data and total message lengths in CsrClientCallServer().

This commit is contained in:
Hermès Bélusca-Maïto 2022-10-29 00:26:41 +02:00
parent 8cd01eaf25
commit 141daf4de8
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -386,10 +386,13 @@ CsrClientCallServer(
/* 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.TotalLength = (CSHORT)DataLength + /* DataLength = user_data_size + anything between
sizeof(CSR_API_MESSAGE) - sizeof(ApiMessage->Data); // FIELD_OFFSET(CSR_API_MESSAGE, Data) + DataLength; * header and data, including intermediate padding */
ApiMessage->Header.u1.s1.DataLength = (CSHORT)DataLength + ApiMessage->Header.u1.s1.DataLength = (CSHORT)DataLength +
FIELD_OFFSET(CSR_API_MESSAGE, Data) - sizeof(ApiMessage->Header); // ApiMessage->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE); FIELD_OFFSET(CSR_API_MESSAGE, Data) - sizeof(ApiMessage->Header);
/* TotalLength = header_size + DataLength + any structure trailing padding */
ApiMessage->Header.u1.s1.TotalLength = (CSHORT)DataLength +
sizeof(CSR_API_MESSAGE) - sizeof(ApiMessage->Data);
/* Fill out the CSR Header */ /* Fill out the CSR Header */
ApiMessage->ApiNumber = ApiNumber; ApiMessage->ApiNumber = ApiNumber;