TVicCommSpy

Copyright (c) Victor Ishikeev, 2001

EnTech Taiwan

http://www.entechtaiwan.com/tools.htm

The TVicCommSpy is a programmer's toolkit allowing you to create Win32 application that monitors all serial port activity on a system. With TVicCommSpy you can hook any COM port(s) on your PC to see what another application sends to or receives from a hooked COM port(s).

The main parts of TVicCommSpy package are:

  • The drivers to capture serial port activity:

    • TVicComm.vxd - the dynamically loaded virtual device driver (VxD) for Windows 95/98/ME
    • TVicComm.sys - the kernel-mode driver for Windows NT/2000/XP

  • The interface modules to communicate between the drivers and Win32 application:
    • TVicCommSpy VCL Component for Borland Delphi or C++Builder (TVicCommUnit.pas)
    • TVicCommSpy class for using in C++ language (VicCommSpy.cpp and VicCommSpy.h)
    • TVicCommSpy ActiveX Control for using in Visual Basic applications (TVicCommSpy.ocx)

  • The sample code library in the following directories:
    • \TestMsvc\ - Microsoft Visual C++ 6.0 project (TestMsvc.dsp)
    • \Delphi\ - Borland Delphi project (CommSpy.dpr)
    • \CBuilder\ - Borland C++Builder project (SpyTest.mak - load as an "Old BCB 1.0 project")
    • \VB\ - Microsoft Visual Basic 6.0 project (CommSpy.vbp)

  • The documentation, including this help-file


Installation

There is two parts of installation procedure: common installlation and compiler-specific installation.

You must do following to execute the common part of installation procedure:

  • Download, unpack and run the executable installation file
  • Follow the instructions on the screen. The installation applet will automatically detect the operating system and install the correct drivers. The TVicComm-based sample applications are now ready to compile and run.
  • To remove TVicComm from the system, go to the control-panel, click on "add/remove programs" and then select "TVicComm"

The second part of the instalation procedure is dependent on what development (programming) enviroment are you using:

  • Borland Delphi 2.0: Menu->Component->Install->Add->Browse to "TVicCommUntit.pas" file->OK
  • Borland Delphi 3.0-6.0: Menu->Install Component->Into New Package (choose name), Unit File Name "TVicCommUnit.pas"->OK
  • Borland C++Builder 1.0: Menu->Component->Install->Add->Browse to "TVicCommUnit.pas" file->OK
  • Borland C++Builder 2.0-5.0: Menu->Install Component->Into New Package (choose name), Unit File Name "TVicCommUnit.pas"->OK
  • Microsoft Visual Basic 6.0: Register TVicCommSpy.OCX "regsvr32 TVicCommSpy.ocx" then add "TVicCommSpy ActiveX Control" to the components palette
  • Microsoft Visual C++ 6.0: No installlation required, just include VicCommSpy.cpp and VicCommSpy.h files to your current project.


Licensing and Registration

TVicCommSpy License Agreement

You should carefully read the following terms and conditions before using this software. Your use of this software indicates your acceptance of this license agreement and warranty .

TVicCommSpy Shareware License (Unregistered)

TVicCommSpy Single License

TVicCommSpy Commercial License

TVicCommSpy Shareware License (Unregistered)

You may use a Shareware Copy of this Software for an evaluation period of to 30 days, in order to determine whether the Software meets your needs before purchasing it. Once the evaluation period ends, you agree to either purchase a Registered Copy of the Software, or to stop using it and remove from your computer system. If you have ordered a Registered Copy of the Software, you may continue to use your Shareware Copy until your Registered Copy arrives.

You must not:

  • defeat, or try to defeat, messages in the Software which encourage users to register;
  • modify or prepare derivative works of the Software;
  • or reverse engineer, decompile or disassemble the Software.

You are hereby granted the right:

  • to make as many copies of this software and its documentation as you wish;
  • give exact copies (including all files) of the original version to anyone;
  • and distribute the software and documentation in its unmodified form via electronic means.

There is no charge for any of the above.

You are specifically prohibited from charging, or requesting donations, for any such copies (a small handling fee is acceptable). You are further prohibited from distributing the software and/or documentation with other products (commercial or otherwise) without prior written permission.

TVicCommSpy Single License

Once registered, you are granted a non-exclusive license to use TVicCommSpy on one computer at a time, for any legal purpose. The TVicCommSpy software is in "use" on a computer when it is loaded into temporary memory (i.e., RAM) or installed into permanent memory (e.g., hard disk or CD-ROM) of that computer. However, installation on a network server for the sole purpose of distribution to one or more other computer(s) shall not constitute "use" for which a separate license is required.

You have not rights to distribute TVicCommSpy drivers and/or TVicCommSpy ActiveX Control (OCX) as part of your software.

To

TVicCommSpy Commercial (World Wide) License

EnTech Taiwan grants you a non-exclusive royalty-free right to reproduce, rename and distribute the TVicCommSpy drivers (tviccomm.sys or tviccomm.vxd) and the tviccommspy.ocx file provided, that you:

  • (a) distribute the driver only in conjunction with and as a part of your software Product which adds significant and primary functionality to the redistributable components;
  • (b) agree to indemnify, hold harmless, and defend EnTech Taiwan and its suppliers from and against any claims or lawsuits, including attorney's fees, that arise or result from the use or distribution of your software Product;
  • (c) do not ship any documentation or source code which demonstrates, explains or uses calls to the drivers; and
  • (d) do not permit further distribution of the drivers by your end user.


Legal Disclamier

Legal Disclaimer

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

IN NO EVENT WILL THE AUTHOR OR ANY OTHER PARTY WHO MAY HAVE DISTRIBUTED THE SOFTWARE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR ONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


TVicCommSpy

TVicCommSpy component

TVicCommSpy is the Delphi/BC++Builder component that monitors all serial port(s) activity on a system.

Unit TVicCommUnit;

Definition

TVicCommSpy = class(TComponent);
TVicCommSpy properties
TVicCommSpy methods
TVicCommSpy events


TVicCommSpy, Properties

Properties

TVicCommSpy


TVicCommSpy.PollInterval

Definition:

published property PollInterval: Integer read write default 50;

Description

The PollInterval property determines in milliseconds the amount of time that passes before the TVicCommSpy initiates another request to the driver data to determine if the new sent and/or received data are available. The default value is 50 milliseconds.

Usually you not need to change this value.


TVicCommSpy.IsHooked

Definition:

public property IsHooked[Index: Byte]: Boolean read;

Description:

Run-time only. Use the IsHooked array property to know if the COM<Index> port was hooked or not. The first item has an index of 1 (COM1), the second an index of 2 (COM2), and so on.


TVicCommSpy, Methods

Methods

TVicCommSpy

Create (costructor)
 Destroy (destructor)
 Hook
Unhook


TVicCommSpy.Create

Definition:

public constructor Create(owner: TComponent); override;

Description:

Call Create to create and initialize a TVicCommSpy component at runtime. TVicCommSpy objects placed at design time are created automatically.
After calling the inherited constructor, Create initializes all internal variables. No drivers have been opened at this time.


TVicCommSpy.Destroy

Definition:

public destructor Destroy; override;

Description:

Destroy unhooks all hooked COM ports then closes the driver.
Do not call Destroy directly in an application. Instead, call Free. Free verifies that the TVicCommSpy is not already freed, and only then calls Destroy .


TVicCommSpy.Hook

Definition :

public procedure Hook(PortNumber: Byte);

Description:

Call Hook method to initiate the COM port spying process. Now, all input/output activity of selected COM port will be hooked in OnSent and OnReceived events. Opens the driver if not opened.


TVicCommSpy.Unhook

Definition:

public procedure Unhook(PortNumber: Byte);

Description:

Unhooks a COM port which have been hooked by Hook method.


TVicCommSpy, Events

Events

TVicCommSpy


TVicCommSpy.OnReceived

Definition:

type TSpyNotifyHandler = procedure(ComNumber: Byte; sValue: string) of object;

published property OnReceived: TSpyNotifyHandler read write;

Description

The event is activated when a new data packet arrives from a hooked COM port.

Parameters:
ComNumber - the COM port number
sValue - Pascal-style string which contains the data arrived from a COM port


TVicCommSpy.OnSent

Definition:

type TSpyNotifyHandler = procedure(ComNumber: Byte; sValue: string) of object;

published property OnSent: TSpyNotifyHandler read write;

Description

The event is activated when a new data packet was sent to the hooked COM port.

Parameters:
ComNumber - the COM port number
sValue - Pascal-style string which contains the data sent to the COM port


TVicCommSpy

TVicCommSpy C++ Class

TVicCommSpy is simple C++ class that allows monitors all serial port(s) activity on a system.

interface: VicCommSpy.h

implementation: VicCommSpy.cpp


TVicCommSpy.Create

TVicCommSpy Constructor

Definition:

TVicCommSpy::TVicCommSpy()

Description:

Creates a TVicCommSpy class instance at runtime. The initializes all internal variables. No drivers have been opened at this time.


TVicCommSpy.Destroy

TVicCommSpy Destructor

Definition:

TVicCommSpy::~TVicCommSpy()

Description:

Unhooks all hooked COM ports then closes the driver.


TVicCommSpy.Hook

Hook method

Definition :

void TVicCommSpy::Hook (UCHAR PortNumber)

Description:

Call Hook method to initiate the COM port spying process. Now, all input/output activity of selected COM port will be hooked in OnSent and OnReceived methods.

Parameters:

UCHAR PortNumber - the COM port number to hook


TVicCommSpy.Unhook

Unhook method

Definition:

void TVicCommSpy::Unhook(UCHAR PortNumber)

Description:

Unhooks a COM port which has been previously hooked by Hook method.

Parameters:

UCHAR PortNumber - the COM port number to unhook


TVicCommSpy.IsHooked

IsHooked method

Definition:

bool TVicCommSpy::IsHooked(UCHAR PortNumber)

Description:

Check if the COM port is already hooked or not.


TVicCommSpy.OnReceived

OnReceived method

Definition:

virtual void TVicCommSpy::OnReceived (UCHAR PortNumber, char * buff, int buflen);

Description

You must override this virtual method to see when a new data packet arrived from a hooked COM port.

Parameters:
ComNumber - the COM port number
buff - pointer to the buffer that contains the data arrived from the hooked COM port
buflen - number of bytes.


TVicCommSpy.OnSent

OnSent method

Definition:

virtual void TVicCommSpy::OnReceived (UCHAR PortNumber, char * buff, int buflen);

Description:

You must override this virtual method to see when a new data packet was sent to the hooked COM port.

Parameters:
ComNumber - the COM port number
buff - pointer to the buffer that contains the data sent to the hooked COM port
buflen - number of bytes.


TVicCommSpy

TVicCommSpy ActiveX Control (OCX)

TVicCommSpy.ocx is an ActiveX Control Module allows monitors all serial port(s) activity on a system.


TVicCommSpy.Hook

Hook method

VB syntax: object.Hook ComPortNumber

C++ syntax: object.Hook(ComPortNumber);

Delphi syntax: object.Hook(ComPortNumber);

Description:

Call Hook method to initiate the COM port spying process. Now, all input/output activity of selected COM port will be hooked in OnSent and OnReceived methods.

Parameters:

PortNumber - the COM port number to hook


TVicCommSpy.IsHooked

IsHooked property

Definition:

VB syntax: object.IsHooked(ComPortNumber)

C++ syntax: object.IsHooked(ComPortNumber);

Delphi syntax: object.IsHooked(ComPortNumber);

Description:

Use the IsHooked property to know if the COM<Index> port was hooked or not. The first item has an index of 1 (COM1), the second an index of 2 (COM2), and so on.


TVicCommSpy.Unhook

Unhook method

Definition:

VB syntax: object.Unhook ComPortNumber

C++ syntax : object.Unhook (ComPortNumber);

Delphi syntax : object.Unhook (ComPortNumber);

Description:

Unhooks a COM port which has been previously hooked by Hook method.

Parameters:

PortNumber - the COM port number to unhook


TVicCommSpy.OnReceived

OnReceived Event

Definition:

VB syntax: Sub object_OnReceived(ByVal PortNumber As Integer, ByVal Buffer As Variant, ByVal BufLen As Integer)

MFC syntax: ::OnReceived(USHORT PortNumber, VARIANT Buffer, USHORT BufLen);

Delphi syntax: procedure object.OnReceived ( PortNumber: Word; Buffer: VARIANT; BufLen: Word);

Description:

The event is fired when a new data packet arrives from a hooked COM port.

Parameters:
ComNumber - the COM port number
Buffer - buffer that contains the data arrived from the hooked COM port
BufLen - number of bytes in Buffer.


TVicCommSpy.OnSent

OnSent Event

Definition:

VB syntax: Sub object_OnSent (ByVal PortNumber As Integer, ByVal Buffer As Variant, ByVal BufLen As Integer)

MFC syntax: ::OnSent (USHORT PortNumber, VARIANT Buffer, USHORT BufLen);

Delphi syntax: procedure object.OnSent ( PortNumber: Word; Buffer: VARIANT; BufLen: Word);

Description:

The event is fired when a new data packet arrives from a hooked COM port.

Parameters:
ComNumber - the COM port number
Buffer - buffer that contains the data sent to the hooked COM port
BufLen - number of bytes in Buffer.


TVicCommSpy.UnhookAll

TVicCommSpy Methods See Also

* Write short description *

Unit TVicCommUnit;

Definition

public
procedure UnhookAll;

Description
* Write description *

See Also
* Write see also *


Description of the unit TVicCommUnit. Indexes

Previous

Indexes

See Also TVicCommUnit

G H I O P S T U V Y

GetDebugPointer 1
Hook 1
IsHooked 1
OnReceived 1
OnSent 1
PollInterval 1
pTypeSharedBuffer 1
SpyNotifyHandler 1
TSpyNotifyHandler 1
TVicCommSpy 1
Events 1
Hierarchy 1
Methods 1
Properties 1
Create 1
Destroy 1
GetDebugPointer 1
Hook 1
IsHooked 1
OnReceived 1
OnSent 1
PollInterval 1
Unhook 1
UnhookAll 1
TVicCommUnit 1
TypeSharedBuffer 1
Unhook 1
UnhookAll 1
VicCommSpy 1
ypeSharedBuffer 1

Previous


Description of the unit TVicCommUnit. Contents

Unit TVicCommUnit
Types
pTypeSharedBuffer
TSpyNotifyHandler
TypeSharedBuffer
Classes
TVicCommSpy