Solved

while calling a C++ COM empty function,getting error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.""

Posted on 2013-06-19
6
377 Views
Last Modified: 2013-06-23
Hello All

While calling a C++ COM empty function,getting error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.""

Please help.
0
Comment
Question by:BYTECHINDIA
  • 2
  • 2
  • 2
6 Comments
 
LVL 16

Assisted Solution

by:George Tokas
George Tokas earned 333 total points
ID: 39261254
Most likely the COM object is not created and you are calling a member function on a non-initialized component...
Try adding a breakpoint at the line raizing the exception and examine the components handler...
This message looks like from managed code so you will see a description "no valid...(something)" or something similar...

George Tokas.
0
 

Author Comment

by:BYTECHINDIA
ID: 39262037
Now when we have changed the location to other server and run the application in c# which is basically calling c++COM DLL empty function,getting error "Exception from HRESULT: 0xC0000005 ",no other detail is coming.I am not able to find out that whether this is from C# code or from c++ DLL.
0
 
LVL 16

Assisted Solution

by:George Tokas
George Tokas earned 333 total points
ID: 39262084
0xC0000005 is access violation code caused from what I described earlier but also an attempt to call a method on a released object...
Exception from HRESULT means that it is something like that:
HRESULT hr = NULL;
hr = functionfromdll();
functionfromdll() is calling a method or function on a NON existent component, it is not just an empty com function...
That means that the dll has to export a creation (new instance of the component) somehow...
In a very few words you are missing a function call needed to create and init the com object...

George Tokas.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 32

Accepted Solution

by:
sarabande earned 167 total points
ID: 39262145
what do you mean by 'COM empty function'?

generally, the error you reported is when using a com pointer that is not valid, or that is not fully initialized, or that was no more valid because of an unsuccessful call before. normally you can avoid those errors by always verifying com objects before use.

Sara
0
 
LVL 32

Expert Comment

by:sarabande
ID: 39262265
access violation is pointer error. so it is more likely to happen in c++ dll.

can you run the program in debug mode from visual studio ide?

Sara
0
 

Author Closing Comment

by:BYTECHINDIA
ID: 39269648
Thanks to all..
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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

744 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

12 Experts available now in Live!

Get 1:1 Help Now