Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incorrect ComCtl32.dll is loaded after porting a project from Win32 to x64 platform in Visual Studio 2010

I have ported a project from Win32 to x64 platform. I changed all dependencies so I can build the project smoothly. However, as soon I start the executable I'm getting an error (0xc000007b).

Using the dependency walker I can see, that at a certain point the ComCTL32.dll is loaded but the x86 and not the x64 as expected.

As soon I turn of the manifest generation (linker->Manifestfile), it works. But that's not a solution.

So my question is: Where in Visual Studio 2010 can I set the path to the correct DLL ComCtl32.dll.

like image 299
GregPhil Avatar asked Jun 10 '14 18:06

GregPhil


People also ask

How do I change from x86 to x64 in Visual Studio?

From the BUILD menu in Visual Studio, select Configuration Manager. From the Active solution platform drop-down list, select New. The New Solution Platform dialog displays. In the Type or select new platform combination box, select x64.

How do I run Visual Studio in 64 bit mode?

From the Visual Studio menu, choose Test, then choose Processor Architecture for AnyCPU projects. Choose x64 to run the tests as a 64-bit process.

What is COMCTL32 DLL used for?

DLL. COMCTL32. DLL implements a wide variety of standard Windows controls, such as File Open, Save, and Save As dialogs, progress bars, and list views.


2 Answers

Well, the manifest matters. An example of a bad one that could cause this problem would look like this:

<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="x86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>

The processerArchitecture attribute value matters. A good one uses *, which means compatible or amd64, which means 64-bit.

like image 89
Hans Passant Avatar answered Oct 11 '22 14:10

Hans Passant


You don't set the path anywhere. You specify a manifest to indicate which version of ComCtrl you want, and then it is up to the OS to find it, like any other DLL. The error you are seeing means a 64bit process is trying to load a 32bit DLL, or vice versa. That could be a search path issue, that could be a dependancy issue. Use a tool like DependancyWalker to find the culprit.

like image 43
Remy Lebeau Avatar answered Oct 11 '22 15:10

Remy Lebeau