Wednesday, July 21, 2010

64 Bit Explained

Programs are still in the same place, in %ProgramFiles%, unless you need the 32 bit version, which is in %ProgramFiles(x86)%, except on a 32 bit machine, where it’s still %ProgramFiles%.

All those dll’s are still in %SystemRoot%\System32, just now they’re 64 bit. The 32 bit ones, they’re in %SystemRoot%\SysWOW64. You’re with me so far, right? Oh, and the 16 bit ones are still in %SystemRoot%\System – moving them would just be weird.

Registry settings are in HKLM\Software, unless you mean the settings for the 32 bit programs, in which case they’re in HKLM\Software\Wow6432Node.

So the rule is easy: stick to the 64 bit versions of apps, and you’ll be fine. Apps without a 64 bit version are pretty obscure anyway, Office and Visual Studio for example[1]. Oh, and stick to the 32 bit version of Internet Explorer (which is the default) if you want any of your add-ins to work. The ‘default’ shortcut for everything else is the 64 bit version. Having two shortcuts to everything can be a bit confusing, so sometimes (cmd.exe) there’s only the one (64 bit) and you’ll have to find the other yourself (back in SysWOW64, of course). And don’t forget to ‘Set-ExecutionPolicy RemoteSigned’ in both your 64 bit and 32 bit PowerShell environments.

Always install 64 bit versions of drivers and stuff, unless there isn’t one (MSDORA, JET), or you need both the 32 bit and 64 bit versions (eg to use SMO / SqlCmd from a 32 bit process like MSBuild). Just don’t do this if the 64 bit installer already installs the 32 bit version for you (like Sql Native Client).

Anything with a ‘32’ is for 64 bit. Anything with a ‘64’ is for 32 bit. Except %ProgramW6432% which is the 64 bit ProgramFiles folder in all cases (well, except on a 32 bit machine). Oh and the .net framework didn’t actually move either, but now it has a Framework64 sibling.

I really don’t understand how people get so worked up over it all.

[1] Ok, so there is a 64 bit version of Office 2010, but given the installer pretty much tells you not to install it, it doesn’t count.

Note though that a 32-bit app doesn't doesn't always see all of the 64-bit stuff for compatibility reasons.EG, the 32bit regedit.exe (in SysWow64) doesn't have a Wow6432Node because you're already in it.Also, there are functions that you can call in your 32-bit app on recent versions of Windows so that if it tries to access c:\windows\system32 it will actually be transparently seeing c:\windows\syswow64 without knowing about it.

See this MS article http://msdn.microsoft.com/en-us/library/aa384249.aspx for information. It links to http://msdn.microsoft.com/en-us/library/aa384232.aspx which talks about registry redirection and http://msdn.microsoft.com/en-us/library/aa384187.aspx, which talks about file system redirection. It outlines the importance of using SHGetSpecialFolderPath to get folder paths properly (even in x86 land you can't always assume things are on C: for example) and, if you really want to hard code paths, use Wow64EnableWow64FsRedirection :p

Cite: "stick to the 32 bit version of Internet Explorer (which is the default)"

No it isn't the default one, at least not for me, the default one was IE 64bit. The most weird thing was with the plugins like flash or silverlight. For example you want to watch a video on youtube and you don't have flash installed. So you install flash you go again on the page of youtube and it still tell you to install flash! If you try to install flash again it tell you that flash is already installed! What's wrong with it? Simple there is only a 32bit version of flash and it is installed correctly on IE 32 bit but you are using IE 64 bit and there is no flash plugin for it!