Sign in to follow this  
Followers 0
jp10558

OSVersion for XP x64?

15 posts in this topic

Is there a way to detect XP x64 as opposed to 32 bit XP?

Share this post


Link to post
Share on other sites



Take a look at the @ProcessorArchitecture macro


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Take a look at the @ProcessorArchitecture macro

Good idea but what if i'm running 32 bit XP on a 64-bit processor, it will still return as a 64-bit OS.

Share this post


Link to post
Share on other sites

I'm not sure how to do this in AutoIt..

http://forums.microsoft.com/MSDN/ShowPost....96&SiteID=1

In vb.net you can check the size of IntPtr to get the number of bits.

Try this in your 64 bit OS and see what you get:

MsgBox(0,"","Your OS is " & osbits() & " bits")

Func osbits()
    $struct = DllStructCreate ("ptr")
    $size = DllStructGetSize ($struct)
    Return $size * 8
EndFunc

Share this post


Link to post
Share on other sites

Good idea but what if i'm running 32 bit XP on a 64-bit processor, it will still return as a 64-bit OS.

True, but atthis point I don't beleive there is a Macro that will return the 64 bit version. Wait a minute, Yes there is. I don't have the time to look it up right now but @OSBuild will do it. Just Google the build numbers fo 64 bit XP.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I think Jon is making a macro for it.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I don't have access to a 64 bit operating system so I don't know if my previous code can return 64bit.

According to wikipedia, some of the build numbers are shared by both 32 bit and 64 bit versions so @OSBuild is no help.

NT 3.1 Windows NT 3.1 Workstation (named just Windows NT), Advanced Server July 27, 1993

528

NT 3.5 Windows NT 3.5 Workstation, Server September 21, 1994

807

NT 3.51 Windows NT 3.51 Workstation, Server May 30, 1995

1057

NT 4.0 Windows NT 4.0 Workstation, Server, Server Enterprise Edition, Terminal Server, Embedded July 29, 1996

1381

NT 5.0 Windows 2000 Professional, Server, Advanced Server, Datacenter Server February 17, 2000

2195

NT 5.1 Windows XP Home, Professional, 64-bit (original), Media Center (original, 2003, 2004 & 2005), Tablet PC (original and 2005), Starter, Embedded, Home N, Professional N October 25, 2001

2600

NT 5.1 Windows Fundamentals for Legacy PCs N/A July 8, 2006

2600

NT 5.2 Windows Server 2003 Standard, Enterprise, Datacenter, Web, Storage, Small Business Server, Compute Cluster April 24, 2003

3790

NT 5.2 Windows XP (5.2) 64-bit 2003, Professional x64 April 25, 2005

3790

NT 5.2 Windows Home Server N/A July 16, 2007

3790

NT 6.0 Windows Vista Starter, Home Basic, Home Premium, Business, Enterprise, Ultimate, Home Basic N, Business N

6000

NT 6.0 Windows Server 2008 Standard, Enterprise, Datacenter, Web, Storage, Small Business Server February 27, 2008 (expected)

6001

NT 7.0 Windows 7 (formerly codenamed Blackcomb, later Vienna) Unknown

Unknown

Edited by weaponx

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Try this... I have no way to test it really, but I'm running 64 bit processor with a 32 bit OS... and it returns the correct result... need someone to see if it return right on a 64 bit OS.

MsgBox(0, 0, _OSWinBit())

Func _OSWinBit()
    Local Const $PROCESSOR_ARCHITECTURE_IA64     = 6
    Local Const $PROCESSOR_ARCHITECTURE_AMD64    = 9
    Local $SYSTEM_INFO = DllStructCreate("short[2];dword;int[3];dword[3];short[3]")
    Local $aGSI = DllCall("Kernel32.dll", "int", "GetSystemInfo", "ptr", DllStructGetPtr($SYSTEM_INFO))
    If IsArray($aGSI) = 0 Or $aGSI[0] = 0 Then Return SetError(1, 0, 0)
    Local $PROCESSARCH = DllStructGetData($SYSTEM_INFO, 1)
    If BitAND($PROCESSARCH, $PROCESSOR_ARCHITECTURE_IA64) Or _
        BitAND($PROCESSARCH, $PROCESSOR_ARCHITECTURE_AMD64) Then Return 64
    Return 32
EndFuncoÝ÷ ØGb´íz¹h¢H§«mæ¢÷ë-q©÷öÛz0#]¶»¬¶+m¡·¡¢w¬´ývÚî²ÛaÊ'y·¥£    ®r¨­æ®¶­sdgVæ2ôõ4&C" Æö6Âb33c·Dõ2ÒFÆÅ7G'V7D7&VFRgV÷C¶6%³#SeÒgV÷C² Æö6Âb33c¶u5tBÒFÆÄ6ÆÂgV÷C´¶W&æVÃ3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´vWE77FVÕv÷scDF&V7F÷'gV÷C²ÂgV÷C·G"gV÷C²ÂFÆÅ7G'V7DvWEG"b33c·Dõ2ÂgV÷C¶çBgV÷C²Â#Sb b4'&b33c¶u5tBæBFÆÅ7G'V7DvWDFFb33c·Dõ2ÂFVâ&WGW&âc@ &WGW&â3 ¤VæDgVæ
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Look at latest beta:

I was just reading that... as I stated before, I knew Jon was going to be working on something like that.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Great, I'll wait for the next release. Right now I'm just looking for C:\Program Files (x86) ... it's not that time critical.

Share this post


Link to post
Share on other sites

Great, I'll wait for the next release. Right now I'm just looking for C:\Program Files (x86) ... it's not that time critical.

Were you able to test my or Smokes code in x64? I would like to know the results.

Share this post


Link to post
Share on other sites

Were you able to test my or Smokes code in x64? I would like to know the results.

The bottom one (the edit) works, not the top one (that I was afraid wouldn't)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

The bottom one (the edit) works, not the top one (that I was afraid wouldn't)

Great, as always! :) Thanks once again smoke!


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

I am fairly new to the "Programming arena" and am trying to set up a script that does certain things to the registry as well as a few others and was wondering how I read the information coming out of the script so that it can display on the window that is created saying either "32 bit OS" or "64 bit OS" depending on the result. Could someon please further explain this to me? Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0