网络安全问题长期威胁着网络终端用户，需要有有效的安全工具解决这个问题，个人防火墙就是其中的一种常用的安全工具。为了实现个人防火墙软件，选用VC++ 6.0开发工具。软件系统主要包括两项工程,一是核心模块设计，即DLL工程，实现了封包截获、管制动作和协议封包的解析任务，主要利用Winsock 2 SPI技术实现网络封包截获，之后利用控管规则对过往封包进行合法性检查和过滤，方法是首先利用Winsock 2 SPI技术建立winsock钩子，用它来截获winsock的调用，然后作出相应动作处理，动作处理需通过控管规则的检查后，确定socket连接是否允许通过，其中控管规则由用户层设置；二是用户模块设计，即EXE工程，实现用户界面和负责与DLL模块的通信，提供了3个主要界面，即封包监视、控管规则、控管规则设置。最后通过测试和应用，基本解决了终端用户的网络连接安全问题。
关键词： 过滤；动态连接库；Winsock 2 SPI；网络封包；协议封包
The Design of the Personal Firewall Based on Windows
The terminal users of network are always threaten by the problems of security of network,so we need a effective tool to solve this problem.The personal firewall is one of the common tools of security. VC++ is selected to implement the personal firewall.The system has two projects mainly. One of the projects is the design of core module which can be called the project of DLL.This project implements behaviors of management and the analysis of packets of protocols. The technology of Winsock 2 SPI is used to capture of pakcets of network. After that, then the checking and filtering of the packets are done using the rules of control and management. At the beginning, the control rules build up the Hook of winsock which is used to capture the tranfer of winsock,and then it implements relative behaviors.The link of socket will be or not get through checking by the rules of control and management. The rules of control and management are set by the layer of user.Then, we should design the module of user which can be called the project of exe. It implements the interface of user and the module of communication with DLL. It provides three main interfaces, they are the watching of filtering packet, the rules of control and management and the setting of rules of control and management. Finally, it has solved the requirement of security of terminal users after the final testing and application.
Key words: Filter ;DLL;Winsock 2 SPI;Network packets; Protocol packets