Skip to content

Commit

Permalink
Adjust CWD magic to accommodate for the latest Windows previews
Browse files Browse the repository at this point in the history
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 <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Feb 11, 2024
1 parent 8148ef7 commit b00763c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions winsup/cygwin/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4873,10 +4873,24 @@ find_fast_cwd_pointer ()
or, 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 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. */
Expand Down

0 comments on commit b00763c

Please sign in to comment.