有一个动态连接库,不知道它里面有什么函数,怎么才能知道?

解决方案 »

  1.   

    给你一个函数,得到DLL内的函数列表:
    function GetDLLFunctions(DLLName: string): string;
    type CharArray = array [0..$FFFFFF] of Char;
    var ImageDebugInformation: PImageDebugInformation;
        vHandle: THandle;
        FunName: string;
        Point: Pointer;
        i, FunCount: integer;
    begin
      Result := '';
      DLLName := ExpandFileName(DLLName);
      if FileExists(DLLName) then
      begin
        vHandle := CreateFile(PChar(DLLName), GENERIC_READ, FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
        if vHandle<>INVALID_HANDLE_VALUE then
        try
          ImageDebugInformation := MapDebugInformation(vHandle, PChar(DLLName), nil, 0);
          if ImageDebugInformation<>nil then
          try
            Point := ImageDebugInformation^.ExportedNames;
            FunCount := 0;
            for i:=0 to Integer(ImageDebugInformation^.ExportedNamesSize-1) do
              if CharArray(Point^)[i]=#0 then
              begin
                FunName := PChar(@CharArray(Point^)[FunCount]);
                if Length(FunName)>0 then Result := Result + FunName + #13;
                if (i>0) and (CharArray(Point^)[i-1]=#0) then Break;
                FunCount := i + 1
              end
          finally
            UnmapDebugInformation(ImageDebugInformation)
          end
        finally
          CloseHandle(vHandle)
        end
      end
    end;
      

  2.   

    ExeScope:http://www.skycn.com/soft/2128.html
    W32DASM: http://www.exetools.com/files/disassemblers/wdasm89.zip
      

  3.   

    我用过exescope能看到函数名, 但是没有函数参数, 这样还是没法在自己的程序中调用呀. 怎么办?
      

  4.   

    用微软的Spy,呵呵!好象不对,是WinSign吧!不记的了,cg1120(代码最优化-§新年祝福你,好运伴着你§) 老兄的方法不知道可不可以了!
      

  5.   

    回复人: yczyk((有鬼)(恶人谷杀手团团副)) ( ) 信誉:100  200 哪有微软的那个东东??
      

  6.   

    只能得到函数名,不能得到参数,否则M$写的什么东西你拿来就用,它还玩什么?
    就像你自己写的DLL,你愿意别人拿来就用吗?参数都得要有相应的文档才有的,
    现在还没有能看参数的工具:(