Dynamic linking seems to be broken for x86_windows
@elicn ci sta già lavorando.
Dal 28/1/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
*Describe the bug
I'm trying to compile a simple dynamic linking example implemented in C language with MinGW and run it with qiling.
In my main.c I have:
#include <stdio.h>
void print_hello();
int main() {
print_hello();
return 0;
}
In my library.c I have:
#include <stdio.h>
void print_hello() {
printf("Hello World!\n");
}
When I compile both and dynamically link they with each other, the resulting executable seems to be working under Wine without any problems:
$ i686-w64-mingw32-gcc library.c -shared -o hello.dll -static-libgcc -static-libstdc++
$ i686-w64-mingw32-gcc main.c hello.dll -o hello.exe -static-libgcc -static-libstdc++
$ wine hello.exe
Hello World!
But, when I give it a run with Qiling it complains about unimplemented APIs in hello.dll:
# /root/qiling/qltool run --filename rootfs/x86_windows/bin/hello.exe --rootfs rootfs/x86_windows
<...>
[!] api print_hello (hello) is not implemented
[!] api _lock (msvcrt) is not implemented
I'm pretty sure there's no problems with hello.dll location, as when I remove it it starts printing an error message of a quite different kind.
Hooking print_hello() with ql.os.set_api() won't be a solution as it gives no chances to perform some instrumentation inside hello.dll real code.
I've also tried performing the same test with x8664_linux target, and unlike for x86_windows, it worked without any problems.
Is there anything I'm missing?
Expected behavior
I expect "Hello World!" to be printed just as under Wine, with print_hello() function from hello.dll being in use
P. S. I've attached my prebuild binaries just in case if you need it. Of course, I'm using the dev branch of Qiling just as suggested in your tutorial.
- Lingua principale
- Python
- Stelle
- 6.2k
- Fork
- 806
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di qilingframework/qiling
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
qilingframework/qiling#1690 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
qilingframework/qiling#1689 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
qilingframework/qiling#1688 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
qilingframework/qiling#1686 ·
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 82/100
qilingframework/qiling#1640 ·
Tutte le issue di qilingframework/qiling
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/datasets#9128 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OpenHands/extensions#975 ·
I maintainer di solito rispondono entro 1 giorno
-
Function/dict state handlers can't supply provider-state injected values (`generate.provider_state`)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pact-foundation/pact-python#1789 ·
I maintainer di solito rispondono entro 9 giorni
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
juandresrodca/AdminForge#66 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno