Solved

Regsvr32 Debug version of an OCX failed, why?

Posted on 2006-10-26
12
1,309 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to calculate times for developing software? 8 67
Importing Special Characters in Dynamics GP Through Integration Manager 3 75
sum28 challenge 31 111
Message not shown 5 49
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

786 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