Click here to Skip to main content
15,888,454 members
Articles / Programming Languages / C++
Article

ExeScanner

Rate me:
Please Sign up or sign in to vote.
4.91/5 (67 votes)
6 Jun 20052 min read 115.6K   4.3K   102   47
This article explains how to enumerate all the objects in a Portable Executable and manipulate them.

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


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: why not just use visual studio? Pin
TheGreatAndPowerfulOz16-Jun-05 8:35
TheGreatAndPowerfulOz16-Jun-05 8:35 
AnswerRe: why not just use visual studio? Pin
Super Lloyd14-Jun-05 12:58
Super Lloyd14-Jun-05 12:58 
GeneralRe: why not just use visual studio? Pin
Super Lloyd14-Jun-05 13:00
Super Lloyd14-Jun-05 13:00 
Questionc# ? Pin
Trance Junkie7-Jun-05 0:56
Trance Junkie7-Jun-05 0:56 
Generalmust 5! Pin
f27-Jun-05 0:28
f27-Jun-05 0:28 
GeneralRe: must 5! Pin
Geert van Horrik7-Jun-05 1:01
Geert van Horrik7-Jun-05 1:01 
GeneralRe: must 5! Pin
f27-Jun-05 3:48
f27-Jun-05 3:48 
GeneralRe: must 5! Pin
Geert van Horrik7-Jun-05 4:32
Geert van Horrik7-Jun-05 4:32 
f2 wrote:
this minor unhappiness

I have tested it with my own app (see signature) and it is not working very well:

1) It says the application has 3 cursors, but it has only one, and it cannot read any of the cursors.
2) I can't load any bitmap
3) Can't load system menu
4) Can't load dialogs
5) Can't load string tables

This is not minor unhappiness. I don't care about a 1 mb docfile, because I have cable. But it's a tip for the programmer, because people with a normal modem (they are still out there) will not download this because of it's size.

I think a 4 is a good rating too! Why should everyone vote 5 for a products that's worth 4,6 or something like that. If everyone can only vote 5 because otherwhise some people think it's unfair to vote lower, the whole vote system will be useless. Now I can see, ah, it has 4,9 so it must be very good. If I only see 5-s, why should I even watch the score then?

I understand that if I had voted 2 or something like that, it will unmotivate the author, but 4 is still a good score.

But this is all just my opinion, I don't want to attack you or something like that.

Geert

Want to spread the newest version of your software automatically? Use Updater!
Visit my website: http://geert.yoki.org
GeneralRe: must 5! Pin
Vishalsinh Jhala7-Jun-05 17:59
Vishalsinh Jhala7-Jun-05 17:59 
GeneralRe: must 5! Pin
kevinf110816-Jun-05 2:49
kevinf110816-Jun-05 2:49 
GeneralRe: must 5! Pin
Franz R.14-Jun-05 0:10
professionalFranz R.14-Jun-05 0:10 
GeneralFor the other sections... Pin
Duncan Edwards Jones7-Jun-05 0:27
professionalDuncan Edwards Jones7-Jun-05 0:27 
GeneralExcellent :-) Pin
Nish Nishant6-Jun-05 23:01
sitebuilderNish Nishant6-Jun-05 23:01 
GeneralGreat work... Pin
Geert van Horrik6-Jun-05 22:43
Geert van Horrik6-Jun-05 22:43 
GeneralRe: Great work... Pin
Vishalsinh Jhala6-Jun-05 22:52
Vishalsinh Jhala6-Jun-05 22:52 
GeneralRe: Great work... Pin
Vishalsinh Jhala6-Jun-05 23:05
Vishalsinh Jhala6-Jun-05 23:05 
GeneralRe: Great work... Pin
Geert van Horrik6-Jun-05 23:59
Geert van Horrik6-Jun-05 23:59 
GeneralRe: Great work... Pin
Vishalsinh Jhala7-Jun-05 1:13
Vishalsinh Jhala7-Jun-05 1:13 
GeneralRe: Great work... Pin
Geert van Horrik7-Jun-05 1:39
Geert van Horrik7-Jun-05 1:39 
GeneralRe: Great work... Pin
Vishalsinh Jhala7-Jun-05 17:54
Vishalsinh Jhala7-Jun-05 17:54 
GeneralRe: Great work... Pin
pjreid15-Jun-05 5:28
pjreid15-Jun-05 5:28 
GeneralRe: Great work... Pin
Geert van Horrik15-Jun-05 5:44
Geert van Horrik15-Jun-05 5:44 
GeneralExcellent work Pin
User 5826196-Jun-05 22:16
User 5826196-Jun-05 22:16 
GeneralRe: Excellent work Pin
mlkeS14-Jun-05 14:12
mlkeS14-Jun-05 14:12 
Generalvc6 version.. Pin
FireEmissary6-Jun-05 22:16
FireEmissary6-Jun-05 22:16 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.