• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IoBuildDeviceIoControlRequest函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IoBuildDeviceIoControlRequest函数的典型用法代码示例。如果您正苦于以下问题:C++ IoBuildDeviceIoControlRequest函数的具体用法?C++ IoBuildDeviceIoControlRequest怎么用?C++ IoBuildDeviceIoControlRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IoBuildDeviceIoControlRequest函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: VBOXUSBTOOL_DECL

VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolIoInternalCtlSendAsync(PDEVICE_OBJECT pDevObj, ULONG uCtl, void *pvArg1, void *pvArg2,
        PKEVENT pEvent, PIO_STATUS_BLOCK pIoStatus)
{
    NTSTATUS Status;
    PIRP pIrp;
    PIO_STACK_LOCATION pSl;
    KIRQL Irql = KeGetCurrentIrql();
    Assert(Irql == PASSIVE_LEVEL);

    pIrp = IoBuildDeviceIoControlRequest(uCtl, pDevObj, NULL, 0, NULL, 0, TRUE, pEvent, pIoStatus);
    if (!pIrp)
    {
        WARN(("IoBuildDeviceIoControlRequest failed!!\n"));
        pIoStatus->Status = STATUS_INSUFFICIENT_RESOURCES;
        pIoStatus->Information = 0;
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    /* Get the next stack location as that is used for the new irp */
    pSl = IoGetNextIrpStackLocation(pIrp);
    pSl->Parameters.Others.Argument1 = pvArg1;
    pSl->Parameters.Others.Argument2 = pvArg2;

    Status = IoCallDriver(pDevObj, pIrp);

    return Status;
}
开发者ID:miguelinux,项目名称:vbox,代码行数:27,代码来源:VBoxUsbTool.cpp


示例2: FlFdcDeviceIo

int FlFdcDeviceIo(int DeviceObject , int Ioctl , int Data ) 
{ int ntStatus ;
  int irp ;
  int irpStack ;
  int doneEvent = __VERIFIER_nondet_int() ;
  int ioStatus = __VERIFIER_nondet_int() ;
  int irp__Tail__Overlay__CurrentStackLocation = __VERIFIER_nondet_int() ;
  int irpStack__Parameters__DeviceIoControl__Type3InputBuffer ;
  long __cil_tmp11 ;

  {
  {
  irp = IoBuildDeviceIoControlRequest(Ioctl, DeviceObject, 0, 0, 0, 0, 1, doneEvent,
                                      ioStatus);
  }
  if (irp == 0) {
    return (-1073741670);
  }
  {
  irpStack = irp__Tail__Overlay__CurrentStackLocation - 1;
  irpStack__Parameters__DeviceIoControl__Type3InputBuffer = Data;
  ntStatus = IofCallDriver(DeviceObject, irp);
  }
  {
  __cil_tmp11 = (long )ntStatus;
  if (__cil_tmp11 == 259L) {
    {
    KeWaitForSingleObject(doneEvent, Suspended, KernelMode, 0, 0);
    ntStatus = myStatus;
    }
  }
  }
  return (ntStatus);
}
}
开发者ID:Heizmann,项目名称:sv-benchmarks,代码行数:35,代码来源:floppy_simpl3_true-unreach-call_true-valid-memsafety_true-termination.cil.c


示例3: setfilter

static void setfilter(PacketFilterExtensionPtr fn) {
	UNICODE_STRING name;
	PDEVICE_OBJECT device=NULL;
	PFILE_OBJECT file=NULL;
	NTSTATUS status;

	RtlInitUnicodeString(&name, DD_IPFLTRDRVR_DEVICE_NAME);
	status=IoGetDeviceObjectPointer(&name, STANDARD_RIGHTS_ALL, &file, &device);

	if(NT_SUCCESS(status)) {
		KEVENT event;
		IO_STATUS_BLOCK iostatus;
		PF_SET_EXTENSION_HOOK_INFO hookinfo;
		PIRP irp;

		hookinfo.ExtensionPointer=fn;
		KeInitializeEvent(&event, NotificationEvent, FALSE);

		irp=IoBuildDeviceIoControlRequest(
			IOCTL_PF_SET_EXTENSION_POINTER, device, &hookinfo,
			sizeof(PF_SET_EXTENSION_HOOK_INFO), NULL, 0, FALSE, &event, &iostatus);

		if(irp && IoCallDriver(device, irp)==STATUS_PENDING)
			KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);

		if(file) ObDereferenceObject(file);
	}
}
开发者ID:Tudi,项目名称:PG2-firewall,代码行数:28,代码来源:filter.c


示例4: SubmitUrbToRootHub

NTSTATUS
SubmitUrbToRootHub(IN PDEVICE_OBJECT Pdo, IN ULONG IoControlCode, IN PURB Urb)
{
    PIRP Irp;
    IO_STATUS_BLOCK IoStatus;
    NTSTATUS Status;
    PIO_STACK_LOCATION Stack = NULL;

    Irp = IoBuildDeviceIoControlRequest(IoControlCode,
                                        Pdo,
                                        NULL, 0,
                                        NULL, 0,
                                        TRUE,
                                        NULL,
                                        &IoStatus);

    if (Irp == NULL)
    {
        DPRINT("Usbhub: IoBuildDeviceIoControlRequest() failed\n");
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    /* Initialize the status block before sending the IRP */
    IoStatus.Status = STATUS_NOT_SUPPORTED;
    IoStatus.Information = 0;

    Stack = IoGetNextIrpStackLocation(Irp);

    Stack->Parameters.Others.Argument1 = Urb;
    Stack->Parameters.Others.Argument2 = NULL;

    Status = IoCallDriver(Pdo, Irp);

    return Status;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:35,代码来源:fdo.c


示例5: IoBuildDeviceIoControlRequest

NTSTATUS CIoControlIrp::Create(PDEVICE_OBJECT TargetDevice,
                               ULONG IoControlCode,
                               bool IsInternal,
                               PVOID InputBuffer,
                               ULONG InputBufferLength,
                               PVOID OutputBuffer,
                               ULONG OutputBufferLength)
{
    m_Irp = IoBuildDeviceIoControlRequest(IoControlCode,
                                          TargetDevice,
                                          InputBuffer,
                                          InputBufferLength,
                                          OutputBuffer,
                                          OutputBufferLength,
                                          IsInternal ? TRUE : FALSE,
                                          m_Event,
                                          &m_IoControlStatus);

    if (m_Irp == nullptr)
    {
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    ObReferenceObject(TargetDevice);
    m_TargetDevice = TargetDevice;
    return STATUS_SUCCESS;
}
开发者ID:daynix,项目名称:UsbDk,代码行数:27,代码来源:Irp.cpp


示例6: TdiQueryDeviceControl

NTSTATUS TdiQueryDeviceControl(
    PFILE_OBJECT FileObject,
    ULONG IoControlCode,
    PVOID InputBuffer,
    ULONG InputBufferLength,
    PVOID OutputBuffer,
    ULONG OutputBufferLength,
    PULONG Return)
/*
 * FUNCTION: Queries a device for information
 * ARGUMENTS:
 *     FileObject         = Pointer to file object
 *     IoControlCode      = I/O control code
 *     InputBuffer        = Pointer to buffer with input data
 *     InputBufferLength  = Length of InputBuffer
 *     OutputBuffer       = Address of buffer to place output data
 *     OutputBufferLength = Length of OutputBuffer
 * RETURNS:
 *     Status of operation
 */
{
    PDEVICE_OBJECT DeviceObject;
    IO_STATUS_BLOCK Iosb;
    NTSTATUS Status;
    KEVENT Event;
    PIRP Irp;

    if (!FileObject) {
        AFD_DbgPrint(MIN_TRACE, ("Bad file object.\n"));
        return STATUS_INVALID_PARAMETER;
    }

    DeviceObject = IoGetRelatedDeviceObject(FileObject);
    if (!DeviceObject) {
        AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
        return STATUS_INVALID_PARAMETER;
    }

    KeInitializeEvent(&Event, NotificationEvent, FALSE);

    Irp = IoBuildDeviceIoControlRequest(IoControlCode,
                                        DeviceObject,
                                        InputBuffer,
                                        InputBufferLength,
                                        OutputBuffer,
                                        OutputBufferLength,
                                        FALSE,
                                        &Event,
                                        &Iosb);
    if (!Irp)
        return STATUS_INSUFFICIENT_RESOURCES;

    Status = TdiCall(Irp, DeviceObject, &Event, &Iosb);

    if (Return)
        *Return = Iosb.Information;

    return Status;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:59,代码来源:tdi.c


示例7: EngFileIoControl

NTSTATUS
APIENTRY
EngFileIoControl(
    IN PFILE_OBJECT pFileObject,
    IN DWORD dwIoControlCode,
    IN PVOID lpInBuffer,
    IN SIZE_T nInBufferSize,
    OUT PVOID lpOutBuffer,
    IN SIZE_T nOutBufferSize,
    OUT PULONG_PTR lpInformation)
{
    PDEVICE_OBJECT pDeviceObject;
    KEVENT Event;
    PIRP pIrp;
    IO_STATUS_BLOCK Iosb;
    NTSTATUS Status;

    /* Get corresponding device object */
    pDeviceObject = IoGetRelatedDeviceObject(pFileObject);
    if (!pDeviceObject)
    {
        return STATUS_INVALID_PARAMETER;
    }

    /* Initialize an event */
    KeInitializeEvent(&Event, SynchronizationEvent, FALSE);

    /* Build IO control IRP */
    pIrp = IoBuildDeviceIoControlRequest(dwIoControlCode,
                                         pDeviceObject,
                                         lpInBuffer,
                                         (ULONG)nInBufferSize,
                                         lpOutBuffer,
                                         (ULONG)nOutBufferSize,
                                         FALSE,
                                         &Event,
                                         &Iosb);
    if (!pIrp)
    {
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    /* Call the driver */
    Status = IoCallDriver(pDeviceObject, pIrp);

    /* Wait if neccessary */
    if (Status == STATUS_PENDING)
    {
        KeWaitForSingleObject(&Event, Executive, KernelMode, TRUE, 0);
        Status = Iosb.Status;
    }

    /* Return information to the caller about the operation. */
    *lpInformation = Iosb.Information;

    /* This function returns NTSTATUS */
    return Status;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:58,代码来源:device.c


示例8: BatteryIoctl

NTSTATUS
NTAPI
BatteryIoctl(IN ULONG IoControlCode, 
             IN PDEVICE_OBJECT DeviceObject,
             IN PVOID InputBuffer,
             IN ULONG InputBufferLength,
             IN PVOID OutputBuffer,
             IN ULONG OutputBufferLength,
             IN BOOLEAN InternalDeviceIoControl)
{
    IO_STATUS_BLOCK IoStatusBlock;
    KEVENT Event;
    NTSTATUS Status;
    PIRP Irp;
    PAGED_CODE();
    if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING BatteryIoctl\n");

    /* Initialize the event and IRP */
    KeInitializeEvent(&Event, SynchronizationEvent, 0);
    Irp = IoBuildDeviceIoControlRequest(IoControlCode,
                                        DeviceObject,
                                        InputBuffer,
                                        InputBufferLength,
                                        OutputBuffer,
                                        OutputBufferLength,
                                        InternalDeviceIoControl,
                                        &Event,
                                        &IoStatusBlock);
    if (Irp)
    {
        /* Call the class driver miniport */
        Status = IofCallDriver(DeviceObject, Irp);
        if (Status == STATUS_PENDING)
        {
            /* Wait for result */
            KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
            Status = IoStatusBlock.Status;
        }
        
        /* Print failure */
        if (!(NT_SUCCESS(Status)) && (CompBattDebug & 8))
            DbgPrint("BatteryIoctl: Irp failed - %x\n", Status);
        
        /* Done */
        if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING BatteryIoctl\n");
    }
    else
    {
        /* Out of memory */
        if (CompBattDebug & 8) DbgPrint("BatteryIoctl: couldn't create Irp\n");
        Status = STATUS_INSUFFICIENT_RESOURCES;
    }
    
    /* Return status */
    return Status;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:56,代码来源:compmisc.c


示例9: call_usbd

NTSTATUS call_usbd(libusb_device_t *dev, void *urb, ULONG control_code,  
                   int timeout)
{
  KEVENT event;
  NTSTATUS status;
  IRP *irp;
  IO_STACK_LOCATION *next_irp_stack;
  LARGE_INTEGER _timeout;
  IO_STATUS_BLOCK io_status;

  if(timeout > LIBUSB_MAX_CONTROL_TRANSFER_TIMEOUT)
    {
      timeout = LIBUSB_MAX_CONTROL_TRANSFER_TIMEOUT;
    }

  KeInitializeEvent(&event, NotificationEvent, FALSE);

  irp = IoBuildDeviceIoControlRequest(control_code, dev->target_device,
                                      NULL, 0, NULL, 0, TRUE,
                                      NULL, &io_status);

  if(!irp)
    {
      return STATUS_NO_MEMORY;
    }

  next_irp_stack = IoGetNextIrpStackLocation(irp);
  next_irp_stack->Parameters.Others.Argument1 = urb;
  next_irp_stack->Parameters.Others.Argument2 = NULL;

  IoSetCompletionRoutine(irp, on_usbd_complete, &event, TRUE, TRUE, TRUE); 

  status = IoCallDriver(dev->target_device, irp);
    
  if(status == STATUS_PENDING)
    {
      _timeout.QuadPart = -(timeout * 10000);
      
      if(KeWaitForSingleObject(&event, Executive, KernelMode,
                               FALSE, &_timeout) == STATUS_TIMEOUT)
        {
          DEBUG_ERROR("call_usbd(): request timed out");
          IoCancelIrp(irp);
        }
    }

  /* wait until completion routine is called */
  KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);

  status = irp->IoStatus.Status;
  
  /* complete the request */
  IoCompleteRequest(irp, IO_NO_INCREMENT);

  return status;
}
开发者ID:mcuee,项目名称:libusb-win32,代码行数:56,代码来源:libusb_driver.c


示例10: FFSGetPartition

NTSTATUS
FFSGetPartition(
	IN PDEVICE_OBJECT DeviceObject,
	OUT ULONGLONG     *StartOffset)
{
    CHAR                  Buffer[2048];
    PIRP                  Irp;
    IO_STATUS_BLOCK       IoStatus;
    KEVENT                Event;
    NTSTATUS              Status;
    PARTITION_INFORMATION *PartInfo;

    PAGED_CODE();

    if (IsFlagOn(DeviceObject->Characteristics, FILE_FLOPPY_DISKETTE))
    {
        *StartOffset = 0;
        return STATUS_SUCCESS;
    }

    KeInitializeEvent(&Event, NotificationEvent, FALSE);

    Irp = IoBuildDeviceIoControlRequest(
			IOCTL_DISK_GET_PARTITION_INFO,
			DeviceObject,
			NULL,
			0,
			Buffer,
			2048,
			FALSE,
			&Event,
			&IoStatus);

    if (!Irp)
	{
		return STATUS_INSUFFICIENT_RESOURCES;
	}

    Status = IoCallDriver(DeviceObject, Irp);
    if (!NT_SUCCESS(Status))
	{
		return Status;
	}

    Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
    if (!NT_SUCCESS(Status))
	{
		return Status;
	}

    PartInfo = (PARTITION_INFORMATION *)Buffer;
    *StartOffset = PartInfo->StartingOffset.QuadPart;

    return Status;
}
开发者ID:GYGit,项目名称:reactos,代码行数:55,代码来源:fsctl.c


示例11: FsRecGetDeviceSectors

BOOLEAN
NTAPI
FsRecGetDeviceSectors(IN PDEVICE_OBJECT DeviceObject,
                      IN ULONG SectorSize,
                      OUT PLARGE_INTEGER SectorCount)
{
    PARTITION_INFORMATION PartitionInfo;
    IO_STATUS_BLOCK IoStatusBlock;
    KEVENT Event;
    PIRP Irp;
    NTSTATUS Status;
    ULONG Remainder;
    PAGED_CODE();

    /* Only needed for disks */
    if (DeviceObject->DeviceType != FILE_DEVICE_DISK) return FALSE;

    /* Build the information IRP */
    KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
    Irp = IoBuildDeviceIoControlRequest(IOCTL_DISK_GET_PARTITION_INFO,
                                        DeviceObject,
                                        NULL,
                                        0,
                                        &PartitionInfo,
                                        sizeof(PARTITION_INFORMATION),
                                        FALSE,
                                        &Event,
                                        &IoStatusBlock);
    if (!Irp) return FALSE;

    /* Override verification */
    IoGetNextIrpStackLocation(Irp)->Flags |= SL_OVERRIDE_VERIFY_VOLUME;

    /* Do the request */
    Status = IoCallDriver(DeviceObject, Irp);
    if (Status == STATUS_PENDING)
    {
        /* Wait for completion */
        KeWaitForSingleObject(&Event,
                              Executive,
                              KernelMode,
                              FALSE,
                              NULL);
        Status = IoStatusBlock.Status;
    }

    /* Fail if we couldn't get the data */
    if (!NT_SUCCESS(Status)) return FALSE;

    /* Otherwise, return the number of sectors */
    *SectorCount = RtlExtendedLargeIntegerDivide(PartitionInfo.PartitionLength,
                                                 SectorSize,
                                                 &Remainder);
    return TRUE;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:55,代码来源:blockdev.c


示例12: DokanSendIoContlToMountManager

NTSTATUS
DokanSendIoContlToMountManager(__in ULONG IoControlCode, __in PVOID InputBuffer,
                               __in ULONG Length, __out PVOID OutputBuffer,
                               __in ULONG OutputLength) {
  NTSTATUS status;
  UNICODE_STRING mountManagerName;
  PFILE_OBJECT mountFileObject;
  PDEVICE_OBJECT mountDeviceObject;
  PIRP irp;
  KEVENT driverEvent;
  IO_STATUS_BLOCK iosb;

  DDbgPrint("=> DokanSendIoContlToMountManager\n");

  RtlInitUnicodeString(&mountManagerName, MOUNTMGR_DEVICE_NAME);

  status = IoGetDeviceObjectPointer(&mountManagerName, FILE_READ_ATTRIBUTES,
                                    &mountFileObject, &mountDeviceObject);

  if (!NT_SUCCESS(status)) {
    DDbgPrint("  IoGetDeviceObjectPointer failed: 0x%x\n", status);
    return status;
  }

  KeInitializeEvent(&driverEvent, NotificationEvent, FALSE);

  irp = IoBuildDeviceIoControlRequest(IoControlCode, mountDeviceObject,
                                      InputBuffer, Length, OutputBuffer,
                                      OutputLength, FALSE, &driverEvent, &iosb);

  if (irp == NULL) {
    DDbgPrint("  IoBuildDeviceIoControlRequest failed\n");
    return STATUS_INSUFFICIENT_RESOURCES;
  }

  status = IoCallDriver(mountDeviceObject, irp);

  if (status == STATUS_PENDING) {
    KeWaitForSingleObject(&driverEvent, Executive, KernelMode, FALSE, NULL);
  }
  status = iosb.Status;

  ObDereferenceObject(mountFileObject);
  // Don't dereference mountDeviceObject, mountFileObject is enough

  if (NT_SUCCESS(status)) {
    DDbgPrint("  IoCallDriver success\n");
  } else {
    DDbgPrint("  IoCallDriver failed: 0x%x\n", status);
  }

  DDbgPrint("<= DokanSendIoContlToMountManager\n");

  return status;
}
开发者ID:MelcherSt,项目名称:dokany,代码行数:55,代码来源:init.c


示例13: setfilter

static void setfilter(PacketFilterExtensionPtr fn)
{
	UNICODE_STRING name;
	PDEVICE_OBJECT device=NULL;
	PFILE_OBJECT file=NULL;
	NTSTATUS status;

	DbgPrint("pbfilter:  > Entering setfilter()\n");
	RtlInitUnicodeString(&name, DD_IPFLTRDRVR_DEVICE_NAME);
	status=IoGetDeviceObjectPointer(&name, STANDARD_RIGHTS_ALL, &file, &device);

	if(NT_SUCCESS(status))
	{
		KEVENT event;
		IO_STATUS_BLOCK iostatus;
		PF_SET_EXTENSION_HOOK_INFO hookinfo;
		PIRP irp;

		DbgPrint("pbfilter:    got devobj\n");
		hookinfo.ExtensionPointer=fn;
		KeInitializeEvent(&event, NotificationEvent, FALSE);

		irp=IoBuildDeviceIoControlRequest(
				IOCTL_PF_SET_EXTENSION_POINTER, device, &hookinfo,
				sizeof(PF_SET_EXTENSION_HOOK_INFO), NULL, 0, FALSE, &event, &iostatus);

		DbgPrint("pbfilter:    calling into driver\n");
		if(irp && IoCallDriver(device, irp)==STATUS_PENDING)
		{
			DbgPrint("pbfilter:    waiting for IRP to complete\n");
			KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
		}
		else
		{
			DbgPrint("pbfilter:    IRP not pending (or no IRP?)\n");
		}

		if(file)
		{
			DbgPrint("pbfilter:    Dereferencing file\n");
			ObDereferenceObject(file);
		}
		else
		{
			DbgPrint("pbfilter:    no file to dereference\n");
		}
	}
	else
	{
		DbgPrint("pbfilter:  * ERROR: unable to get IpFltDrv DevObj, status:[0x%lX]\n", status);
	}

	DbgPrint("pbfilter:  < Leaving setfilter()\n");
}
开发者ID:Cecildt,项目名称:peerblock,代码行数:54,代码来源:filter.c


示例14: Ext2GetPartitionInfo

/*************************************************************************
*
* Function: Ext2MountVolume()
*
* Description:
*	This routine is used for querying the partition information.
*
* Expected Interrupt Level (for execution) :
*  IRQL_PASSIVE_LEVEL 
*
* Arguments:
*
*	TargetDeviceObject - The target of the query
*	PartitionInformation - Receives the result of the query
*
* Return Value:
*
*	NTSTATUS - The return status for the operation
*
*************************************************************************/
NTSTATUS
Ext2GetPartitionInfo (
    IN PDEVICE_OBJECT TargetDeviceObject,
    IN PPARTITION_INFORMATION PartitionInformation
    )
{
    PIRP Irp;
    KEVENT *PtrEvent = NULL;
    NTSTATUS Status;
    IO_STATUS_BLOCK Iosb;

    //
    //  Query the partition table
    //
	PtrEvent = ( KEVENT * )Ext2AllocatePool( NonPagedPool, Ext2QuadAlign( sizeof( KEVENT ) )  );
	



    KeInitializeEvent( PtrEvent, NotificationEvent, FALSE );
	
    Irp = IoBuildDeviceIoControlRequest( IOCTL_DISK_GET_PARTITION_INFO,
                                         TargetDeviceObject,
                                         NULL,
                                         0,
                                         PartitionInformation,
                                         sizeof(PARTITION_INFORMATION),
                                         FALSE,
                                         PtrEvent,
                                         &Iosb );

    if ( Irp == NULL ) 
	{
		DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [FS Ctrl]", PtrEvent);
		ExFreePool( PtrEvent );
		return 0;
    }

    Status = IoCallDriver( TargetDeviceObject, Irp );

    if ( Status == STATUS_PENDING ) {

        (VOID) KeWaitForSingleObject( PtrEvent,
                                      Executive,
                                      KernelMode,
                                      FALSE,
                                      (PLARGE_INTEGER)NULL );

        Status = Iosb.Status;
    }
	DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [FS Ctrl]", PtrEvent);
	ExFreePool( PtrEvent );
    return Status;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:74,代码来源:fsctrl.c


示例15: Ext2DiskIoControl

NTSTATUS
Ext2DiskIoControl (
    IN PDEVICE_OBJECT   DeviceObject,
    IN ULONG            IoctlCode,
    IN PVOID            InputBuffer,
    IN ULONG            InputBufferSize,
    IN OUT PVOID        OutputBuffer,
    IN OUT PULONG       OutputBufferSize)
{
    ULONG           OutBufferSize = 0;
    KEVENT          Event;
    PIRP            Irp;
    IO_STATUS_BLOCK IoStatus;
    NTSTATUS        Status;

    ASSERT(DeviceObject != NULL);

    if (OutputBufferSize)
    {
        OutBufferSize = *OutputBufferSize;
    }

    KeInitializeEvent(&Event, NotificationEvent, FALSE);

    Irp = IoBuildDeviceIoControlRequest(
              IoctlCode,
              DeviceObject,
              InputBuffer,
              InputBufferSize,
              OutputBuffer,
              OutBufferSize,
              FALSE,
              &Event,
              &IoStatus
          );

    if (Irp == NULL) {
        DEBUG(DL_ERR, ( "Ext2DiskIoControl: failed to build Irp!\n"));
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    Status = IoCallDriver(DeviceObject, Irp);

    if (Status == STATUS_PENDING)  {
        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
        Status = IoStatus.Status;
    }

    if (OutputBufferSize) {
        *OutputBufferSize = (ULONG)(IoStatus.Information);
    }

    return Status;
}
开发者ID:dond2008,项目名称:ext2fsd,代码行数:54,代码来源:block.c


示例16: SendOnlineNotification

/*
 * @implemented
 */
VOID
SendOnlineNotification(IN PUNICODE_STRING SymbolicName)
{
    PIRP Irp;
    KEVENT Event;
    NTSTATUS Status;
    PFILE_OBJECT FileObject;
    PIO_STACK_LOCATION Stack;
    PDEVICE_OBJECT DeviceObject;
    IO_STATUS_BLOCK IoStatusBlock;

    /* Get device object */
    Status = IoGetDeviceObjectPointer(SymbolicName,
                                      FILE_READ_ATTRIBUTES,
                                      &FileObject,
                                      &DeviceObject);
    if (!NT_SUCCESS(Status))
    {
        return;
    }

    /* And attached device object */
    DeviceObject = IoGetAttachedDeviceReference(FileObject->DeviceObject);

    /* And send VOLUME_ONLINE */
    KeInitializeEvent(&Event, NotificationEvent, FALSE);
    Irp = IoBuildDeviceIoControlRequest(IOCTL_VOLUME_ONLINE,
                                        DeviceObject,
                                        NULL, 0,
                                        NULL, 0,
                                        FALSE,
                                        &Event,
                                        &IoStatusBlock);
    if (!Irp)
    {
        goto Cleanup;
    }

    Stack = IoGetNextIrpStackLocation(Irp);
    Stack->FileObject = FileObject;

    Status = IoCallDriver(DeviceObject, Irp);
    if (Status == STATUS_PENDING)
    {
        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
    }

Cleanup:
    ObDereferenceObject(DeviceObject);
    ObDereferenceObject(FileObject);

    return;
}
开发者ID:Strongc,项目名称:reactos,代码行数:56,代码来源:notify.c


示例17: KeInitializeEvent

NTSTATUS
RosKmdRapAdapter::SetVC4Power(
        bool    bOn)
{
    PIRP pIrp = NULL;
    KEVENT ioCompleted;
    IO_STATUS_BLOCK statusBlock;
    MAILBOX_SET_POWER_VC4 setPowerVC4;

    KeInitializeEvent(&ioCompleted, NotificationEvent, FALSE);

    INIT_MAILBOX_SET_POWER_VC4(&setPowerVC4, bOn);

    pIrp = IoBuildDeviceIoControlRequest(
        IOCTL_MAILBOX_PROPERTY,
        m_pRpiqDevice,
        &setPowerVC4,
        sizeof(setPowerVC4),
        &setPowerVC4,
        sizeof(setPowerVC4),
        false,
        &ioCompleted,
        &statusBlock);
    if (NULL == pIrp)
    {
        return STATUS_NO_MEMORY;
    }

    NTSTATUS status;

    status = IoCallDriver(m_pRpiqDevice, pIrp);

    if (status == STATUS_PENDING)
    {
        KeWaitForSingleObject(&ioCompleted, Executive, KernelMode, FALSE, NULL);
        status = statusBlock.Status;
    }

    if (STATUS_SUCCESS != status)
    {
        return status;
    }

    if (setPowerVC4.Header.RequestResponse == RESPONSE_SUCCESS)
    {
        return STATUS_SUCCESS;
    }
    else
    {
        return STATUS_INVALID_PARAMETER;
    }
}
开发者ID:eejackliu,项目名称:graphics-driver-samples,代码行数:52,代码来源:RosKmdRapAdapter.cpp


示例18: LfsFiltIoControl

static
NTSTATUS
LfsFiltIoControl(
	IN  HANDLE			ControlFileHandle,
	IN	PFILE_OBJECT	ControlFileObject,
	IN	ULONG    		IoControlCode,
	IN	PVOID    		InputBuffer OPTIONAL,
	IN	ULONG    		InputBufferLength,
	OUT PVOID	    	OutputBuffer OPTIONAL,
	IN	ULONG    		OutputBufferLength
	)
{
	NTSTATUS		ntStatus;
	PDEVICE_OBJECT	deviceObject;
	PIRP			irp;
	KEVENT	    	event;
	IO_STATUS_BLOCK	ioStatus;

	UNREFERENCED_PARAMETER(ControlFileHandle);

	Bus_KdPrint_Def(BUS_DBG_SS_TRACE, ("Entered\n"));

	deviceObject = IoGetRelatedDeviceObject(ControlFileObject);
	
	KeInitializeEvent(&event, NotificationEvent, FALSE);

	irp = IoBuildDeviceIoControlRequest(
			IoControlCode,
			deviceObject,
			InputBuffer,
			InputBufferLength,
			OutputBuffer,
			OutputBufferLength,
			FALSE,
			&event,
			&ioStatus
			);
	
	if (irp == NULL) {
		return STATUS_INSUFFICIENT_RESOURCES;
	}

	ntStatus = IoCallDriver(deviceObject, irp);
	if (ntStatus == STATUS_PENDING)
	{
		KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
		ntStatus = ioStatus.Status;
	}

	return ntStatus;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:51,代码来源:utils.c


示例19: IopLoadFileSystemDriver

/*
 * @implemented
 */
VOID
NTAPI
IopLoadFileSystemDriver(IN PDEVICE_OBJECT DeviceObject)
{
    IO_STATUS_BLOCK IoStatusBlock;
    PIO_STACK_LOCATION StackPtr;
    KEVENT Event;
    PIRP Irp;
    NTSTATUS Status;
    PDEVICE_OBJECT AttachedDeviceObject = DeviceObject;
    PAGED_CODE();

    /* Loop as long as we're attached */
    while (AttachedDeviceObject->AttachedDevice)
    {
        /* Get the attached device object */
        AttachedDeviceObject = AttachedDeviceObject->AttachedDevice;
    }

    /* Initialize the event and build the IRP */
    KeInitializeEvent(&Event, NotificationEvent, FALSE);
    Irp = IoBuildDeviceIoControlRequest(IRP_MJ_DEVICE_CONTROL,
                                        AttachedDeviceObject,
                                        NULL,
                                        0,
                                        NULL,
                                        0,
                                        FALSE,
                                        &Event,
                                        &IoStatusBlock);
    if (Irp)
    {
        /* Set the major and minor functions */
        StackPtr = IoGetNextIrpStackLocation(Irp);
        StackPtr->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL;
        StackPtr->MinorFunction = IRP_MN_LOAD_FILE_SYSTEM;

        /* Call the driver */
        Status = IoCallDriver(AttachedDeviceObject, Irp);
        if (Status == STATUS_PENDING)
        {
            /* Wait on it */
            KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
        }
    }

    /* Dereference DO - FsRec? - Comment out call, since it breaks up 2nd stage boot, needs more research. */
//  IopDecrementDeviceObjectRef(AttachedDeviceObject, TRUE);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:52,代码来源:volume.c


示例20: RecoveryThread

VOID RecoveryThread(PVOID Arg)
{
    PIO_STACK_LOCATION stack;
    IO_STATUS_BLOCK    IoStatus;
    KEVENT             Event;
    PIRP               Irp;
    NTSTATUS           status;

    PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION)Arg;

    while(1)
    {
        // the main part of the driver will signal us when we need to fix things
        KeWaitForSingleObject(&pdx->RecoveryEvent, Executive, KernelMode, FALSE, NULL);
    
        if(pdx->RecoveryExit) break;
        
        KeInitializeEvent(&Event, SynchronizationEvent, FALSE);

        // reset our device
        Irp = IoBuildDeviceIoControlRequest(
                                             IOCTL_INTERNAL_USB_RESET_PORT,
                                             pdx->LowerDeviceObject,
                                             NULL,
                                             0,
                                             NULL,
                                             0,
                                             TRUE,
                                             &Event,
                                             &IoStatus
                                           );

        stack = IoGetNextIrpStackLocation(Irp);
        
        status = IoCallDriver(pdx->LowerDeviceObject, Irp);

        if(STATUS_PENDING == status)
        {
            KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
            
            status = IoStatus.Status;
        }

        // start polling again
        StartPolling(pdx);
    }

    PsTerminateSystemThread(STATUS_SUCCESS);
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:49,代码来源:ReadWrite.cpp



注:本文中的IoBuildDeviceIoControlRequest函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IoCompleteRequest函数代码示例发布时间:2022-05-30
下一篇:
C++ IoAllocateMdl函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap