CreateInstance Returns "The specified module could not be found."

2

I've been trying to get a program that worked on Windows 2000 to work on Windows 2003. Everything I've had to do so far to get the program to work on Windows 2003 has had to do with incorrect configuration. Right now, this piece of code:

chr = pAdapterEnvPtr.CreateInstance(__uuidof(PFADAPTERMNGLib::PFAdapterEnv));

is returning:

0x8007007E

or in other words:

The specified module could not be found.

I have two other programs and another .dll and I can successfully create instances of those classes. But this seems to fail.

I have used Procmon to try to figure out what the program can't find, but Procmon did not display anything that could indicate that the program could not find something.

In OleView, if I try to create an instance of the class, I see the following image:

IClassFactory::CreateInstance failed.  The specified module could not be found.  severity: SEVERITY_ERROR, facility: FACILITY_WIN32 ($8007007E

If you look on the left side of the image, trying to create an instance of PFComgMng gives me the same error. (PFAdapterEnv and PFCompMng use the same process, PFAdapterMng.exe.) However, PFMQMonitor, PFSend, and PFTrace all work correctly. (Which use PFMQListen.exe, PFSend.dll, and PFTraceService.exe.)

Another thing that I wanted to note is that the following piece of code:

hr = pPFCompMng.CreateInstance(__uuidof(PFADAPTERMNGLib::PFCompMng));

works perfectly fine when it gets called earlier from PFAdapterMng.exe. So it seems like PFAdapterMng.exe can successfully find the module and create the instance, but any other processes that try to create either of the instances of the classes within PFAdapterMng.exe can't find the module, resulting in this error.

Since Procmon isn't helping with this specific case, does anyone know what I could do to figure out what's keeping other processes from finding the module?

UPDATE:

I can't run Dependency Walker with profiling because PFAdapterMng.exe and PFTraceService.exe must be run as services. I tried to run Dependency Walker while profiling OleView and tried to create instances of PFAdapterEnv and PFCompMng to try to find out why I was getting the Module not found message box. Unfortunately, Dependency Walker didn't show that anything was missing.

UPDATE2:

Maybe I missed something in the Procmon log, so I created a new log by capturing events right before I stepped over the call to CreateInstance and right after the call. Maybe someone else could take a look and tell me if i missed it? I simply can't find any indications that PFMQListen.exe could not find something..

Here's a link to a zipped folder with a Procmon file, a .csv file, and a .xml file.

http://www.mediafire.com/?07jq8zj7emmpsvd

UPDATE3:

So, I managed to get Dependency Walker running under Profile mode to create an instance of PFAdapterEnv. Dependency Walker did not find any missing .dll's.

So, Procmon doesn't show anything, and neither does Dependency Walker. I was stepping through the code at the assembly level with ollydbg, and I noticed that the error was created in the function NdrClientCall2. I don't know if this means anything.

Any ideas as to what else I can try? Do people need more information to help me solve this problem? If so, please ask.

UPDATE4:

I tried using /RegServer to register the applications, and it worked. I tried using /RegServer previously, where I just unregistered everything using /UnregServer. This time, I also deleted the component from Component Services which I needed to have because I wanted to run PFAdapterMng under another identity.

So, it seems like everything works when running on /RegServer and double-clicking the applications. However, I would like everything to run under a different configuration.

How do I configure everything to get the applications to work as follows:

PFAdapterMng.exe - Register as /Service and run under another identity through services.msc PFTraceServer.exe - Register as /Service and run under another identity through services.msc

PFMQListen.exe - Register as /RegServer which will be started by PFAdapterMng PFMQSend.dll - Registered with Regsvr32 and loaded by PFAdapterMng

Thanks, Krzys

c++
com
windows-server-2003
com+
createinstance
asked on Stack Overflow Jul 30, 2011 by Krzysztof Czelusniak • edited Aug 12, 2019 by Glorfindel

1 Answer

0

My guess is that it is related to the search path of some DLL dependencies of the executable. You can try the "Dependency Walker" on every module to see if all DLL are available: http://www.dependencywalker.com/ And update the search PATH if needed.

answered on Stack Overflow Jul 30, 2011 by rodrigo

User contributions licensed under CC BY-SA 3.0