How to tell that my 32 bit code is running on a 64 bit OS?

I have various procedures to detect OS name, version, IE version, various DLL versions etc.

Recently I have run it on 64bit Vista Ultimate, and based on the information I received, I would have never guessed that the OS was 64bit. IE was reported as 32 bit, The same with WinInet, Comctrl, etc. Even the system folder was reported as C:\Windows\system32.

As I said, the "64bit" phrase was nowhere to be found. I understand that 32 bit code will use 32bit environment, but how can I tell that the OS version was 64 bit?

Any ideas?
0
Pietia
12/13/2009 5:23:54 PM
embarcadero.delphi.general 4258 articles. 0 followers. Follow

6 Replies
777 Views

Similar Articles

[PageSpeed] 43

Captain Mockba wrote:

> how can I tell that the OS version was 64 bit?

How about the Windows IsWow64Process() call?

http://msdn.microsoft.com/en-us/library/ms684139(VS.85).aspx

Eric
0
Eric
12/13/2009 5:38:59 PM
> {quote:title=Eric Thorniley wrote:}{quote}

> How about the Windows IsWow64Process() call?
> 
> http://msdn.microsoft.com/en-us/library/ms684139(VS.85).aspx

The page also reads:

"Note that this technique is not a reliable way to detect whether the operating system is a 64-bit version of Windows because the Kernel32.dll in current versions of 32-bit Windows also contains this function"

Edited by: Captain Mockba on Dec 13, 2009 12:15 PM:

but I guess I was quoting it out of context and this method can still be used.
0
Pietia
12/13/2009 8:15:53 PM
<Captain Mockba> wrote in message news:193412@forums.codegear.com...

> The page also reads:
>
> "Note that this technique is not a reliable way to detect whether the 
> operating
> system is a 64-bit version of Windows because the Kernel32.dll in current
> versions of 32-bit Windows also contains this function"

That note is saying not to rely on the *presense* of the IsWow64Process() 
function to detect the OS type.  You have to actually call the function, 
when present, to determine that, as demonstrated in the code nippet provided 
in the documentation.  For example (translated to Delphi):

{code:delphi}
type
  LPFN_ISWOW64PROCESS = function(hProcess: THandle, var Wow64Process: BOOL): 
BOOL; stdcall;

function IsWow64: Boolean;
var
  fnIsWow64Process: LPFN_ISWOW64PROCESS;
  bIsWow64: BOOL;
begin
  Result := False;
  fnIsWow64Process := 
LPFN_ISWOW64PROCESS(GetProcAddress(GetModuleHandle('kernel32'), 
'IsWow64Process');
  if Assigned(fnIsWow64Process) then
  begin
    bIsWow64 := False;
    if fnIsWow64Process(GetCurrentProcess(), bIsWow64) then
      Result := bIsWow64;
  end;
end;

begin
  if IsWow64() then
    WriteLn('Running on WOW64')
  else
    WriteLn('Running on 32-bit Windows');
end.
{code}

-- 
Remy Lebeau (TeamB)
0
Remy
12/14/2009 7:29:47 AM
For completeness' sake - you might also wish to look at this:

http://stackoverflow.com/questions/1436185/how-can-i-tell-if-im-running-on-x64
0
Philipp
12/14/2009 1:01:21 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}

> That note is saying not to rely on the *presense* of the IsWow64Process() 
> function to detect the OS type.  You have to actually call the function, 
> when present, to determine that, as demonstrated in the code nippet provided 
> in the documentation.  For example (translated to Delphi):

Yes, I noticed that later. Thanks for the code Remy!
0
Pietia
12/14/2009 1:41:30 PM
> {quote:title=Philipp S wrote:}{quote}
> For completeness' sake - you might also wish to look at this:
> 
> http://stackoverflow.com/questions/1436185/how-can-i-tell-if-im-running-on-x64

Interesting, I missed that. Thanks!
0
Pietia
12/14/2009 1:42:18 PM
Reply:

Similar Artilces:

Probable Stupid Question: Using 64-bit Code on 64-bit Processors running 32-bit Windows...
Hi, Does anyone know if it is possible to do 64-bit processing (probably by writing some assembly language code) when running on a 64-bit CPU under 32-bit Windows? As near as I can tell, one has to develop all 64-bit code on a 64-bit machine running 64-bit windows and the target machines for 64-bit code have to be 64-bit machines running 64-bit windows. What might be useful, if it is possible, would be being able to detect a 64-bit processor when running 32-bit windows and take advantage of that to speed up some calculations. DanH ...

Probable Stupid Question: Using 64-bit Code on 64-bit Processors running 32-bit Windows... #2
Hi, Does anyone know if it is possible to do 64-bit processing (probably by writing some assembly language code) when running on a 64-bit CPU under 32-bit Windows? As near as I can tell, one has to develop all 64-bit code on a 64-bit machine running 64-bit windows and the target machines for 64-bit code have to be 64-bit machines running 64-bit windows. What might be useful, if it is possible, would be being able to detect a 64-bit processor when running 32-bit windows and take advantage of that to speed up some calculations. DanH Dan Hale wrote: > Does anyone k...

Call 64bit dll's function from 32 bit delphi code on 64 bit OS
Is there any way or trick to call a function in 64 bit DLL from Delphi code? Any hardware manufacturer must compile their device drivers into 64bit code for 64 bit OS. So for example, graphic driver from NVidia is compiled to 64bit code for 64bit OS. Question is how to load 64 bit dll from 32 bit delphi code and call such function? I hope somebody has already dealing with that. Thanks > is how to load 64 bit dll from 32 bit delphi code and call such function? http://msdn.microsoft.com/en-us/library/aa384249(VS.85).aspx http://blogs.msdn.com/oldnewthing/archive/2008/10/20/9...

Disadvantage in running an ASP.NET 32-bit application on a 64-bit Windows server in 32-bit mode?
 Hello,My ASP.NET application has some 32-bit DLLs I can't change.  I've deployed the application to a 64-bit Windows 2003 server and I can get it to run if I enable 32-bit ASP.NET support.My question:  is this configuration worth it?  Or would I be better off just running it on a Windows 32-bit Server?  Even more specifically, can a 32-bit application running on 64-bit Windows take advantage of the extra RAM the machine might have?Thanks!Mike There's really no disadvantage in running 32 bit application pool on a 64 bits system.With 64 bits OS, the OS ...

Running 64 bit console application from a 32 bit Delphi GUI app?
I want to improve the usability of a 64 bit command line program so it can be handled by fairly inexperienced users. For this I need a normal Delphi program to have data specifiers etc, which in the end results in a command file for the console application. This is no big deal. The problem is the following: ------------------------------ 1) Can I start the 64 bit console app in Windows7X64 using the CreateProcess API like I am used to for 32 bit applications? Or are 64 bit programs different? 2) And if that is possible, can I somehow snatch what it sends to standard out (the co...

64 bit cpu // 64 bit Os version // 64 bit powerbuilder?
Hi guys, Does anyone know if Powebuilder is available in 64 bit? Kind regards A 64-bit version of PB does not (yet) exist. -- HTH Arnoud Url: http://www.gloriant.be Also check out my PB Reference site : http://www.pbinfo.be "Gunther Huygens" <ghuygens@be.xrt.com> wrote in message news:eoSjDRaCDHA.331@forums-1-dub... > Hi guys, > > Does anyone know if Powebuilder is available in 64 bit? > > Kind regards > > > > Since there are no OS Windows 64 bits, i wonder how it could be possible. Since there is a 64 bi...

SQL 8 support for 64 bit OS and 64 BIT OS, 64 BIT BUS Support, technical white paper, documentation, examples and success stories for SQL 8 if any please
SQL Anywhere Associates!! Is SQL 8 support 64 bit OS and 64 BIT OS, 64 BIT BUS Support, technical white paper, documentation, examples and success stories for SQL 8 if any please.... Thanks Vairam I believe that SQL Anywhere Studio is currently only released in a 32-bit format. TO the extent that 32-bit applications can run on a 64-bit OS, you can use ASA on a 64-bit system. -- Reg Domaratzki, Sybase iAnywhere Solutions Certified SQL Anywhere Associate Please reply only to the newsgroup ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm -> Cho...

SQL 8 support for 64 bit OS and 64 BIT OS, 64 BIT BUS Support, technical white paper, documentation, examples and success stories for SQL 8 if any please
SQL Anywhere Associates!! Is SQL 8 support 64 bit OS and 64 BIT OS, 64 BIT BUS Support, technical white paper, documentation, examples and success stories for SQL 8 if any please.... Thanks Vairam Is there any particular 64 bit OS that you are interested in hearing about? - Mark VS Vairam wrote: > > SQL Anywhere Associates!! > Is SQL 8 support 64 bit OS and 64 BIT OS, 64 BIT BUS Support, technical > white paper, documentation, examples and success stories for SQL 8 if any > please.... > > Thanks > > Vairam WINDOWS all flavours...

Packaging on a 32-bit and running on 64-bit
--------------090106050304000107000603 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Hi all, I am using a 32-bit Debian Linux for development and would like to deploy on the same linux but for the 64-bit variant. What do I have to take in mind? Trying to execute a package build on 32-bit at the 64-bit system caused several errors (e.g. incompatible 64-bit IO.so found) Thanks in advance, Werner --------------090106050304000107000603-- On Sun, Jun 20, 2010 at 11:45 AM, Developer <developer@onlinehome.de> wrote: >...

32 bits OS on 64 bits processors
Hello everyone, First post for me on the security now forum cause I'd like to share some though about today's OS market. I recently came to realize that most computer sellers like Dell, only ship 32 bits OS on their core 2 duo machines, thus limiting the available RAM to 3.3Go. This limitation does not stop them to offer upgrades of, say, 8Go of RAM which is totally useless with a Vista 32. Strangely they don't even offer the choice to buy a Vista 64 license. The 4Go memory barrier is still pretty high for an average customers but not for long. How about a lambda u...

64 bit OS/32 bit compiler
Need to know whether an executable compiled on a 64 bit OS with a 32 bit compiler will process on a 32 bit OS. Has anyone had any experience with this? wayne wrote: > > Need to know whether an executable compiled on a 64 bit OS with a 32 bit > compiler will process on a 32 bit OS. Has anyone had any experience with > this? Depends on whether it was linked with the 32bit or 64bit libraries. -am � 2001 ...

32-bit OS on a 64-bit computer
--____MLDDUTNVHDLQYNOVZGXI____ Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; modification-date="Fri, 4 Jan 2007 04:49:40 -0600" I get this message when I begin an install on a Dell PowerEdge 2850; is = there a 64-bit version of OES SP2? --____MLDDUTNVHDLQYNOVZGXI____ Content-Type: multipart/related; boundary="____DHQCIQMOMKFLZDGCJWDZ____" --____DHQCIQMOMKFLZDGCJWDZ____ Content-Type: text/html; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Content-Disposition: inli...

Should change the code from bit 32 to bit 64?
Hi to all, I developed a web application by default now i convert this into X64(bit 64), its working fine in my machine. but some body says should change the code based on bit otherwise deployment machine raise some problem, is it true?If this post is answer of your question then don't forgot to Click Mark As Answer Hi, Based on my understanding, your ASP.NET website is 32-bits application, and you want to deploy it on the 64-bits web server, right? To run 32-bits application on 64-bits server, it needs Windows-32-on-Windows-64 (WOW64) and must configure IIS to create 32-bit worker ...

Excel 64-bit and Delphi 32-bit
Hi, Any known issues with using Excel 2010 64-bit with a Delphi 32-bit app (Delphi 2009) My app uses the ExcelXP TExcelApplication object and nothing real fancy. I basically opens Excel, gets a list of all the ranges, and then updates the cells. It works fine with Excel 2007 but I have one customer who is reporting problems and he has Excel 2010 64-bit. Also, is there a way for my app to determine if Excel is 32 or 64-bit so that I can log an appropriate message. -- Bob Small I think one the main points of the new Delphi 64-bit compiler was that it was required to be able...

Web resources about - How to tell that my 32 bit code is running on a 64 bit OS? - embarcadero.delphi.general

Running - Wikipedia, the free encyclopedia
This article is about the type of locomotion in humans. For running in horses, see Horse gait . For locomotion in dogs, see Gait (dog) . For ...

Tony Bevan: Former Wollongong mayor accused of running paedophile network
A FORMER Kings Cross sex worker has opened his little black book containing the names and details of high profile clients he claims were a part ...

Time is running out to upgrade or abandon Internet Explorer
Microsoft is scrapping security updates for older versions of Internet Explorer as it pushes PC owners towards Windows 10.

Frankston home intruder was running after woman before his death, witness says
An intruder who entered a home in Melbourne's south was running after the female owner moments before he was killed when a neighbour came to ...

Rodale to Fold Running Times
Rodale is folding Running Times magazine. The January/February issue will be its final publication. Rodale, which also owns Runner’s World, ...

‘Maze Runner: The Scorch Trials’ catches up with official endless running game
... with the Gladers across the Scorch. Run, Gladers, run Indeed, just like its predecessor, Maze Runner: The Scorch Trials is naturally a running ...

Cardinals running backs show that they have depth too
The Cardinals were searching for a breakthrough moment in the second half and their one-two punch at running back provided just that.

Petrolicious goes running up that Hill in a Ferrari 250 GTO
Filed under: Videos , Ferrari , Classics Watch Derek Hill pilot his father's Ferrari 250 GTO in seven minutes of unedited footage courtesy of ...

"Bowe Bergdahl said he planned to cause a DUSTWUN by leaving his outpost, OP Mest, and running—or at ...
"This map (push play to fly over the area) gives a sense of the terrain he would have had to cross." That's a supplement to the first episode ...

The Wreckage Of The House Democrats Will Never Come Back While Blue Dogs And New Dems Are Running The ...
... since he became president and nary a whisper or a hint that perhaps the incompetent and corrupt men charged with the responsibility of running ...

Resources last updated: 12/12/2015 9:58:52 PM