Are you running on 64bit Windows?

Recently I was asked how to determine whether a DF program (all DF programs are 32bit!) is running on a 32 bit or 64 bit Windows. There are lots of hacky ways to do it, like checking whether the machine has a certain registry keys or certain directories (Ex. C:\Program Files (x86)). Here is the official way recommended by Microsoft, implemented in DF.

Use Windows

External_Function IsWow64Process  "IsWow64Process" Kernel32.dll Handle hProcess Pointer pb64 Returns Boolean
External_Function GetProcAddress "GetProcAddress" Kernel32.dll Handle hModule String sProc Returns Pointer
External_Function GetCurrentProcess "GetCurrentProcess" Kernel32.dll Returns DWord

Function Is64 Global Returns Boolean
	Handle hKernel
	Pointer pProcAddress
	String sModule
	Boolean b64 bSuccess
	Move "Kernel32.dll" to sModule
	Move (GetModuleHandle(AddressOf(sModule))) to hKernel
	Move (GetProcAddress(hKernel, "IsWow64Process")) to pProcAddress
	If (pProcAddress) Begin
		Move False to b64
		Move (IsWow64Process(GetCurrentProcess(),AddressOf(b64))) to bSuccess
		Function_Return b64
	End
	Function_Return False
End_Function

Showln (Is64())
InKey FieldIndex