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
|
__declspec(naked) BOOL __fastcall SameSector(LPBYTE lpSect1, LPBYTE lpSect2)
{ // ECX = lpSect1, EDX = lpSect2
asm
(
".intel_syntax noprefix\n"
"push ebx\n"
"mov eax, edx\n"
"mov ebx, 32\n"
"Next:\n"
"mov edx, [ecx]\n"
"cmp edx, [eax]\n"
"jne short Diff\n"
"mov edx, [ecx+4]\n"
"cmp edx, [eax+4]\n"
"jne short Diff\n"
"mov edx, [ecx+8]\n"
"cmp edx, [eax+8]\n"
"jnz short Diff\n"
"mov edx, [ecx+12]\n"
"cmp edx, [eax+12]\n"
"jne short Diff\n"
"dec ebx\n"
"jz short samExit\n"
"add ecx, 16\n"
"add eax, 16\n"
"jmp short Next\n"
"Diff:\n"
"xor eax, eax\n"
"samExit:\n"
"pop ebx\n"
"ret 0\n"
".att_syntax \n"
:
:"d" (lpSect2), "c" (lpSect1)// ECX = lpSect1, EDX = lpSect2
:
); |
Partager