__asm { //
push eax //
push ecx //
movsx ecx, temp_char //
lea eax, EKey //
call encryptX // encrypt the character
mov temp_char, al //
pop ecx //
pop eax //
}
EChars[i] = temp_char; // Store encrypted char in the encrypted chars array
}
return;
// ---------------------------- start of ASM code ---------------------------------------------------------------encryptX: push ecx //push to manipulate
xchg eax, ecx //exchange values in eax and ecx / eax holds old ecx
neg al //twos complement least most eax byte (old ecx)
ror al, 1 //rotate right least most byte by 1 of eax
xor al, byte ptr[ecx] //exlcusive or least most byte against ecx value being pointed at
push edx //push edx onto stack for manipulatio
mov edx, eax //move eax into edx
xchg eax, ecx //swap values of ecx and eax
rol byte ptr[eax], 3 //rotate left the byte being pointed at 3 times
xor dl, byte ptr[eax] //xor the least byte by pointed value in eax
rol dl, 2 //rotate left the least byte in edx by 2
mov eax, edx //move edx value into eax
pop edx //pop values out
pop ecx //pop values out
ret //return
}
i have the task of implementing a standard call in this code - be that cdecl or std call
'mov eax, [ebp+8] // get first parameter that was pushed'
i understand the idea of pushing the pointers location but i am unsure of where i would tell the pointer to look.
be that mov eax, [ebp+4/8/12] or what have you
any help in telling me how i would do this would be greatly appreciated, similarly if one of you kind folk do solve this could an explanation be added
Thanks