How to check if OS is 32 or 64 bit?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to check if OS is 32 or 64 bit?

Gruenewald, Tom

Hello VisualWorks developers,
how can I check if my application is running on a 32 or 64 bit Windows system? Independent from the Windows version itself.
Thank you for your answers in advance.

Best regards,
Tom Grünewald

________

Carl Zeiss Industrielle Messtechnik GmbH
Softwareentwicklung/Software Development

T o m   G r ü n e w a l d

73446 Oberkochen, Germany
tel: +49.7364.20-8541
fax: +49.7364.20-4800
email: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Hermann Gerlinger
Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben, Harald Klaiber
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Handelsregister: Amtsgericht Ulm, HRB 501561
USt-IdNr.: DE 811 515 346


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Andres Valloud-4
I'd look at this first.

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

On 8/3/12 5:05 , Tom Gruenewald wrote:

> Hello VisualWorks developers,
> how can I check if my application is running on a 32 or 64 bit Windows
> system? Independent from the Windows version itself.
> Thank you for your answers in advance.
>
> Best regards,
> Tom Grünewald
>
> ________
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Softwareentwicklung/Software Development
>
> T o m   G r ü n e w a l d
>
> 73446 Oberkochen, Germany
> tel: +49.7364.20-8541
> fax: +49.7364.20-4800
> email: [hidden email]
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Hermann Gerlinger
> Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben,
> Harald Klaiber
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Handelsregister: Amtsgericht Ulm, HRB 501561
> USt-IdNr.: DE 811 515 346
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain
> business or company secrets. If you have received this email in error,
> please contact the sender and delete the message immediately. Any use of
> this email, including saving, publishing, copying, replication or
> forwarding of the message or the contents is not permitted.
>
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Gruenewald, Tom

http://support.microsoft.com/kb/556009

 

os := OSSystemSupport concreteClass new.

arch := os

                getVariableWithRoot: os HKEY_LOCAL_MACHINE

                path: #('SYSTEM' 'CurrentControlSet' 'Control' 'Session Manager' 'Environment')

                name: 'PROCESSOR_ARCHITECTURE'

                ifAbsent: [nil].

x64 := arch = 'AMD64'.

 

HTH,

 

-Boris

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Tom Gruenewald
Sent: Friday, August 03, 2012 8:05 AM
To: Visualworks Mailing List
Subject: [vwnc] How to check if OS is 32 or 64 bit?

 

Hello VisualWorks developers,
how can I check if my application is running on a 32 or 64 bit Windows system? Independent from the Windows version itself.
Thank you for your answers in advance.

Best regards,
Tom Grünewald

________

Carl Zeiss Industrielle Messtechnik GmbH
Softwareentwicklung/Software Development

T o m   G r ü n e w a l d

73446 Oberkochen, Germany
tel: +49.7364.20-8541
fax: +49.7364.20-4800
email: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Hermann Gerlinger
Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben, Harald Klaiber
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Handelsregister: Amtsgericht Ulm, HRB 501561
USt-IdNr.: DE 811 515 346


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
jb
Reply | Threaded
Open this post in threaded view
|

Store connection problem with PostreSql 9.1.3

jb
In reply to this post by Gruenewald, Tom
Hi!

I have created Store database tables and as  table creator I can use Store without any problems. But I want to give access rights to a user "normal" (without super user priviledges). I give him a "grant connect" to  my Store database but if "normal" tries to connect Store answers with the error message "The Store database tables do not appear to be in the current database ..". But they do exist, of course.

It seems to be a PostgreSql access priviledge problem. I found that "normal" can connect to the Store database but not access the tables inside. I cannot remember a similar problem with earlier versions of PostgreSql.

Any ideas?

Johannes


________________________________


Staatlich anerkannte private Fachhochschule
NORDAKADEMIE
Gemeinnützige Aktiengesellschaft
Köllner Chaussee 11
25337 Elmshorn

Vorstand:
Prof. Dr. Georg Plate (Vorsitzender), Dipl.-Ing. Jörg Meier (stellv. Vorstand)

Vorsitzender des Aufsichtsrats:
Dr. h.c. Hans-Heinrich Bruns

Sitz:
Elmshorn, Amtsgericht Elmshorn, HRB 1682


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Andres Valloud-6
In reply to this post by Boris Popov, DeepCove Labs (SNN)
Has anyone tried what happens when you run the below code on a 64 bit
CPU that's running a 32 bit version of Windows?

On 8/3/2012 5:43 AM, Boris Popov, DeepCove Labs wrote:

> http://support.microsoft.com/kb/556009
>
> os := OSSystemSupport concreteClass new.
>
> arch := os
>
>                  getVariableWithRoot: os HKEY_LOCAL_MACHINE
>
>                  path: #('SYSTEM' 'CurrentControlSet' 'Control' 'Session
> Manager' 'Environment')
>
>                  name: 'PROCESSOR_ARCHITECTURE'
>
>                  ifAbsent: [nil].
>
> x64 := arch = 'AMD64'.
>
> HTH,
>
> -Boris
>
> *From:*[hidden email] [mailto:[hidden email]] *On
> Behalf Of *Tom Gruenewald
> *Sent:* Friday, August 03, 2012 8:05 AM
> *To:* Visualworks Mailing List
> *Subject:* [vwnc] How to check if OS is 32 or 64 bit?
>
> Hello VisualWorks developers,
> how can I check if my application is running on a 32 or 64 bit Windows
> system? Independent from the Windows version itself.
> Thank you for your answers in advance.
>
> Best regards,
> Tom Grünewald
>
> ________
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Softwareentwicklung/Software Development
>
> T o m   G r ü n e w a l d
>
> 73446 Oberkochen, Germany
> tel: +49.7364.20-8541
> fax: +49.7364.20-4800
> email: [hidden email] <mailto:[hidden email]>
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Hermann Gerlinger
> Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben,
> Harald Klaiber
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Handelsregister: Amtsgericht Ulm, HRB 501561
> USt-IdNr.: DE 811 515 346
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain
> business or company secrets. If you have received this email in error,
> please contact the sender and delete the message immediately. Any use of
> this email, including saving, publishing, copying, replication or
> forwarding of the message or the contents is not permitted.
>
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Boris Popov, DeepCove Labs (SNN)
Andres,

The name of the KB is quite clear to me that it isn't to detect the capability of a CPU, but rather a version of the OS. Not sure how fair this test is, but a 32-bit Windows XP in a VMWare VM shows  "x86" for this registry key and a 64-bit Windows XP in the next tab shows "AMD64".

-Boris


-----Original Message-----
From: Andres Valloud [mailto:[hidden email]]
Sent: Friday, August 03, 2012 12:06 PM
To: Boris Popov, DeepCove Labs
Cc: Tom Gruenewald; Visualworks Mailing List
Subject: Re: [vwnc] How to check if OS is 32 or 64 bit?

Has anyone tried what happens when you run the below code on a 64 bit CPU that's running a 32 bit version of Windows?

On 8/3/2012 5:43 AM, Boris Popov, DeepCove Labs wrote:

> http://support.microsoft.com/kb/556009
>
> os := OSSystemSupport concreteClass new.
>
> arch := os
>
>                  getVariableWithRoot: os HKEY_LOCAL_MACHINE
>
>                  path: #('SYSTEM' 'CurrentControlSet' 'Control'
> 'Session Manager' 'Environment')
>
>                  name: 'PROCESSOR_ARCHITECTURE'
>
>                  ifAbsent: [nil].
>
> x64 := arch = 'AMD64'.
>
> HTH,
>
> -Boris
>
> *From:*[hidden email] [mailto:[hidden email]] *On
> Behalf Of *Tom Gruenewald
> *Sent:* Friday, August 03, 2012 8:05 AM
> *To:* Visualworks Mailing List
> *Subject:* [vwnc] How to check if OS is 32 or 64 bit?
>
> Hello VisualWorks developers,
> how can I check if my application is running on a 32 or 64 bit Windows
> system? Independent from the Windows version itself.
> Thank you for your answers in advance.
>
> Best regards,
> Tom Grünewald
>
> ________
>
> Carl Zeiss Industrielle Messtechnik GmbH Softwareentwicklung/Software
> Development
>
> T o m   G r ü n e w a l d
>
> 73446 Oberkochen, Germany
> tel: +49.7364.20-8541
> fax: +49.7364.20-4800
> email: [hidden email] <mailto:[hidden email]>
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH Carl-Zeiss-Straße 22, 73447
> Oberkochen
> Aufsichtsratsvorsitzender: Dr. Hermann Gerlinger
> Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben,
> Harald Klaiber Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Handelsregister: Amtsgericht Ulm, HRB 501561
> USt-IdNr.: DE 811 515 346
>
> ----------------------------------------
> This message is intended for a particular addressee only and may
> contain business or company secrets. If you have received this email
> in error, please contact the sender and delete the message
> immediately. Any use of this email, including saving, publishing,
> copying, replication or forwarding of the message or the contents is not permitted.
>
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Andres Valloud-6
The text of the KB says "if you see x86 then the OS is 32 bits".  It
does not say "if you see x64 [or something else] then the OS is 64
bits", or "the OS is 32 bits if and only if you see x86".

I also found there is a function you might be able to call via DLLCC
that gets you system information, but unfortunately it seems to provide
you the same data as in the registry in that it tells you the
architecture of the CPU only.

I'm sorry if this seems a bit too pedantic, but we've seen details like
this one make a huge difference.  If it works, and you can verify it
actually works, then great.

On 8/3/2012 9:11 AM, Boris Popov, DeepCove Labs wrote:

> Andres,
>
> The name of the KB is quite clear to me that it isn't to detect the
> capability of a CPU, but rather a version of the OS. Not sure how
> fair this test is, but a 32-bit Windows XP in a VMWare VM shows
> "x86" for this registry key and a 64-bit Windows XP in the next tab
> shows "AMD64".
>
> -Boris
>
>
> -----Original Message----- From: Andres Valloud
> [mailto:[hidden email]] Sent: Friday, August 03, 2012 12:06 PM
> To: Boris Popov, DeepCove Labs Cc: Tom Gruenewald; Visualworks
> Mailing List Subject: Re: [vwnc] How to check if OS is 32 or 64 bit?
>
> Has anyone tried what happens when you run the below code on a 64 bit
> CPU that's running a 32 bit version of Windows?
>
> On 8/3/2012 5:43 AM, Boris Popov, DeepCove Labs wrote:
>> http://support.microsoft.com/kb/556009
>>
>> os := OSSystemSupport concreteClass new.
>>
>> arch := os
>>
>> getVariableWithRoot: os HKEY_LOCAL_MACHINE
>>
>> path: #('SYSTEM' 'CurrentControlSet' 'Control' 'Session Manager'
>> 'Environment')
>>
>> name: 'PROCESSOR_ARCHITECTURE'
>>
>> ifAbsent: [nil].
>>
>> x64 := arch = 'AMD64'.
>>
>> HTH,
>>
>> -Boris
>>
>> *From:*[hidden email] [mailto:[hidden email]]
>> *On Behalf Of *Tom Gruenewald *Sent:* Friday, August 03, 2012 8:05
>> AM *To:* Visualworks Mailing List *Subject:* [vwnc] How to check if
>> OS is 32 or 64 bit?
>>
>> Hello VisualWorks developers, how can I check if my application is
>> running on a 32 or 64 bit Windows system? Independent from the
>> Windows version itself. Thank you for your answers in advance.
>>
>> Best regards, Tom Grünewald
>>
>> ________
>>
>> Carl Zeiss Industrielle Messtechnik GmbH
>> Softwareentwicklung/Software Development
>>
>> T o m   G r ü n e w a l d
>>
>> 73446 Oberkochen, Germany tel: +49.7364.20-8541 fax:
>> +49.7364.20-4800 email: [hidden email]
>> <mailto:[hidden email]> http://www.zeiss.de/imt
>>
>> Carl Zeiss Industrielle Messtechnik GmbH Carl-Zeiss-Straße 22,
>> 73447 Oberkochen Aufsichtsratsvorsitzender: Dr. Hermann Gerlinger
>> Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben,
>> Harald Klaiber Sitz der Gesellschaft: 73446 Oberkochen,
>> Deutschland Handelsregister: Amtsgericht Ulm, HRB 501561 USt-IdNr.:
>> DE 811 515 346
>>
>> ---------------------------------------- This message is intended
>> for a particular addressee only and may contain business or company
>> secrets. If you have received this email in error, please contact
>> the sender and delete the message immediately. Any use of this
>> email, including saving, publishing, copying, replication or
>> forwarding of the message or the contents is not permitted.
>>
>>
>>
>> _______________________________________________ vwnc mailing list
>> [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>
>
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Boris Popov, DeepCove Labs (SNN)
Thankfully everyone knows that mailing list answers are suggestions only and should be taken with a grain of salt and rationale. Right? ;)

There's also this,

http://1code.codeplex.com/SourceControl/changeset/view/39074#842775

-Boris


-----Original Message-----
From: Andres Valloud [mailto:[hidden email]]
Sent: Friday, August 03, 2012 12:28 PM
To: Boris Popov, DeepCove Labs
Cc: Tom Gruenewald; Visualworks Mailing List
Subject: Re: [vwnc] How to check if OS is 32 or 64 bit?

The text of the KB says "if you see x86 then the OS is 32 bits".  It does not say "if you see x64 [or something else] then the OS is 64 bits", or "the OS is 32 bits if and only if you see x86".

I also found there is a function you might be able to call via DLLCC that gets you system information, but unfortunately it seems to provide you the same data as in the registry in that it tells you the architecture of the CPU only.

I'm sorry if this seems a bit too pedantic, but we've seen details like this one make a huge difference.  If it works, and you can verify it actually works, then great.

On 8/3/2012 9:11 AM, Boris Popov, DeepCove Labs wrote:

> Andres,
>
> The name of the KB is quite clear to me that it isn't to detect the
> capability of a CPU, but rather a version of the OS. Not sure how fair
> this test is, but a 32-bit Windows XP in a VMWare VM shows "x86" for
> this registry key and a 64-bit Windows XP in the next tab shows
> "AMD64".
>
> -Boris
>
>
> -----Original Message----- From: Andres Valloud
> [mailto:[hidden email]] Sent: Friday, August 03, 2012 12:06 PM
> To: Boris Popov, DeepCove Labs Cc: Tom Gruenewald; Visualworks Mailing
> List Subject: Re: [vwnc] How to check if OS is 32 or 64 bit?
>
> Has anyone tried what happens when you run the below code on a 64 bit
> CPU that's running a 32 bit version of Windows?
>
> On 8/3/2012 5:43 AM, Boris Popov, DeepCove Labs wrote:
>> http://support.microsoft.com/kb/556009
>>
>> os := OSSystemSupport concreteClass new.
>>
>> arch := os
>>
>> getVariableWithRoot: os HKEY_LOCAL_MACHINE
>>
>> path: #('SYSTEM' 'CurrentControlSet' 'Control' 'Session Manager'
>> 'Environment')
>>
>> name: 'PROCESSOR_ARCHITECTURE'
>>
>> ifAbsent: [nil].
>>
>> x64 := arch = 'AMD64'.
>>
>> HTH,
>>
>> -Boris
>>
>> *From:*[hidden email] [mailto:[hidden email]] *On
>> Behalf Of *Tom Gruenewald *Sent:* Friday, August 03, 2012 8:05 AM
>> *To:* Visualworks Mailing List *Subject:* [vwnc] How to check if OS
>> is 32 or 64 bit?
>>
>> Hello VisualWorks developers, how can I check if my application is
>> running on a 32 or 64 bit Windows system? Independent from the
>> Windows version itself. Thank you for your answers in advance.
>>
>> Best regards, Tom Grünewald
>>
>> ________
>>
>> Carl Zeiss Industrielle Messtechnik GmbH Softwareentwicklung/Software
>> Development
>>
>> T o m   G r ü n e w a l d
>>
>> 73446 Oberkochen, Germany tel: +49.7364.20-8541 fax:
>> +49.7364.20-4800 email: [hidden email]
>> <mailto:[hidden email]> http://www.zeiss.de/imt
>>
>> Carl Zeiss Industrielle Messtechnik GmbH Carl-Zeiss-Straße 22,
>> 73447 Oberkochen Aufsichtsratsvorsitzender: Dr. Hermann Gerlinger
>> Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben,
>> Harald Klaiber Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
>> Handelsregister: Amtsgericht Ulm, HRB 501561 USt-IdNr.:
>> DE 811 515 346
>>
>> ---------------------------------------- This message is intended for
>> a particular addressee only and may contain business or company
>> secrets. If you have received this email in error, please contact the
>> sender and delete the message immediately. Any use of this email,
>> including saving, publishing, copying, replication or forwarding of
>> the message or the contents is not permitted.
>>
>>
>>
>> _______________________________________________ vwnc mailing list
>> [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

johnhwoods
In reply to this post by Gruenewald, Tom
Feel free to tell me to mind my own business, but why do you want to know?  Normally I'm only concerned with whether my VM is 32 or 64 bit which I confess I normally do by checking if SmallInteger maxVal > 2**32.

Otherwise I think something like this is simple enough

Myclass>>OSbitwidth
| pa |
pa := UserEnvironment at: 'PROCESSOR_ARCHITECTURE'
   ifAbsent: [self error: 'env var PROCESSOR_ARCHITECTURE not found, is this  even Windows?'].
pa = 'x86' ifTrue: [^32].
pa = 'AMD64' ifTrue: [^64].
self error: [self error: 'env var PROCESSOR_ARCHITECTURE has unrecognized value']

... John
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Karsten Kusche
Why not just do something like:

Win32SystemSupport new DWORD pointerType sizeof


on 32bit that returns 4 and on 64bit that returns 8.

You cannot just do sizeof(long) because that differs for Windows and Unixes. But checking the pointer size works pretty good.


Karsten




-- 
Karsten Kusche - Dipl. Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812 

Am Montag, 13. August 2012 um 12:48 schrieb johnhwoods:

Feel free to tell me to mind my own business, but why do you want to know?
Normally I'm only concerned with whether my VM is 32 or 64 bit which I
confess I normally do by checking if SmallInteger maxVal > 2**32.

Otherwise I think something like this is simple enough

Myclass>>OSbitwidth
| pa |
pa := UserEnvironment at: 'PROCESSOR_ARCHITECTURE'
ifAbsent: [self error: 'env var PROCESSOR_ARCHITECTURE not found, is this
even Windows?'].
pa = 'x86' ifTrue: [^32].
pa = 'AMD64' ifTrue: [^64].
self error: [self error: 'env var PROCESSOR_ARCHITECTURE has unrecognized
value']

... John




--
Sent from the VisualWorks mailing list archive at Nabble.com.
_______________________________________________
vwnc mailing list


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Boris Popov, DeepCove Labs (SNN)

To clarify, the below simply checks current program, not the OS, so a return of 4 does not mean that OS is 32-bit as per original question in this thread. Hypothetically you could see that one may want to determine the OS capability to provide matching download links or alternate user instructions etcetera.

 

-Boris

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Karsten Kusche
Sent: Monday, August 13, 2012 7:20 AM
To: johnhwoods
Cc: [hidden email]
Subject: Re: [vwnc] How to check if OS is 32 or 64 bit?

 

Why not just do something like:

 

Win32SystemSupport new DWORD pointerType sizeof

 

on 32bit that returns 4 and on 64bit that returns 8.

You cannot just do sizeof(long) because that differs for Windows and Unixes. But checking the pointer size works pretty good.

 

Karsten

 

 

 

-- 

Karsten Kusche - Dipl. Inf. - [hidden email]

Georg Heeg eK - Köthen

Handelsregister: Amtsgericht Dortmund A 12812 

 

Am Montag, 13. August 2012 um 12:48 schrieb johnhwoods:

Feel free to tell me to mind my own business, but why do you want to know?

Normally I'm only concerned with whether my VM is 32 or 64 bit which I

confess I normally do by checking if SmallInteger maxVal > 2**32.

 

Otherwise I think something like this is simple enough

 

Myclass>>OSbitwidth

| pa |

pa := UserEnvironment at: 'PROCESSOR_ARCHITECTURE'

ifAbsent: [self error: 'env var PROCESSOR_ARCHITECTURE not found, is this

even Windows?'].

pa = 'x86' ifTrue: [^32].

pa = 'AMD64' ifTrue: [^64].

self error: [self error: 'env var PROCESSOR_ARCHITECTURE has unrecognized

value']

 

... John

 

 

 

 

--

Sent from the VisualWorks mailing list archive at Nabble.com.

_______________________________________________

vwnc mailing list

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Niall Ross
In reply to this post by Gruenewald, Tom
Dear Tom,
    to know if VisualWorks is running as 32 bit on a 64 bit architecture
machine, I use

    SystemUtils
        getEnvironmentVariable: 'PROCESSOR_ARCHITEW6432'
        ifAbsent: [^false].
    ^true

Of course,
    ObjectMemory is64Bit
will tell you if VisualWorks is running as 64bit.

If you have stripped the SystemUtils class, Boris' code shows getting
the same information.

HTH
             Yours faithfully
                   Niall Ross

>Hello VisualWorks developers,
>how can I check if my application is running on a 32 or 64 bit Windows
>system? Independent from the Windows version itself.
>Thank you for your answers in advance.
>
>Best regards,
>Tom Grünewald
>
>________
>
>Carl Zeiss Industrielle Messtechnik GmbH
>Softwareentwicklung/Software Development
>
>T o m   G r ü n e w a l d
>
>73446 Oberkochen, Germany
>tel: +49.7364.20-8541
>fax: +49.7364.20-4800
>email: [hidden email]
>http://www.zeiss.de/imt
>
>Carl Zeiss Industrielle Messtechnik GmbH
>Carl-Zeiss-Straße 22, 73447 Oberkochen
>Aufsichtsratsvorsitzender: Dr. Hermann Gerlinger
>Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben, Harald
>Klaiber
>Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
>Handelsregister: Amtsgericht Ulm, HRB 501561
>USt-IdNr.: DE 811 515 346
>
>
>----------------------------------------
>This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.  
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Boris Popov, DeepCove Labs (SNN)
Niall,

There's also this, which you may need to take into account,

http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx

-Boris

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Niall Ross
Sent: Monday, August 13, 2012 11:39 AM
To: Tom Gruenewald
Cc: Visualworks Mailing List
Subject: Re: [vwnc] How to check if OS is 32 or 64 bit?

Dear Tom,
    to know if VisualWorks is running as 32 bit on a 64 bit architecture machine, I use

    SystemUtils
        getEnvironmentVariable: 'PROCESSOR_ARCHITEW6432'
        ifAbsent: [^false].
    ^true

Of course,
    ObjectMemory is64Bit
will tell you if VisualWorks is running as 64bit.

If you have stripped the SystemUtils class, Boris' code shows getting the same information.

HTH
             Yours faithfully
                   Niall Ross

>Hello VisualWorks developers,
>how can I check if my application is running on a 32 or 64 bit Windows
>system? Independent from the Windows version itself.
>Thank you for your answers in advance.
>
>Best regards,
>Tom Grünewald
>
>________
>
>Carl Zeiss Industrielle Messtechnik GmbH Softwareentwicklung/Software
>Development
>
>T o m   G r ü n e w a l d
>
>73446 Oberkochen, Germany
>tel: +49.7364.20-8541
>fax: +49.7364.20-4800
>email: [hidden email]
>http://www.zeiss.de/imt
>
>Carl Zeiss Industrielle Messtechnik GmbH Carl-Zeiss-Straße 22, 73447
>Oberkochen
>Aufsichtsratsvorsitzender: Dr. Hermann Gerlinger
>Geschäftsführer: Dr. Rainer Ohnheiser (Vorsitzender), Felix Hoben,
>Harald Klaiber Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
>Handelsregister: Amtsgericht Ulm, HRB 501561
>USt-IdNr.: DE 811 515 346
>
>
>----------------------------------------
>This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.  
>
>  
>
>-----------------------------------------------------------------------
>-
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to check if OS is 32 or 64 bit?

Mark Pirogovsky-3
In reply to this post by johnhwoods

johnhwoods wrote:
Feel free to tell me to mind my own business, but why do you want to know? 
There are many circumstances, when the application may want to know if the platform is 32 VS 64 bits especially on Windows:
  • I just came across the problem where the code  reading/writing windows registry (which was working fine since Windows 95), does not work the same way under Windows 7 64 bit. 
  • If your application installer is built using VW you have to know.
  • If you use automated update process you need to know which EXE/DLL files to download, and so on.


Normally I'm only concerned with whether my VM is 32 or 64 bit which I
confess I normally do by checking if SmallInteger maxVal > 2**32.

Otherwise I think something like this is simple enough

Myclass>>OSbitwidth
| pa |
pa := UserEnvironment at: 'PROCESSOR_ARCHITECTURE'
   ifAbsent: [self error: 'env var PROCESSOR_ARCHITECTURE not found, is this 
even Windows?'].
pa = 'x86' ifTrue: [^32].
pa = 'AMD64' ifTrue: [^64].
self error: [self error: 'env var PROCESSOR_ARCHITECTURE has unrecognized
value']

... John




--
View this message in context: http://forum.world.st/How-to-check-if-OS-is-32-or-64-bit-tp4642867p4643889.html
Sent from the VisualWorks mailing list archive at Nabble.com.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc





____________________________________________________________
Woman is 57 But Looks 27
Mom publishes simple facelift trick that angered doctors...
ConsumerLifestyles.org
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc