CheatMaker 论坛

注册

 

发新话题 回复该主题

Cheat Engine 6.5 - 添加数值类型:2/4字节高位优先 [复制链接]

1#



输入以下代码:
2 字节(高位优先)
  1. alloc(TypeName,256)
  2. alloc(ByteSize,4)
  3. alloc(ConvertRoutine,1024)
  4. alloc(ConvertBackRoutine,1024)

  5. TypeName:
  6. db '2 Byte Big Endian',0   //CE不支持中文m


  7. ByteSize:
  8. dd 2

  9. //The convert routine should hold a routine that converts the data to an integer (in eax)
  10. //function declared as: stdcall int ConvertRoutine(unsigned char *input);
  11. //Note: Keep in mind that this routine can be called by multiple threads at the same time.
  12. ConvertRoutine:
  13. //jmp dllname.functionname
  14. [64-bit]
  15. //or manual:
  16. //parameters: (64-bit)
  17. //rcx=address of input
  18. xor eax,eax
  19. mov ax,[rcx] //eax now contains the bytes 'input' pointed to
  20. xchg ah,al //convert to big endian

  21. ret
  22. [/64-bit]

  23. [32-bit]
  24. //jmp dllname.functionname
  25. //or manual:
  26. //parameters: (32-bit)
  27. push ebp
  28. mov ebp,esp
  29. //[ebp+8]=input
  30. //example:
  31. mov eax,[ebp+8] //place the address that contains the bytes into eax
  32. mov ax,[eax] //place the bytes into eax so it's handled as a normal 4 byte value
  33. and eax,ffff //cleanup
  34. xchg ah,al //convert to big endian

  35. pop ebp
  36. ret 4
  37. [/32-bit]

  38. //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)
  39. //function declared as: stdcall void ConvertBackRoutine(int i, unsigned char *output);
  40. ConvertBackRoutine:
  41. //jmp dllname.functionname
  42. //or manual:
  43. [64-bit]
  44. //parameters: (64-bit)
  45. //ecx=input
  46. //rdx=address of output
  47. //example:
  48. xchg ch,cl //convert the little endian input into a big endian input
  49. mov [rdx],cx //place the integer the 4 bytes pointed to by rdx

  50. ret
  51. [/64-bit]

  52. [32-bit]
  53. //parameters: (32-bit)
  54. push ebp
  55. mov ebp,esp
  56. //[ebp+8]=input
  57. //[ebp+c]=address of output
  58. //example:
  59. push eax
  60. push ebx
  61. mov eax,[ebp+8] //load the value into eax
  62. mov ebx,[ebp+c] //load the address into ebx

  63. //convert the value to big endian
  64. xchg ah,al

  65. mov [ebx],ax //write the value into the address
  66. pop ebx
  67. pop eax

  68. pop ebp
  69. ret 8
  70. [/32-bit]
复制代码
4 字节(高位优先)
  1. alloc(TypeName,256)
  2. alloc(ByteSize,4)
  3. alloc(ConvertRoutine,1024)
  4. alloc(ConvertBackRoutine,1024)

  5. TypeName:
  6. db '4 Byte Big Endian',0 //db '4 字节 (高位优先)',0

  7. ByteSize:
  8. dd 4

  9. //The convert routine should hold a routine that converts the data to an integer (in eax)
  10. //function declared as: stdcall int ConvertRoutine(unsigned char *input);
  11. //Note: Keep in mind that this routine can be called by multiple threads at the same time.
  12. ConvertRoutine:
  13. //jmp dllname.functionname
  14. [64-bit]
  15. //or manual:
  16. //parameters: (64-bit)
  17. //rcx=address of input
  18. xor eax,eax
  19. mov eax,[rcx] //eax now contains the bytes 'input' pointed to
  20. bswap eax //convert to big endian

  21. ret
  22. [/64-bit]

  23. [32-bit]
  24. //jmp dllname.functionname
  25. //or manual:
  26. //parameters: (32-bit)
  27. push ebp
  28. mov ebp,esp
  29. //[ebp+8]=input
  30. //example:
  31. mov eax,[ebp+8] //place the address that contains the bytes into eax
  32. mov eax,[eax] //place the bytes into eax so it's handled as a normal 4 byte value

  33. bswap eax

  34. pop ebp
  35. ret 4
  36. [/32-bit]

  37. //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)
  38. //function declared as: stdcall void ConvertBackRoutine(int i, unsigned char *output);
  39. ConvertBackRoutine:
  40. //jmp dllname.functionname
  41. //or manual:
  42. [64-bit]
  43. //parameters: (64-bit)
  44. //ecx=input
  45. //rdx=address of output
  46. //example:
  47. bswap ecx //convert the little endian input into a big endian input
  48. mov [rdx],ecx //place the integer the 4 bytes pointed to by rdx

  49. ret
  50. [/64-bit]

  51. [32-bit]
  52. //parameters: (32-bit)
  53. push ebp
  54. mov ebp,esp
  55. //[ebp+8]=input
  56. //[ebp+c]=address of output
  57. //example:
  58. push eax
  59. push ebx
  60. mov eax,[ebp+8] //load the value into eax
  61. mov ebx,[ebp+c] //load the address into ebx

  62. //convert the value to big endian
  63. bswap eax

  64. mov [ebx],eax //write the value into the address
  65. pop ebx
  66. pop eax

  67. pop ebp
  68. ret 8
  69. [/32-bit]
复制代码
最终效果图:

分享 转发
我来人间一趟 奔着自由与光
TOP
2#

为什么在CE界面上点击了鼠标右键并没有弹出菜单“定义新的自定义类型(自动汇编)”选项啊?
最后编辑jiqigou 最后编辑于 2015-11-09 20:13:17
TOP
3#

为什么在CE界面上点击了鼠标右键并没有弹出菜单“定义新的自定义类型(自动汇编)”选项啊?
jiqigou 发表于 11/9/2015 7:48:52 PM
在数值类型的下拉菜单框上点
我来人间一趟 奔着自由与光
TOP
发新话题 回复该主题