VitoPlantamura.com logo - Click here to go to the site home page... Click here to go to the site home page... Click here to go to the Blog page... Click here to go to the archives page... Click here to go to the about page...
"extremely impressive work"
- Mark Russinovich, www.sysinternals.com
(referring to my BugChecker)
my face...
Homepage of Vito Plantamura (@), Windows Researcher, VPC Technologies SRL CEO. [user=Guest] - updated: August 08, 2007
 WMCOPYDATA CLIENT/SERVER IPC CLASS
WMCOPYDATA CLIENT/SERVER IPC CLASS

INTRODUCTION

The CWmCopyDataPeer class is a class I have used in more than one project of mine in the past. It should be enough tested for being used with confidence in other projects as well. If you have suggestions and/or corrections about this implementation, please feel free to write to me.

It is intended expressly for client/server IPC purposes: in fact the server code waits and accepts only one connection from the corresponding peer. Consider that the inherent nature of Windows messages and their handling mechanism does NOT allow the use of this class for inter-machine exchange of data purposes: it is suitable only for inter-process communication on the same machine where authentication isn't strictly a issue. One method that can be implemented in order to provide a basic authentication mechanism in this class could be to derive the Process ID from the provided HWND associated to an incoming message and then to do authorization checks on the user account name and/or on the process privileges associated to that sending process.

TYPE DEFINITION DETAILS

class CWmCopyDataPeer
{
      // construction.
      CWmCopyDataPeer ( HINSTANCE hiModuleInstance, BOOL bIsClient, charstring& strChannelName, PFNRECV pfnRecvCallback, DWORD dwRecvCallbackParam );
 
      // methods.
      BOOL Connect ();
      void Disconnect ();
      int Send ( CONST BYTE* pbBuffer, int nBufferSize, HWND hwnd = NULL, DWORD* pdwRetVal = NULL );
      DWORD Broadcast( CONST BYTE* pbBuffer, int nBufferSize );
      BOOL FindPeer ( BOOL force = FALSE );
};

HOW TO USE

Simply instantiate the class and then call the Connect method. Each channel is identified by the class name of its receiving window, which is created and managed from a dedicated thread that is started by the the Connect method.

REQUIRED DEFINITIONS

All my IPC classes use STL under the hood. Be sure to include the following definitions BEFORE the definitions of all my IPC types:

// Stl Stuff.
 
#include <string>
#include <vector>
#include <map>
typedef std::basic_string< CHAR > charstring;
typedef std::vector< charstring > charstring_vector;
typedef std::basic_string< WCHAR > widestring;
typedef std::vector< widestring > widestring_vector;

ACTUAL CODE

WmCopyData_code.h

 Quotes
"Among the Windows experts I know personally, no one can beat Vito Plantamura."
- Francesco Balena, Code Architects SRL

"Your NDIS Monitor application, is amongst the most impressive networking code I have seen on the .Net framework."
- Ben Hakim.
 Photos
Various images from italian conferences and events (keep the mouse on a thumbnail for a short description):
Me at the Microsoft/HP/Intel organized Route64 event in Milan in May 2005, explaining how COM+ behaves on 64-bit Microsoft operating systems. I was there with the friends of Code Architects.
Me at the Microsoft Security Roadshow event in Bari in April 2006, explaining how the logon process works in Windows NT. There were 250 attendees.
Microsoft Security Roadshow 2006 in Treviso. This is an image of the huge 700-seats conference room.
Me at the Microsoft Security Roadshow 2006 in Treviso. This is a moment of the 3-hours session.
 Site login
NOTE: Actually the login feature is used only for administrative and content management purposes.
Username

Password

Everything here (code, binaries, text, graphics, design, html) is © 2010 Vito Plantamura and VPC Technologies SRL (VATID: IT06203700965).
If you download something (compilable or not) from the site, you should read the license policy file.
If you want to contact me via email, write at this address.