Page 1 of 1

What is the correct Code of custom type in ce 7.2 ,for xor fixed value ?

Posted: Tue Mar 02, 2021 5:53 am
by longsers
[Link]


[Link]

The verification method is:
a xor a =0
an address with xor key Will be converted to 0

panraven say "any normal address reference is on CE memory not target process memory."if If a custom type for fixed value of xor is correct, it will be valid for all programs because it is a calculation of ce itself.

mgr.inz.Player say the code work on CE6.5. So this code is invalid in CE 7.2?How to fix?ce's own template seems to be changed or not right

Code: Select all

alloc(TypeName,256)
alloc(ByteSize,4)
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
define(XOR_KEY,0e59d3a5)

TypeName:
db 'XOR Algoritm',0

ByteSize:
dd 4  //4 byte real value and 4 byte encryption key right after it

//stdcall int ConvertRoutine(unsigned char *input);
ConvertRoutine:
[64-bit]
//rcx=address of input
mov eax,dword [rcx] //eax now contains the bytes 'input' pointed to
xor eax,XOR_KEY
ret
[/64-bit]

[32-bit]
mov eax,dword [esp+4]
mov eax,dword [eax]
xor eax,XOR_KEY
ret 4
[/32-bit]

//stdcall void ConvertBackRoutine(int i, unsigned char *output);
ConvertBackRoutine:
[64-bit]
//ecx=input
//rdx=address of output

xor ecx,XOR_KEY
mov [rdx],ecx
ret
[/64-bit]

[32-bit]
//[ebp+8]=input
//[ebp+c]=address of output
push eax
push edi
mov eax,dword [esp+C]
mov edi,dword [esp+10]
xor eax,XOR_KEY
mov dword [edi],eax
pop edi
pop eax
ret 8
[/32-bit]