安全中国首页 > 文章中心 > 逆向工程技术
 
易语言核心runtime的loader和部分services的逆向工程
更新时间:2007-12-20 1:03:56
责任编辑:流火
热 点:

__declspec(naked) void _cdecl ServerFunction_03(void)
{
  
  __asm
  {
    push ebp
    mov ebp,esp
    mov LibCmdNO,0
    mov ThisBaseCmdOffset,ebx
  }
  temp = 0;
  FindOK = false;
  while(KernelBaseCmd[temp].CmdOffset != -1)
  {
    if(KernelBaseCmd[temp].CmdOffset == ThisBaseCmdOffset)
    {
      FindOK = true;
      ThisExecuteCmdPoint = &(KernelBaseCmd[temp].CmdPoint);
      break;
    }
    temp++;
  }
  if(FindOK == false)
  {
    ThisLibInfo = LibInfoHead;
    ThisLibInfo += LibCmdNO;
    if(ThisLibInfo->ThisLibHandle == NULL || ThisLibInfo->ThisLibInfo == NULL)
    {
      sprintf(ErrorString, "%s\n\nIntra error string is \"%s\".", ERROR_015, ThisLibInfo->ThisLibName);
      MessageBoxA(0, ErrorString, "error", MB_ICONERROR);    
      ServerFunction_09(0);  
    }
    ThisCmdsFuncHead = &(ThisLibInfo->ThisLibInfo->m_pCmdsFunc);

    __asm
    {
      mov eax,[ThisCmdsFuncHead]
      add ebx,dword ptr ds:[eax]
    }
  }
  else
  {
    __asm
    {
      mov ebx,ThisExecuteCmdPoint
    }
  }
  __asm
  {
    lea eax,dword ptr ss:[esp+0x0c]
    sub esp,0x0c
    push eax
    push dword ptr ss:[esp+0x18]
    xor eax,eax
    mov dword ptr ss:[esp+0x08],eax
    mov dword ptr ss:[esp+0x0c],eax
    mov dword ptr ss:[esp+0x10],eax
    lea edx,dword ptr ss:[esp+0x08]
    push edx
    call dword ptr ds:[ebx]
    mov eax,dword ptr ss:[esp+0x0C]
    mov edx,dword ptr ss:[esp+0x10]
    mov ecx,dword ptr ss:[esp+0x14]
    mov esp,ebp
    pop ebp
    retn  
  }

}

void _cdecl ServerFunction_04(void)
{
  MessageBoxA(0, ERROR_012, "error", MB_ICONERROR);
  ServerFunction_09(0);
  return;
}

void _cdecl ServerFunction_05(void)
{
  MessageBoxA(0, ERROR_013, "error", MB_ICONERROR);
  ServerFunction_09(0);
  return;
}

__declspec(naked) UINT32 _cdecl ServerFunction_06(UINT32 Param1)
{
  __asm
  {
    push ebp
    mov ebp,esp
    push ecx
    mov eax,Param1
    mov ecx,ThisHeap
  }
  HeapAlloc(ThisHeap, 0, Param1);
  __asm
  {
    mov dword ptr ss:[ebp-0x04],eax
    cmp dword ptr ss:[ebp-0x04],0
    jnz okey
  }
  MessageBoxA(0, ERROR_008, "error", MB_ICONERROR);
  ServerFunction_09(0);
  __asm
  {
okey:
    mov eax,dword ptr ss:[ebp-0x04]
    mov esp,ebp
    pop ebp
    retn
  }
}

__declspec(naked) UINT32 _cdecl ServerFunction_07(UINT32 Param1, UINT32 Param2)
{
  __asm
  {
    push ebp
    mov ebp,esp
    sub esp,0x0c
    cmp Param1,0
    jnz a
    mov eax,Param2
    push eax
    call ServerFunction_06
    add esp,0x04
    jmp end    
a:    
  }
  HeapReAlloc(ThisHeap, 0, (void *)Param1, Param2);
  __asm
  {
    mov Param1,eax
    cmp Param1,0
    jnz b
  }
  MessageBoxA(0, ERROR_010, "error", MB_ICONERROR);
  ServerFunction_09(0);
  __asm
  {
    
b:
    mov eax,Param1
end:
    mov esp,ebp
    pop ebp
    retn
  }
}

void _cdecl ServerFunction_08(UINT32 Param1)
{
  if(Param1 != 0)
  {
    HeapFree(ThisHeap, 0, (void *)Param1);  
  }

  return;
}

void _cdecl ServerFunction_10(UINT32 Param1)
{  
  return;
}

void _cdecl ServerFunction_11(UINT32 Param1)
{
  MessageBoxA(0, ERROR_011, "error", MB_ICONERROR);
  ServerFunction_09(0);
  return;
}

void _cdecl ServerFunction_12(UINT32 Param1)
{
  SaveAAddress = Param1;
  return;
}

void InitServerPointTable(void)
{
  ServerPointTable[0] = (UINT32)ServerFunction_00;
  ServerPointTable[1] = (UINT32)ServerFunction_01;
  ServerPointTable[2] = (UINT32)ServerFunction_02;
  ServerPointTable[3] = (UINT32)ServerFunction_03;
  ServerPointTable[4] = (UINT32)ServerFunction_04;
  ServerPointTable[5] = (UINT32)ServerFunction_05;
  ServerPointTable[6] = (UINT32)ServerFunction_06;
  ServerPointTable[7] = (UINT32)ServerFunction_07;
  ServerPointTable[8] = (UINT32)ServerFunction_08;
  ServerPointTable[9] = (UINT32)ServerFunction_09;
  ServerPointTable[10] = (UINT32)ServerFunction_10;
  ServerPointTable[11] = (UINT32)ServerFunction_11;
  ServerPointTable[12] = (UINT32)ServerFunction_12;
}

void UpdataServerPointTable(void)
{
  ptemp = (UINT32 *)((UINT32)ECodeHeaderInfo + pHelpFuncSectionOffset->m_nRecordOffset);
  for(i = 0; i <= ESERVERCOUNT - 1; i++)
  {
    (* ptemp) = ServerPointTable[i];
    ptemp++;
  }
}

上一页 1 2 3 4 5 下一页

 
相关文章
48小时热门文章
 
48小时热门软件
48小时热门动画