Detect whether Office is 32bit or 64bit via the registry

From TechNet article on 64-bit editions of Office 2010:

If you have installed Office 2010 including Microsoft Outlook 2010, Outlook sets a registry key named Bitness of type REG_SZ on the computer on which it is installed. The Bitness registry key indicates whether the Outlook 2010 installation is 32-bit or 64-bit. This may be useful to administrators who are interested in auditing computers to determine the installed versions of Office 2010 in their organization.

  • Registry path: HKEY_LOCAL_MACHINE\Software\Microsoft\Office\14.0\Outlook
  • if you have installed Office 2013 then use this Registry path: HKEY_LOCAL_MACHINE\Software\Microsoft\Office\15.0\Outlook
  • Registry key: Bitness
  • Value: either x86 or x64

and elsewhere in the same article:

Starting with Office 2010, Outlook is available as a 32-bit application and a 64-bit application. The version (bitness) of Outlook that you choose depends on the edition of the Windows operating system (32-bit or 64-bit) and the edition of Office 2010 (32- or 64-bit) that is installed on the computer, if Office is already installed on that computer.

Factors that determine the feasibility of installing a 32-bit or a 64-bit version of Outlook include the following:

  • You can install 32-bit Office 2010 and 32-bit Microsoft Outlook 2010 on a supported 32-bit or 64-bit edition of the Windows operating system. You can install the 64-bit version of Office 2010 and 64-bit Outlook 2010 only on a supported 64-bit operating system.
  • The default installation of Office 2010 on a 64-bit edition of the Windows operating system is 32-bit Office 2010.
  • The bitness of an installed version of Outlook is always the same as the bitness of Office 2010, if Office is installed on the same computer. That is, a 32-bit version of Outlook 2010 cannot be installed on the same computer on which 64-bit versions of other Office 2010 applications are already installed, such as 64-bit Microsoft Word 2010 or 64-bit Microsoft Excel 2010. Similarly, a 64-bit version of Outlook 2010 cannot be installed on the same computer on which 32-bit versions of other Office applications are already installed.

I've tested Otaku's answer and it appears that the Outlook bitness value is set even when Outlook is not installed, even though the article referenced does not clearly indicate that this would be the case.


To add to vtrz's answer, here's a function I wrote for Inno Setup:

const
  { Constants for GetBinaryType return values. }
  SCS_32BIT_BINARY = 0;
  SCS_64BIT_BINARY = 6;
  { There are other values that GetBinaryType can return, but we're }
  { not interested in them. }

{ Declare Win32 function  }
function GetBinaryType(lpApplicationName: AnsiString; var lpBinaryType: Integer): Boolean;
external '[email protected] stdcall';

function Is64BitExcelFromRegisteredExe(): Boolean;
var
  excelPath: String;
  binaryType: Integer;
begin
  Result := False; { Default value - assume 32-bit unless proven otherwise. }
  { RegQueryStringValue second param is '' to get the (default) value for the key }
  { with no sub-key name, as described at }
  { http://stackoverflow.com/questions/913938/ }
  if IsWin64() and RegQueryStringValue(HKEY_LOCAL_MACHINE,
      'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe',
      '', excelPath) then begin
    { We've got the path to Excel. }
    try
      if GetBinaryType(excelPath, binaryType) then begin
        Result := (binaryType = SCS_64BIT_BINARY);
      end;
    except
      { Ignore - better just to assume it's 32-bit than to let the installation }
      { fail.  This could fail because the GetBinaryType function is not }
      { available.  I understand it's only available in Windows 2000 }
      { Professional onwards. }
    end;
  end;
end;