### Merge request
This fixes a vulnerability by incorrect parsing of command line arguments.
The way how a triple quote chars (or double quote chars inside a quoted string) will be currently parsed in `CommandLineToArgvW` of wine is wrong, therefore opens an attack vector (using artificially created command line validated with different rules matching default parsing mechanism of Windows), so could be even considered as a vulnerability.
## Proposed changes
`CommandLineToArgvW` will parse command line arguments correct and more similar to Windows.
Here is the diff illustrating wrong behavior:
```diff
## # test is an alias for
## # python.exe -c "from sys import argv; del argv[0]; print(str(len(argv)) + ' | ' + ' | '.join(argv))"
- # Wine
+ # Windows (and fixed variant)
## double in quoted string:
> test "abc""def" ghi" xxx
- 2 | abc"def ghi | xxx
+ 2 | abc"def | ghi xxx
> test "abc"""def" ghi" xxx
- 3 | abc"def | ghi" xxx
+ 2 | abc"def ghi | xxx
## triple in unquoted string:
> test abc"""def" ghi" xxx
- 2 | abc"def ghi | xxx
+ 2 | abc"def | ghi xxx
> test abc""""def" ghi" xxx
- 2 | abc"def | ghi xxx
+ 2 | abc"def ghi | xxx
```
As a consequence:
- the arguments can be parsed incorrectly (compared to default behavior of Windows parser) in the way that parts of quoted arguments may become unquoted and vice versa, as well as swim between different args;
- an attacker may create artificial command line that pass validation rules of nominal condition of Windows, but vulnerable here (inject, data steal, etc), because the arguments would deviate between validation and execution phase
- special tokens like pipe `|`, ampersand `&` or redirecting tokens like `>` that normally included in quoted string (and validated as a string) could abrupt get different meaning and used for piping, redirecting etc, that beside the injection possibility opens still worse attacking vector that can even cause RCE or used to create persistent exploits.
<details><summary>Here is the nominal condition how arguments will be parsed in Windows...</summary>
cmd line|arg1|arg2
---|---|---
abc" "def|abc def|
abc\\" \\"def|abc"|"def
"abc\\" \\"def"|abc" "def|
"abc"" ""def"|abc" "def|
abc"" ""def|abc|def
abc""" """def|abc" "def|
abc\\""" \\"""def|abc"|"def
abc\\\\""" \\\\"""def|abc\\" \\"def
"abc"""def" ghi"</sup>|abc"def ghi|
"abc"""def" ghi<br><sup>* missing close qoute at end</sup>|abc"def ghi|
"abc""def" ghi|abc"def|ghi
"abc\\"""def" ghi|abc""def|ghi
"abc\\\\"""def" ghi"|abc\\"def ghi|
"abc\\\\\\"""def" ghi|abc\\""def|ghi
"abc\\\\\\\\"""def" ghi"|abc\\\\"def ghi|
</details>
For PoC one could use any lang like tcl, python, etc, or even a self-written executable getting the argc/argv from main.<br/>
The above diff and nominal condition was generated using this python script on Windows box:
```python
from sys import argv; del argv[0]; print(str(len(argv)) + ' | ' + ' | '.join(argv))
```
## References
[Related PR](https://github.com/reactos/reactos/pull/5186) with fix for ReactOS.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2472
This second MR in the Wayland series adds display configuration related enhancements, including providing more display information (like a proper/consistent name and position) to Wine and implementing GetCurrentDisplaySettings.
To get additional information from the Wayland compositor we need to use a protocol from the wayland-protocols collection, so we introduce support in the build system for protocol .xml files, and also makedep changes to gracefully handle the case these external sources are missing when the driver is disabled. These changes are introduced on their own in the first commit in the series, but we can squash it with the next commit, where the functionality is first used, if preferred.
To be able to provide a consistent view of the display settings across all processes, this MR adds a shared memory region containing an authoritative version of the Wayland output information (see the "winewayland.drv: Implement GetCurrentDisplaySettings." commit for more details).
**Important note:** This MR requires the wayland-protocols package in the CI docker image. Without it the Wayland driver build will be disabled, so any build results are not going to be representative of the Wayland driver code changes in this branch.
Thanks!
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2476
On Windows, ldap_delete_(ext_)s returns LDAP_UNWILLING_TO_PERFORM when
trying to delete an entry that cannot be deleted. On Unix,
LDAP_SERVER_DOWN is returned instead. Unix also returns LDAP_SERVER_DOWN
immediately from ldap_delete_ext if the entry cannot be deleted, whereas
Windows queues an asynchronous operation and returns LDAP_SUCCESS.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54702
--
v2: wldap32: Handle null DN or null message in ldap_delete* and add tests.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2481
I initially wanted to do the refactoring in a separate merge request, but since my merge request yesterday broke the tests, I decided to add the implementation into this commit as well.
--
v2: kernelbase: Recursively obtain the Wow6432Node parent.
kernelbase: Add support for shared registry keys.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2483
I initially wanted to do the refactoring in a separate merge request, but since my merge request yesterday broke the tests, I decided to add the implementation into this commit as well.
--
v3: kernelbase: Recursively obtain the Wow6432Node parent.
kernelbase: Add support for shared registry keys.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2483
--
v2: wineps: Handle EMR_LINETO record in spool files.
wineps: Handle EMR_MOVETOEX record in spool files.
wineps: Handle EMR_RECTANGLE record in spool files.
wineps: Handle pen selection in spool files.
wineps: Handle brush selection in spool files.
wineps: Handle EMR_EOF record in spool files.
wineps: Handle EMR_HEADER record in spool files.
wineps: Write document header and footer in PrintDocumentOnPrintProcessor.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2484