Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-20159

[X64] Need shim for msys

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • None

    Description

      Problem:

       

      See https://github.com/git-for-windows/msys2-runtime/commit/5fe6d81012e97a348608511450f6a63750c906b6

      Needs a shim. Patch RtlGetCurrentDirectory_U export point to a decoy version written in asm:

      #include <ksamd64.inc>
      EXTERN RtlGetCurrentDirectory_U:PROC
      EXTERN RtlAcquirePebLock:PROC
      EXTERN FastPebLock:QWORD
      EXTERN RtlEnterCriticalSection:PROC
      EXTERN RtlpCurDirRef:QWORD
       
      .code
      MsysDecoy_UseRtlpCurDirRef:
          // This path should never be executed!
          int HEX(2c)
          lea rcx, FastPebLock[rip]
          call RtlEnterCriticalSection
          mov rbx, qword ptr [RtlpCurDirRef]
          test rbx, rbx
      MsysDecoy_continue:
          jmp RtlGetCurrentDirectory_U
       
      PUBLIC RtlGetCurrentDirectory_U_RtlpMsysDecoy
      RtlGetCurrentDirectory_U_RtlpMsysDecoy:
          // Short jmp that hopefully does not contain a 0xe8
          jmp short MsysDecoy_continue
          // This emulates the call that msys/cygwin are looking for
          // and will never be executed
          call MsysDecoy_UseRtlpCurDirRefEND
      

      The shim should be registered to "msys-2.0.dll".

       

      Attachments

        Activity

          People

            learn_more Mark Jansen
            ThePhysicist Timo Kreuzer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: