Skip to content

Commit 61d302a

Browse files
committed
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: "technilogically sufficiently advanced") code needs to be adjusted accordingly. This fixes git-for-windows/git#4429 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 5026cc8 commit 61d302a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

winsup/cygwin/path.cc

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4581,10 +4581,24 @@ find_fast_cwd_pointer ()
45814581
or, then `mov %r12,%rcx', then `callq RtlEnterCriticalSection'. */
45824582
lock = (const uint8_t *) memmem ((const char *) use_cwd, 80,
45834583
"\x4c\x8d\x25", 3);
4584-
if (!lock)
4585-
return NULL;
45864584
call_rtl_offset = 14;
45874585
}
4586+
4587+
if (!lock)
4588+
{
4589+
/* A recent Windows Preview calls `lea rel(rip),%r13' then
4590+
some unrelated instructions, then `callq RtlEnterCriticalSection'.
4591+
*/
4592+
lock = (const uint8_t *) memmem ((const char *) use_cwd, 80,
4593+
"\x4c\x8d\x2d", 3);
4594+
call_rtl_offset = 24;
4595+
}
4596+
4597+
if (!lock)
4598+
{
4599+
return NULL;
4600+
}
4601+
45884602
PRTL_CRITICAL_SECTION lockaddr =
45894603
(PRTL_CRITICAL_SECTION) (lock + 7 + peek32 (lock + 3));
45904604
/* Test if lock address is FastPebLock. */

0 commit comments

Comments
 (0)