I need to know if a exe file contains at least one icon. A fast way, if that's possible.
I tried with PrivateExtractIcons and it works, but only for 32 bit exe files.
It's not working for 64 bit exe files.
I need this to work with any exe file in any Windows >= XP (x86 and x64).
I'm using Delphi 2009.
Call LoadLibraryEx passing LOAD_LIBRARY_AS_DATAFILE or LOAD_LIBRARY_AS_IMAGE_RESOURCE.
Call EnumResourceTypes to check if the module has any icon resources.
Note that this is not exhaustive since some applications (e.g. modern Office) store their image assets in custom form and not icon resources.
Related
I have used TZIPForge for a long time now. Now I would like to change to JEDI JCL Compress.
With TZIPForge I can decide whether it compressed fully in memory or whether it writes to disk directly while compressing.
JEDI JCL seems to compress fully in memory which can cause problems with very big files. How is it possible to write directly to disk instead?
AFAIR Jedi CodeLib today is a wrapper over 7-zip DLL API ( www.7-zip.org ) and thus is a bit overkill if you only need creating simplified old-school ZIPs ( such as Java JARs or Office OpenDocument or OpenXML files ).
Indeed, there is a difference, when the compression takes place - some libraries compress every particular file immediately when given data. And then committing the archive is only writing the end-directory of the zip. Some libraries though keep ALL the uncompressed content in memory and only compress it when committing.
Check ZeZippy*.pas files at https://github.com/Avemey/zexmlss/tree/master/zexmlss/src
This is implementing creation of ODS/XLSX zips with different engines. XE2 RTL and ZipMaster and Jedi CodeLib interfaces supported, you just can match their micro-implementations to see differences.
PS. AFAIR I also wanted to add Windows XP implementation, but seems got diverted from it :-)
https://github.com/the-Arioch/avemey.com/blob/master/zexmlss/src/zeZippyXP.txt
I'm a bit confused on something, being quite a while since I've used external controls. Basically, I'm writing a small test app with Delphi XE3 which uses an ActiveX control. A TLB file is generated as usual. I have tested on two machines (an Acer notebook and a Dell Latitude 10). When I test on my desktop Windows machine I get an error traceable to the OCX file. I was under the impression that the TLB.pas file was all that was needed to instantiate the control. Do I also need to install and register the OCX file ? Does COM component need to be distributed with its .DLL file ? TIA for your anticipated help.
Brian Corll
The type library only describes how to call the library. The .pas file generated from the type library also only describes how to call the library. That's all compile time. At run time when you actually call the library, you need the library to be registered and present.
So yes, you'll need to distribute and register the library.
Convert might be the wrong word, but to save a user having to install something I wondered if a small EXE can be embedded in a web-page (IE only) using ActiveX so it is run when a button is pressed. Obviously a big security hole but is it feasible?
Urgh, just thinking about it makes me die a little inside.
But yes, package up the exe and the activex in a cab file and use the activex to launch the exe.
Info on packaging up ActiveX cab files is here: http://msdn.microsoft.com/en-us/library/aa751974(v=vs.85).aspx
A bit more information on Inf files (specifically the DestDir bit): http://msdn.microsoft.com/en-us/library/aa741215(v=vs.85).aspx
This would allow you to put the exe in a known location (Windows or System) so that you could execute it from the activex control providing permissions were set correctly
I'm using Delphi.
I want to know how to extract (all) the icons from an exe file and insert them into another, preserving the order and the index of the icons.
I found some samples of Delphi code using Google but the problem is that it doesn't extract them all.
And I've found some compiled programs (exes) that do one or the other but not both.
Why do I need this: because I have to start some exe files (that have those icons) from virtualized applications. And I want to make some external exe files that have the same name and the same icons.
Thank you for your help.
The source is available for Colin Wilson's XN Resource Editor. It should have what you need.
http://www.wilsonc.demon.co.uk/d10resourceeditor.htm
Alternatively you have the Delphi sample 'ResXplor'. If it's not distributed in your version it's also avalaible to download here: http://radstudiodemos.svn.sourceforge.net/viewvc/radstudiodemos/branches/RadStudio_XE/Delphi/VCL/resXplor/
There was a similar question about extracting icons. PrivateExtractIcons gives you access to specific image sizes in an icon resource, but you need to know the sizes ahead of time, and Microsoft warns that this method is not for general use.
There is a working example of extracting the entire icon resource with all of the image sizes on Delphi Praxis. The example has a problem with 256 pixel images, so it would have to be tweaked to account for these.
I'm compiling my application with Delphi 2010. My problem (it may not be a problem for anybody else) is that when you open that EXE with any resource editor you can see RCDATA which holds forms data. I don't like an idea of my program being "exposed" so I want to ask you is there any trick to remove that information from EXE or encrypt it that nobody (at least from resource editor) can see it?
You may create your forms fully via source.
opposite: you can't use the form designer.
with gexperts you can convert existing forms to source.
encrypting and compressing is not a solution. when the app can load the resources a engineer can it do, too.
I have written a DFM compressor that works inside of the Delphi IDE to compress DFMs at compile time. It then decompresses them on the fly at runtime.
I sell it for $15 US and it comes with src.
It currently works with D7, D2006, D2007 and D2009. I don't own D2010 but I have recently gotten XE and I will be upgrading it and making it available for XE as well in the near future. If someone makes a request for XE, or even D2010 compatibility, I'll work to make that happen sooner.
It's called the DeForM System and can be found here.
I use it for a number of my personal projects.
You would need to modify VCL source code to teach form loader to take resources elsewhere. Also, compilation would require post-build step or stripping resources from the compiled EXE and moving them to a separate encrypted file (for example). All of this is manual work, I never heard of any automation for described tasks.
One thing you could do IF your forms are finalized (i.e. they won't be modified further) is take GExperts and use their Component To Code expert to create forms and their contents in runtime. But modification of such forms will require changes in code.
It actually just holds published property of the components you drop on your forms and the form itself (actually the content of DFM file for each form), not any source code. So even if somebody extracts that data, they can at most produce a form visually looking the same as your form, but none of the codes you wrote for the form.
One way to hide such data from resource editors is to build all the components you use in your form at runtime, not using the form designer. This way, the DFM resource will not contain their data. As far as I remember, there are tools which are able to receive a DFM file as input, and generate runtime code for component creations automatically (e.g. GExpert), so that you could copy\paste the code in your form's OnCreate event-handler.
Another option is to use an EXE compressor. A compressor will compress your EXE file so the content of the file will be changed and not usable until being decompressed. Tools like UPX can compress your EXE file and decompress it on the fly when you execute the EXE. Take note that using known compressors like UPX has the drawback that many cracking tools or crackers can detect them and automatically decompress the EXE before processing it. So if you need more security, you'd better go for custom compressors.
I haven't used it, but Citadel for Delphi does automatic compression and encryption of DFM resources in your EXE. It doesn't look like they've updated past Delphi 2009 yet, but it's exactly what you're looking for.