A Quick Check If 32 or 64-bit OS


A quick way to check if it is a 32 or 64-bit OS is to determine the size of a pointer. In 32-bit Operating System (OS), the size of the pointer is 4-byte (a DWORD), however at 64-bit OS, the size of the pointer is 8-byte (a QWORD).

Therefore the following Pascal code may be enough.

function Is32: boolean; inline;
begin
	Result := SizeOf(Pointer) = 4;
end;

function Is64: boolean; inline;
begin
	Result := SizeOf(Pointer) = 8;
end;

However, the functions are determined at compiling stage. Thus if you compile the code under Win32, it will return true either under Win32 or Win64 (WOW64). The above functions, in this sense, can be used to check current program is 32-bit or 64-bit, to be more precisely.

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
165 words
Last Post: Script32: A Freeware to Convert VBScript/JScript/HTA to Executables
Next Post: Tricks of VBScript

The Permanent URL is: A Quick Check If 32 or 64-bit OS

One Response

  1. Christian Cristofori

Leave a Reply