Ta Meski - I will work through it. 

Also found these to be useful for looking at platform and compiled
components - 

(all-in-one code framework)
http://1code.codeplex.com/SourceControl/changeset/view/39074#842775 

http://stackoverflow.com/questions/336633/how-to-detect-windows-64-bit-platf
orm-with-net/3489142#3489142 

http://stackoverflow.com/questions/270531/how-to-determine-if-a-net-assembly
-was-built-for-x86-or-x64 
                   
http://stackoverflow.com/questions/1542213/how-to-find-the-number-of-cpu-cor
es-via-net-c/2670568#2670568  

________________________________
Ian Thomas
Victoria Park, Western Australia

-----Original Message-----
From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of mike smith
Sent: Thursday, February 09, 2012 2:44 PM
To: ozDotNet
Subject: Re: Detecting what an assembly was compiled with

On Wed, Feb 8, 2012 at 9:21 PM, Ian Thomas <il.tho...@iinet.net.au> wrote:
>
> Another “environment” type question for those with more experience than I.
>
> I assume that (apart from Corflags CLI tool, which is inappropriate) the
correct .NET method to detect what an assembly was compiled for (AnyCPU,
x86, x64) is Module.GetPEKind ?
>
> How do I safely load and report on its status, some DLL (not knowing if it
is a .NET assembly)? That is, can someone give me a really simple example?
And secondly, although I know what I compiled my own app for – at the time
I’m doing it – I can see a situation when the application should self-test
what is was compiled for – ie, load itself in a different process? How would
I do that?
>
> I can’t find examples of either of these today.
>
> (about 2-3 years ago, I did some of this precautionary testing, but I’ve
entirely forgotten how. I’m not intending to head the wrong way into
extensibility – I would use MEF if I had to load and use DLLs for some
extensibility.)
>

Load the entire file into virtual memory not executable, and then step
thru the structures in the PE header.

http://msdn.microsoft.com/en-us/magazine/cc301805.aspx

That's really old, but still works - I modified it to modify VB 6
version info stored in the header, then write  it back



--
Meski

 http://courteous.ly/aAOZcv

"Going to Starbucks for coffee is like going to prison for sex. Sure,
you'll get it, but it's going to be rough" - Adam Hills

Reply via email to