Files Delphi

// kaynak http://www.swissdelphicenter
uses
ImageHlp;
procedure ListDLLFunctions(DLLName: string; List: TStrings);
// by Dmitry Streblechenko
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;
try
ListDLLFunctions('C:\WINNT\system32\psapi.dll', List);
ShowMessage(IntToStr(list.Count) + ' functions in dll');
s := 'List of functions:';
for i := 0 to List.Count - 1 do
s := s + #13#10 + List[i];
ShowMessage(S);
finally
List.Free
end;
end;
end.