GCC 内嵌汇编实现动态调用 windows API,gccapi


 
 //测试...
 char* cap="你好世界";
 char* msg="这是个测试,你知道吗?";
 long hwnd=0;
 long flag=0;
 HINSTANCE lib=0;
 FARPROC proc=0;
 LPCSTR dll="user32";
 LPCSTR sproc="MessageBoxA";
 
 lib= LoadLibraryA(dll);
 proc=GetProcAddress( lib, sproc);
 
 printf("%x/n%x/n",lib,proc);
 
 asm volatile(
     "push %0/n/t"
     "push %1/n/t"
     "push %2/n/t"
     "push %3/n/t"
     "call *%4/n/t"
     :
     :"r"(hwnd),"r"(cap),"r"(msg),"r"(flag),"r"(proc)
     :"ebx"
 );

//也可以分开写
// asm volatile(
//     "push %0/n/t"
//     "push %1/n/t"
//     :
//     :"r"(hwnd),"r"(cap)
//     :"ebx"
// );
// asm volatile(
//     "push %0/n/t"
//     "push %1/n/t"
//     "call *%2/n/t"
//     :
//     :"r"(msg),"r"(flag),"r"(proc)
//     :"ebx"
// );
 
 
 FreeLibrary((HMODULE)lib);
 

www.xyjys.comtrue/article/20231129/2444259.htmlTechArticleGCC 内嵌汇编实现动态调用 windows API,gccapi //测试... char* cap=你好世界; char* msg=这是个测试,你知道吗?; long hwnd=0; long flag=0; HINSTANCE lib=0; FARPROC proc=0; LPCSTR dll=user32; LPCSTR sproc=MessageBoxA; lib...

相关文章

    暂无相关文章

小鱼文聚评论

XY推荐