Commit graph

8 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto f4279fc356
[CSRSRV] Clarify few comments, and use MAXULONG. 2020-10-30 01:55:16 +01:00
Hermès Bélusca-Maïto 1815aae877
[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
2020-04-15 15:59:08 +02:00
Hermès Bélusca-Maïto e3a7066279
[CSRSRV] CsrCaptureArguments(): Tell the compiler the contents ClientCaptureBuffer points to has a volatile character.
See https://docs.microsoft.com/fr-fr/archive/blogs/itgoestoeleven/why-your-user-mode-pointer-captures-are-probably-broken
for more details.

Since the contents of ClientCaptureBuffer is in the shared memory, the
client could modify it while it is being probed and captured, and so we
have to avoid any potential compiler optimizations regarding the
captured "Length = ClientCaptureBuffer->Size" and
"PointerCount = ClientCaptureBuffer->PointerCount" values.
2020-04-15 14:14:06 +02:00
Hermès Bélusca-Maïto 7e2db77338
[CSRSRV] Improve validation of CSR API Message's capture buffers.
- Improve capture buffer validation in CsrCaptureArguments(), by
  implementing the checks done by Windows 2003 (NT 5.2) described
  in section "Server-Side Validation and Capture" of the article
  https://www.geoffchappell.com/studies/windows/win32/csrsrv/api/apireqst/capture_header.htm

- In CsrReleaseCapturedArguments(), protect the data copy back into
  the client buffer within a SEH block.
2020-04-15 02:07:00 +02:00
Hermès Bélusca-Maïto 358dd50d61
[CSRSRV] CsrCaptureArguments() and CsrReleaseCapturedArguments(): Use better names for the capture buffers.
Rename inaccurate names 'LocalCaptureBuffer' and 'RemoteCaptureBuffer'
into 'ClientCaptureBuffer' and 'ServerCaptureBuffer' respectively.
(Recall: CSRSRV is the 'Server', and any app doing LPC calls to it is
the 'Client'.)
2020-04-15 02:06:59 +02:00
Hermès Bélusca-Maïto 835f3ef13d
[CSRSRV] Only when CSRSRV is compiled in debugging mode, should we display debugging messages and support debug breakpoints.
Also, trigger the less fatal breakpoints only if CSRSS/CSRSRV is being
debugged (the 'BeingDebugged' flag is set in the current PEB). This will
avoid any unhandled breakpoint exceptions when testing/fuzzing running
debug builds of ReactOS without any debugger attached.
2020-04-15 02:06:58 +02:00
Hermès Bélusca-Maïto 37b2c1450c
[CSRSRV] s/LPWSTR/PWSTR/ as the former is not NT type. 2020-04-15 02:06:57 +02:00
Colin Finck c2c66aff7d Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
Renamed from reactos/subsystems/win32/csrsrv/api.c (Browse further)