Jump to content

Identifying if Windows is 32 or 64 bits


 Share

Recommended Posts

Now here's a good one for you guys :dance:

I'm working on a small program to assist a client apply patches to his PCs using the infamous QChain program.

In order for the program to be as idiot-proof as possible, I need to know the following:

The user's version of Windows --> @OSVersion

The type of windows this is --> @OSTYPE

The language used --> @OSLang

Version and language are OK. My problem is with @OSType. Here's a direct quote from the help file (yes some of us do read it :dance:)

Returns "WIN32_NT" for NT/2000/XP/2003 and returns "WIN32_WINDOWS" for 95/98/Me

So is @OSType going to contain "WIN64_NT" if someone is using window's latest offering?

This is critically important for my program to work properly since installing patches for the wrong window type will result in an error. I'd like to intercept this error from within my program and not as a return parameter from the update files ...

Ok well I'll search the registry while waiting for an answer ... (I.E.: anyone out there with a 64 bit windows willing to try the folloing code?)

MsgBox(1,"Windows Type",@OSType)

Thanks a million :(

P.S.: Someone finds the answer, I'll post the final program on this forum :whistle:

Edited by Celeri

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

Ok well I've done my homework ... and so far no joy :dance:

Since I don't have access to a 64 bit version of XP it doesn't make it any easier ... and no thanks to Microsoft - MSDN is just a pain to decypher :whistle:

(it usually beats up the noob within me)

BTW in case I wasn't clear, I don't want to know if the processor can handle 64 bits, I want to know if Windows can (not the same thing).

Thanks again :dance:

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

Instead of using macros try to retrieve this info from registry....

e.g. "HK_Local_Machine\SOFTWARE\Windows NT\CurrentVersion\"

There are several keys there that have info about the operating system....

I cant know what the keys are like in x64 cos havent installed them yet...Someone else could give you this info...

Edited by hgeras
Link to comment
Share on other sites

no thanks to Microsoft - MSDN is just a pain to decypher :whistle:

(it usually beats up the noob within me)

what you need is this:

LINK1 and

LINK2

You will need DLLCall() and DLLStructCreate() etc. as well.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

I checked your links and it says that if return value is 2 in dwMinorVersion (OSVERSIONINFOEx) then it indicates that The operating system is Windows Server 2003 "R2", Windows Server 2003, or Windows XP Professional x64 Edition.So again there is no way to distinguish if it is a 64bit environment or not....

Link to comment
Share on other sites

I checked your links and it says that if return value is 2 in dwMinorVersion (OSVERSIONINFOEx) then it indicates that The operating system is Windows Server 2003 "R2", Windows Server 2003, or Windows XP Professional x64 Edition.So again there is no way to distinguish if it is a 64bit environment or not....

<{POST_SNAPBACK}>

so, what do you think that x64 might mean? I associate it with Windows XP 64 Bit. And I think that is what Celeri is interested in.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

If you run the function in Windows server 2003 then:

dWMajorVersion= 5 and dWMinorVersion= 2

If you run the function in Windows XP x64 then:

dWMajorVersion = 5 and dWMinorVersion = 2

How are you going to tell which one is which?

Link to comment
Share on other sites

How are you going to tell which one is which?

Ah, you are right. Maybe we need an additional function. GetSystemInfo() and the struct SYSTEM_INFO with "member" wProcessorArchitecture. LINK

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Yes you are right...But then gets too complicated.... I believe the key "ProductName" in "HK_Local_Machine\SOFTWARE\Windows NT\CurrentVersion\" is much easier to access and might do the trick...Unless he wants some practice in DllStruct() !!!

C ya

Link to comment
Share on other sites

Yes you are right...But then gets too complicated.... I believe the key "ProductName" in "HK_Local_Machine\SOFTWARE\Windows NT\CurrentVersion\" is much easier to access and might do the trick...Unless he wants some practice in DllStruct() !!!

C ya

<{POST_SNAPBACK}>

WOW thanks for the quick reply, I'm blown away! :whistle: (can you see I'm having fun with these smilies?)

BTW the correct registry branch is HKLM\Software\Microsoft\Windows NT\CurrentVersion (I've learned by borking the registry over and over and over and over ...) ... but sadly ProductName is as generic as can be ... unless it ends in x64 when the OS is 64 bit, in which case that would be sufficient for me.

Oh thanks another million to /dev/null for the links, which are excellent! But I fear this link is the better alternative; so happens when you run 32bit code on a 64bit system, it goes through something called WOW (windows on windows). If the value is true than voilà, 64 bits it is. Sadly it's not going to happen (with me at least). I have another idea :dance:

But what really boggles the mind is the fact that there is no *real* provision (from MicroSlouch that is) to see if the OS can handle 64 bit code. Like I said before I made quite a bit of research today for an external alternative and I'm really amazed by the fact that no one (even MSDN!) seems to think it's important to know!!! I mean how hard is it to program IS_OS_64BITS? You'd figure after all the marketing, hype and stuff ...

Anyways I think I'll go for the really cheap alternative of trying to find a system file that's present in the 64bit version but not on the 32bit one. If that fails then it's either going to be that DLL thingie or a giant prompt when starting the program:

"THOU SHALL NOT RUN 32BIT PATCHES ON THY 64BIT OS" :dance:

And as promised, as soon as I have something substantial, I will post it here (err... in scripts and scraps that is!!)

Edited by Celeri

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

I ask jpm again to implement an advancing of the macro "OS_TYPE" with "WIN64_NT".

Regards

Holger

<{POST_SNAPBACK}>

WOW thanks :dance:

If I find an alternative I'll let everyone know :whistle:

Obi Wan Celeri

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

not to change what the Windows API return I will not change @OSTYPE to be as consistent as Windows is...

but I will add a @PROCESSORARCHITECTURE which will return IA32 IA64 X64

<{POST_SNAPBACK}>

WOW just for moi? :">

BTW, if anyone knows a file or folder that exists ONLY in Windows XP X64, I would really appreciate that info ... so far I've dissected a whole bunch of updates for X64 and found no noticeable difference - except on the binary side that is ... Hmmm...

Allright well thank you all for your efforts!!!

Ah yes, my program is 50% complete - it should be on this forum by the week's end :whistle: (if anyone interested that is)

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

WOW just for moi?  :">

BTW, if anyone knows a file or folder that exists ONLY in Windows XP X64, I would really appreciate that info ... so far I've dissected a whole bunch of updates for X64 and found no noticeable difference - except on the binary side that is ... Hmmm...

Allright well thank you all for your efforts!!!

Ah yes, my program is 50% complete - it should be on this forum by the week's end :whistle: (if anyone interested that is)

<{POST_SNAPBACK}>

actually, you've already made mention of WoW, which would not be necessary on any system without XP X64 right? why not research up on that WoW on MSDN and see what lib/dll it's in...
Link to comment
Share on other sites

actually, you've already made mention of WoW, which would not be necessary on any system without XP X64 right? why not research up on that WoW on MSDN and see what lib/dll it's in...

<{POST_SNAPBACK}>

EXACTLY :whistle:

Thanks, finding this file should be the best solution until we have a bullet-proof way of knowing through constants :dance:

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

Bingo!

Found something very interesting. Unless I'm seriously wrong the information on this page should facilitate identification.

Obviously it's always possible for someone to make false positives but if I verify multiple conditions the only way to really fool my detection would be to ... read my source ehehehe

Keep you posted when my code is done - it might eventually be useful to someone :whistle:

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

Bingo!

Found something very interesting. Unless I'm seriously wrong the information on this page should facilitate identification.

Obviously it's always possible for someone to make false positives but if I verify multiple conditions the only way to really fool my detection would be to ... read my source ehehehe

Keep you posted when my code is done - it might eventually be useful to someone :whistle:

<{POST_SNAPBACK}>

why would someone WANT to generate a false positive to make your program run in a way that their computer apparently wouldn't be able to handle or understand?
Link to comment
Share on other sites

Try the last beta .67. I add a @ProcessorArch macro to handle this problem.

I didn't add it in @OSType because there is 2 versions of 64-bit one with different binary/action possible on it.

I stay with how Windows works internally and report the difference with this new macro. :whistle:

Link to comment
Share on other sites

Try the last beta .67. I add a @ProcessorArch macro to handle this problem.

I didn't add it in @OSType because there is 2 versions of 64-bit one with different binary/action possible on it.

I stay with how Windows works internally and report the difference with this new macro. :whistle:

<{POST_SNAPBACK}>

Allright, I'll check it out ... as soon as I can get the bloody betas to install properly :dance:

Et merci encore!

Edited by Celeri

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...