Worm64 Posted January 24, 2015 Report Posted January 24, 2015 (edited) A fost un mic pariu cu @Usr6.M-am gandit sa il postez aici pentru cine vrea sa foloseasca functii din windows.h in asm.#include "windows.h"char a2[]="usr6";char a3[]="Salut";int main(){ __asm { mov eax,0 push eax mov eax,offset a3 push eax mov eax,offset a2 push eax mov eax,0 push eax call DWORD PTR MessageBox pop ebx pop ebx pop ebx pop ebx }} Edited January 24, 2015 by Worm64 1 Quote
Nytro Posted January 24, 2015 Report Posted January 24, 2015 Nu e nevoie sa pui totul in EAX inainte de push. Iar eliberarea memoriei NU se face pentru WinAPI (ex, MessageBox) deoarece au calling convention __stdcall. Functiile din C au calling convention __cdecl si acolo e necesara acea secventa "pop ebx..." dar nu se face asa, se face mai rapid cu incrementarea ESP-ului: add ESP, 0x10 (adica 16 bytes).Info:1. Calling Conventions Demystified - CodeProject2. Using Win32 calling conventions Quote