Fractal Life

May 20, 2008

Implications of using Vista 64-bit when writing 32-bit code

Filed under: 64-bit — wordpress @ 19:48

I run Vista 64-bit Enterprise (under Bootcamp on my Mac Book Pro), and ran into an interesting side-effect yesterday.  At least it was interesting to me. :)

I want to store some values in the Windows Registry under the LocalMachine hive (a global setting, to get around a chicken-and-the-egg configuration problem I had).  My build target within Visual Studio 2008 was ‘Any CPU’, which means in effect, it creates a 32-bit executable.

The code worked fine - I could both write to and read from the registry.

But when I ran Regedit to go look at the values, I couldn’t find them.  I was looking at the right spot — HKEY_LOCAL_MACHINE\SOFTWARE\Oak City Software but my value wasn’t there!  I knew the write suceeded because I could read the value back again — it’s just that it wasn’t written where I thought it would go.  Walking off to get a refill on Diet Dr. Pepper while a global search in the registry ran, I returned to find that the values had been stored under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Oak City Software

It turns out that when running 32-bit code on a 64-bit OS, Microsoft transparently redirects your registry calls to this special Wow6432 node in the registry.

OK, time for an experiment.  I changed the build target from ‘Any CPU’ to ‘x64′, thus creating a 64-bit executable.  Running this resulted in my values being written to the place I expected within the registry.

I’m tempted to call this a leaky abstraction, but on the other hand, it is transparent to my code, and any support burden would be internal — I don’t expect my endusers to be spelunking in the registry.  But at the same time I’m curious as to why this was done.  I suspect that the registry doesn’t store values with as strong a datatyping as we think — someone trying to read a 64-bit value when only 32-bits was actually written might be a problem.

May 5, 2008

Q & A Session

Filed under: Vagabond — wordpress @ 18:37
  • Q: Why are you doing this?
  • A: We’ve already covered this. I’m either nuts, or inspired. Take your pick.
  • Q: Can you fit everything in your SUV that you might need for 3 years?
  • A: It’s going to be tight. I (briefly) thought about getting an RV, but the depreciation on them follows a curve more like that of a car than a home.

    This chart shows buying a $65k ($80k MSRP) RV, which is pretty run-of-the-mill. At the end of 13 years, your home is now worth 2/3 less than when you bought it. The appliances (the design of which is specific to a RV) are worn out, the chassis has 150,000 miles or more on it, and to buy a replacement costs even more than this one, thanks to the wonders of inflation.

    I’m developing multiple shopping lists for when I move to a new town. I expect, as much as I dislike the company, I’ll be doing some shopping at Wal-Mart. I’ve always tried to avoid joining the disposable society we’ve become, but with this change, it looks like I’ll have no choice but to buy the cheapest stuff available, and throw away what I can’t give away when I’m done with a contract.

  • Q: What are you going to do with your house?
  • A: I’m going to rent it out. If you know someone who wants to move to Raleigh, and be near WakeMed North Healthplex, it’s a great location, only about a mile from I-540, and so excellent for commuting to RTP.
  • May 3, 2008

    What is Chip up to?

    Filed under: Career, Vagabond — wordpress @ 18:43

    I’m leaving my job and becoming a vagabond.

    This may be the dumbest thing I’ve ever done, but I really want to leave the Raleigh area and see more of the country. The Grand Scheme is to take contracts of six to nine month duration, and just go where the work is. It’ll be me and Hopper the cat, roaming the backroads of the USA in a small SUV.

    Does it make sense to give up a stable job, working with really smart people at a profitable firm that is making a real difference in people’s lives? Nope. None at all. But I want to do it anyway.

    May 2, 2008

    First Entry

    Filed under: Uncategorized — wordpress @ 13:46

    This is my new home on the internet, after hosting for years at my RoadRunner personal page.

    I’m doing a mass posting of the stuff I’ve written earlier, but before I had WordPress set up.

    Powered by WordPress