delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback



Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi








Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (5)


List Functions in DLLGo to colin pringle's websiteFormat this article printer-friendly!Bookmark function is only available for registered users!
List Functions In DLL
Product:
Delphi all versions
Category:
N/A
Skill Level:
Scoring:
Last Update:
12/24/2001
Search Keys:
delphi delphi3000 article borland vcl code-snippet Dll, List , Functions Extract Data From DLL
Times Scored:
6
Visits:
6898
Uploader: colin pringle
Company: cjpsoftware
Reference: Cjpsoftware.com
 
Question/Problem/Abstract:
LIst Functions In DLL
Answer:





ShellSPY V1.1a

is the award winning and powerful monitoring solution that you need! ShellSPY
gives you the power to log all keystrokes, windows viewed, applications ran, internet
connections made, passwords entered, chat conversations that were made, Monitor
all running tasks on your pc Download
Now


  



Web Site:
Cjpsoftware.com



unit listfunctionsindll;

interface

uses
  Forms,
  Classes,
  SysUtils,
  Dialogs,
  ImageHlp, // routines to access debug information
  Windows;


type
  TForm1 = class(TForm)

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


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;

// the following is an example how to use the procedure

var
  List: TStrings;
  I: integer;
  S: String;

begin
  List := TStringList.Create;

  ListDLLFunctions('c:\cjpexplorerv11\expreg.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.





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Didnt work returned 0
    Glenn Sullivan (Dec 10 2004 7:17AM)

I tried this on the BITS DLL (c:\windows\system32\qmgr.dll) and it does not seem to work
Respond

A Step Further
    Tony Jackson (Dec 5 2001 6:42PM)

I got it to work. However, it only lists the functions. How about taking it a step further and somehow list the arguments.
Respond

Windows 2000 Server SP2
    Oscar Felis (Dec 5 2001 1:16PM)

Doesn't work on subject. I get an empty result.
Respond

RE: Windows 2000 Server SP2
colin pringle (Dec 5 2001 5:41PM)

Could you explain subject ?
Respond

RE: RE: Windows 2000 Server SP2
Oscar Felis (Dec 6 2001 9:23AM)

It works on 95/98 but not on 2000/XP I get List.Count = 0.
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


   


  Community Ad of
E. Irigoyen
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)