Hook.DLL: Using Memory Mapped file for two way communication?


I wrote a simple Hook DLL that communicates to its "creator process" with OpenFileMapping/MapViewOfFile during the DLL_PROCESS_ATTACH.  After hook DLL has written some data to the Memory mapped file, it uses PostMessage no notify the "creator process" that new data is available in memory mapped file.    When Posted Message arrives, creator just reads the input from file.

The communication is currently "one way" only, while I need two way communication.

My question is, what would be a best way to allow "creator process" easily respond true/false back to the Hook DLL (applications).  I checked using SendMessage instead of PostMessage  but it may be too slow..  I need to have a fast method.

 



TommiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

George TokasCommented:
As I understand you want a communication between applications...
Why making your life miserable and don't use sockets??
Drop a TServerSocket in one app and a TClientSocket to the other.
Select nonBlocking model, Host to "localhost" if they are about to run in the same PC, chose a port and communicate with AnsiStrings using the functions Socket->SendText() and Socket->ReceiveText()...

gtokas.
TommiAuthor Commented:

I prefer to use only Win32 calls, no any external libraries.


PS:   Sorry, actually this is not CBuilder question,  Its a General C++ question ,  but since there was no win32 or C++ category and I did not want to choose MFC category, I had to place my Q  here:

George TokasCommented:
There is a C++ TA...
Check out in the left under programming channels|Languages..
It's the third in a row right under C#...

gtokas.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

TommiAuthor Commented:
is there a way to change the category of this Q
George TokasCommented:
Use the following link and ask a moderator to change it..
http://www.experts-exchange.com/Community_Support/

gtokas.
George TokasCommented:
BTW...
Have you considered using a "simple" file instead of all these and check it both apps in a 1sec basis??
Use a byte at the start to declare locked from application and the ID of the application changed it...

gtokas.
TommiAuthor Commented:
Thanks, but  I will use Mutex  
TommiAuthor Commented:
Even better, I found the Global Atom Table, its faster option I think so I go for it
GranModCommented:
PAQed with points refunded (125)

GranMod
Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.