首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 嵌入开发 > 驱动开发 >

驱动通信,该如何解决

2012-04-05 
驱动通信[codeC]#defineTEST_PROCESS_WIN32_DEV_NAMEL\\Device\\testdrv#defineTEST_PROCESS_DEV_NAMEL

驱动通信
[code=C]
#defineTEST_PROCESS_WIN32_DEV_NAME    L"\\Device\\testdrv"
#defineTEST_PROCESS_DEV_NAME      L"\\DosDevices\\testdrv"

NTSTATUS testdrv_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
DbgPrint("testdrv_Create\n");//Dbgview中看不到这句的显示

Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);

return Irp->IoStatus.Status;
}

NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING RegistryPath)
{
  NTSTATUS status;
  PDEVICE_OBJECT  deviceObject;

  RtlInitUnicodeString( &DeviceNameString,    TEST_PROCESS_WIN32_DEV_NAME );
  RtlInitUnicodeString( &LinkDeviceNameString,TEST_PROCESS_DEV_NAME );

  KdPrint(("DriverEntry Enter............................\n"));//Dbgview中看不到这句的显示
 
  status = IoCreateDevice(
                DriverObject,
                0,                     
                &DeviceNameString,
                FILE_DEVICE_DISK_FILE_SYSTEM,
                FILE_DEVICE_SECURE_OPEN,
                FALSE,
                & deviceObject );

  status = IoCreateSymbolicLink(
                (PUNICODE_STRING) &LinkDeviceNameString,
                (PUNICODE_STRING) &DeviceNameString
                );

  if (!NT_SUCCESS(status))
    {
DbgPrint("Link error\n");//Dbgview中看不到这句的显示
        IoDeleteDevice(deviceObject);
        return status;
    }
  DbgPrint("IRP Load\n");//Dbgview中看不到这句的显示
  DriverObject->MajorFunction[IRP_MJ_CREATE] = testdrv_Create;
  DriverObject->MajorFunction[IRP_MJ_CLOSE] = testdrv_Close;
  DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = testdrv_IoControl;
  DriverObject->DriverUnload=UnloadDriver;
shadow ssdt hook...
[/code]
Win2003+free模式编译,驱动加载成功了,但是程序却无法与驱动通信
DbgPrint没有输出,但是DriverEntry的shadow ssdt hook却执行成功了
这是怎么回事啊?

[解决办法]
你的dbgview设置好没?

热点排行