C 固步自封

C 固步自封,c,reverse-engineering,disassembly,C,Reverse Engineering,Disassembly,需要一个函数的帮助,我想这并不难,有人能把它翻译成C,这样我就可以从那里学习逻辑了吗 0x004011cf mov al, byte [esi] | : 0x004011d1 and eax, 0xff | : 0x004011d6 mul ebx | : 0x004011d8 inc esi | : 0x004011d9 add edi, eax | : 0x004011db inc ebx | : 0x004011dc dec ecx | `=< 0x004011dd j

需要一个函数的帮助,我想这并不难,有人能把它翻译成C,这样我就可以从那里学习逻辑了吗

0x004011cf mov al, byte [esi]

| : 0x004011d1 and eax, 0xff

| : 0x004011d6 mul ebx

| : 0x004011d8 inc esi

| : 0x004011d9 add edi, eax

| : 0x004011db inc ebx

| : 0x004011dc dec ecx

| `=< 0x004011dd jne 0x4011cf
给你:

esi显然是指向某个长度为ecx的缓冲区的指针

但是如果没有任何上下文信息,很难判断这段代码实际上在做什么

等效的C代码大致做到了这一点:

  char *esi;    // points to some buffer...
  int ebx;      // contains some value
  int edi;      // contains some value
  int ecx;      // some counter, presubably the length of the buffer pointed by esi
  ...
  do
  {  
    edi += *esi++ * ebx++;
  } while (--ecx != 0)
您需要学习x86汇编的基础知识

  char *esi;    // points to some buffer...
  int ebx;      // contains some value
  int edi;      // contains some value
  int ecx;      // some counter, presubably the length of the buffer pointed by esi
  ...
  do
  {  
    edi += *esi++ * ebx++;
  } while (--ecx != 0)