最多看个函数名。参数是看不到的 这个函数是我在程序员大本营上找到的
我将代码贴出。大家直接可以用
procedure TForm1.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^) = #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;
加上下面一句再在你的FORM1上放个打开文件的对话框加一个LISTBOX
那么一个查看DLL函数内容的小工具就生成了
procedure TForm1.Button1Click(Sender: TObject);
begin
opendialog1.Execute;
ListDLLFunctions(opendialog1.FileName, Listbox1.items);
end;