网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Delphi
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.Delphi控件的拿来主义(三).
.编程打开特殊的系统窗口(如控制面.
.设置全局快捷键.
.Delphi编程规范1.0.0.0.
.Delphi中串口通信的实现.
.Delphi编写数据库程序要点.
.VCL消息处理机制的内幕.
.最酷的程序员用KOL.
.Delphi常见图象格式转换技术.
.多语言应用.
.给Delphi/C++Builder程序员:编写.
.Delphi中布尔类型辨析.
.对Delphi控件的一点改良.
.DELPHI基础开发技巧.
.一個可以顯示CheckBox或RadioBut.
.监视剪贴板内容.
.用Delphi实现远程屏幕抓取.
.在Delphi中实现任意形状的窗体.
.怎么让TreeView前面显示CheckBox.
.让彩色光标出现在Delphi程序中.

取得某一dll所有输出函数名

发表日期:2006-2-4


 

取得某一dll所有输出函数名
在uses里加上ImageHlp

procedure ListDLLFunctions(DLLName: String; List: TStrings);
type
  chararr = array [0..$FFFFFF] of Char;
  var
  H: THandle;
  I,
  fc: integer;
  st: string;
  arr: Pointer;
  ImageDebugInformation: PImageDebugInformation;
begin
  List.Clear;
  DLLName := ExpandFileName(DLLName);
  if FileExists(DLLName) then
  begin
    H := CreateFile(PChar(DLLName), GENERIC_READ, FILE_SHARE_READ or
      FILE_SHARE_WRITE, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
    if H<>INVALID_HANDLE_VALUE then
      try
        ImageDebugInformation := MapDebugInformation(H, PChar(DLLName), nil, 0);
        if ImageDebugInformation<>nil then
          try
            arr := ImageDebugInformation^.ExportedNames;
            fc := 0;
            for I := 0 to ImageDebugInformation^.ExportedNamesSize - 1 do
              if chararr(arr^)[I]=#0 then
              begin
                st := PChar(@chararr(arr^)[fc]);
                if Length(st)>0 then
                  List.Add(st);
                if (I>0) and (chararr(arr^)[I-1]=#0) then
                  Break;
                fc := I + 1
              end
          finally
            UnmapDebugInformation(ImageDebugInformation)
          end
      finally
        CloseHandle(H)
      end
  end
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  List: TStrings;
  I: integer;
  S: String;

begin
  List := TStringList.Create;

  ListDLLFunctions('c:\windows\system\Abcsda.dll', List);
  showmessage(inttostr(list.count));
  S := 'List of functions';
  for I := 0 to List.Count - 1 do
    S := S + #13#10 + List[I];
  ShowMessage(S);

  List.Free
end;

//rock
//转载请保留此信息

上一篇:取得自从开机到现在CPU运行的周期数,超毫秒级的精度 人气:3715
下一篇:扫雷程序思想讲解 人气:4500
浏览全部Delphi的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐