1. 程式人生 > >def檔案&匯出函式&lib檔案關聯

def檔案&匯出函式&lib檔案關聯


lib /list xx.lib 列出lib裡所有obj檔名,我這裡如下
。。。。。很多省略
lib/err/err.obj
lib/dict/dictll.obj
lib/coreDump/coreDumpWin32.obj
lib/config/preference.obj
lib/config/configUL.obj

找到你關注的obj,這裡選擇configUL.obj,然後 lib /EXTRACT:lib/config/configUL.obj xx.lib
解出configUL.obj, 然後把obj拖入IDA,我這裡是ida5.5,在函式列表裡找你要呼叫的函式,然後逆之

_Config_GetString       .text 00000068 00000039 R . . . B . .
_Config_GetBool         .text 000000B8 00000039 R . . . B . .
_Config_GetLong         .text 00000108 00000039 R . . . B . .
_Config_GetInt64        .text 00000158 0000003D R . . . B . .
_Config_GetTriState     .text 00000198 00000039 R . . . B . .
_Config_GetDouble       .text 000001E8 00000041 R . . . B T .
_Config_GetPathName     .text 00000288 00000039 R . . . B . .
_Config_NotSet          .text 000002C4 00000035 R . . . B . .
_Config_GetLongPlain    .text 000003B0 00000015 . . . . . . .
_Panic                  UNDEF 000003D0 00000004 R . . . . . .
_Preference_GetString   UNDEF 000003D4 00000004 R . . . . . .
_Str_Vsnprintf          UNDEF 000003D8 00000004 R . . . . . .
_Preference_GetBool     UNDEF 000003DC 00000004 R . . . . . .
_Preference_GetLong     UNDEF 000003E0 00000004 R . . . . . .
_Preference_GetInt64    UNDEF 000003E4 00000004 R . . . . . .
_Preference_GetTriState UNDEF 000003E8 00000004 R . . . . . .
_Preference_GetDouble   UNDEF 000003EC 00000004 R . . . . . .
_Preference_GetPathName UNDEF 000003F4 00000004 R . . . . . .
_Preference_NotSet      UNDEF 000003F8 00000004 R . . . . . .


我這裡隨便選擇一個函式 _Config_GetString,很小的函式,呵呵,方便說明
.text:00000068 _Config_GetString proc near
.text:00000068
.text:00000068 var_400         = byte ptr -400h
.text:00000068 arg_0           = dword ptr  8
.text:00000068 arg_4           = dword ptr  0Ch
.text:00000068 arg_8           = byte ptr  10h
.text:00000068
.text:00000068                 push    ebp
.text:00000069                 mov     ebp, esp
.text:0000006B                 mov     ecx, [ebp+arg_4]
.text:0000006E                 sub     esp, 400h
.text:00000074                 lea     eax, [ebp+arg_8]
.text:00000077                 push    eax
.text:00000078                 push    ecx
.text:00000079                 lea     edx, [ebp+var_400]
.text:0000007F                 push    400h
.text:00000084                 push    edx
.text:00000085                 call    _Str_Vsnprintf
.text:0000008A                 mov     ecx, [ebp+arg_0]
.text:0000008D                 lea     eax, [ebp+var_400]
.text:00000093                 push    eax
.text:00000094                 push    ecx
.text:00000095                 call    _Preference_GetString
.text:0000009A                 add     esp, 18h
.text:0000009D                 mov     esp, ebp
.text:0000009F                 pop     ebp
.text:000000A0                 retn
.text:000000A0 _Config_GetString endp

這個函式很簡單,一看就知道功能了,格式化一個buffer,構建一個字串返回,
下面是是直接f5後修改的結果
int __cdecl Config_GetString(int a1, int a2, char *buf)
{
  char buffer[0x400];
  Str_Vsnprintf(buffer, sizeof(buffer), a2, buf);
  return Preference_GetString(a1, &v4);
}

這種手法,搞個10個,8個的函式還行,多了會死人的,最好看了關鍵思路自己寫個來的更快