//==============================================================================
//输出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^)=#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;