为什么我使用IoCreateDevice创建设备的时候总是返回失败呢...求救...
代码如下
#define NT_DEVICE_NAME L"\\Devices\\MYSYS"
PDRIVER_OBJECT lpDeviceObject;
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING theRegistryPath)
{
UNICODE_STRING DeviceNameString ;
UNICODE_STRING DeviceLinkString ;
NTSTATUS ntStatus;
DriverObject->DriverUnload=OnUnload;
RtlInitUnicodeString(&DeviceNameString,NT_DEVICE_NAME);
KdPrint(("%ws",DeviceNameString.Buffer));
ntStatus = IoCreateDevice(DriverObject,0, &DeviceNameString, FILE_DEVICE_UNKNOWN, 0, FALSE, &lpDeviceObject);
if(!NT_SUCCESS(ntStatus))
{
KdPrint(("创建设备错误 0x%x\n", ntStatus));
return ntStatus;
}else
{
KdPrint(("创建设备成功 0x%x\n", ntStatus));
}
KdPrint(("驱动加载成功!\n"));
return STATUS_SUCCESS;
}
总是返回0xC000003A的值,请问一下这个是什么原因呢.....