all groups > dotnet clr > july 2006 >
You're in the

dotnet clr

group:

Determining executable code type


Determining executable code type ebucis NO[at]SPAM gmail.com
7/29/2006 5:29:17 AM
dotnet clr:
Hi,
I am developing an application that loads at runtime executable
code, investigates it and catalogs it (stores some information about
it).
When the executable is managed code, using reflection i can obtain the
metadata information and add it to the catalog. But when the executable
(exe or dll) is an unmanaged code I prompt the user and let him provide
some "metadata".
My problem is that I have not been successful correctly identifying
manage code from unmanaged code at runtime.
My first approach was to expect an exception if i tried to load a dll
or exe using reflection, but at the end of the day, there are a lot of
more reasons for an assembly not to load (e.g. missing required
references).

At this point I don't know what to do.

Thanks,

Lester
Re: Determining executable code type Michael Nemtsev
7/29/2006 12:54:06 PM
Hello ebucis@gmail.com,

Check PE header of the file whether it contains managed code.
You need to look in COM Descriptor Directory entry in the PE - if there is
nonzero address thus it constains managed code

[quoted text, click to view]
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Re: Determining executable code type ebucis NO[at]SPAM gmail.com
7/31/2006 12:20:00 PM
I also found this based on your hint:

http://geekswithblogs.net/rupreet/archive/2005/11/02/58873.aspx

Thanks!!

[quoted text, click to view]
AddThis Social Bookmark Button