Nytro Posted June 14, 2010 Report Posted June 14, 2010 O metoda "draguta" de apel dinamic. Autorul nu il stiu, cred ca e vorba de "Skillless".#include <windows.h>int main(){ HINSTANCE Dll = LoadLibrary("user32.dll"); DWORD(*Func)(void) = (DWORD(*)(void))GetProcAddress(Dll, "MessageBoxA"); HWND A = 0; LPCTSTR B = "Question?"; LPCTSTR C = "Title!"; UINT D = MB_ICONEXCLAMATION | MB_YESNO; asm("push %0" :: "r"(D)); asm("push %0" :: "r"(C)); asm("push %0" :: "r"(); asm("push %0" :: "r"(A)); Func(); asm("pop %0" :: "r"(A)); asm("pop %0" :: "r"(); asm("pop %0" :: "r"(C)); asm("pop %0" :: "r"(D)); FreeLibrary(Dll); return 0;}Va dati si voie seama ce face, ce functie apeleaza si cum. Quote
loki Posted June 15, 2010 Report Posted June 15, 2010 Presupun doar din ochi, ca e vorba de afisarea unui alert.Da ce tare! simplu si dragut cat sa pricepi un apel de functie cu transmiterea parametrilor in stiva inainte de apelare, putina asamblare si lucrul cu un DLL = in asta chiar eram total afon. Quote
loki Posted June 15, 2010 Report Posted June 15, 2010 Daca faci chestia asta dupa ce ai apelat MessageBox ai bulit stiva si tot ce se intampla dupa o sa fie vraistesunt curios: de ce? nu e simplu push si pop? E vorba de vreo eliberare automata inainte de pop provocata de func, cod adaugat in compilare? Ca altfel par sa corespunda in program si sa fie ok. Quote