要输入的代码:
- alloc(TypeName,256)
- alloc(ByteSize,4)
- alloc(PreferedAlignment, 4)
- alloc(ConvertRoutine,1024)
- alloc(ConvertBackRoutine,1024)
- TypeName:
- db '3 Byte',0
- ByteSize:
- dd 3
- PreferedAlignment:
- dd 1
- ConvertRoutine:
- //jmp dllname.functionname
- [64-bit]
- //or manual:
- //parameters: (64-bit)
- //rcx=address of input
- xor eax,eax
- mov ax,[rcx] //eax now contains the bytes 'input' pointed to
- ret
- [/64-bit]
- [32-bit]
- //jmp dllname.functionname
- //or manual:
- //parameters: (32-bit)
- push ebp
- mov ebp,esp
- //[ebp+8]=input
- //example:
- mov eax,[ebp+8] //place the address that contains the bytes into eax
- mov ax,[eax] //place the bytes into eax so it's handled as a normal 4 byte value
- and eax,ffff //cleanup
- pop ebp
- ret 4
- [/32-bit]
- //The convert back routine should hold a routine that converts the given integer back to a row of bytes (e.g when the user wats to write a new value)
- //function declared as: stdcall void ConvertBackRoutine(int i, unsigned char *output);
- ConvertBackRoutine:
- //jmp dllname.functionname
- //or manual:
- [64-bit]
- //parameters: (64-bit)
- //ecx=input
- //rdx=address of output
- //example:
- mov [rdx],cx //place the integer the 4 bytes pointed to by rdx
- ret
- [/64-bit]
- [32-bit]
- //parameters: (32-bit)
- push ebp
- mov ebp,esp
- //[ebp+8]=input
- //[ebp+c]=address of output
- //example:
- push eax
- push ebx
- mov eax,[ebp+8] //load the value into eax
- mov ebx,[ebp+c] //load the address into ebx
- mov [ebx],ax //write the value into the address
- pop ebx
- pop eax
- pop ebp
- ret 8
- [/32-bit]
复制代码效果图:
备注:游戏中的值为0-255内的值需要用模糊搜索。