Docsity

CSE775 Project 1: Inter-process Communication using WM_CopyData or Memory-Mapped Files - P, Study Guides, Projects, Research of Engineering

Toggle sidebar
bg1
CSE775 – Distributed Objects
Spring 2009
Project #1 – Inter-process Communication due
Monday, Feb 09
Purpose:
In this project you will develop a structured form of inter-process communication and will use that facility to
build a test logger that accepts asynchronous requests to log information generated in another process.
Essentially we will be piping data from the monitored process to the logging process during test runs, and
piping summary information back at the end of the test.
The availability of inter-process communication facilities encourage the partitioning of programs across
address spaces and, if the facility supports it, across machines. This has three advantages: 1) the partitions
are isolated by process boundaries, so an exception in one process need not bring down the whole system,
2) new process code can be added to extend the system with little impact on the design of the rest of the
system, and 3) management of process resources can use different policies in each of the processes. If this
sounds familiar, it should. Application Domains are used in managed code for the same reasons.
Windows provides several means for inter-process communication, e.g., Windows messaging using
WM_CopyData, shared memory via Memory-Mapped Files, Named Pipes, and Sockets. COM supports RPC
communication, and .Net managed code supports Remoting and Windows Communication Foundation. In
this project you are asked to use either WM_CopyData messages or a Memory-Mapped File to achieve
communication between two processes in the same machine1.
Requirements:
Your InterprocComm project:
1. shall use standard C++2 and the standard library, compile and link from the command line, using VC+
+ 8.0, as provided in the ECS clusters and operate in the environment provided there3.
2. shall support asynchronous sending of time- stamped XML messages between two processes.
3. shall enqueue messages on the sending side, provide a dedicated sending thread to dequeue each
message, and rendezvous with the receiving process using a synchronized transfer.
4. shall provide an executive program and a logging program.
5. The executive program shall create a Win32 Window that has a button control to start the logging
process, a checkbox to indicate whether logged data is to be save in a file, an EditBox to provide the log
file name, and an EditBox control to display a summary of the logged data, explained below. The
executive shall encode each of its windows messages as an IPC XML message and send to the logger.
Thus, if the user moves the mouse across the window, the logger will display a sequence of mouse
move messages. If the user clicks the logger button while the logger is running the executive will
send the logger a request to terminate.
6. The logger program shall create a Win32 Window that has an EditBox to display messages. New
messages should appear at the top of the EditBox display. If the executive process sends a termination
message the logger will return a list of all of the windows messages it received and their counts. It then
terminates.
You will find the following references useful for this project:
1. Memory Mapped files
http://msdn2.microsoft.com/en-us/library/ms810613.aspx
1 You may also provide machine to machine communication using sockets as a bonus activity. If you do
that, please provide the same interface for both forms of IPC.
2 This means, for example that you may not use the .Net managed C++/CLI.
3 VC++ version 8.0 is Visual Studio .Net and is available in all the ECS clusters.
pf2

Partial preview of the text

Download CSE775 Project 1: Inter-process Communication using WM_CopyData or Memory-Mapped Files - P and more Study Guides, Projects, Research Engineering in PDF only on Docsity!

CSE775 – Distributed Objects

Spring 2009

Project #1 – Inter-process Communication due

Monday, Feb 09

Purpose:

In this project you will develop a structured form of inter-process communication and will use that facility to build a test logger that accepts asynchronous requests to log information generated in another process. Essentially we will be piping data from the monitored process to the logging process during test runs, and piping summary information back at the end of the test. The availability of inter-process communication facilities encourage the partitioning of programs across address spaces and, if the facility supports it, across machines. This has three advantages: 1) the partitions are isolated by process boundaries, so an exception in one process need not bring down the whole system,

  1. new process code can be added to extend the system with little impact on the design of the rest of the system, and 3) management of process resources can use different policies in each of the processes. If this sounds familiar, it should. Application Domains are used in managed code for the same reasons. Windows provides several means for inter-process communication, e.g., Windows messaging using WM_CopyData, shared memory via Memory-Mapped Files, Named Pipes, and Sockets. COM supports RPC communication, and .Net managed code supports Remoting and Windows Communication Foundation. In this project you are asked to use either WM_CopyData messages or a Memory-Mapped File to achieve communication between two processes in the same machine^1.

Requirements:

Your InterprocComm project:

  1. shall use standard C++^2 and the standard library, compile and link from the command line, using VC+
    • 8.0, as provided in the ECS clusters and operate in the environment provided there^3.
  2. shall support asynchronous sending of time-stamped XML messages between two processes.
  3. shall enqueue messages on the sending side, provide a dedicated sending thread to dequeue each message, and rendezvous with the receiving process using a synchronized transfer.
  4. shall provide an executive program and a logging program.
  5. The executive program shall create a Win32 Window that has a button control to start the logging process, a checkbox to indicate whether logged data is to be save in a file, an EditBox to provide the log file name, and an EditBox control to display a summary of the logged data, explained below. The executive shall encode each of its windows messages as an IPC XML message and send to the logger. Thus, if the user moves the mouse across the window, the logger will display a sequence of mouse move messages. If the user clicks the logger button while the logger is running the executive will send the logger a request to terminate.
  6. The logger program shall create a Win32 Window that has an EditBox to display messages. New messages should appear at the top of the EditBox display. If the executive process sends a termination message the logger will return a list of all of the windows messages it received and their counts. It then terminates. You will find the following references useful for this project:
  7. Memory Mapped files http://msdn2.microsoft.com/en-us/library/ms810613.aspx (^1) You may also provide machine to machine communication using sockets as a bonus activity. If you do that, please provide the same interface for both forms of IPC. (^2) This means, for example that you may not use the .Net managed C++/CLI. (^3) VC++ version 8.0 is Visual Studio .Net and is available in all the ECS clusters.

CSE775 – Distributed Objects Spring 2009

  1. Win32 API – FindWindow http://msdn2.microsoft.com/en-us/library/ms633499.aspx
  2. Win32 API - FindWindowEx http://msdn2.microsoft.com/en-us/library/ms633500(VS.85).aspx
  3. Win32 API - WM_CopyData http://msdn.microsoft.com/en-us/library/ms649011.aspx
  4. The following reference will not provide specific help for this project, but covers some interesting related ideas. Obviously the techniques described here could be used for unethical purposes, but it has constructive applications related to this project. Three Ways to Inject Your Code into Another Process http://www.codeproject.com/threads/winspy.asp