PDA

View Full Version : First! 64 bit detector



DaveR
23-Jul-2021, 10:39 AM
Is anybody using anything in their DF20 executables to detect whether the machine is running a Windows 64 bit version? I see a method under pfAccessrights of cRegistry in the DF20 help but are there any drawbacks? Like needed Admin access? We want to roll out DF20/32 but advise users that they can ask for the 64 bit menu if their machine can run it.



Boolean bOpened bExists
Handle hoRegistry Get Create (RefClass(cRegistry)) to hoRegistry
// Set the default of phRootKey...
Set phRootKey of hoRegistry to HKEY_LOCAL_MACHINE
// set access rights to read
Set pfAccessRights of hoRegistry to Key_Read
// check if this is a 64 bit machine
// if so, the Wow6432Node key will exist
Get KeyExists of hoRegistry "SOFTWARE\Wow6432Node" to bExists
If bExists do something

Send Destroy of hoRegistry


moved from windows..

Samuel Pizarro
23-Jul-2021, 11:23 AM
I believe this api should do it!

this was the link I was trying to share
IsWow64Process2 function (wow64apiset.h) - Win32 apps | Microsoft Docs (https://docs.microsoft.com/en-us/windows/win32/api/wow64apiset/nf-wow64apiset-iswow64process2)


this one was posted wrongly
https://docs.microsoft.com/pt-br/windows/win32/api/sysinfoapi/nf-sysinfoapi-getnativesysteminfo?redirectedfrom=MSDN

wila
23-Jul-2021, 11:59 AM
Dave,

https://vdf-guidance.com/ContribPage.asp?Page=PKGCLSOSVERSIONI&ContribRecId=123

property pbX64
would be the one.

I'm pretty sure that Frank Cheng also has some code for this at his site if you are looking for an alternative.

Checking the registry for the WOW6432Node tree is a hack which should not be relied upon.
For kicks I just checked on a 32 bits machine down here and it HAS this tree. Part of it written by Microsoft no less (NotePad :D )
--
Wil

DaveR
23-Jul-2021, 12:28 PM
Dave,

https://vdf-guidance.com/ContribPage.asp?Page=PKGCLSOSVERSIONI&ContribRecId=123

property pbX64
would be the one.

I'm pretty sure that Frank Cheng also has some code for this at his site if you are looking for an alternative.

Checking the registry for the WOW6432Node tree is a hack which should not be relied upon.
For kicks I just checked on a 32 bits machine down here and it HAS this tree. Part of it written by Microsoft no less (NotePad :D )
--
Wil

thanks Wil, yes I thought it was likely to be unreliable as it is present on a machine I KNOW to be 32 bit as its where I compile our charmode stuff. I'll take a look.

DaveR
23-Jul-2021, 12:29 PM
I believe this api should do it!

this was the link I was trying to share
IsWow64Process2 function (wow64apiset.h) - Win32 apps | Microsoft Docs (https://docs.microsoft.com/en-us/windows/win32/api/wow64apiset/nf-wow64apiset-iswow64process2)


this one was posted wrongly
https://docs.microsoft.com/pt-br/windows/win32/api/sysinfoapi/nf-sysinfoapi-getnativesysteminfo?redirectedfrom=MSDN



Thanks, Samuel, I will take a look.

DaveR
23-Jul-2021, 01:21 PM
(taking a look) 2010 is the giveaway :cool:
Quite a task to keep that up to date.

Win10Pro is 6.2 and that's the only version I'm interested in so far. If Windows 7 was 6.1 where does that leave Windows 8. And I wouldn't know where to start with the processors or I'd help you.

Stephen W. Meeley
23-Jul-2021, 02:23 PM
Dave,

I think Win 10 is only returning 6.2 because of the manifest (or lack thereof). Try this article...

https://docs.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version

DaveR
23-Jul-2021, 02:31 PM
Dave,

I think Win 10 is only returning 6.2 because of the manifest (or lack thereof). Try this article...

https://docs.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version

interesting and thanks for the heads up - This is Wil's stand-alone code from 2010 so isn't primed for anything past windows 7 anyway.. I haven't tried embedding the relevant bits in my app yet.

wila
23-Jul-2021, 03:48 PM
(taking a look) 2010 is the giveaway :cool:
Quite a task to keep that up to date.

Win10Pro is 6.2 and that's the only version I'm interested in so far. If Windows 7 was 6.1 where does that leave Windows 8. And I wouldn't know where to start with the processors or I'd help you.

hehe.. you only asked about the X64 logic and I"m pretty sure that part works fine.
Now you're just changing the goal post :)

Here then is Frank's alternative, from 2017 (you _win_ 7 years)
http://vdf.frankcheng.com/is64.htm

--
Wil