Click here to Skip to main content
15,881,803 members
Articles / Desktop Programming / MFC

How to write a simple but effective TCP/IP port scanner for Win32

Rate me:
Please Sign up or sign in to vote.
4.82/5 (15 votes)
27 Oct 20017 min read 162.7K   7.3K   101  
An article on how to write a TCP/IP port scanner with a GUI, based on the MFC's property sheet paradigm
/*
	typedef.h
	Definizione dei tipi (CRT).
	Luca Piergentili, 27/07/93
	lpiergentili@yahoo.com
	http://www.geocities.com/lpiergentili/
*/
#ifndef _TYPEDEF_H
#define _TYPEDEF_H 1

/*
	_BOOL_TYPE
*/
#ifndef _BOOL_TYPE
	#ifdef _WINDOWS
		#include "window.h"
	#else
		typedef int BOOL;
		#define TRUE 1
		#define FALSE 0
	#endif
	#define _BOOL_TYPE 1
#endif

/*
	tipi specifici per Win32
*/
#ifndef _WINDOWS
	#ifdef WIN32
		#define VOID
		#define FAR
		#define NEAR
		#define PASCAL
		#define CDECL
	#else
		#define VOID			void
		#define FAR			far
		#define NEAR			near
		#define PASCAL			pascal
		#define CDECL			_cdecl
	#endif

	typedef unsigned char		BYTE;
	typedef unsigned short int	WORD;
	typedef unsigned long		DWORD;
	typedef unsigned int		UINT;
	typedef signed short		HWND;
	typedef signed long			HANDLE;
	#ifdef STRICT
		typedef signed long		LONG;
	#else
		#define LONG long
	#endif
	typedef char NEAR*			PSTR;
	typedef char NEAR*			NPSTR;
	typedef char FAR*			LPSTR;
	typedef const char FAR*		LPCSTR;
	typedef BYTE NEAR*			PBYTE;
	typedef BYTE FAR*			LPBYTE;
	typedef int NEAR*			PINT;
	typedef int FAR*			LPINT;
	typedef WORD NEAR*			PWORD;
	typedef WORD FAR*			LPWORD;
	typedef long NEAR*			PLONG;
	typedef long FAR*			LPLONG;
	typedef DWORD NEAR*			PDWORD;
	typedef DWORD FAR*			LPDWORD;
	typedef void FAR*			LPVOID;

	#define LOBYTE(w)			((BYTE)(w))
	#define HIBYTE(w)			((BYTE)(((UINT)(w) >> 8) & 0xff))
	#define LOWORD(l)			((WORD)(DWORD)(l))
	#define HIWORD(l)			((WORD)((((DWORD)(l)) >> 16) & 0xffff))
	#define MAKELONG(l,h)		((LONG)(((WORD)(l)) | (((DWORD)((WORD)(h))) << 16)))
	#define MAKELP(sel,off)		((void FAR*)MAKELONG((off),(sel)))
	#define SELECTOROF(lp)		HIWORD(lp)
	#define OFFSETOF(lp)		LOWORD(lp)
#endif /* _WINDOWS */

/*
	valori massimi per Win32
*/
#define BYTE_MAX				0xff
#define WORD_MAX				0xffff
#define DWORD_MAX				0xffffffff
#define DWORD_INVALID_VALUE		DWORD_MAX

/*
	FPCALLBACK
	tipo per il puntatore a funzione per le callback
*/
#ifndef _FPCALLBACK_TYPE
	#define _FPCALLBACK_TYPE 1
	typedef UINT (*FPCALLBACK)(LPVOID,LPVOID);
#endif // _FPCALLBACK_TYPE

#endif /* _TYPEDEF_H */

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


Written By
Web Developer
Italy Italy
I like C and C++, Acid Jazz, James Brown, gli Spaghetti Aglio e Olio, alla Bolognesa, alla Puttanesca e le Fettuccine alla Matriciana ('Maccaroni' over the world). Of course I like beautiful big tits girls too, my little car, Frank Zappa, the art of Zen, italian coffee and much more...

Comments and Discussions