Solved

Regsvr32 Debug version of an OCX failed, why?

Posted on 2006-10-26
12
1,299 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
 

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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
fizzArray2 challenge 1 58
isEverywhere  challenge 19 64
matchUp  challenge 9 71
mapAB Challlenge 35 85
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now