Can't register VC7 COM DLL on deployment machine

G

George Kustas

I have a VC7 COM+ DLL that is a dependency of a .net web service I am
trying to deploy. The regsvr32.exe failed to register the dll, so I
ran Depends.exe (on the deployment machine) to see what the problem
was.

Depends displayed an error:
Warning: At least one module has an unresolved import due to a missing
export function in a delay-load dependent module.

It highlighted mpr.dll, function WNetRestoreConnectionA as the
culprit. This appears to be an erroneous warning, because this dll
exists, and this entry point is there. mpr.dll on the deployment
machine is the same version and date as the same file on my
development machine (where I built the COM DLL). When running
Depends.exe on my development machine, I don't get this warning
either, and it registers fine.

Other info: I tried to register (regsvr32.exe) on two other machines
and the same failure occurs. It appears that the only machine that I
can register this DLL on is the machine that it was built. The same
erro messages occur in Depends.exe on these machines as well.

I really think there must be some defect in VC7 here... Can anyone
help?
 
C

Carl Daniel [VC++ MVP]

George said:
I really think there must be some defect in VC7 here... Can anyone
help?

What else does depends report?
Are you linking to the DLL runtime library?
Are you installing it with your application?
When regsvr32 fails, exactly what is the error message?

-cd
 
G

George Kustas

Thanks so much for responding. See answers inline...
What else does depends report?

This is the only error that depends reports.
Are you linking to the DLL runtime library?

Here is the entire linker command line:
/OUT:"Release/DSSWrap.dll" /INCREMENTAL:NO /NOLOGO /DLL
/IDLOUT:"_DSSWrap.idl" /DEBUG /PDB:"Release/DSSWrap.pdb"
/SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /IMPLIB:"Release/DSSWrap.lib"
/MACHINE:X86 comsvcs.lib kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
Are you installing it with your application?

I created an installer for may app using visual studio. This dll is a
dependency, so it installs it and tries to register it. I'm able to
reproduce the same problem running regsvr32.exe.
When regsvr32 fails, exactly what is the error message?

"DllRegisterServer failed. Return was 80070716"
 
C

Carl Daniel [VC++ MVP]

George said:
"DllRegisterServer failed. Return was 80070716"

This one is the key. 80070716 = HRESULT_FROM_WIN32(0x716).

0x716 = 1814. Looking in Winerror.h, we find:

//
// MessageId: ERROR_RESOURCE_NAME_NOT_FOUND
//
// MessageText:
//
// The specified resource name cannot be found in the image file.
//
#define ERROR_RESOURCE_NAME_NOT_FOUND 1814L

So the problem has something to do with a resource that's accessed by
DllMain or DllRegisterServer.

Question: What is the OS on the target machine? I'm betting that it's
Win9x, and that you have resource IDs greater than 32767 in your DLL. If
that's the case, the solution is to redo your resource IDs with numbers
below 32767, as higher numbers aren't supported on Win9x.

-cd
 
G

George Kustas

Question: What is the OS on the target machine? I'm betting that it's
Win9x, and that you have resource IDs greater than 32767 in your DLL. If
that's the case, the solution is to redo your resource IDs with numbers
below 32767, as higher numbers aren't supported on Win9x.

The target machine is the same OS as the build machine: Windows XP
Pro, same service levels.

HOWEVER: here is a snip from the resource.h file. Sure enough, there
is a high value generated by Visual Studio:
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201

Unfortunately, I change 32768 to 201, rebuilt, and alas, still get the
same error registering it. Any other ideas why I would get a resource
error?

Also worth noting: Whenever I build this DLL on my development
machine, the registration fails the first time after a compilation is
made. I have to do a second build, where no compilation takes place,
and the registration works. Odd, huh?
 
G

George Kustas

I finally did something I should have done two days ago (no, not shoot
myself). I completely rebuilt the project from scratch: let the studio
create my COM+ components, and copy/pasted the original COM cpp and h
files into the new project. Everything works okay now. Don't know why,
don't care - who knows what evil lurks in the heart of Visual
Studio...

Sorry to have wasted your time with this one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top