Click here to Skip to main content
Click here to Skip to main content

ExeScanner

By , 6 Jun 2005
 

ExeScanner

Introduction

Inspired by the ResourceHacker from Angus Johnson, I decided to make one of my own. ExeScanner, as the name suggests, can scan an executable file and enumerate all the objects in its resource section. The next version will have two main features:

  1. Resource scripting engine which can compile/decompile resources.
  2. Enumerate other sections of an executable file besides the resource section.

What does ExeScanner do?

ExeScanner allows you to view bitmaps, cursors, icons, strings, dialogs, menus and binary resources in any executable file. Any other resources except the first 6 are shown as the binary resources. Each resource type can be imported or exported. Import facility allows modifying the resources within the executable file with an external file, while export facility allows to extract and save the resources as a file. Dialogs and menus are exceptions to the import/export facility (as they require the resource scripting engine which will be a part of ExeScanner 1.1).

ExeScanner Design Overview (Class Hierarchy)

ExeScanner has been designed keeping in mind the future extensions and generalization of the project. With class hierarchy I have tried to incorporate a symmetric behavior in each object although they might be very different.

There are two base classes PEBase and PEResource. Any object in a PE file should always inherit from PEBase. If it's a resource object, it should inherit from PEResource. In fact, PEResource also inherits from PEBase. These base classes have some methods and members which make its representation and manipulation standardized and reduces code by implementing polymorphic behavior.

Let's have a look at a few classes and what they do:

  • PortableExecutable - Encapsulates DOS and Windows header. Also holds ResourceSection.
  • ResourceSection - Encapsulates ResourceSectionHeader and holds ResourceBranch.
  • ResourceBranch - Each branch represents a broad category of resources like BITMAP, ICON, STRING, BINARY etc. Also holds ResourceNode.
  • ResourceNode - ResourceNode can hold exactly one resource of any category, i.e., there can be multiple bitmaps in BITMAP category and thus multiple ResourceNode in ResourceBranch with each ResourceNode holding PEResBitmap.
  • PEResBitmap - Bitmap object.
  • PEResIcon - Icon object.
  • PEResCursor - Cursor object.
  • PEResString - String object.
  • PEResMenu - Menu object.
  • PEResBinary - Binary object.
  • PEResDialog - Dialog object.

Above mentioned seven classes encapsulate the logic to display themselves, import, export, and then when requested, give property info.

  • PEFile - Encapsulates the I/O to the executable file being scanned. Provides the facility to directly read/write by specifying the offset from the beginning.
  • PEListTree - It's a doubly linked list that stores each PE object, primarily used for creating navigation tree.

Hope you enjoy using the application. And would welcome your comments/suggestions on how to make it better.

History

  • ExeScanner 1.0 - Initial release.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Vishalsinh Jhala
Web Developer
United States United States
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questiondis is excellent but dere's smthing i want 2 knowmemberMember 448281617 Dec '08 - 3:16 
hi vishal
 
dis wud b a small issue for u..so kindly solve it
 
i need 2 identify executable files in an application.
so is dere a file header or whatever dat we can read and find what type of file it is..
 
pls reply.. i've been trying dis 4 days
GeneralExcellent job !!!memberCastorTiu18 Oct '06 - 8:46 
I need something for NE executables, but this will help a lot to understand the headers.
 
Definitely my 5 points.
 
Gustavo
 
P.S.: Nice about Big Grin | :-D
GeneralA bugmemberH.B.Shen11 Apr '06 - 3:00 
Fuction:
void PEResDialog::GetPropertyInfo(CString& strInfo)
has a bug.
The dialog template could be:
1>.DLGTEMPLATEEX dlgtemp;
2>.DLGTEMPLATE dlgtemp;

 
H.B.Shen
QuestionPE Graphical Area Access?memberIslamianFalcon24 Nov '05 - 20:06 
Hello,
anybody guide me about how to access the Portable Executable (PE) graphical area. plz also tell me it is possible or not?
i want to access the PE graphical area that is going to display at screen....
GeneralExcellent workmemberi8412 Sep '05 - 23:55 
Thanks a lot.
GeneralNice WorkmemberBitsAndBytes21 Jun '05 - 22:21 
Hey Vishal,
 
This is just excellent, not because it scans the exe, but the attitude with which you developed it. I liked your mantra - "Share the Code and exchange the knowledge".
 
Keep going on buddy... Laugh | :laugh:
 
**************
Bits&Bytes !!!
__o
_-\<,_
(_)/ (_)

GeneralNicememberThatsAlok21 Jun '05 - 18:45 
I am looking for tool like this for months Smile | :) and that too with source code is a DOUBLE BONUS Smile | :)
 
Thanks
 

"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

cheers,
Alok Gupta
Generalmfc70.dllmemberLee Middleotn10 Jun '05 - 15:48 
Sorry to be so dense, but where can I download mfc70.dll?
 
Lee
GeneralRe: mfc70.dllmemberArie Levy21 Oct '09 - 0:20 
http://www.dll-files.com/dllindex/dll-files.shtml?mfc70[^]
GeneralGreat!sussCharlieLei9 Jun '05 - 15:16 
Your work is very excellent
GeneralPhoto scanmemberArmen Hakobyan9 Jun '05 - 1:21 
Nice laser and infrared photo scans in the about dialog
Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D Big Grin | :-D
 
#define __ARMEN_H__
Questionwhich ceil()?memberUnruled Boy8 Jun '05 - 16:01 
in vs2003, it could not be compiled, telling me it could not decide to use which ceil()D'Oh! | :doh:
 
Regards,
unruledboy@hotmail.com
AnswerRe: which ceil()?memberChristian Graus8 Jun '05 - 16:27 
Probably the code somewhere includes math and somewhere else includes math.h ?
 
Christian Graus - Microsoft MVP - C++
AnswerRe: which ceil()?memberrkh07916 Jun '05 - 8:54 
int iLines = (int)ceil((double)(m_dwSizeNew) /16) + 1;

Generalnice work.memberbevpet7 Jun '05 - 10:19 
nice utility.
thanks
Questionwhy not just use visual studio?memberyafan7 Jun '05 - 3:25 
You can do the same thing by opening an executable file using visual studio...
 
-y
 

AnswerRe: why not just use visual studio?memberTom Archer7 Jun '05 - 16:59 
True, but the author is giving you the tools to perform this task in your code.
AnswerRe: why not just use visual studio?memberVishalsinh Jhala7 Jun '05 - 18:29 
Hi,
 
I am not sure whether I have understood your question right or not but let me try to answer it. ExeScanner allows you to actually see the bitmap and not hex view of bitmap. It also allows you to modify it without the source code of exe you are scanning. Same is the case with many other resources. Visual studio can provide only hex view of a exe file if you dont have its source code. But ExeScanner shows what in the exe, how it looks and also allows to modify them(not all but many).
 
Vishal.
GeneralRe: why not just use visual studio?memberahz8 Jun '05 - 7:23 
Vishalsinh Jhala wrote:
Visual studio can provide only hex view of a exe
 
Not true.
 
Visual Studio does indeed let you open an exe as a resource and you can modify the resources in there. In VS6 just open the exe or dll using the file open dialog. In VS7 (VS.NET) use the file open dialog, but click the little down arrow on the open button and choose "Open With..." then select "Resource editor".
GeneralRe: why not just use visual studio?memberJohn M. Drescher9 Jun '05 - 3:34 
Can you modify the resource in an executable (without any source code) and save it back in vc.net?
 
John
GeneralRe: why not just use visual studio?memberahz10 Jun '05 - 6:48 
yes
GeneralRe: why not just use visual studio?memberVishalsinh Jhala13 Jun '05 - 1:50 
Hello ahz,
 
I was unaware about this feature which studio provides. I checked it out and it a very handy feature.
 
But even if I knew it before I would have made this program. As you can see in the introduction of this article "Inspired by ResourceHacker from ...."
 
So there are tools that can do it better than ExeScanner but I wanted to make one of my own. Secondly None of thest tools give you the source code of how they do it(in VC++).
 
Besides being a useful tool, ExeScanner also helps in sharing knowledge and ideas through source code.
 
Vishal.
GeneralRe: why not just use visual studio?memberahz16 Jun '05 - 8:35 
Hey, that's great!
 
Sharing is good and thanks for doing it. And so is figuring out how to do something for yourself (even though someone/something else has/is doing it) is definately good. It's good to explore and learn. Kudo's and more power to you! I wish more people (especially those who profess programmerhood, would do more of it).
 
I wasn't knocking your efforts at all, I merely wanted to correct a misunderstanding about Visual Studio.

 
If you wan to hear God laugh, just tell him what your plans are. Laugh | :laugh:
AnswerRe: why not just use visual studio?memberSuper Lloyd14 Jun '05 - 12:58 
well, what about doing it without VisualStudio?
Visual Studi is expensive, plenty of people can't affort it!
 
Moreover this time you've got the source code to do it, unlike VisualStudio (I searched, but it was not on the DVD Wink | ;)
GeneralRe: why not just use visual studio?memberSuper Lloyd14 Jun '05 - 13:00 
it's left to the reader, as an exercise Wink | ;)
 
in C# it's easy to load assembly and enumerate resource, but this article inspire me to write my own which will browse both assembly and native executable...

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 7 Jun 2005
Article Copyright 2005 by Vishalsinh Jhala
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid