阅读:1661回复:1
求助IoCreateDevice出错
NTSTATUS ccpAttachDevice( PDRIVER_OBJECT driver, PDEVICE_OBJECT oldobj, PDEVICE_OBJECT *fltobj, PDEVICE_OBJECT *next )
{ NTSTATUS status; PDEVICE_OBJECT topdev = NULL; status = IoCreateDevice(driver, 0, NULL, oldobj->DeviceType, 0, FALSE, fltobj); 为什么会出错了,我是照书上抄的,在虚拟机上运行,告诉我可能的错误原因吧。 |
|
沙发#
发布于:2010-05-22 19:29
UNICODE_STRING devName;
PDEVICE_OBJECT pDevObj; RtlInitUnicodeString(&devName,L"\\Device\\wer881027"); //创建设备 status = IoCreateDevice(driver, sizeof(DEVICE_EXTENSION), &devName, FILE_DEVICE_UNKNOWN, 0, TRUE, &pDevObj ); if (!NT_SUCCESS(status)){ KdPrint(("IoCreateDevice faild\n")); return 2; } else{ KdPrint(("IoCreateDevice ok\n")); } |
|