Regsvr32 Debug version of an OCX failed, why?

Hi There,

I am working with the old OCX libraries. Development environment: Windows XP/Sp2 + Visual Studio 6.0 / Sp6.

When I was registering for the debug version of my OCX library using regsvr32, it failed and result of debug points to:

BOOL COleLinkingDoc::RegisterIfServerAttached(LPCTSTR lpszPathName, BOOL bMessage)

The lpszPathName that is my OCX file name is empty; although I am sure the path name has been sent to the regsvr32.

I tried to register the same OCX file in my code:

// Start of the code /////////

#ifdef _WIN32
      // this call failed because file path is empty when it is passed to COleLinkingDoc::RegisterIfServerAttached  function even I send a const string!
      // Note that if it is release version, it works fine
      HINSTANCE hDLL = LoadLibrary("C:\\MyOcx\\Debug\\MyLib.ocx");
            if(NULL == hDLL)
           {
               // See Winerror.h for explaination of error code.
               DWORD error = GetLastError();
               TRACE1("LoadLibrary() Failed with: %i\n", error);
           }
#endif
//
/////////End of code ////////

Could anybody here tell me why the problem occurs and how to get rid of it?

Thank you,

xyl
xylAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
Hm, I'd try to run the 'regsvr32.exe' command in the DependencyWalker (www.dependencywalker.com) in 'Profile' mode to see what's happening behind the scenes. Go to 'File|Open...', select 'regsvr32.exe'. The go to 'Profile|Starr profiling...' and set the appropriate arguments and settings, then push 'OK' and watch the log.
0
 
jkrCommented:
If you are trying that on a system that does not have VC++ installed, the debug DLLs won't be available, thus the error. A Debug build needs the counterparts of the debug runtime to be present, which is not authorized as "redistributable" by MS.
0
 
xylAuthor Commented:
That is not my case. regsvr32 fails on the computer built it (VS 6.0+Sp6 on WinXP).

Thank you for the response. Any more idea?

xyl
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
xylAuthor Commented:
I have installed the DependencyWalker(version 2.1.3623), it presents more info on a DLL than version 1.0 that I was using previously.

According to suggestion of jkr (it is a great idea, thank you, jkr!),
I found two files DWMAPI.DLL and MFC42LOC.DLL are missing in my system, and FOUR other files (KERNEL32.DLL, MPR.DLL, MSCTFIME.IME, SHLWAPI.DLL) are in question (marked as red). Is it possible for me to download the files being missing and being in question from the Internet? Or could somebody send me copies of them? I really want to resolve the problem, although I am not sure if the files cause the failure of the registration.

Thank you,

xyl
0
 
xylAuthor Commented:
The error message for loading my ocx is as below:
LoadLibraryExW("myOcx.ocx", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: Invalid access to memory location (998).

I am using my computer as an administrator and have highest privilege on it.

Any idea?

Thank you,

xyl
0
 
xylAuthor Commented:
More info about my problem:

If the myOcx.ocx is in its debug directory, the error info:
LoadLibraryExW("myOcx.ocx", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: Invalid access to memory location (998).

If the file is copied into C:\WOMDOWS\system32, then loaded with the dependency walker, the error info is:
LoadLibraryExW("myOcx.ocx", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).

Could anyone tell me why the error messages are deferent upon on deferent location?

Thank you,

xyl
0
 
xylAuthor Commented:
I increased the point for experts who give me ideas. Please help.

xyl
0
 
xylAuthor Commented:
Hi there,

Please let me know if my question is too dificult and if it is possible to debug applications using  Ocx/Dll under WindowsXP/VS 6.0?

xyl
0
 
xylAuthor Commented:
OK, I resolved the problem by myself.

The message "Invalid access to local memory location" is really misleading. The problem I has was the OCX failed in registration has dependencies on other libraries. One of library was wrong version of it. That caused the problem.

Thank you for your help,

xyl
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.