dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: C++
Expertise: Beginner
Jan 11, 2000

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


NT Sharing C++ Objects Through Memory Mapped Files

Question:
I am writing a Microsoft ISAPI-based application using MFC classes. We need to get access to some of the objects used within the application from an NT service.

I tried using Memory mapped files, backed by the System Paging file to achieve this —all looks ok, and we can retrieve a pointer to the object from the second process—however, any ASSERT_VALID() call fails with a report of an invalid vtable. I can understand why this is happening, but is there any way to 'repair' the class from the second process, and create a valid vtable?

Answer:
Unfortunately, the value of the vfptr (which is a pointer to a compiler-generated table that contains the memory addresses of a class's virtual member functions) is valid only within the address space of its process.

You cannot access it from another process safely. If you wish to call a virtual function from another process, there's no escape from using non-standard features such as COM, CORBA or any other forms of distributed objects.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date