[PATCH v2 0/1] MR256: ntdll: Do not open directory file when setting the same directory path.
Paul Gofman (@gofman)
wine at gitlab.winehq.org
Thu Jun 16 11:51:06 CDT 2022
Fixes The Rising of The Shield Hero: Relieve the Animation hangs on start (and maybe something else with ENIGMA protector).
The protector implements virtual file system which hotpatches a lot of file related functions, in particular, NtOpenFile(). When NtOpenFile() is called from RtlSetCurrentDirectory_U() with peb lock held the hotpatcher takes its own lock and that can deadlock with other threads performing file / path operations ending up in get_full_path_helper() which also takes PEB lock. Once the hotpatcher is initialized the game only sets "." or the same full path as current and may do that rather often.
It seems that reopening the file handle for the same directory is redundant anyway, so probably makes sense to just avoid that part.
v2: ntdll: Do not open directory file when setting the same directory path.
More information about the wine-devel