Home > Documentation > Miscellaneous

Using 32bit COMponents in 64bit environment

When trying to use old components and APIs, developer may face the following problem: 32bit COM objects are not usable in a 64bit environment. Attempt to access a 32bit COM in a 64bit environment will result "class not registered" error. However this issue can be resolved by using dllhost as a surrogate for the 32bit COM object.

Implementation of this fix involves a number of simple registry modifications:

  1. Locate your COM object GUID under the HKey_Classes_Root\Wow6432Node\CLSID\[GUID]
  2. Once located add a new REG_SZ (string) value. The name must be AppID and data must be the same COM object GUID you have just searched for
  3. Add a new key under HKey_Classes_Root\Wow6432Node\AppID\ The new key must be called the same as GUID of the COM object
  4. Under the new key you've just added, add a new REG_SZ (string) value, and call it DllSurrogate. Leave the value empty.
  5. Create a new key under HKey_Local_Machine\Software\Classes\AppID\. Again the new key must be called the same as the COM object's GUID. No values are necessary to be added under this key.

Note for Windows Server 2008 R2 Server Core

Windows Server 2008 R2 Server Core is the first operating system with optional 32-bit support. This means that it is necessary to enable 32-bit application support explicitly. WoW64, the 32-bit app support layer, is not installed by default (in order to reduces the attach surface, save memory and makes the whole OS more lightweight). Obviously, the operating system can run native 64-bit apps only in this configuration.

If somebody try to run 32-bit code on Server Core in default configuration, they will receive an error message saying that the application cannot be executed due to lack of 32-bit application support. 32-bit support can be installed by running the following command from the command line:

start /w ocsetup ServerCore-WOW64

Person who can make such update must have privileges of the system administrator.