• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

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.

 



0
Tommi
Asked:
Tommi
  • 4
  • 4
1 Solution
 
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.
0
 
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:

0
 
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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

gtokas.
0
 
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.
0
 
TommiAuthor Commented:
Thanks, but  I will use Mutex  
0
 
TommiAuthor Commented:
Even better, I found the Global Atom Table, its faster option I think so I go for it
0
 
GranModCommented:
PAQed with points refunded (125)

GranMod
Community Support Moderator
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now