Finally Microsoft implemented InternetReadFileExW function …

Some time ago I was surprised when noticed that UNICODE version of WinInet function InternetReadFileEx is not implemented. Disassembling wininet.dll gave me the following results:

.text:000007FF7D0D16A0 ; InternetReadFileExW proc near
.text:000007FF7D0D16A0                 sub     rsp, 28h
.text:000007FF7D0D16A4                 mov     ecx, 78h
.text:000007FF7D0D16A9                 call    cs:SetLastError
.text:000007FF7D0D16AF                 xor     eax, eax
.text:000007FF7D0D16B1                 add     rsp, 28h
.text:000007FF7D0D16B5                 retn
.text:000007FF7D0D16B5 InternetReadFileExW endp

So InternetReadFileExW just was calling SetLastError(120); which means that this function is not impelemneted on the target system. The problem is: at that time official documentation stated that InternetReadFileExW is implemented!

I wrote several letters to MSFT about this issue, but they just forgot about me – there were no reply concerning my problem. Now I see that starting with IE7 Beta Microsoft implemented this function as a quick hack – it simply calls InternetReadFileExA:

.text:6302FDC7                 public InternetReadFileExW
.text:6302FDC7 InternetReadFileExW proc near
.text:6302FDC7 hFile           = dword ptr  8
.text:6302FDC7 lpBuffersOut    = dword ptr  0Ch
.text:6302FDC7 dwFlags         = dword ptr  10h
.text:6302FDC7 dwContext       = dword ptr  14h
.text:6302FDC7                 mov     edi, edi
.text:6302FDC9                 push    ebp
.text:6302FDCA                 mov     ebp, esp
.text:6302FDCC                 mov     eax, [ebp+lpBuffersOut]
.text:6302FDCF                 push    esi
.text:6302FDD0                 xor     esi, esi
.text:6302FDD2                 cmp     eax, esi
.text:6302FDD4                 jz      short loc_6302FDF3
.text:6302FDD6                 cmp     [eax+8], esi
.text:6302FDD9                 jnz     short loc_6302FDF3
.text:6302FDDB                 push    [ebp+dwContext] ; dwContext
.text:6302FDDE                 push    [ebp+dwFlags]   ; dwFlags
.text:6302FDE1                 push    eax             ; lpBuffersOut
.text:6302FDE2                 push    [ebp+hFile]     ; hFile
.text:6302FDE5                 call    InternetReadFileExA
.text:6302FDEA                 mov     esi, eax
.text:6302FDEC loc_6302FDEC:

.text:6302FDEC                 mov     eax, esi
.text:6302FDEE                 pop     esi
.text:6302FDEF                 pop     ebp
.text:6302FDF0                 retn    10h
.text:6302FDF3 ; ---------------------------------------------------------------------------
..text:6302FDF3                 push    57h
.text:6302FDF5                 jmp     loc_63044AE6
.text:6302FDF5 InternetReadFileExW endp

Leave a Reply

Your email address will not be published. Required fields are marked *