[Bug 48487] New: MSYS based Git 2.25 installer reports 'could not decode hex <hexstring>' (needs support for CryptStringToBinaryW CRYPT_STRING_HEX)

WineHQ Bugzilla wine-bugs at winehq.org
Sun Jan 19 14:21:28 CST 2020


https://bugs.winehq.org/show_bug.cgi?id=48487

            Bug ID: 48487
           Summary: MSYS based Git 2.25 installer reports 'could not
                    decode hex <hexstring>' (needs support for
                    CryptStringToBinaryW CRYPT_STRING_HEX)
           Product: Wine
           Version: 5.0-rc6
          Hardware: x86-64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: crypt32
          Assignee: wine-bugs at winehq.org
          Reporter: focht at gmx.net
      Distribution: ---

Hello folks,

as it says. The error message pops up a number of times and can be dismissed.

Download:

https://github.com/git-for-windows/git/releases/tag/v2.25.0.windows.1

--- snip ---
$ WINEDEBUG=+seh,+relay,+cmd,+crypt wine ./Git-2.25.0-32-bit.exe >>log.txt 2>&1
...
005b:Call KERNEL32.CreateProcessW(00000000,00f822ec
L"\"C:\\users\\focht\\Temp\\is-79D9L.tmp\\Git-2.25.0-32-bit.tmp\"
/SL5=\"$70062,45991292,224256,Z:\\home\\focht\\Downloads\\Git-2.25.0-32-bit.exe\"
",00000000,00000000,00000000,00000000,00000000,00000000,0032fe54,0032fe44)
ret=0040ebdd 
...
005b:Ret  KERNEL32.CreateProcessW() retval=00000001 ret=0040ebdd 
...
005d:Call KERNEL32.CreateFileW(019bc684 L"C:\\Program Files
(x86)\\Git\\dev\\fd",c0000000,00000000,00000000,00000002,00000080,00000000)
ret=0042643d
005d:Call ntdll._wcsicmp(019bc684 L"C:\\Program Files
(x86)\\Git\\dev\\fd",7b05c3f6 L"CONIN$") ret=7b00f02f
005d:Ret  ntdll._wcsicmp() retval=ffffffcb ret=7b00f02f
005d:Call ntdll._wcsicmp(019bc684 L"C:\\Program Files
(x86)\\Git\\dev\\fd",7b05c404 L"CONOUT$") ret=7b00f045
005d:Ret  ntdll._wcsicmp() retval=ffffffcb ret=7b00f045
005d:Call ntdll.wcsncmp(019bc684 L"C:\\Program Files
(x86)\\Git\\dev\\fd",7b05c328 L"\\\\.\\",00000004) ret=7b00f05d
005d:Ret  ntdll.wcsncmp() retval=ffffffe7 ret=7b00f05d
005d:Call ntdll.RtlIsDosDeviceName_U(019bc684 L"C:\\Program Files
(x86)\\Git\\dev\\fd") ret=7b00f06f
005d:Ret  ntdll.RtlIsDosDeviceName_U() retval=00000000 ret=7b00f06f
005d:Call ntdll.RtlDosPathNameToNtPathName_U(019bc684 L"C:\\Program Files
(x86)\\Git\\dev\\fd",0032ee14,00000000,00000000) ret=7b00f1b3
005d:Ret  ntdll.RtlDosPathNameToNtPathName_U() retval=00000001 ret=7b00f1b3
005d:Call
ntdll.NtCreateFile(0032ee24,c0100080,0032edfc,0032edf4,00000000,00000080,00000000,00000005,00000060,00000000,00000000)
ret=7b00f2a6
005d:Ret  ntdll.NtCreateFile() retval=00000000 ret=7b00f2a6
005d:Call ntdll.RtlFreeUnicodeString(0032ee14) ret=7b00f3bb
005d:Ret  ntdll.RtlFreeUnicodeString() retval=019bc684 ret=7b00f3bb
005d:Ret  KERNEL32.CreateFileW() retval=000000c0 ret=0042643d
005d:Call crypt32.CryptStringToBinaryW(01348e5c
L"213c73796d6c696e6b3efffe2f00700072006f0063002f00730065006c0066002f00660064000000",00000050,00000004,019c65b4,0165d4cc,00000000,00000000)
ret=00499fca
005d:Call KERNEL32.IsBadStringPtrW(01348e5c,00000050) ret=7c332f9f
005d:Ret  KERNEL32.IsBadStringPtrW() retval=00000000 ret=7c332f9f
005d:trace:crypt:CryptStringToBinaryW
(L"213c73796d6c696e6b3efffe2f00700072006f0063002f00730065006c0066002f00660064000000",
80, 00000004, 0x19c65b4, 0x165d4cc, (nil), (nil))
005d:fixme:crypt:CryptStringToBinaryW Unimplemented type 4
005d:Ret  crypt32.CryptStringToBinaryW() retval=00000000 ret=00499fca
005d:Call KERNEL32.GetLastError() ret=004a1f1e
005d:Ret  KERNEL32.GetLastError() retval=00000057 ret=004a1f1e
005d:Call KERNEL32.RaiseException(0eedfade,00000001,00000007,0032f064)
ret=004fa043
005d:Call ntdll.memcpy(0032efd8,0032f064,0000001c) ret=7b00daa1
005d:Ret  ntdll.memcpy() retval=0032efd8 ret=7b00daa1
005d:trace:seh:raise_exception code=eedfade flags=1 addr=0x7b00dab1 ip=7b00dab1
tid=005d
005d:trace:seh:raise_exception  info[0]=004fa043
005d:trace:seh:raise_exception  info[1]=01686200
005d:trace:seh:raise_exception  info[2]=013f4c70
005d:trace:seh:raise_exception  info[3]=013f0350
005d:trace:seh:raise_exception  info[4]=00000018
005d:trace:seh:raise_exception  info[5]=0032f120
005d:trace:seh:raise_exception  info[6]=0032f080
005d:trace:seh:raise_exception  eax=0032efc4 ebx=013f4c70 ecx=0032f064
edx=0032efc4 esi=00000007 edi=0032f030
005d:trace:seh:raise_exception  ebp=0032f018 esp=0032efc4 cs=320023 ds=ffff002b
es=002b fs=55110063 gs=006b flags=00000212
005d:trace:seh:call_stack_handlers calling handler at 0x4fa44f code=eedfade
flags=1
005d:trace:seh:call_stack_handlers handler at 0x4fa44f returned 1
005d:trace:seh:call_stack_handlers calling handler at 0x494d53 code=eedfade
flags=1 
...
005d:Call user32.MessageBoxW(000200c2,01341d0c L"Could not write \"C:\\Program
Files (x86)\\Git\\dev\\fd\" could not decode hex
213c73796d6c696e6b3efffe2f00700072006f0063002f00730065006c0066002f00660064000000",01413a94
L"Git 2.25.0 Setup",00000030) ret=0047ca0a 
--- snip ---

The script source is here:

https://github.com/git-for-windows/build-extra/blob/3c00b55dd02a3df50ee157d158873d074c0a8f24/installer/install.iss

--- snip ---
function CreateCygwinSymlink(SymlinkPath,TargetPath:String):Boolean;
var
    Attribute:DWord;
    i:Integer;
    Hex,Buffer:string;
    Stream:TStream;
    Size:LongWord;
begin
    Result:=True;
    // assuming that the target is actually all-ASCII, convert to UTF-16
    for i:=Length(TargetPath) downto 1 do
       
TargetPath:=Copy(TargetPath,1,i)+#0+Copy(TargetPath,i+1,Length(TargetPath)-i);
    Hex:='213c73796d6c696e6b3efffe'; // "!<symlink>\xff\xfe"
    for i:=1 to Length(TargetPath) do
        Hex:=Hex+CharToHex(Ord(TargetPath[i])); // append wide characters as
hex
    Hex:=Hex+'0000'; // append a wide NUL
    // write the file
    Stream:=TFileStream.Create(SymlinkPath,fmCreate);
    try
        Size:=Length(Hex) div 2;
        SetLength(Buffer,Size);
        if
(CryptStringToBinary(Hex,Length(Hex),CRYPT_STRING_HEX,Buffer,Size,0,0)=0) or
(Size<>Length(Hex) div 2) then
            RaiseException('could not decode hex '+Hex);
        Stream.WriteBuffer(Buffer,Size);
    except
        LogError('Could not write "'+SymlinkPath+'" '+GetExceptionMessage());
        Result:=False;
    finally
        Stream.Free
    end;
    // Set system bit (required for Cygwin to interpret this as a symlink)
    Attribute:=GetFileAttributes(SymlinkPath);
    if (Attribute and 4) = 0  then
    begin
        Attribute:=Attribute or 4;
        if not SetFileAttributes(SymlinkPath,Attribute) then begin
            LogError('Could not mark "'+SymlinkPath+'" as system file');
            Result:=False;
        end;
    end;
end;
--- snip ---

Wine source:

https://source.winehq.org/git/wine.git/blob/02f3a133b64ed1f979309e1399738eaa2e204651:/dlls/crypt32/base64.c#l990

--- snip ---
 990 BOOL WINAPI CryptStringToBinaryW(LPCWSTR pszString,
 991  DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary,
 992  DWORD *pdwSkip, DWORD *pdwFlags)
 993 {
 994     StringToBinaryWFunc decoder;
 995     LONG ret;
 996 
 997     TRACE("(%s, %d, %08x, %p, %p, %p, %p)\n", debugstr_wn(pszString,
cchString ? cchString : -1),
 998      cchString, dwFlags, pbBinary, pcbBinary, pdwSkip, pdwFlags);
 999 
1000     if (!pszString)
1001     {
1002         SetLastError(ERROR_INVALID_PARAMETER);
1003         return FALSE;
1004     }
1005     /* Only the bottom byte contains valid types */
1006     if (dwFlags & 0xfffffff0)
1007     {
1008         SetLastError(ERROR_INVALID_DATA);
1009         return FALSE;
1010     }
1011     switch (dwFlags)
1012     {
1013     case CRYPT_STRING_BASE64_ANY:
1014         decoder = Base64AnyToBinaryW;
1015         break;
1016     case CRYPT_STRING_BASE64:
1017         decoder = Base64ToBinaryW;
1018         break;
1019     case CRYPT_STRING_BASE64HEADER:
1020         decoder = Base64HeaderToBinaryW;
1021         break;
1022     case CRYPT_STRING_BASE64REQUESTHEADER:
1023         decoder = Base64RequestHeaderToBinaryW;
1024         break;
1025     case CRYPT_STRING_BASE64X509CRLHEADER:
1026         decoder = Base64X509HeaderToBinaryW;
1027         break;
1028     case CRYPT_STRING_BINARY:
1029         decoder = DecodeBinaryToBinaryW;
1030         break;
1031     case CRYPT_STRING_ANY:
1032         decoder = DecodeAnyW;
1033         break;
1034     case CRYPT_STRING_HEX:
1035     case CRYPT_STRING_HEXASCII:
1036     case CRYPT_STRING_HEXADDR:
1037     case CRYPT_STRING_HEXASCIIADDR:
1038         FIXME("Unimplemented type %d\n", dwFlags & 0x7fffffff);
1039         /* fall through */
1040     default:
1041         SetLastError(ERROR_INVALID_PARAMETER);
1042         return FALSE;
1043     }
1044     if (!cchString)
1045         cchString = strlenW(pszString);
1046     ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip,
pdwFlags);
1047     if (ret)
1048         SetLastError(ret);
1049     return ret == ERROR_SUCCESS;
1050 }
--- snip ---

Microsoft docs:

https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptstringtobinarya

$ sha1sum Git-2.25.0-32-bit.exe 
7dc64019c089d4a9a3700ee7140a7af9a5416199  Git-2.25.0-32-bit.exe

$ du -sh Git-2.25.0-32-bit.exe 
45M    Git-2.25.0-32-bit.exe

$ wine --version
wine-5.0-rc6

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list