[Haskell-cafe] Same code, system, but different arch using Win32 for reading registry.

Brandon Allbery allbery.b at gmail.com
Mon Apr 10 16:34:03 UTC 2017


On Mon, Apr 10, 2017 at 2:17 PM, Akos Marton <makos999 at gmail.com> wrote:

> Can it be that ghc forces its evaluation during compilation and renders
> something hard-coded into the binary? - this is how it feels, I am trying
> to show it, so far w/o success.


No. The System.Info module works that way (more precisely it reports things
baked into the binary at compile time), but the Win32 module is making an
actual system call. That system call is being processed by WoW32 and
returning information about the emulator, not the host.

If it's not clear yet: WoW32 is a restricted virtual machine. Expect it to
behave as if the program is running in a 32-bit Windows inside VirtualBox.
You get this any time you run a 32-bit executable on 64-bit Windows. It
does not matter what language you use. It does not matter how you access
this information.

I do not know that, but it feels like I should use something which can be
> called via *system* and hence on can rely on the local window api and not
> on the system I compile.
>

That will likely still run within WoW32 though, and report the emulated
32-bit CPU. Windows is specifically avoiding the thing you want, in order
to provide backward compatibility.

At this point you probably need to spend some time with MSDN to see if
there is a way for something running in WoW32 to find out details of the
host, probably by communicating with the hypervisor.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170410/0e26c1a6/attachment.html>


More information about the Haskell-Cafe mailing list