views:

404

answers:

6

I am building a project in VS2005 and several of my DLLs are failing to register. The error message I am getting in Visual Studio is:

Project : error PRJ0019: A tool returned an error code from "Registering ActiveX Control..."

which is nicely vague. When I register the DLL manually through the command line (using regsv32.exe, I get the following error:

LoadLibrary("test.ocx") failed - This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix the problem.

I ran Dependency Walker (depends.exe) on the culprit .ocx file but it isn't showing any obvious problems.

I have also done a re-build but I'm still getting the same problem.

Any suggestions as to how I could determine the cause of this failure to register?

+1  A: 

Probably the easiest way to troubleshoot this whole category of problem is to install Process Monitor from microsoft.com.

Process Montior lets you observe the system calls processes are making, and in this case you will be able to see if some system call is failing. For example, if you are lacking a dependency, then a CreateFile() call will be seen failing with a DLL, OCX, etc. as the filename.

Launch procmon and configure the filter to exclude events other than from regsvr32.exe, reproduce your test case, and then check the log. Look for NAME_NOT_FOUND errors in the return value column.

Heath Hunnicutt
Yes, so many problems can be diagnosed with just Process Monitor.
sharptooth
A: 

Do you have the C++ Redistributable Package Installed?

Matthew Talbert
I have it installed, but I have a feeling my company's patching system has pushed out an updated version of a redistributable DLL which is causing all of these headaches.
LeopardSkinPillBoxHat
+2  A: 

Most probable is because the embedded manifests. You should take a resource explorer application and check your DLLs for the embedded manifests. It might be that one of the dependent DLLs (or your DLL) require some versions of other DLLs which don't exists.

I got this message: "This application has failed to start because the application configuration is incorrect." in case of embedded manifest mistmatches.

Cătălin Pitiș
This seems like the most likely explanation so far - I think it has something to do with a patch which updated a DLL in a redistributable. Do you have any more information about how to check which version of the redistributable DLL my DLL is looking for?
LeopardSkinPillBoxHat
I know that I had problems with SP1 of VS2005, which changed the version of MSVCRT dlls. What I did is to check the dependencies (e.g. using dependency walker) and then take each DLL (including mine) and check the embedded manifest (if any) to see the version of the DLL and the needed version specified in the manifest of the dependent DLL. Most likely is because of standard library DLL patch. In case of mismatched versions, I was forced to rebuild those DLLs as well.
Cătălin Pitiș
A: 

There are several things you can try:

  • try regsvr32 w/ fusion log enabled (fuslogvw.exe - it works for unmanaged dlls as well). This would give you a bit more information than depends on what external dependencies are loaded, where are they loaded from and what errors were hit.
  • copy the .ocx and its dependencies to the root or a first level folder and try registering from there. I don't remember details, but there was an old problem with registering a COM dll from within too deep of a path.
  • run regsvr32 under WinDbg. Set a breakpoint DllMain and see if it does anything funky.
  • If you never break on DllMain in WinDbg, set a breakpoint on module load for your dll and once it's hit, you can either step through LoadLibrary, or just set a generic load library breakpoint and check every dll after that.
Franci Penov
+1  A: 

Microsoft had recently released a Security Update for ATL (KB971090). It is un update on top of MSVS2005sp1 and it's both compilate-time and runtime compatibility breaker. Check if your building environment has this patch.

References:

Andrey
+1 for the last link. This is the explanation; I have changed the accepted answer to this one now.
LeopardSkinPillBoxHat
A: 

i downloaded opera 10 and it gave me a warning sayin that my msimg32 is missing or too old and get a library from win98mill installation but what do i do?

ty