阅读:1404回复:7
郁闷:win2k用DriverWorks开发的驱动总是安装不成功
我在win2k下用DriverWorks开发的驱动(选WDM模式),好不容易将驱动编译成功,兴冲冲的安装,却总安装不成功。我采用手动安装,用DriverMonitor打开sys下的驱动文件(.sys),然后StartDriver,没有使用INF文件,结果总是出现这样的错误:
ERROR(1058):The driver is marked as disabled(Start=4) in its Service Database entry. 我查了下注册表,驱动的Start明明为3,怎么说是4呢? 而且只能进入DriverEntry,其它都没有进入。驱动文件如下: #define VDW_MAIN #include <vdw.h> #include "NetBrake.h" #include "NetBrakeDevice.h" #pragma hdrstop("NetBrake.pch") SetPoolTag(). POOLTAG DefaultPoolTag('BteN'); KDebugOnlyTrace t("NetBrake"); // Begin INIT section #pragma code_seg("INIT") DECLARE_DRIVER_CLASS(NetBrake, NULL) ///////////////////////////////////////////////////////////////////// // NetBrake::DriverEntry // // Routine Description: // This is the first entry point called by the system when the // driver is loaded. // // Parameters: // RegistryPath - String used to find driver parameters in the // registry. To locate NetBrake look for: // HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBrake // // Return Value: // NTSTATUS - Return STATUS_SUCCESS if no errors are encountered. // Any other indicates to the system that an error has occured. // // Comments: // NTSTATUS NetBrake::DriverEntry(PUNICODE_STRING RegistryPath) { t << "In DriverEntry Compiled at " __TIME__ " on " __DATE__ "\n"; // Open the "Parameters" key under the driver KRegistryKey Params(RegistryPath, L"Parameters"); if ( NT_SUCCESS(Params.LastError()) ) { #if DBG ULONG bBreakOnEntry = FALSE; // Read "BreakOnEntry" value from registry Params.QueryValue(L"BreakOnEntry", &bBreakOnEntry); // If requested, break into debugger if (bBreakOnEntry) DbgBreakPoint(); #endif // Load driver data members from the registry LoadRegistryParameters(Params); } m_Unit = 0; return STATUS_SUCCESS; } ///////////////////////////////////////////////////////////////////// // NetBrake::LoadRegistryParameters // // Routine Description: // Load driver data members from the registry. // // Parameters: // Params - Open registry key pointing to "Parameters" // // Return Value: // None // // Comments: // Member variables are updated with values read from registry. // // The parameters are found as values under the "Parameters" key, // HKLM\SYSTEM\CurrentControlSet\Services\NetBrake\Parameters\... // void NetBrake::LoadRegistryParameters(KRegistryKey &Params) { m_bBreakOnEntry = FALSE; Params.QueryValue(L"BreakOnEntry", &m_bBreakOnEntry); t << "m_bBreakOnEntry loaded from registry, resulting value: [" << m_bBreakOnEntry << "]\n"; } // End INIT section ///////////////////////////////////////////////////////////////////// #pragma code_seg() ///////////////////////////////////////////////////////////////////// // NetBrake::AddDevice // // Routine Description: // Called when the system detects a device for which this // driver is responsible. // // Parameters: // Pdo - Physical Device Object. This is a pointer to a system device // object that represents the physical device. // // Return Value: // NTSTATUS - Success or failure code. // // Comments: // This function creates the Functional Device Object, or FDO. The FDO // enables this driver to handle requests for the physical device. // NTSTATUS NetBrake::AddDevice(PDEVICE_OBJECT Pdo) { t << "AddDevice called\n"; // Create the device object. Note that we used a form of "placement" new, // that is a member operator of KDevice. This form will use storage // allocated by the system in the device object's device to store our // class instance. NetBrakeDevice * pDevice = new ( NULL, FILE_DEVICE_UNKNOWN, NULL, 0, DO_EXCLUSIVE | DO_DIRECT_IO ) NetBrakeDevice(Pdo, m_Unit); if (pDevice == NULL) { t << "Error creating device NetBrakeDevice" << (ULONG) m_Unit << EOL; return STATUS_INSUFFICIENT_RESOURCES; } NTSTATUS status = pDevice->ConstructorStatus(); if ( !NT_SUCCESS(status) ) { t << "Error constructing device NetBrakeDevice" << (ULONG) m_Unit << " status " << (ULONG) status << EOL; delete pDevice; } else { m_Unit++; } return status; } // EOF 请问哪位大虾遇到这种问题?如何解决? |
|
沙发#
发布于:2004-08-06 18:19
试一试用它EzDriverInstaller安装
|
|
|
板凳#
发布于:2004-08-06 18:56
我遇到一样的问题,就是用EzDriverInstaller装载也弹出出错对话框“An error occured while installing the driver”,怎么办?
|
|
地板#
发布于:2004-08-06 19:50
open driver成功
start Driver 出现“ERROR(1058):The driver is marked as disabled (Start=4) in its service database”, 出现这种问题是你没有把硬件连接上,把你的硬件连接上即可 |
|
|
地下室#
发布于:2004-08-06 20:28
呵呵,再次感谢楼上的帮助(不是第一次了)。我一直将卡设备插在主板上(那个设备是pci设备),总是先插设备,后开机,然后按上述方法安装驱动,这样难道不行么?我怕开机插卡会烧掉(pnp还是不放心)。
|
|
5楼#
发布于:2004-08-06 20:47
pci当然要先插再开机,不然不烧才怪了
|
|
6楼#
发布于:2004-08-06 22:02
呵呵,再次感谢楼上的帮助(不是第一次了)。我一直将卡设备插在主板上(那个设备是pci设备),总是先插设备,后开机,然后按上述方法安装驱动,这样难道不行么?我怕开机插卡会烧掉(pnp还是不放心)。 那你开机后有没有提示发现新硬件,如果没有说明驱动已经成功加载了,所以你不能用DriverMonitor在打开*.sys,你这种驱动不能被加载两次,如果要加载应该把以前的驱动删掉 |
|
|
7楼#
发布于:2004-08-07 09:16
开机后出现硬件安装向导,而且我用DriverMonitor没有看到驱动打印的调试信息。所以应该没有加载。
还有,我的驱动是驱动向导模板自动生成的,还没有添加任何代码,设备也插上了。在WinNT下选NT4.0 Style,其它选同样的选项,则没有任何问题,能安装成功。在Win2K下选NT4.0 Style生成驱动安装后,总是重启。 呵呵,snowStart,真的很感谢总是回复。不管怎么样,先给一些分再说。 [编辑 - 8/7/04 by terrace] |
|