1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
| #include <stdio.h>
int __fastcall Test1(int valeur)
{
asm shl eax, 2
}
int __fastcall Test2(int valeur)
{
asm
{
mov edx, valeur
shl edx, 2
mov eax, edx
}
}
__declspec(naked) int Test3(int valeur)
{
asm
{
push ebp
mov ebp, esp
mov eax, valeur
shl eax, 2
pop ebp
ret
}
}
__declspec(naked) __fastcall int Test4(int valeur)// Caca
{
asm
{
shl eax, 2
ret
}
}
__declspec(naked) Test5()
{
#define _Argument [esp + 4]
asm
{
mov eax, _Argument
shl eax, 2
ret
}
}
int main()
{
int i, j;
for(i = 0; i < 10; i++)
{
j = Test1(i);
printf("%d\t", j);
j = Test2(i);
printf("%d\t", j);
j = Test3(i);
printf("%d\t", j);
asm
{
push i
call Test3
mov j, eax
pop ecx
}
printf("%d\t", j);
j = Test4(i);
printf("%d\t", j);
asm
{
mov eax, i
call Test4
mov j, eax
}
printf("%d\t", j);
asm
{
push i
call Test5
mov j, eax
pop eax
}
printf("%d\t", j);
asm push i
Test5();
asm mov j, eax
asm pop eax
printf("%d\n", j);
}
return 0;
} |
Partager