On Fri, 7 Mar 2025, LIU Hao wrote:

> Ahh right. I have found my issue now. I was using a patched binutils like in
> Wine [1]. It produced delay-import data which somehow worked if passed to
> `ResolveDelayLoadedAPI()`, but the mingw-w64 implementation didn't like it. It
> was not modifying the IAT that caused the fault; it was earlier than that:
>
>    ```
>    Thread 1 received signal SIGSEGV, Segmentation fault.
>    0x00007ff6ff0c280a in __delayLoadHelper2 (pidd=0x7ff6ff0c30a0
> <__DELAY_IMPORT_DESCRIPTOR_delay_ws2_32_a>,
>        ppfnIATEntry=0x7ff6ff0c40b0 <__imp_WSAGetLastError>)
>        at
> D:/lh_mouse/GitHub/MINGW-packages/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/misc/delayimp.c:161
>    161       dli.dlp.fImportByName = !IMAGE_SNAP_BY_ORDINAL(pitd->u1.Ordinal);
>    (gdb)
>    ```

So speaking of that, I may have found a bug in Wine's
LdrResolveDelayLoadedAPI: it looks like it only ever fills in the ordinal,
but not the name in what this code calls dli.dlp.szProcName.  It should be
more like the lines after where you had the break, if fImportByName fill
in the string otherwise fill in the ordinal.


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to