Skip to content

Commit 4840a56

Browse files
dschojon-turney
authored andcommitted
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 git-for-windows/git#4429 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent e7858c0 commit 4840a56

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

winsup/cygwin/path.cc

+17-3
Original file line numberDiff line numberDiff line change
@@ -4511,13 +4511,27 @@ find_fast_cwd_pointer ()
45114511
if (!lock)
45124512
{
45134513
/* Windows 8.1 Preview calls `lea rel(rip),%r12' then some unrelated
4514-
or, then `mov %r12,%rcx', then `callq RtlEnterCriticalSection'. */
4514+
ops, then `mov %r12,%rcx', then `callq RtlEnterCriticalSection'. */
45154515
lock = (const uint8_t *) memmem ((const char *) use_cwd, 80,
45164516
"\x4c\x8d\x25", 3);
4517-
if (!lock)
4518-
return NULL;
45194517
call_rtl_offset = 14;
45204518
}
4519+
4520+
if (!lock)
4521+
{
4522+
/* A recent Windows 11 Preview calls `lea rel(rip),%r13' then
4523+
some unrelated instructions, then `callq RtlEnterCriticalSection'.
4524+
*/
4525+
lock = (const uint8_t *) memmem ((const char *) use_cwd, 80,
4526+
"\x4c\x8d\x2d", 3);
4527+
call_rtl_offset = 24;
4528+
}
4529+
4530+
if (!lock)
4531+
{
4532+
return NULL;
4533+
}
4534+
45214535
PRTL_CRITICAL_SECTION lockaddr =
45224536
(PRTL_CRITICAL_SECTION) (lock + 7 + peek32 (lock + 3));
45234537
/* Test if lock address is FastPebLock. */

0 commit comments

Comments
 (0)