当前位置: 代码迷 >> 驱动开发 >> 驱动通信,该如何解决
  详细解决方案

驱动通信,该如何解决

热度:22   发布时间:2016-04-28 11:00:11.0
驱动通信
[code=C]
#define TEST_PROCESS_WIN32_DEV_NAME    L"\\Device\\testdrv"
#define TEST_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设置好没?
  相关解决方案