Calling CoCreateInstance CLSCTX_INPROC_SERVER from a 32 bits app, but the COM server .dll is x64

Pablo Glomby 171 Reputation points

I have a question... I call CoCreateInstance with CLSCTX_INPROC_SERVER from an x86 app but the registered .dll is a 64 bits library.
Is there a way to instantiate it by doing a trick? I mean... I see for example there is an undocumented SHCreateLocalServerRundll API that may be run using rundll32.exe but it's not documented...


Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,062 questions
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
2,888 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 32,031 Reputation points

    You can instantiate a 64-bit com server from a 32-bit client if the server is an out-of-process server. A COM server hosted in a 64-bit DLL can be instantiated as an out-of-process server by using the system COM surrogate.

    Example usage update -
    The screenshot below shows a COM server hosted in a 64-bit DLL being instantiated by a 64-bit client directly and as an out-of-process server using the system's COM Surrogate.

    It also shows a 32-bit client failing when attempting to instantiate it as an in-process server but succeeding when using the COM surrogate to instantiate the 64-bit server as out-of-process.


    1 person found this answer helpful.
    0 comments No comments