Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - determine app is 32 or 64 bit

Reply
 
Old 08-05-2009   #1 (permalink)
powah


 
 

determine app is 32 or 64 bit

I like to determine whether an application is 32 or 64 bit on windows
server 2008. Is that a shell command to do that?

My System SpecsSystem Spec
Old 08-05-2009   #2 (permalink)
Bob Landau


 
 

RE: determine app is 32 or 64 bit

You are not clear as to whether you want to know

1) Is foo.exe 32 or 64 bit application

2) When running foo.exe which environment are you running in (32 or 64).

I had ask the Powershell group to document 2). They may have but I've not
found it.

For 1) you will need to crack the PE header and look at the Magic value
within the IMAGE_OPTIONAL_HADER section of the PE header

http://msdn.microsoft.com/en-us/libr...39(VS.85).aspx

I don't know if this can be done using .NET classes

For 2) the situation is easier even though there are more permutations

2a) 32 bit process running in 32 bit Windows: [intptr]::size -eq 4

2b) 32 bit process running in 64 bit Windows: [intptr]::size -eq 4 -and
(Test-Path Env:PROCESSOR_ARCHITEW6432)

2c 64 bit process [intptr]::size -eq 8


bob

"powah" wrote:
Quote:

> I like to determine whether an application is 32 or 64 bit on windows
> server 2008. Is that a shell command to do that?
>
My System SpecsSystem Spec
Old 08-06-2009   #3 (permalink)
powah


 
 

Re: determine app is 32 or 64 bit

On Aug 5, 8:55*pm, Bob Landau <BobLan...@xxxxxx>
wrote:
Quote:

> You are not clear as to whether you want to know
>
> 1) Is foo.exe 32 or 64 bit application
>
> 2) When running foo.exe which environment are you running in (32 or 64).
>
> I had ask the Powershell group to document 2). *They may have but I've not
> found it.
>
> For 1) you will need to crack the PE header and look at the Magic value
> within the IMAGE_OPTIONAL_HADER section of the PE header
>
> http://msdn.microsoft.com/en-us/libr...39(VS.85).aspx
>
> I don't know if this can be done using .NET classes
>
> For 2) *the situation is easier even though there are more permutations
>
> 2a) 32 bit process running in 32 bit Windows: * *[intptr]::size -eq 4
>
> 2b) 32 bit process running in 64 bit Windows: * *[intptr]::size -eq 4-and
> (Test-Path Env:PROCESSOR_ARCHITEW6432)
>
> 2c 64 bit process *[intptr]::size -eq 8
>
> bob
>
> "powah" wrote:
Quote:

> > I like to determine whether an application is 32 or 64 bit on windows
> > server 2008. Is that a shell command to do that?
I ask about 1) Is unmanaged application foo.exe 32 or 64 bit
application?
Your answer implies that there is no shell command to do something
like this:
C:\>apptype foo.exe
64 bit unmanaged application

My System SpecsSystem Spec
Old 08-06-2009   #4 (permalink)
Bob Landau


 
 

Re: determine app is 32 or 64 bit

None that I know of however I wouldn't be surprised if there is one out there
someplace.

Check SysInternals and perhaps search for PE reader

"powah" wrote:
Quote:

> On Aug 5, 8:55 pm, Bob Landau <BobLan...@xxxxxx>
> wrote:
Quote:

> > You are not clear as to whether you want to know
> >
> > 1) Is foo.exe 32 or 64 bit application
> >
> > 2) When running foo.exe which environment are you running in (32 or 64).
> >
> > I had ask the Powershell group to document 2). They may have but I've not
> > found it.
> >
> > For 1) you will need to crack the PE header and look at the Magic value
> > within the IMAGE_OPTIONAL_HADER section of the PE header
> >
> > http://msdn.microsoft.com/en-us/libr...39(VS.85).aspx
> >
> > I don't know if this can be done using .NET classes
> >
> > For 2) the situation is easier even though there are more permutations
> >
> > 2a) 32 bit process running in 32 bit Windows: [intptr]::size -eq 4
> >
> > 2b) 32 bit process running in 64 bit Windows: [intptr]::size -eq 4 -and
> > (Test-Path Env:PROCESSOR_ARCHITEW6432)
> >
> > 2c 64 bit process [intptr]::size -eq 8
> >
> > bob
> >
> > "powah" wrote:
Quote:

> > > I like to determine whether an application is 32 or 64 bit on windows
> > > server 2008. Is that a shell command to do that?
>
> I ask about 1) Is unmanaged application foo.exe 32 or 64 bit
> application?
> Your answer implies that there is no shell command to do something
> like this:
> C:\>apptype foo.exe
> 64 bit unmanaged application
>
>
My System SpecsSystem Spec
Old 08-06-2009   #5 (permalink)
Alex K. Angelopoulos


 
 

Re: determine app is 32 or 64 bit

I found one; it's a CodeProject demo, but includes console demo code and the
binaries, and can be used to check 32/64 for a binary (as well as some other
attributes).

http://www.codeproject.com/KB/files/XPEInfo.aspx



"Bob Landau" <BobLandau@xxxxxx> wrote in message
news:24BF266B-6070-45F5-9A3B-06FA4B549641@xxxxxx
Quote:

> None that I know of however I wouldn't be surprised if there is one out
> there
> someplace.
>
> Check SysInternals and perhaps search for PE reader
>
> "powah" wrote:
>
Quote:

>> On Aug 5, 8:55 pm, Bob Landau <BobLan...@xxxxxx>
>> wrote:
Quote:

>> > You are not clear as to whether you want to know
>> >
>> > 1) Is foo.exe 32 or 64 bit application
>> >
>> > 2) When running foo.exe which environment are you running in (32 or
>> > 64).
>> >
>> > I had ask the Powershell group to document 2). They may have but I've
>> > not
>> > found it.
>> >
>> > For 1) you will need to crack the PE header and look at the Magic value
>> > within the IMAGE_OPTIONAL_HADER section of the PE header
>> >
>> > http://msdn.microsoft.com/en-us/libr...39(VS.85).aspx
>> >
>> > I don't know if this can be done using .NET classes
>> >
>> > For 2) the situation is easier even though there are more permutations
>> >
>> > 2a) 32 bit process running in 32 bit Windows: [intptr]::size -eq 4
>> >
>> > 2b) 32 bit process running in 64 bit Windows: [intptr]::size -eq
>> > 4 -and
>> > (Test-Path Env:PROCESSOR_ARCHITEW6432)
>> >
>> > 2c 64 bit process [intptr]::size -eq 8
>> >
>> > bob
>> >
>> > "powah" wrote:
>> > > I like to determine whether an application is 32 or 64 bit on windows
>> > > server 2008. Is that a shell command to do that?
>>
>> I ask about 1) Is unmanaged application foo.exe 32 or 64 bit
>> application?
>> Your answer implies that there is no shell command to do something
>> like this:
>> C:\>apptype foo.exe
>> 64 bit unmanaged application
>>
>>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
determine if PC is on a certain network VB Script
Determine File Version of a dll PowerShell
Determine PST Format PowerShell
How Do I Determine The Serial Port In Use? Vista hardware & devices
API to determine if UAC is enabled? Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46