Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread Marcos Douglas
On Wed, Mar 16, 2011 at 3:21 PM, Robert Wolfe wrote: > 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 in

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread Robert Wolfe
On 3/16/2011 8:45 AM, Marcos Douglas wrote: 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 o

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread Marcos Douglas
On Wed, Mar 16, 2011 at 2:23 PM, DaWorm wrote: > 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

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread DaWorm
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; { --

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread Marcos Douglas
On Wed, Mar 16, 2011 at 12:19 PM, DaWorm wrote: > 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

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread DaWorm
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,

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread Marcos Douglas
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$}

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread Juha Manninen
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 vers

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-16 Thread Marcos Douglas
On Wed, Mar 16, 2011 at 12:56 AM, Robert Wolfe wrote: > 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? >>> >>>

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Robert Wolfe
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

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marcos Douglas
On Tue, Mar 15, 2011 at 1:40 PM, Marcos Douglas wrote: > 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

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marcos Douglas
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

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Henry Vermaak
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. Henry

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marcos Douglas
On Tue, Mar 15, 2011 at 12:48 PM, Marco van de Voort wrote: > 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

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marco van de Voort
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.m

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marcos Douglas
On Tue, Mar 15, 2011 at 11:47 AM, DaWorm wrote: > 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) : > BOO

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marcos Douglas
On Tue, Mar 15, 2011 at 12:36 PM, Henry Vermaak wrote: > On 15 March 2011 15:19, Marcos Douglas wrote: >> >> Right. But is better ignore the IA64? > > You can do whatever you like.  We chose to ignore it, since we don't > support it.  You just have to check for the > PROCESSOR_ARCHITECTURE_IA64,

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Henry Vermaak
On 15 March 2011 15:19, Marcos Douglas wrote: > > Right. But is better ignore the IA64? You can do whatever you like. We chose to ignore it, since we don't support it. You just have to check for the PROCESSOR_ARCHITECTURE_IA64, too, if you'd like to support it. See the msdn page: http://msdn.

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marcos Douglas
On Tue, Mar 15, 2011 at 12:05 PM, Sven Barth wrote: >> 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 {$mo

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Henry Vermaak
On 15 March 2011 15:00, Marcos Douglas wrote: > > 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 was Delphi code, so remove the @. He

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Sven Barth
Am 15.03.2011 16:00, schrieb Marcos Douglas: 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 Win

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marcos Douglas
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

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread DaWorm
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 : TIs

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Henry Vermaak
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.

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marcos Douglas
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 >

Re: [fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Henry Vermaak
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. Henry _

[fpc-pascal] Function to know if WIN is 32 or 64

2011-03-15 Thread Marcos Douglas
Is there some function to know if the Windows is 32 or 64? Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal