mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[CSRSRV] Addendum to e3a70662
: Fix build.
Since indeeed the memcpy/move type of functions usually don't operate on pointers to 'volatile' data, don't make ClientCaptureBuffer volatile. Instead when retrieving the values of its 'Size' and 'PointerCount' members (see the SEH block), use the so-called technique of "volatile glasses" [1], where the pointer will be explicitly casted to "volatile TYPE*" where needed. [1]: https://docs.microsoft.com/archive/blogs/itgoestoeleven/why-your-user-mode-pointer-captures-are-probably-broken
This commit is contained in:
parent
2032c3afba
commit
1815aae877
1 changed files with 3 additions and 4 deletions
|
@ -1120,8 +1120,7 @@ CsrCaptureArguments(IN PCSR_THREAD CsrThread,
|
|||
IN PCSR_API_MESSAGE ApiMessage)
|
||||
{
|
||||
PCSR_PROCESS CsrProcess = CsrThread->Process;
|
||||
volatile CSR_CAPTURE_BUFFER* ClientCaptureBuffer;
|
||||
PCSR_CAPTURE_BUFFER ServerCaptureBuffer = NULL;
|
||||
PCSR_CAPTURE_BUFFER ClientCaptureBuffer, ServerCaptureBuffer = NULL;
|
||||
ULONG_PTR EndOfClientBuffer;
|
||||
SIZE_T SizeOfBufferThroughOffsetsArray;
|
||||
SIZE_T BufferDistance;
|
||||
|
@ -1151,7 +1150,7 @@ CsrCaptureArguments(IN PCSR_THREAD CsrThread,
|
|||
}
|
||||
|
||||
/* Capture the buffer length */
|
||||
Length = ClientCaptureBuffer->Size;
|
||||
Length = ((volatile CSR_CAPTURE_BUFFER*)ClientCaptureBuffer)->Size;
|
||||
|
||||
/*
|
||||
* Now check if the remaining of the buffer is inside our mapped section.
|
||||
|
@ -1171,7 +1170,7 @@ CsrCaptureArguments(IN PCSR_THREAD CsrThread,
|
|||
}
|
||||
|
||||
/* Capture the pointer count */
|
||||
PointerCount = ClientCaptureBuffer->PointerCount;
|
||||
PointerCount = ((volatile CSR_CAPTURE_BUFFER*)ClientCaptureBuffer)->PointerCount;
|
||||
|
||||
/*
|
||||
* Check whether the total buffer size and the pointer count are consistent
|
||||
|
|
Loading…
Reference in a new issue