testDrv.cpp
资源名称:ipfilter.zip [点击查看]
上传用户:nnxzhh
上传日期:2007-01-11
资源大小:742k
文件大小:4k
源码类别:
防火墙与安全工具
开发平台:
WINDOWS
- ///////////////////////////////////////////////////////////////////////////////
- //
- // Copyright (C) 1999 - 2000 Mark Roddy
- //
- // Hollis Technology Solutions
- // 94 Dow Road
- // Hollis, NH 03049
- // info@hollistech.com
- // www.hollistech.com
- //
- // This library is free software; you can redistribute it and/or
- // modify it under the terms of the GNU Lesser General Public
- // License as published by the Free Software Foundation; either
- // version 2 of the License, or (at your option) any later version.
- //
- // This library is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- // Lesser General Public License for more details.
- //
- // You should have received a copy of the GNU Lesser General Public
- // License along with this library; if not, write to the Free Software
- // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- //
- // www.fsf.org
- //
- //
- //
- // Synopsis:
- //
- //
- // Version Information:
- //
- // $Header: /cpprun/sys/testDrv/testDrv.cpp 2 1/01/00 11:00p Markr $
- //
- ///////////////////////////////////////////////////////////////////////////////
- #include "htscpp.h"
- CPP_DRIVER_ENTRY(PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath);
- enum baseType { BIRD, PLANE, SUPERMAN };
- class base {
- public:
- base();
- virtual ~base();
- virtual baseType isa()=0;
- };
- class global : public base {
- public:
- global(int x);
- global();
- virtual ~global();
- int getX();
- virtual baseType isa();
- private:
- int m_x;
- };
- base::base()
- {
- #if DBG
- DbgPrint("base: this %xn", this);
- #endif
- }
- base::~base()
- {
- #if DBG
- DbgPrint("~base: this %xn", this);
- #endif
- }
- global::global(int x)
- {
- #if DBG
- DbgPrint("global( %x): this %xn", x, this);
- #endif
- m_x = x;
- }
- global::global()
- {
- #if DBG
- DbgPrint("global: this %xn", this);
- #endif
- m_x = 0;
- }
- global::~global()
- {
- #if DBG
- DbgPrint("~global: this %xn", this);
- #endif
- m_x = 0;
- }
- int global::getX()
- {
- #if DBG
- DbgPrint("global::getX m_x %x this %xn", m_x, this);
- #endif
- return m_x;
- }
- baseType global::isa()
- {
- #if DBG
- DbgPrint("global::isa this %xn", this);
- #endif
- return BIRD;
- }
- global one(2);
- global two;
- global other(3);
- extern "C" void
- testUnload(PDRIVER_OBJECT DriverObject);
- CPP_DRIVER_ENTRY(PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath)
- {
- #if DBG
- DbgPrint("CPP_DRIVER_ENTRYn");
- #endif
- DriverObject->DriverUnload = testUnload;
- if (one.getX() != 2) {
- return STATUS_UNSUCCESSFUL;
- }
- if (two.getX() != 0) {
- return STATUS_UNSUCCESSFUL;
- }
- global * three = new('vrdT') global(4); // this is not global!
- if (!three) {
- //
- // allocation failure!
- //
- return STATUS_UNSUCCESSFUL;
- }
- if (other.getX() != 3) {
- return STATUS_UNSUCCESSFUL;
- }
- global four(4444);
- if (four.getX() != 4444) {
- delete three;
- return STATUS_UNSUCCESSFUL;
- }
- delete three;
- return STATUS_SUCCESS;
- }
- void
- testUnload(PDRIVER_OBJECT DriverObject)
- {
- #if DBG
- DbgPrint("testUnloadn");
- #endif
- return;
- }
- ///////////////////////////////////////////////////////////////////////////////
- //
- // Change History Log
- //
- // $Log: /cpprun/sys/testDrv/testDrv.cpp $
- //
- // 2 1/01/00 11:00p Markr
- //
- // 1 12/17/99 8:14a Markr
- //
- ///////////////////////////////////////////////////////////////////////////////