Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

An Adventure: How to implement a Firewall-Hook Driver?

, 28 Oct 2004
Firewall-Hook driver is a completely unknown method to develop simple packet filtering applications. With this article, I want to tell you how this driver works and what you need to do to use it in your applications.
fwhookdrv_bin.zip
FirewallApp.exe
FwHookDrv.sys
fwhookdrv_src.zip
FirewallHooK
FirewallApp.dsp
FirewallApp.dsw
res
CVS
Entries
Entries.Extra
Repository
Root
FirewallApp.ico
FirewallAppDoc.ico
newtoolbar.bmp
Toolbar.bmp
Driver
buildchk_wxp_x86.log
Debug
FwHookDrv.sys
vc60.idb
FwHookDrv.dsp
FwHookDrv.dsw
makefile
objchk_wxp_x86
i386
fwhookdrv.obj
FwHookDrv.pdb
FwHookDrv.sys
_objects.mac
sources
FwHookDrv.sys
FirewallApp.exe
/*

  FwHookDrv.H

  Author: Jes�s O.
  Last Updated : 12/09/03 
  
*/


//
// Define the various device type values.  Note that values used by Microsoft
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
// by customers.
//
// Device type
#define FILE_DEVICE_FWHOOKDRV  0x00692322


#define FWHOOKDRV_IOCTL_INDEX  0x830


// IOCTLs
#define START_IP_HOOK CTL_CODE(FILE_DEVICE_FWHOOKDRV, FWHOOKDRV_IOCTL_INDEX,METHOD_BUFFERED, FILE_ANY_ACCESS)

#define STOP_IP_HOOK CTL_CODE(FILE_DEVICE_FWHOOKDRV, FWHOOKDRV_IOCTL_INDEX+1, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define ADD_FILTER CTL_CODE(FILE_DEVICE_FWHOOKDRV, FWHOOKDRV_IOCTL_INDEX+2, METHOD_BUFFERED, FILE_WRITE_ACCESS)

#define CLEAR_FILTER CTL_CODE(FILE_DEVICE_FWHOOKDRV, FWHOOKDRV_IOCTL_INDEX+3, METHOD_BUFFERED, FILE_ANY_ACCESS)



// Structure to define filter rules
typedef struct filter
{
	USHORT protocol;		// Protocol

	ULONG sourceIp;			// Source Ip
	ULONG destinationIp;	// Destination Ip

	ULONG sourceMask;		// Source Ip mask
	ULONG destinationMask;	// Destination Ip mask

	USHORT sourcePort;		// Source port
	USHORT destinationPort; // Destination port
	
	BOOLEAN drop;			// if TRUE, the packet will be dropped
}IPFilter, *PIPFilter;





By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Jesus Oliva
Chief Technology Officer
Spain Spain
To summarize: learn, learn, learn... and then try to remember something I.... I don't Know what i have to remember...
 
http://www.olivacorner.com

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411023.1 | Last Updated 28 Oct 2004
Article Copyright 2004 by Jesus Oliva
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid