Commit graph

22 commits

Author SHA1 Message Date
George Bișoc e8277e51e2
[CSRSS] Fix MSVC AMD64 build 2021-06-25 12:42:02 +02:00
George Bișoc 03636df1e3
[CSRSS] Enable compilation of raise hard error function call code
With introduction of 74e527b, a330b56 and subsequently 2791ecd ReactOS can now properly set IOPL (I/O privilege level) for user mode trusted processes. With that said, enable the compilation of raise hard error function call code back.
2021-06-25 11:55:35 +02:00
George Bișoc f144ba8d8b
[CSRSS] Do not give IOPL to the Client/Server native process if ran on a AMD64 system
ProcessUserModeIOPL is strictly implemented for 32-bit architecture so it doesn't make any sense for CSRSS to gather user mode I/O privilege when that won't work anyway.
2021-06-25 10:33:28 +02:00
Hermès Bélusca-Maïto abd4c818dc
[CSRSRV] Fix uninitialized variable warning detected by Clang. (#3619)
CORE-17545

subsystems/win32/csrsrv/api.c:63:9: warning: variable 'ServerDll' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
    if ((ServerId >= CSR_SERVER_DLL_MAX) ||
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
subsystems/win32/csrsrv/api.c:67:76: note: uninitialized use occurs here
        DPRINT1("CSRSS: %lx is invalid ServerDllIndex (%08x)\n", ServerId, ServerDll);
                                                                           ^~~~~~~~~
2021-05-05 17:24:14 +02:00
Hermès Bélusca-Maïto c5b87ac6ac
[CSRSRV] Display some other DPRINTs only when CSRSRV is compiled in debugging mode.
Addendum to 835f3ef1.
2021-05-05 17:24:13 +02:00
Jérôme Gardou e6bea426f3 [CSRSRV] Fix comment 2021-03-23 18:35:13 +01:00
Jérôme Gardou 7054cd10b1 [CSRSRV] Fix locking logic when destroying threads & processes 2021-03-23 18:17:44 +01:00
Serge Gautherie 63007901fd
[CSRSRV] CsrApiHandleConnectionRequest(): Remove ASSERT() redundant condition (#2858)
Detected by Cppcheck: redundantCondition.
Addendum to 835f3ef1.
2021-03-04 22:54:00 +01:00
Hermès Bélusca-Maïto f4279fc356
[CSRSRV] Clarify few comments, and use MAXULONG. 2020-10-30 01:55:16 +01:00
Serge Gautherie b5af1eb44a
[CSRSRV] CsrUnhandledExceptionFilter: Check RtlAdjustPrivilege() result (#2864)
And remove unused NtRaiseHardError() Status assignment.

Detected by Cppcheck: redundantAssignment.
Related to commit d221bdfb (r55647).
2020-06-01 20:20:31 +02:00
Serge Gautherie 4425bd8db3
[CSRSRV] CsrSetProcessSecurity(): Check 1st NtQueryInformationToken() result (#2862)
Also:
* Add 1 NtClose(hToken), in an error case.
* Do not call RtlFreeHeap(..., ..., NULL).

Follow-up to #2857.
2020-06-01 14:17:29 +03:00
Serge Gautherie 8fde48b5d7
[CSRSRV] CsrGetProcessLuid(): Check 1st NtQueryInformationToken() result too (#2857)
Detected by Cppcheck: redundantAssignment.
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2020-05-25 23:52:35 +02: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 dd77ac67d0
[CSRSRV] Protect the Server DLL entrypoint calls under SEH. 2020-04-15 02:06:58 +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
Jérôme Gardou 23373acbb9 [CMAKE] Use modules instead of shared libraries
There is no need to compile our DLLs as shared libraries since we are
managing symbols exports and imports through spec files.

On my system, this reduces the configure-time by a factor of two.
2019-04-06 17:43:38 +02:00
Timo Kreuzer cf77354dce [REACTOS] Fix 64 bit issues 2018-08-04 19:19:34 +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