Cygwin: Adjust CWD magic to accommodate for the latest Windows previews

Reportedly Windows 11 build 25*** from Insider changed the current
working directory logic a bit, and Cygwin's "magic" (or:
"technologically sufficiently advanced") code needs to be adjusted
accordingly.

This fixes https://github.com/git-for-windows/git/issues/4429

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2023-05-22 13:36:27 +02:00 committed by Jon Turney
parent e7858c0a58
commit 4840a56325
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
1 changed files with 17 additions and 3 deletions

View File

@ -4511,13 +4511,27 @@ find_fast_cwd_pointer ()
if (!lock)
{
/* Windows 8.1 Preview calls `lea rel(rip),%r12' then some unrelated
or, then `mov %r12,%rcx', then `callq RtlEnterCriticalSection'. */
ops, then `mov %r12,%rcx', then `callq RtlEnterCriticalSection'. */
lock = (const uint8_t *) memmem ((const char *) use_cwd, 80,
"\x4c\x8d\x25", 3);
if (!lock)
return NULL;
call_rtl_offset = 14;
}
if (!lock)
{
/* A recent Windows 11 Preview calls `lea rel(rip),%r13' then
some unrelated instructions, then `callq RtlEnterCriticalSection'.
*/
lock = (const uint8_t *) memmem ((const char *) use_cwd, 80,
"\x4c\x8d\x2d", 3);
call_rtl_offset = 24;
}
if (!lock)
{
return NULL;
}
PRTL_CRITICAL_SECTION lockaddr =
(PRTL_CRITICAL_SECTION) (lock + 7 + peek32 (lock + 3));
/* Test if lock address is FastPebLock. */