🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.language.objectpascal
Article #32456

Re: What does the package contain

#32456
From: Scott Maskiel
Date: Sat, 23 Nov 2002 12:42
71 lines
3288 bytes
Uter [TeamD] wrote:
>>  procedure GetPackageInfo(Module: HMODULE; Param: Pointer;
>>    var Flags: Integer; InfoProc: TPackageInfoProc);
> 
> 
> I don't have an HModule for the second (failed) bpl.  I need to know what's
> in it because I can't load it.
> 
> This is a very simplified example of what I hope to be able to accomplish...
> 
> for i := 0 to FilesFoundNamesStringList.Count - 1 do
> begin
>   try
>     LoadPackage(FilesFoundNamesStringList[i]);
>   except
>     on E: EPackageError do     // invalid package
>     begin
>       // i wish this next function existed..
>       // it would take the file name of an unloaded module and
>       // it would return something useful to
>       // be used in the next function
>       APackageInfoRecord :=
> GetExportedStuffFromPackage(FilesFoundNamesStringList[i]);
> 
>       // this would take the info record and iterate the
>       // list of loaded modules to find a matching one
>       if
> FindSimilarModuleAndDecideWhichIsOlderAndLoadTheNewOne(APacakgeInfoRecord)
> then
>         RenameFile(FilesFoundNamesStringList[i],
>           FilesFoundNamesStringList[i] + '.InvalidPackageFile');
>     end
>     else  // package intialization failed
>     begin
>       E.Message := 'Module initialization failed: ' +
> FilesFoundNamesStringList[i]
>         ' with message: ' + E.Message
>     end;
>   end;
> end;
> 
> 
>>There are many other package functions in there that may be of use to
>>you.
>>Also, enter "packages" into the Delphi Help. :)
> 
> 
> Such abuse!  I'm deeply hurt.  <g>
> 
> I've already looked at the package functions thank you very much. :)
> 
> I know something like this must be possible because I can view the exports
> with tdump or QuickView.
> 
> --
> Mark Lauter
> 
> 

Mark,

Packages are nothing more than sophisticated DLL's.  You can use the 
LoadLibrary API function to return an instance pointer - your HMODULE 
argument.

If this is an unacceptable solution, download the delphi source to a PE 
file analysis tool, and extract the bits you need to go through the 
Exports section.

Regards,
Scott
Technical Details
Message-ID: <3ddf77a6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.wirehub.nl!feedme.news.mediaways.net!news.uni-x.net!newsgroups.borland.com!not-for-mail
References: <3ddece43$1@newsgroups.borland.com> <3dded94e$1@newsgroups.borland.com> <3ddef233@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109d30,7385ecc87b03ad2c
X-Google-Attributes: gid109d30,public
X-Google-ArrivalTime: 2002-11-23 05:16:07 PST
Date: Sat, 23 Nov 2002 23:42:04 +1100
From: Scott Maskiel <scott_maskiel@somedomain.com.au>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.delphi.language.objectpascal
Subject: Re: What does the package contain
References: <3ddece43$1@newsgroups.borland.com> <3dded94e$1@newsgroups.borland.com> <3ddef233@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 210.49.88.70
Message-ID: <3ddf77a6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1038055334 210.49.88.70 (23 Nov 2002 04:42:14 -0800)
Lines: 72
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.wirehub.nl!feedme.news.mediaways.net!news.uni-x.net!newsgroups.borland.com!not-for-mail