How to test if windows 32 or 64 bit
How to test if windows 32 or 64 bit
Hello,
I searched the forum but couldn't find an answer to my question:
How to test in Purebasic if Windows is 32 or 64 bits?
thank you
I searched the forum but couldn't find an answer to my question:
How to test in Purebasic if Windows is 32 or 64 bits?
thank you
Re: How to test if windows 32 or 64 bit
The simple method would be to check if a pointer uses 4 byte or 8 byte. Or use IsWow64Process. But this is just for simple cases and does not work if you run a win32 session on a win64 host
Re: How to test if windows 32 or 64 bit
Author: freak
Author: ts-soft
Code: Select all
Prototype GetNativeSystemInfo(*lpSystemInfo.SYSTEM_INFO)
#PROCESSOR_ARCHITECTURE_AMD64 = 9
#PROCESSOR_ARCHITECTURE_IA64 = 6
#PROCESSOR_ARCHITECTURE_INTEL = 0
#PROCESSOR_ARCHITECTURE_UNKNOWN = $ffff
Procedure Is64bitOS()
Protected kernel32, GetNativeSystemInfo.GetNativeSystemInfo
Protected info.SYSTEM_INFO
Protected Result = #False
kernel32 = OpenLibrary(#PB_Any, "Kernel32.dll")
If kernel32
GetNativeSystemInfo = GetFunction(kernel32, "GetNativeSystemInfo")
If GetNativeSystemInfo
GetNativeSystemInfo(@info)
If info\wProcessorArchitecture <> #PROCESSOR_ARCHITECTURE_INTEL ; x86
Result = #True
EndIf
EndIf
CloseLibrary(kernel32)
EndIf
ProcedureReturn Result
EndProcedure
Debug Is64bitOS()
Code: Select all
Import ""
GetNativeSystemInfo(*info)
EndImport
Procedure Is64bitOS()
Protected Info.SYSTEM_INFO
GetNativeSystemInfo(Info)
If info\wProcessorArchitecture
ProcedureReturn #True
EndIf
EndProcedure
Debug Is64bitOS()
Egypt my love
Re: How to test if windows 32 or 64 bit
Hello,
Thank you all for your responses
Thank you all for your responses
Re: How to test if windows 32 or 64 bit
I use
Code: Select all
CompilerIf #PB_Compiler_Processor=#PB_Processor_x64
Procedure Is32On64()
ProcedureReturn 0
EndProcedure
CompilerElse
Import ""
GetNativeSystemInfo(*temp)
EndImport
Procedure Is32On64()
Protected temp.SYSTEM_INFO
GetNativeSystemInfo(temp)
Select temp\wProcessorArchitecture
Case 6,9,12
ProcedureReturn 1
EndSelect
ProcedureReturn 0
EndProcedure
CompilerEndIf
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Re: How to test if windows 32 or 64 bit
There should be a native command to do this.
Re: How to test if windows 32 or 64 bit
Yes. But Fred is busy with the V6 release.
So - who does a "(system) environment" module?
I tried to cover the the linux part here. windows info and parsing the CPU-ID bitmask are easily done. Maybe driver and I/O interfaces should be added (network, serial, wlan, parallel? usb!). It would probably be easier to detect or use common system information tools and parse the output to create the module structures / Infos. CPU-Z, GPU-Z, hwinfo, AMD and nvidia tools.
Maybe the futuremark systeminfo but i don't know if their license allows it.
This would be a great starting point to collect lot of info for such a module: Heise - Systeminfo tools
Re: How to test if windows 32 or 64 bit
Code: Select all
If GetEnvironmentVariable("CommonProgramFiles(x86)")
Debug "This is a 64 bits version of Windows"
Else
Debug "This is a 32 bits version of Windows"
EndIf
Re: How to test if windows 32 or 64 bit
Tank you Marc56us