Commit graph

15 commits

Author SHA1 Message Date
George Bișoc d862fa6fc8
[ADVAPI32] Implement security descriptor management in CreateProcessAsUserCommon internal function
Currently CreateProcessAsUserCommon doesn't set a default descriptor for the newly duplicated token object for the new process nor it sets any security information for both the process and thread. This is wrong, because when the process is created on behalf of the user's security context,
it still uses the previous security information of the creator that initially gave birth to the process. CreateDefaultProcessSecurityCommon function will serve as a placeholder until CreatePrivateObjectSecurity is implemented.
2022-05-06 10:09:50 +02:00
George Bișoc e90e918039
[ADVAPI32] Soft rewrite of CreateProcessAsUserCommon
Refactor the function in such a way that it can jump to a single exit but most importantly, implement a "rinse and repeat" mechanism where we assign a primary token to process by disabling impersonation first and retry with impersonation later.

More info can be found in the documention within the code.
2022-05-06 10:09:50 +02:00
Hermès Bélusca-Maïto 9393fc320e
[FORMATTING] Remove trailing whitespace. Addendum to 34593d93.
Excluded: 3rd-party code (incl. wine) and most of the win32ss.
2021-09-13 03:52:22 +02:00
Timo Kreuzer 5d8e834897 [REACTOS] Fix a number of MSVC warnings 2021-07-23 22:03:48 +02:00
Timo Kreuzer f3a9b524f1 [ADVAPI32] Fix copying the TokenSource string
TOKEN_SOURCE::SourceString is an 8 char non-null-terminated string. Copy it as such.

Fixes GCC 8 warning:
dll/win32/advapi32/misc/logon.c:638:5: error: 'strncpy' output truncated before terminating nul copying 8 bytes from a string of the same length [-Werror=stringop-truncation]
     strncpy(TokenSource.SourceName, "Advapi  ", sizeof(TokenSource.SourceName));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-07-20 13:56:18 +02:00
Eric Kohl b17e8a5e3c [ADVAPI32] CreateProcessAsUserA/W: Partially revert an obvious case of over-engineering. Only share the common parts! Now it looks a lot better. No more stupid bUnicode! 2018-12-27 19:29:20 +01:00
Hermès Bélusca-Maïto c446ce0d62
[ADVAPI32] Improve a bit CreateProcessAsUser().
- Check whether the user-provided token is a primary token.

- Do not fail when the RtlAdjustPrivilege() call fails (see the code
  comment for an explanation). TL;DR is: that call may indeed fail but
  the privilege may also not be necessary because the user-provided
  token is a restricted version of the caller's primary token.
  And this is situation is perfectly fine.

This fixes Java 7 installation, CORE-14874.
2018-09-28 00:45:04 +02:00
Eric Kohl 4114dcad46 [ADVAPI32] Implement SystemFunction028 to always return the default session key. 2018-09-19 00:20:11 +02:00
Eric Kohl 6c0d9c01e2 [ADVAPI32] SystemFunction004 and SystemFunction005 must return the required output buffer size via out->Length when the buffer is too small. 2018-09-17 23:19:02 +02:00
Eric Kohl 5ebcc6cdc1 [ADVAPI32] Add parameter checks to LogonUserExW and initialize the token handle. 2018-08-05 16:16:53 +02:00
Hermès Bélusca-Maïto d4b4da5385
[ADVAPI32] Additions for CreateProcessAsUserA/W().
- Use a common helper function used by both the ANSI and UNICODE functions
  so that the large code block that deals with setting the new process token
  becomes automatically common to both these functions, while the ANSI vs.
  UNICODE conversions are handled directly via the CreateProcessA/W() calls.

- Duplicate the token and acquire the process primary token assignment
  privilege before calling NtSetInformationProcess().
2018-06-27 23:40:07 +02:00
Thomas Faber 58f2c14c23
[ADVAPI32] Fix non-PCH build. 2018-01-08 09:51:15 +01:00
Mark Jansen d0f3fa51fb [ADVAPI32] Stub OpenTrace and ProcessTrace so newer versions of ProcessExplorer start again.
CORE-10312
2018-01-07 22:29:17 +01:00
Amine Khaldi 7ed4c1dd03 [ADVAPI32] Remove unused debug channels and comment out unused variables. Silences some clang-cl warnings. 2017-12-07 23:34:28 +01: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