// TestDrv.c
// 08-07-2000
// Copyright @2005
#define _TESTDRV_SYS_
#include
#include "TestDrv.h"
// =================================================================
// DISCLAIMER
// =================================================================
/*
This software is provided "as is" and any express or implied
warranties, including, but not limited to, the implied warranties of
merchantability and fitness for a particular purpose are disclaimed.
In no event shall the author
direct, indirect, incidental, special, exemplary, or consequential
damages (including, but not limited to, procurement of substitute
goods or services; loss of use, data, or profits; or business
interruption) however caused and on any theory of liability,
whether in contract, strict liability, or tort (including negligence
or otherwise) arising in any way out of the use of this software,
even if advised of the possibility of such damage.
*/
// =================================================================
// REVISION HISTORY
// =================================================================
/*
08-07-2000 V1.00 Original version.
*/
// =================================================================
// GLOBAL DATA
// =================================================================
PRESET_UNICODE_STRING (usDeviceName, CSTRING (DRV_DEVICE));
PRESET_UNICODE_STRING (usSymbolicLinkName, CSTRING (DRV_LINK ));
PDEVICE_OBJECT gpDeviceObject = NULL;
PDEVICE_CONTEXT gpDeviceContext = NULL;
// =================================================================
// DISCARDABLE FUNCTIONS
// =================================================================
NTSTATUS DriverInitialize (PDRIVER_OBJECT pDriverObject,
PUNICODE_STRING pusRegistryPath);
NTSTATUS DriverEntry (PDRIVER_OBJECT pDriverObject,
PUNICODE_STRING pusRegistryPath);
// -----------------------------------------------------------------
#ifdef ALLOC_PRAGMA
#pragma alloc_text (INIT, DriverInitialize)
#pragma alloc_text (INIT, DriverEntry)
#endif
// =================================================================
// DEVICE REQUEST HANDLER
// =================================================================
NTSTATUS DeviceDispatcher (PDEVICE_CONTEXT pDeviceContext,
PIRP pIrp)
{
PIO_STACK_LOCATION pisl;
DWORD dInfo = 0;
NTSTATUS ns = STATUS_NOT_IMPLEMENTED;
pisl = IoGetCurrentIrpStackLocation (pIrp);
switch (pisl->MajorFunction)
{
case IRP_MJ_CREATE:
case IRP_MJ_CLEANUP:
case IRP_MJ_CLOSE:
{
ns = STATUS_SUCCESS;
break;
}
}
pIrp->IoStatus.Status = ns;
pIrp->IoStatus.Information = dInfo;
IoCompleteRequest (pIrp, IO_NO_INCREMENT);
return ns;
}
// =================================================================
// DRIVER REQUEST HANDLER
// =================================================================
NTSTATUS DriverDispatcher (PDEVICE_OBJECT pDeviceObject,
PIRP pIrp)
{
return (pDeviceObject == gpDeviceObject
? DeviceDispatcher (gpDeviceContext, pIrp)
: STATUS_INVALID_PARAMETER_1);
}
// -----------------------------------------------------------------
void DriverUnload (PDRIVER_OBJECT pDriverObject)
{
IoDeleteSymbolicLink (&usSymbolicLinkName);
IoDeleteDevice (gpDeviceObject);
return;
}
// =================================================================
// DRIVER INITIALIZATION
推荐阅读
- Windows 2000 下 RDS 配置详解
- 7 《Undocumented Windows 2000 Secrets》翻译 --- 第四章
- 怀旧服暗月马戏团时间
- 如何在Windows2000中动态禁用/启用Ctrl-Alt-Delete
- 部分未公开的Windows 2000核心功能调用
- Windows 2000服务器配置攻略
- 关掉Windows 2000不必要的服务
- Windows 2000的“隐形”武器
- Windows 2000 快速查找文件
- 获得Windows 2000的帮助信息