Link to home
Start Free TrialLog in
Avatar of xyl
xyl

asked on

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
Avatar of jkr
jkr
Flag of Germany image

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.
Avatar of xyl
xyl

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xyl

ASKER

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
Avatar of xyl

ASKER

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
Avatar of xyl

ASKER

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
Avatar of xyl

ASKER

I increased the point for experts who give me ideas. Please help.

xyl
Avatar of xyl

ASKER

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
Avatar of xyl

ASKER

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