how to detect OS architecture?

Regan Heath regan at netmail.co.nz
Tue Dec 17 05:21:30 PST 2013


On Mon, 16 Dec 2013 21:26:31 -0000, Hugo Florentino <hugo at acdam.cu> wrote:

> On Mon, 16 Dec 2013 17:04:18 -0000, Regan Heath wrote:
>> ...
>> Compile the launcher as 32bit, and use this global boolean "isWow64":
>> ...
>
> Thanks, it's nice to have another option.
> What do you guys think are the possible advantages/disadvantages of  
> either solution?

Is GetNativeSystemInfo your other solution?  On the MSDN page for  
GetNativeSystemInfo it recommends using IsWow64Process to detect if you're  
running under WOW64, at which point you would then call  
GetNativeSystemInfo.

I am not sure what GetNativeSystemInfo does if called from a 32 bit exe on  
a 32 bit OS..

I /know/ that the code in std.internal.windows.advapi32 which dynamically  
loads and calls IsWow64Process will work, because we use it here at work  
for this very purpose.  It's also the simplest most direct way to answer  
this specific question and it's already present, tested and working in  
phobos .. so I would be inclined to use it, in preference over  
GetNativeSystemInfo.

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d-learn mailing list