This patch set is based upon [patches from Wine Staging](https://github.com/wine-staging/wine-staging/tree/master/patches/n…, and implements support for the `SYSTEM`, `HIDDEN` and `READONLY` DOS file attributes. These have been implemented in various ways depending upon the capabilities of the operating system and the file system.
# Storage Methods
## FAT MSDOS file attributes
* Linux: [`ioctl_fat(2)`](https://www.man7.org/linux/man-pages/man2/ioctl_fat.2.html)
On Linux, the FAT filesystem implementation allows DOS file attributes to be applied to files and
queried through a family of ioctls. Note that these ioctls are not yet supported by the NTFS or CIFS
drivers.
## Extended File Attributes
* Linux: [`xattr(7)`](https://www.man7.org/linux/man-pages/man7/xattr.7.html)
* MacOS: [`getxattr(2)`](https://www.unix.com/man-page/osx/2/getxattr/), [`setxattr(2)`](https://www.unix.com/man-page/osx/2/setxattr/), [`removexattr(2)`](https://www.unix.com/man-page/osx/2/removexattr/)
* FreeBSD, NetBSD: [`extattr(2)`](https://nixdoc.net/man-pages/FreeBSD/man2/extattr.2.html)
Modern filesystems generally support Extended File Attributes - auxiliary blobs of binary data that can be attached to a file. Samba uses the `user.DOSATTRIB` attribute to store DOS attribute information in the form of a hexadecimal value.
Note that although FreeBSD and NetBSD support the extended attribute system calls, these are not currently implemented in the operating system, or supported in any of their filesystem drivers.
## BSD File Flags
* MacOS: [`fchflags(2)`](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fchflags.2.html)
* FreeBSD, NetBSD: [`fchflags(2)`](https://nixdoc.net/man-pages/FreeBSD/man2/fchflags.2.html)
On some BSD-like operating systems including MacOS, FreeBSD and NetBSD, the `struct stat` structure contains the `st_flags` member can carry flags of which the following can be used to represent DOS attributes:
* `UF_IMMUTABLE` can represent `FILE_ATTRIBUTE_READONLY`
* `UF_HIDDEN` can reprent `FILE_ATTRIBUTE_HIDDEN` (not available on NetBSD)
# Design
The implementation is takes an opportunistic approach. It will attempt to store flags by any of the above mentioned methods, and will retrieve flags using any available method and will combine flags from multiple sources together.
# See Also
* https://bugs.winehq.org/show_bug.cgi?id=9158
* https://bugs.winehq.org/show_bug.cgi?id=15679
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/924
Many code sections still use fixed-size arrays on stack - or even worse - `strcat` in combination with strings of unknown length. This MR/PR provides general purpose Wine-internal functions for safer string handling. The functions are currently header-only to not pollute msvcrt exports.
The API was written for an upcoming shell32/shlexec patch (WIP) to properly fix
possible stack corruptions due to out-of-bounds writes for unexpected long paths or URLs.
This is a dynamic container inspired by C++ std::string / std::vector with
wide/narrow conversion and formatted text. Growth factor = 2 for simplicity.
Differences to `STRING`/`UNICODE_STRING` (`RtlCreateUnicodeString` and similar):
* No USHORT length limitation
* Actual dynamic resizable container
* String formatting and conversion support
* Short and consistent API naming
New test added to msvcrt: `winestring`
--
v2: Various improvements and fixes
https://gitlab.winehq.org/wine/wine/-/merge_requests/910
Change strategy for resetting local scope when unloading a module.
Old strategy was keeping the local scoped symbol alive on some code path when
unloading a module.
This caused some bad behavior as we kept a pointer to a deleted object.
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/931
With this series it's now possible to run and pass `user32:monitor` and `user32:sysparams` tests with nulldrv, and so most `user32` tests (except for a few desktop cursor position tests). This still requires some prefix configuration to enable the nulldrv driver, or a change like https://gitlab.winehq.org/rbernon/wine/-/commit/753368ad0ec52f03f8d6e78ca79… to enable it when `DISPLAY` environment variable is unset.
This then shows that some of the user32 tests are failing with winex11 but passing with nulldrv, as in https://gitlab.winehq.org/rbernon/wine/-/commit/6d5f4109a514a0dc266899fcacf….
--
v4: win32u: Read mode from the registry if GetCurrentDisplaySettings fails.
win32u: Write display settings to the registry in apply_display_settings.
win32u: Lock display devices while applying display settings.
win32u: Force update display cache after NtUserChangeDisplaySettingsEx.
win32u: Introduce a new VirtualScreenRectChanged display driver callback.
win32u: Add a BOOL force parameter to update_display_cache.
https://gitlab.winehq.org/wine/wine/-/merge_requests/551