Solved

Regsvr32 Debug version of an OCX failed, why?

Posted on 2006-10-26
12
1,325 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:xyl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
12 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 17816735
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
 

Author Comment

by:xyl
ID: 17818121
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
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 17819844
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
 Watch the Recording: Learning MySQL 5.7

MySQL 5.7 has a lot of new features. If you've dabbled with an older version of MySQL, it is definitely worth learning.

 

Author Comment

by:xyl
ID: 17822336
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
 

Author Comment

by:xyl
ID: 17822566
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
 

Author Comment

by:xyl
ID: 17825112
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
 

Author Comment

by:xyl
ID: 17827732
I increased the point for experts who give me ideas. Please help.

xyl
0
 

Author Comment

by:xyl
ID: 17830589
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
 

Author Comment

by:xyl
ID: 17834261
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

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question