• Lib文件解析


    摘自:http://bbs.csdn.net/topics/330266854

    lib就是obj文件打包起来的,可以用lib.exe解出来,下面是vc环境下的操作,其他环境,看命令行帮助就可以了。

    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个的函数还行,多了会死人的,最好看了关键思路自己写个来的更快

    lib.exe可在vs的安装目录中找到。

    附相关链接:

    tlib使用介绍:

    http://blog.csdn.net/hongriha/article/details/4643904

    本人对TC的Graphics.lib库的反汇编工作记录

    http://blog.chinaunix.net/uid-16936786-id-2841961.html

  • 相关阅读:
    nyoj_518_取球游戏_201404161738
    nyoj_528_找球号(三)_201404152050
    nyoj_68_三点顺序_201404152013
    nyoj_123_士兵杀敌(四)_201404131143
    树状数组
    nyoj_116_士兵杀敌(二)_201404131107
    hdu_1024_糖果大战_201404021640
    hdu_1205_吃糖果_201404021440
    nyoj_278_排队_201403282135
    nyoj_127_星际之门(一)_201403282033
  • 原文地址:https://www.cnblogs.com/ant-wjf/p/3544324.html
Copyright © 2020-2023  润新知