Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-03

Function to know if WIN is 32 or 64

27 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Henry Vermaak
to Marcos Douglas
Marcos Douglas wrote
Is there some function to know if the Windows is 32 or 64?

You can use the GetNativeSystemInfo function. Check TSystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 to see if it's 64 bit.

Henry

Reply by email

Marcos Douglas
to Henry Vermaak
Henry Vermaak wrote 7 lines
On 15 March 2011 14:05, Marcos Douglas wrote: > Is there some function to know if the Windows is 32 or 64? You can use the GetNativeSystemInfo function.  Check TSystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 to see if it's 64 bit.

What unit?

I've used this function in Delphi (7) and didn't work:
function is64bitOS: boolean;
  var
    SysInfo: TSystemInfo;
  begin
    GetSystemInfo(SysInfo);
    Result := (
         (Sysinfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64)
      or (Sysinfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64)
      );
end;

Marcos Douglas

Reply by email

Henry Vermaak
to Marcos Douglas
Marcos Douglas wrote 10 lines
On Tue, Mar 15, 2011 at 11:13 AM, Henry Vermaak wrote: > > On 15 March 2011 14:05, Marcos Douglas wrote: > > Is there some function to know if the Windows is 32 or 64? > > You can use the GetNativeSystemInfo function.  Check > TSystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 to > see if it's 64 bit. What unit?

None, since the minimum supported client is XP. Try to load it yourself, e.g.:

type
  TGNSIProc = procedure (var lpSystemInfo: TSystemInfo); stdcall;
const
  PROCESSOR_ARCHITECTURE_AMD64 = 9;
function Isx64: Boolean;
var
  si: TSystemInfo;
  GNSIProc: TGNSIProc;
begin
  Result := False;
  ZeroMemory(@si, SizeOf(si));
  @GNSIProc := GetProcAddress(GetModuleHandle('kernel32.dll'),
    'GetNativeSystemInfo');
  if @GNSIProc = nil then
    Exit;
  GNSIProc(si);
  if si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 then
    Result := True;
end;

This ignores ia64, as you can see.

Henry

Reply by email

DaWorm
to Henry Vermaak

I've used this in Delphi 32 and it seems to work. Forgot where I pulled the basic info. Probably doesn't do much on native 64 bit.

function Is64BitOS: Boolean;
type
  TIsWow64Process = function(Handle:THandle; var IsWow64 : BOOL) :
BOOL; stdcall;
var
  hKernel32 : Integer;
  IsWow64Process : TIsWow64Process;
  IsWow64 : BOOL;
begin
  // we can check if the operating system is 64-bit by checking whether
  // we are running under Wow64 (we are 32-bit code). We must check if this
  // function is implemented before we call it, because some older versions
  // of kernel32.dll (eg. Windows 2000) don't know about it.
  // see http://msdn.microsoft.com/en-us/library/ms684139%28VS.85%29.aspx
  Result := False;
  hKernel32 := LoadLibrary('kernel32.dll');
  if (hKernel32 = 0) then RaiseLastOSError;
  @IsWow64Process := GetProcAddress(hkernel32, 'IsWow64Process');
  if Assigned(IsWow64Process) then
   Begin
    IsWow64 := False;
    if (IsWow64Process(GetCurrentProcess, IsWow64)) then
     Result := IsWow64
   end;
  FreeLibrary(hKernel32);
end;

Jeff.

Reply by email

Marcos Douglas
to Henry Vermaak: None, since the minimum supported client is XP. Try to load it yourself, e.g.: type…
Henry Vermaak wrote 35 lines
On 15 March 2011 14:25, Marcos Douglas wrote: > On Tue, Mar 15, 2011 at 11:13 AM, Henry Vermaak wrote: >> >> On 15 March 2011 14:05, Marcos Douglas wrote: >> > Is there some function to know if the Windows is 32 or 64? >> >> You can use the GetNativeSystemInfo function.  Check >> TSystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 to >> see if it's 64 bit. > > What unit? None, since the minimum supported client is XP.  Try to load it yourself, e.g.: type  TGNSIProc = procedure (var lpSystemInfo: TSystemInfo); stdcall; const  PROCESSOR_ARCHITECTURE_AMD64 = 9; function Isx64: Boolean; var  si: TSystemInfo;  GNSIProc: TGNSIProc; begin  Result := False;  ZeroMemory(@si, SizeOf(si)); := GetProcAddress(GetModuleHandle('kernel32.dll'),    'GetNativeSystemInfo');  if @GNSIProc = nil then    Exit;  GNSIProc(si);  if si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 then    Result := True; end;
Weird. This code did not compile in this line:
 @GNSIProc := GetProcAddress(GetModuleHandle('kernel32.dll'),
'GetNativeSystemInfo');
Error: unit1.pas(46,2) Error: Can't assign values to an address
This ignores ia64, as you can see.

What is ia64?

Marcos Douglas

Reply by email

Sven Barth
to Marcos Douglas
Marcos Douglas wrote 44 lines
On Tue, Mar 15, 2011 at 11:35 AM, Henry Vermaak wrote: > On 15 March 2011 14:25, Marcos Douglas wrote: >> On Tue, Mar 15, 2011 at 11:13 AM, Henry Vermaak wrote: >>> >>> On 15 March 2011 14:05, Marcos Douglas wrote: >>>> Is there some function to know if the Windows is 32 or 64? >>> >>> You can use the GetNativeSystemInfo function. Check >>> TSystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 to >>> see if it's 64 bit. >> >> What unit? > > None, since the minimum supported client is XP. Try to load it yourself, e.g.: > > type > TGNSIProc = procedure (var lpSystemInfo: TSystemInfo); stdcall; > > const > PROCESSOR_ARCHITECTURE_AMD64 = 9; > > function Isx64: Boolean; > var > si: TSystemInfo; > GNSIProc: TGNSIProc; > begin > Result := False; > ZeroMemory(@si, SizeOf(si)); > @GNSIProc := GetProcAddress(GetModuleHandle('kernel32.dll'), > 'GetNativeSystemInfo'); > if @GNSIProc = nil then > Exit; > GNSIProc(si); > if si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 then > Result := True; > end; Weird. This code did not compile in this line: @GNSIProc := GetProcAddress(GetModuleHandle('kernel32.dll'), 'GetNativeSystemInfo'); Error: unit1.pas(46,2) Error: Can't assign values to an address

Just a guess:
Add {$mode delphi} at the top.

Another solution would be:
GNSIProc := TGNSIProc(GetProcAddress(...));
> > This ignores ia64, as you can see. What is ia64?

A 64-bit architecture developed by Intel and supported by Windows server systems (although it should be dropped with one of the next versions?!) and Linux systems.

Also see here:
http://en.wikipedia.org/wiki/IA64

Regards,
Sven

Reply by email

Marcos Douglas
to Sven Barth: Just a guess: Add {$mode delphi} at the top. Another solution would be: GNSIProc :=…
Sven Barth wrote 13 lines
> Weird. This code did not compile in this line: > := GetProcAddress(GetModuleHandle('kernel32.dll'), > 'GetNativeSystemInfo'); > > Error: unit1.pas(46,2) Error: Can't assign values to an address > > Just a guess: Add {$mode delphi} at the top. Another solution would be: GNSIProc := TGNSIProc(GetProcAddress(...));

I forgot... =( I just copied the code from Delphi to Lazarus... sorry. I used the second solution.

Show quoted text 10 lines
>> This ignores ia64, as you can see. > > What is ia64? A 64-bit architecture developed by Intel and supported by Windows server systems (although it should be dropped with one of the next versions?!) and Linux systems. Also see here: http://en.wikipedia.org/wiki/IA64

Right. But is better ignore the IA64?

I found this code to Delphi:
const
  PROCESSOR_ARCHITECTURE_AMD64 = 9;
  {$EXTERNALSYM PROCESSOR_ARCHITECTURE_AMD64}
  PROCESSOR_ARCHITECTURE_IA64 = 6;
  {$EXTERNALSYM PROCESSOR_ARCHITECTURE_IA64}
function GetNativeSystemInfo(var SystemInfo: TSystemInfo): Boolean;
type
  TGetNativeSystemInfo = procedure (var SystemInfo: TSystemInfo) stdcall;
var
  LibraryHandle: HMODULE;
  _GetNativeSystemInfo: TGetNativeSystemInfo;
begin
  Result := False;
  LibraryHandle := GetModuleHandle(kernel32);
  if LibraryHandle  0 then
  begin
    _GetNativeSystemInfo := GetProcAddress(
      LibraryHandle, 'GetNativeSystemInfo');
    if Assigned(_GetNativeSystemInfo) then
    begin
      _GetNativeSystemInfo(SystemInfo);
      Result := True;
    end
    else
      GetSystemInfo(SystemInfo);
  end
  else
    GetSystemInfo(SystemInfo);
end;
function IsWindows64: Boolean;
var
  ASystemInfo: TSystemInfo;
begin
  GetNativeSystemInfo(ASystemInfo);
  Result := ASystemInfo.wProcessorArchitecture in
    [PROCESSOR_ARCHITECTURE_IA64, PROCESSOR_ARCHITECTURE_AMD64];
end;

So, IA64 is 6. That is correct?

Marcos Douglas

Reply by email

Marcos Douglas
to DaWorm: I've used this in Delphi 32 and it seems to work. Forgot where I pulled the basic info. …
DaWorm wrote 29 lines
I've used this in Delphi 32 and it seems to work.  Forgot where I pulled the basic info.  Probably doesn't do much on native 64 bit. function Is64BitOS: Boolean; type  TIsWow64Process = function(Handle:THandle; var IsWow64 : BOOL) : BOOL; stdcall; var  hKernel32 : Integer;  IsWow64Process : TIsWow64Process;  IsWow64 : BOOL; begin  // we can check if the operating system is 64-bit by checking whether  // we are running under Wow64 (we are 32-bit code). We must check if this  // function is implemented before we call it, because some older versions  // of kernel32.dll (eg. Windows 2000) don't know about it.  // see http://msdn.microsoft.com/en-us/library/ms684139%28VS.85%29.aspx  Result := False;  hKernel32 := LoadLibrary('kernel32.dll');  if (hKernel32 = 0) then RaiseLastOSError; := GetProcAddress(hkernel32, 'IsWow64Process');  if Assigned(IsWow64Process) then   Begin    IsWow64 := False;    if (IsWow64Process(GetCurrentProcess, IsWow64)) then     Result := IsWow64   end;  FreeLibrary(hKernel32); end;

Thanks Jeff, this also works and seems to be standard function to know if is a 32 or 64bits
See http://msdn.microsoft.com/en-us/library/ms684139%28v=vs.85%29.aspx

Marcos Douglas

Reply by email

Marcos Douglas
to Marco van de Voort
Marco van de Voort wrote 12 lines
In our previous episode, Marcos Douglas said: > > ? ?if (IsWow64Process(GetCurrentProcess, IsWow64)) then > > ? ? Result := IsWow64 > > ? end; > > ?FreeLibrary(hKernel32); > > end; > > Thanks Jeff, this also works and seems to be standard function to know > if is a 32 or 64bits > See http://msdn.microsoft.com/en-us/library/ms684139%28v=vs.85%29.aspx IIRC Delphi.about.com has Delphi code for this.

But I need it for FPC.

Marcos Douglas

Reply by email

Marcos Douglas
to Henry Vermaak
Henry Vermaak wrote 7 lines
On 15 March 2011 15:46, Marcos Douglas wrote: > > Thanks Jeff, this also works and seems to be standard function to know > if is a 32 or 64bits No, this won't work if your application is compiled for win64 (since it won't run under the emulator), as Jeff mentioned.

You're right.
Look the parameter Wow64Process [out]:
"(...)If the process is a 64-bit application running under 64-bit Windows, the value is also set to FALSE".

http://msdn.microsoft.com/en-us/library/ms684139%28v=vs.85%29.aspx

Thanks.

Marcos Douglas

Reply by email

Marcos Douglas
to Marcos Douglas
Marcos Douglas wrote 15 lines
On Tue, Mar 15, 2011 at 1:33 PM, Henry Vermaak wrote: > On 15 March 2011 15:46, Marcos Douglas wrote: >> >> Thanks Jeff, this also works and seems to be standard function to know >> if is a 32 or 64bits > > No, this won't work if your application is compiled for win64 (since > it won't run under the emulator), as Jeff mentioned. You're right. Look the parameter Wow64Process [out]: "(...)If the process is a 64-bit application running under 64-bit Windows, the value is also set to FALSE". http://msdn.microsoft.com/en-us/library/ms684139%28v=vs.85%29.aspx

My final test:

program iswin64;
{$mode objfpc}{$H+}
uses Classes, dynlibs, Windows;
const
  PROCESSOR_ARCHITECTURE_AMD64 = 9;
  PROCESSOR_ARCHITECTURE_IA64 = 6;
type
  TGetNativeSystemInfo = procedure (var lpSystemInfo: TSystemInfo); stdcall;
function Is64bits: Boolean;
var
  h: TLibHandle;
  si: TSystemInfo;
  getinfo: TGetNativeSystemInfo;
begin
  Result := False;
  H := GetModuleHandle('kernel32.dll');
  try
    ZeroMemory(@SI, SizeOf(SI));
    getinfo := TGetNativeSystemInfo(GetProcAddress(h, 'GetNativeSystemInfo'));
    if not Assigned(@getinfo) then
      Exit;
    getinfo(SI);
    if SI.wProcessorArchitecture in
       [PROCESSOR_ARCHITECTURE_AMD64, PROCESSOR_ARCHITECTURE_IA64] then
      Result := True;
  finally
    UnloadLibrary(H);
  end;
end;
begin
  writeln('WIN 64  ', Is64bits);
  readln;
end.

Marcos Douglas

Reply by email

Robert Wolfe
to Marcos Douglas: What unit? I've used this function in Delphi (7) and didn't work: function is64bitOS:…
Marcos Douglas wrote 27 lines
On Tue, Mar 15, 2011 at 11:13 AM, Henry Vermaak wrote: > On 15 March 2011 14:05, Marcos Douglas wrote: >> Is there some function to know if the Windows is 32 or 64? > You can use the GetNativeSystemInfo function. Check > TSystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 to > see if it's 64 bit. What unit? I've used this function in Delphi (7) and didn't work: function is64bitOS: boolean; var SysInfo: TSystemInfo; begin GetSystemInfo(SysInfo); Result := ( (Sysinfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64) or (Sysinfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64) ); end; Marcos Douglas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Not sure this will work for you or not, but here is what I use:

Program OSType ;
Uses SysUtils;
Begin ;
    WriteLn ;
    {$IFDEF WIN32}
        WriteLn ('This is a 32-bit version of Windows.') ;
    {$ENDIF$}
    {$IFDEF WIN64}
        WriteLn ('This is a 64-bit version of Windows.') ;
    {$ENDIF}
End.

The value returned, however, depends on whether the 32-bit compiler of the 64-bit cross-compiler was used.

Reply by email

Marcos Douglas
to Robert Wolfe
Robert Wolfe wrote 55 lines
On 3/15/2011 10:25 AM, Marcos Douglas wrote: > > On Tue, Mar 15, 2011 at 11:13 AM, Henry Vermaak >  wrote: >> >> On 15 March 2011 14:05, Marcos Douglas  wrote: >>> >>> Is there some function to know if the Windows is 32 or 64? >> >> You can use the GetNativeSystemInfo function.  Check >> TSystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 to >> see if it's 64 bit. > > What unit? > > > I've used this function in Delphi (7) and didn't work: > function is64bitOS: boolean; >   var >     SysInfo: TSystemInfo; >   begin >     GetSystemInfo(SysInfo); >     Result := ( >          (Sysinfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64) >       or (Sysinfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64) >       ); > end; > > > Marcos Douglas > _______________________________________________ > fpc-pascal maillist  -   > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > Not sure this will work for you or not, but here is what I use: Program OSType ; Uses SysUtils; Begin ;   WriteLn ;   {$IFDEF WIN32}       WriteLn ('This is a 32-bit version of Windows.') ;   {$ENDIF$}   {$IFDEF WIN64}       WriteLn ('This is a 64-bit version of Windows.') ;   {$ENDIF} End. The value returned, however, depends on whether the 32-bit compiler of the 64-bit cross-compiler was used.

Interesting. But I think not works on my case. The compiler is 32-bits but Windows can vary.

Marcos Douglas

Reply by email

Juha Manninen
to Marcos Douglas

Marcos Douglas kirjoitti keskiviikko 16 maaliskuu 2011 13:18:41:

On Wed, Mar 16, 2011 at 12:56 AM, Robert Wolfe
Show quoted text 15 lines
> WriteLn ; > {$IFDEF WIN32} > WriteLn ('This is a 32-bit version of Windows.') ; > {$ENDIF$} > {$IFDEF WIN64} > WriteLn ('This is a 64-bit version of Windows.') ; > {$ENDIF} > > End. > > The value returned, however, depends on whether the 32-bit compiler of > the 64-bit cross-compiler was used. Interesting. But I think not works on my case. The compiler is 32-bits but Windows can vary.

I was also thinking to suggest the compile time IFDEFs. If the application is compiled for 32-bits then it can behave like a 32-bit application. No need to check what do you need the run-time info?

Regards,
Juha

Reply by email

Marcos Douglas
to Juha Manninen
Juha Manninen wrote 24 lines
Marcos Douglas kirjoitti keskiviikko 16 maaliskuu 2011 13:18:41: > On Wed, Mar 16, 2011 at 12:56 AM, Robert Wolfe wrote: > >   WriteLn ; > >   {$IFDEF WIN32} > >       WriteLn ('This is a 32-bit version of Windows.') ; > >   {$ENDIF$} > >   {$IFDEF WIN64} > >       WriteLn ('This is a 64-bit version of Windows.') ; > >   {$ENDIF} > > > > End. > > > > The value returned, however, depends on whether the 32-bit compiler of > > the 64-bit cross-compiler was used. > > Interesting. But I think not works on my case. The compiler is 32-bits > but Windows can vary. I was also thinking to suggest the compile time IFDEFs. If the application is compiled for 32-bits then it can behave like a 32-bit application. No need to check anything at runtime. For what do you need the run-time info?

The problem already been resolved (see the begin of this thread). The program was compiled in 32-bits but I have to know what kind of OS is running because my program needs to install somethings.

Marcos Douglas

Reply by email

DaWorm
to Marcos Douglas
Marcos Douglas wrote
The program was compiled in 32-bits but I have to know what kind of OS is running because my program needs to install somethings.

That's why I needed it too. In my case, my code is always 32 bit, but to install a smart card NULL driver, I needed to be able to adjust both the 32 bit registry and the 64 bit registry. Just adjusting the 32 bit registry wasn't enough. I also had to make sure the code was being ran as an administrator.

Jeff.

Reply by email

Marcos Douglas
to DaWorm
DaWorm wrote 8 lines
On Wed, Mar 16, 2011 at 8:45 AM, Marcos Douglas wrote: > The program was compiled in 32-bits but I have to know what kind of OS > is running because my program needs to install somethings. That's why I needed it too.  In my case, my code is always 32 bit, but to install a smart card NULL driver, I needed to be able to adjust both the 32 bit registry and the 64 bit registry.  Just adjusting the 32 bit registry wasn't enough.

Exactly.

I also had to make sure the code was being ran as an administrator.

That's nice. Can you share the function?

Marcos Douglas

Reply by email

DaWorm
to Marcos Douglas
Marcos Douglas wrote
> I also had to make sure the code was > being ran as an administrator. That's nice. Can you share the function?

Again, don't remember where I found this, Google or MSDN probably. Only tested in Delphi.

function IsAdmin: Boolean;
{ ------------------------------------------------------------- Returns a boolean indicating whether or not user has admin privileges. (Call only when running under NT.)

  ------------------------------------------------------------- }
var
  hAccessToken       : tHandle;
  ptgGroups          : pTokenGroups;
  dwInfoBufferSize   : DWORD;
  psidAdministrators : PSID;
  int                : integer;            // counter
  blnResult          : boolean;            // return flag
const
 SECURITY_NT_AUTHORITY: SID_IDENTIFIER_AUTHORITY = (Value:
(0,0,0,0,0,5)); // ntifs
 SECURITY_BUILTIN_DOMAIN_RID: DWORD = $00000020;
 DOMAIN_ALIAS_RID_ADMINS: DWORD = $00000220;
 DOMAIN_ALIAS_RID_USERS : DWORD = $00000221;
 DOMAIN_ALIAS_RID_GUESTS: DWORD = $00000222;
 DOMAIN_ALIAS_RID_POWER_: DWORD = $00000223;
begin
 Result := False;
 ptgGroups := nil;
 blnResult := OpenThreadToken( GetCurrentThread, TOKEN_QUERY, True,
                               hAccessToken );
 if ( not blnResult ) then
  begin
   if GetLastError = ERROR_NO_TOKEN then
    blnResult := OpenProcessToken( GetCurrentProcess, TOKEN_QUERY,
                                   hAccessToken );
  end;
 if ( blnResult ) then
  try
   GetMem(ptgGroups, 1024);
   blnResult := GetTokenInformation( hAccessToken, TokenGroups, ptgGroups, 1024,
                                     dwInfoBufferSize );
   CloseHandle( hAccessToken );
   if ( blnResult ) then
    begin
     AllocateAndInitializeSid( SECURITY_NT_AUTHORITY, 2,
                               SECURITY_BUILTIN_DOMAIN_RID,
                               DOMAIN_ALIAS_RID_ADMINS,
                               0, 0, 0, 0, 0, 0,
                               psidAdministrators );
     {$R-}
     for int := 0 to ptgGroups.GroupCount - 1 do
      if EqualSid( psidAdministrators, ptgGroups.Groups[ int ].Sid ) then
       begin
        Result := True;
        Break;
       end;
     {$R+}
     FreeSid( psidAdministrators );
    end;
  finally
   FreeMem( ptgGroups );
  end;
end;

Reply by email

Marcos Douglas
to DaWorm
DaWorm wrote 11 lines
On Wed, Mar 16, 2011 at 11:25 AM, Marcos Douglas wrote: >> I also had to make sure the code was >> being ran as an administrator. > > That's nice. Can you share the function? Again, don't remember where I found this, Google or MSDN probably. Only tested in Delphi. function IsAdmin: Boolean; [......]

Thanks, I will test.

Marcos Douglas

Reply by email

Robert Wolfe
to Marcos Douglas: On Wed, Mar 16, 2011 at 9:21 AM, Juha Manninen The problem already been resolved (see the…
Marcos Douglas wrote 28 lines
On Wed, Mar 16, 2011 at 9:21 AM, Juha Manninen wrote: > Marcos Douglas kirjoitti keskiviikko 16 maaliskuu 2011 13:18:41: >> On Wed, Mar 16, 2011 at 12:56 AM, Robert Wolfe > wrote: >>> WriteLn ; >>> {$IFDEF WIN32} >>> WriteLn ('This is a 32-bit version of Windows.') ; >>> {$ENDIF$} >>> {$IFDEF WIN64} >>> WriteLn ('This is a 64-bit version of Windows.') ; >>> {$ENDIF} >>> >>> End. >>> >>> The value returned, however, depends on whether the 32-bit compiler of >>> the 64-bit cross-compiler was used. >> Interesting. But I think not works on my case. The compiler is 32-bits >> but Windows can vary. > I was also thinking to suggest the compile time IFDEFs. > If the application is compiled for 32-bits then it can behave like a 32-bit > application. No need to check anything at runtime. > > For what do you need the run-time info? The problem already been resolved (see the begin of this thread). The program was compiled in 32-bits but I have to know what kind of OS is running because my program needs to install somethings.

So you are writing your own application installer then?

Reply by email

Marcos Douglas
to Robert Wolfe
Robert Wolfe wrote 9 lines
On 3/16/2011 8:45 AM, Marcos Douglas wrote: > > [...] > The problem already been resolved (see the begin of this thread). > The program was compiled in 32-bits but I have to know what kind of OS > is running because my program needs to install somethings. > So you are writing your own application installer then?

I wrote (done!) an installer to an old application that no have installer. Was my first ("real" or "in production") application using FPC and Lazarus.

This old application uses Oracle, BDE and don't have installer... and, for my client, this is a big problem...
I will talk about that in another thread.

Marcos Douglas

Reply by email