I am trying to call MessageBoxA () directly in the assembly using gcc inline. However, I need to do this in two ways: first use dynamic addressing, with LoadLibrary () and GetProcAddress () - I found a tutorial about this, trying to follow it. But I'm also interested in directly accessing the MessageBoxA address, which is 0x7e4507ea on my Windows SP3 in English.
I am trying to execute this code:
int main(int argc, char **argv) { asm(" xor %eax, %eax \t\n\ xor %ebx, %ebx \t\n\ xor %ecx, %ecx \t\n\ xor %edx, %edx \t\n\ push $0x0 \t\n\ push $0x44444444 \t\n\ push $0x44444444 \t\n\ pop %ecx \t\n\ mov %dl,0x3(%ecx) \t\n\ mov $0x7e4507ea, %ebx \t\n\ push %edx \t\n\ push %ecx \t\n\ push %ecx \t\n\ push %edx \t\n\ mov $0x8, %ax \t\n\ call *%ebx \t\n\ "); }
I'm not sure if this is possible in Windows, directly call the address without specifying a library (in this case user32.dll). I know that on Linux it's just called write () syscall, but on Windows I am not familiar yet.
I expect to see a window with the message "DDDDDDDD". Can someone help me with this please? Appreciate any help using the links to textbooks.
thanks a lot
source share