阅读:1866回复:2
使用driverwork开发的程序,出错高手进来看看!!!
// CharSampleDevice.cpp
// Implementation of CharSampleDevice device class // // Generated by DriverWizard version DriverStudio 2.6.0 (Build 336) // Requires Compuware\'s DriverWorks classes // #pragma warning(disable:4065) // Allow switch statement with no cases #include <vdw.h> #include \"..\\CharSampleDeviceinterface.h\" #include \"CharSample.h\" #include \"CharSampleDevice.h\" #include \"..\\CharSampleioctl.h\" #pragma hdrstop(\"CharSample.pch\") GUID CharSampleDevice_Guid = CharSampleDevice_CLASS_GUID; extern KTrace T; // Global driver trace object //////////////////////////////////////////////////////////////////////// // CharSampleDevice::CharSampleDevice // // Routine Description: // This is the constructor for the Functional Device Object, or FDO. // It is derived from KPnpDevice, which builds in automatic // dispatching of subfunctions of IRP_MJ_POWER and IRP_MJ_PNP to // virtual member functions. // // Parameters: // Pdo - Physical Device Object - this is a pointer to a system // device object that represents the physical device. // // Unit - Unit number. This is a number to append to the device\'s // base device name to form the Logical Device Object\'s name // // Return Value: // None // // Comments: // The object being constructed contains a data member (m_Lower) of type // KPnpLowerDevice. By initializing it, the driver binds the FDO to the // PDO and creates an interface to the upper edge of the system class driver. // CharSampleDevice::CharSampleDevice(PDEVICE_OBJECT Pdo, ULONG Unit) : KPnpDevice(Pdo, &CharSampleDevice_Guid) { // Check constructor status if ( ! NT_SUCCESS(m_ConstructorStatus) ) { return; } // Remember our unit number m_Unit = Unit; // Initialize the lower device m_Lower.Initialize(this, Pdo); // Inform the base class of the lower edge device object SetLowerDevice(&m_Lower); // Initialize the PnP Policy settings to the \"standard\" policy SetPnpPolicy(); // TODO: Customize the PnP Policy for this device by setting // flags in m_Policies. } CharSampleDevice::~CharSampleDevice() { } NTSTATUS CharSampleDevice::DefaultPnp(KIrp I) { I.ForceReuseOfCurrentStackLocationInCalldown(); return m_Lower.PnpCall(this, I); } NTSTATUS CharSampleDevice::DefaultPower(KIrp I) { I.IndicatePowerIrpProcessed(); I.CopyParametersDown(); return m_Lower.PnpPowerCall(this, I); } NTSTATUS CharSampleDevice::SystemControl(KIrp I) { I.ForceReuseOfCurrentStackLocationInCalldown(); return m_Lower.PnpCall(this, I); } NTSTATUS CharSampleDevice::OnStartDevice(KIrp I) { return STATUS_SUCCESS; } NTSTATUS CharSampleDevice::OnStopDevice(KIrp I) { return STATUS_SUCCESS; } NTSTATUS CharSampleDevice::OnRemoveDevice(KIrp I) { return STATUS_SUCCESS; } NTSTATUS CharSampleDevice::Create(KIrp I) { return I.PnpComplete(this, STATUS_SUCCESS, IO_NO_INCREMENT); } NTSTATUS CharSampleDevice::Close(KIrp I) { return I.PnpComplete(this, STATUS_SUCCESS, IO_NO_INCREMENT); } NTSTATUS CharSampleDevice::DeviceControl(KIrp I) { NTSTATUS status; // CHAR n,c[]=\"零一二三四五六七八九\"; CHAR n,c[]=\"零一二三四五六七八九\"; T << \"CharSampleDevice::DeviceControl\\n\"; switch (I.IoctlCode()) { case CHARSAMPLE_IOCTL_800: n=*(CHAR *)I.IoctlBuffer(); if ((n >= \'0\') && (n <= \'9\')) { n -= \'0\'; strncpy((PCHAR)I.IoctlBuffer(),&c[n*2],2); I.Information() = 2; status = STATUS_SUCCESS; } else status = STATUS_INVALID_PARAMETER; break; default: // Unrecognized IOCTL request status = STATUS_INVALID_PARAMETER; break; } return I.PnpComplete(this, status); } 出错信息:: Compiling... CharSampleDevice.cpp F:\\E盘内容\\C盘内容\\WDM\\WAHBOOK\\Win2000\\CharSample\\SYS\\CharSampleDevice.cpp(10) : fatal error C1083: Cannot open include file: \'vdw.h\': No such file or directory Error executing cl.exe. CharSampleDevice.obj - 1 error(s), 0 warning(s) 我已经将vdw.h头文件加入到工程了,还是编译不过去,怎么或是阿 高手请教!!! |
|
沙发#
发布于:2003-07-07 11:57
编译一下vdwlib.dsw,在driverworks\\source下面。
|
|
板凳#
发布于:2004-01-11 17:24
lamxu说的对,试一试。而且启动VC时一定要从DDK Build Settings中启动,这大概是需要配置VC的环境的。答对加分。
|
|
|