如何查看DLL文件内部有哪些函数(50分)

S

siaosa

Unregistered / Unconfirmed
GUEST, unregistred user!
如何查看DLL文件内部有哪些函数,以及函数需要哪些参数?
 
前者,可以用tdump(delphi自带)
后者,可以用动态反汇编工具自己跟程序,至于怎么跟,看个人技术了。
 
//==============================================================================
//输出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;
 
TO:quark
编译时显示找不到PImageDebugInformation,还要引用哪些单元,才能够使用该函数?
 
uses ImageHlp
 
试过了,还是不能显示DLL的内容。
 
自己写一个就是了

这是 C++
typedef struct _IMAGE_DEBUG_INFORMATION {
LIST_ENTRY List;
DWORD Size;
PVOID MappedBase;
USHORT Machine;
USHORT Characteristics;
DWORD CheckSum;
DWORD ImageBase;
DWORD SizeOfImage;
DWORD NumberOfSections;
PIMAGE_SECTION_HEADER Sections;
DWORD ExportedNamesSize;
PSTR ExportedNames;
DWORD NumberOfFunctionTableEntries;
PIMAGE_FUNCTION_ENTRY FunctionTableEntries;
DWORD LowestFunctionStartingAddress;
DWORD HighestFunctionEndingAddress;
DWORD NumberOfFpoTableEntries;
PFPO_DATA FpoTableEntries;
DWORD SizeOfCoffSymbols;
PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols;
DWORD SizeOfCodeViewSymbols;
PVOID CodeViewSymbols;
PSTR ImageFilePath;
PSTR ImageFileName;
PSTR ReservedDebugFilePath;
DWORD ReservedTimeDateStamp;
BOOL ReservedRomImage;
PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory;
DWORD ReservedNumberOfDebugDirectories;
DWORD ReservedOriginalFunctionTableBaseAddress;
DWORD Reserved[2];
} IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
 

Similar threads

顶部