当前位置: 首页>>代码示例>>C++>>正文


C++ IoGetDeviceObjectPointer函数代码示例

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


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

示例1: 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

示例2: RegisterForTargetDeviceNotification

/*
 * @implemented
 */
VOID
RegisterForTargetDeviceNotification(IN PDEVICE_EXTENSION DeviceExtension,
                                    IN PDEVICE_INFORMATION DeviceInformation)
{
    NTSTATUS Status;
    PFILE_OBJECT FileObject;
    PDEVICE_OBJECT DeviceObject;

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

    /* And simply register for notifications */
    Status = IoRegisterPlugPlayNotification(EventCategoryTargetDeviceChange,
                                            0, FileObject,
                                            DeviceExtension->DriverObject,
                                            MountMgrTargetDeviceNotification,
                                            DeviceInformation,
                                            &(DeviceInformation->TargetDeviceNotificationEntry));
    if (!NT_SUCCESS(Status))
    {
        DeviceInformation->TargetDeviceNotificationEntry = NULL;
    }

    ObDereferenceObject(FileObject);

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

示例3: vol_close

NTSTATUS vol_close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) {
    volume_device_extension* vde = DeviceObject->DeviceExtension;
    pdo_device_extension* pdode = vde->pdode;

    TRACE("(%p, %p)\n", DeviceObject, Irp);

    Irp->IoStatus.Information = 0;

    ExAcquireResourceExclusiveLite(&pdo_list_lock, TRUE);

    ExAcquireResourceSharedLite(&pdode->child_lock, TRUE);

    if (InterlockedDecrement(&vde->open_count) == 0 && vde->removing) {
        NTSTATUS Status;
        UNICODE_STRING mmdevpath;
        PDEVICE_OBJECT mountmgr;
        PFILE_OBJECT mountmgrfo;
        PDEVICE_OBJECT pdo;

        RtlInitUnicodeString(&mmdevpath, MOUNTMGR_DEVICE_NAME);
        Status = IoGetDeviceObjectPointer(&mmdevpath, FILE_READ_ATTRIBUTES, &mountmgrfo, &mountmgr);
        if (!NT_SUCCESS(Status))
            ERR("IoGetDeviceObjectPointer returned %08x\n", Status);
        else {
            remove_drive_letter(mountmgr, &vde->name);

            ObDereferenceObject(mountmgrfo);
        }

        if (vde->mounted_device) {
            device_extension* Vcb = vde->mounted_device->DeviceExtension;

            Vcb->vde = NULL;
        }

        if (vde->name.Buffer)
            ExFreePool(vde->name.Buffer);

        ExReleaseResourceLite(&pdode->child_lock);
        ExDeleteResourceLite(&pdode->child_lock);

        if (vde->pdo->AttachedDevice)
            IoDetachDevice(vde->pdo);

        pdo = vde->pdo;
        IoDeleteDevice(vde->device);

        if (!no_pnp)
            IoDeleteDevice(pdo);
    } else
        ExReleaseResourceLite(&pdode->child_lock);

    ExReleaseResourceLite(&pdo_list_lock);

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

示例4: 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

示例5: ImScsiGetAdapterDeviceObject

NTSTATUS
ImScsiGetAdapterDeviceObject()
{
    NTSTATUS status = STATUS_OBJECT_NAME_NOT_FOUND;
    int i;
    UNICODE_STRING objname = { 0 };
    PFILE_OBJECT file_object = NULL;
    PDEVICE_OBJECT device_object = NULL;
    WCHAR objstr[] = L"\\Device\\Scsi\\PhDskMnt00";

    if (pMPDrvInfoGlobal->DeviceObject != NULL)
        return STATUS_SUCCESS;

    for (i = 0; i < 100; i++)
    {
        LARGE_INTEGER wait_time;

        if ((i & 7) == 7)
        {
            wait_time.QuadPart = -1;
            KeDelayExecutionThread(KernelMode, FALSE, &wait_time);
        }

        _snwprintf(objstr, sizeof(objstr)/sizeof(*objstr), L"\\Device\\Scsi\\PhDskMnt%i", i);

        RtlInitUnicodeString(&objname, objstr);

        KdPrint2(("PhDskMnt::ImScsiGetAdapterDeviceObject: Attempt to open %ws...\n", objstr));
    
        status = IoGetDeviceObjectPointer(&objname, GENERIC_ALL, &file_object, &device_object);

        if (!NT_SUCCESS(status))
        {
            KdPrint2(("PhDskMnt::ImScsiGetAdapterDeviceObject: Attempt to open %ws failed: status=0x%x\n", objstr, status));
            continue;
        }

        if (device_object->DriverObject != pMPDrvInfoGlobal->pDriverObj)
        {
            KdPrint2(("PhDskMnt::ImScsiGetAdapterDeviceObject: %ws was not our device.\n", objstr, status));
            continue;
        }

        pMPDrvInfoGlobal->DeviceObject = device_object;

        return STATUS_SUCCESS;
    }

    if (NT_SUCCESS(status))
        KdPrint(("PhDskMnt::ImScsiGetAdapterDeviceObject: Successfully opened %ws.\n", objstr));
    else
        DbgPrint(("PhDskMnt::ImScsiGetAdapterDeviceObject: Could not locate SCSI adapter device object by name.\n"));

    return status;
}
开发者ID:ludaohong,项目名称:Arsenal-Image-Mounter,代码行数:55,代码来源:phdskmnt.c

示例6: 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

示例7: DriverEntry

NTSTATUS DriverEntry(
	__in PDRIVER_OBJECT DriverObject,
	__in PUNICODE_STRING RegistryPath
	)
{
	UNICODE_STRING CfixkrName = RTL_CONSTANT_STRING( CFIXKR_DEVICE_NT_NAME );
	PFILE_OBJECT File;
	PDEVICE_OBJECT CfixkrObject;
	NTSTATUS Status;

	UNREFERENCED_PARAMETER( RegistryPath );

	KdPrint( ( "CFIXDRV: DriverEntry of test driver\n" ) );

	//
	// Install dispatch routines.
	//
	DriverObject->MajorFunction[ IRP_MJ_CREATE ]	= CfixkDrvNotImplemented;
	DriverObject->MajorFunction[ IRP_MJ_CLOSE ]		= CfixkDrvNotImplemented;
	DriverObject->DriverUnload						= CfixkDrvUnload;

	//
	// Lookup cfixkr and obtain interface.
	//
	Status = IoGetDeviceObjectPointer(
		&CfixkrName,
		FILE_WRITE_DATA,
		&File,
		&CfixkrObject );
	if ( ! NT_SUCCESS( Status ) )
	{
		KdPrint( ( "CFIX: Failed to obtain pointer to cfixkr device\n" ) );
		return Status;
	}

	Status = CfixkDrvQueryReporter( CfixkrObject );
	if ( NT_SUCCESS( Status ) )
	{
		//
		// Keep a reference to the device to lock the driver in
		// memory until we have released the interface.
		//
		ObReferenceObject( CfixkrObject );
		CfixkDrvCfixkrDevice = CfixkrObject;
	}

	//
	// We have obtained the interface, which is referenced. We can thus
	// release File while having locked the DO through the interface.
	//
	ObDereferenceObject( File );

	return Status; 
}
开发者ID:jpassing,项目名称:cfix,代码行数:54,代码来源:drvmain.c

示例8: 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

示例9: VBoxGdcInit

/* Guest Device Communication API */
NTSTATUS VBoxGdcInit()
{
    UNICODE_STRING UniName;
    RtlInitUnicodeString(&UniName, VBOXGUEST_DEVICE_NAME_NT);
    NTSTATUS Status = IoGetDeviceObjectPointer(&UniName, FILE_ALL_ACCESS, &g_ctx.Gdc.pFo, &g_ctx.Gdc.pDo);
    if (!NT_SUCCESS(Status))
    {
        WARN(("IoGetDeviceObjectPointer failed Status(0x%x)", Status));
        memset(&g_ctx.Gdc, 0, sizeof (g_ctx.Gdc));
    }
    return Status;
}
开发者ID:virendramishra,项目名称:VirtualBox4.1.18,代码行数:13,代码来源:VBoxMFInternal.cpp

示例10: ssh_virtual_adapter_device_add_ref

/* ssh_virtual_adapter_device_add_ref()
 *
 * Increments the reference count of underlying virtual NIC's device object
 * thus ensuring that the virtual NIC can't be unloaded from memory.
 *
 * This function must be run on IRQL PASSIVE_LEVEL.
 *
 */
static Boolean
ssh_virtual_adapter_device_add_ref(SshVirtualAdapter va)
{
  Boolean status = TRUE;
#ifndef _WIN32_WCE
  PDEVICE_OBJECT device_object = NULL;
  UNICODE_STRING device_name;
#endif /* _WIN32_WCE */

  SSH_DEBUG(SSH_D_MIDSTART, ("ssh_virtual_adapter_device_add_ref()"));

  SSH_ASSERT(va != NULL);
  SSH_ASSERT(va->adapter != NULL);
  SSH_ASSERT(va->file_object == NULL);

#ifndef _WIN32_WCE
  SSH_ASSERT(SSH_GET_IRQL() == SSH_PASSIVE_LEVEL);

  NdisInitUnicodeString(&device_name, NULL);

  if (ssh_adapter_device_object_name_get(va->adapter, &device_name))
    {
      SSH_ASSERT(device_name.Buffer != NULL);
      SSH_ASSERT(device_name.Length > 0);

      if (!NT_SUCCESS(IoGetDeviceObjectPointer(
				       &device_name, FILE_ALL_ACCESS,
				       (PFILE_OBJECT *)&va->file_object,
				       &device_object)))
        {
          SSH_DEBUG(SSH_D_FAIL, ("IoGetDeviceObjectPointer() FAILED!"));

          status = FALSE;
        }

      ssh_free(device_name.Buffer);
    }
  else
    {
      SSH_DEBUG(SSH_D_FAIL, ("ssh_device_object_name_get() FAILED!"));
      status = FALSE;
    }

#else /* not _WIN32_WCE */

  /* Just initialize with a bogus value... */
  va->file_object = (void *)0x00BEEF00;

#endif /* not _WIN32_WCE */

  return (status);
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:60,代码来源:virtual_adapter_private.c

示例11: vbglDriverOpen

RT_C_DECLS_END
# endif

int vbglDriverOpen (VBGLDRIVER *pDriver)
{
# ifdef RT_OS_WINDOWS
    UNICODE_STRING uszDeviceName;
    RtlInitUnicodeString (&uszDeviceName, L"\\Device\\VBoxGuest");

    PDEVICE_OBJECT pDeviceObject = NULL;
    PFILE_OBJECT pFileObject = NULL;

    NTSTATUS rc = IoGetDeviceObjectPointer (&uszDeviceName, FILE_ALL_ACCESS,
                                            &pFileObject, &pDeviceObject);

    if (NT_SUCCESS (rc))
    {
        Log(("vbglDriverOpen VBoxGuest successful pDeviceObject=%x\n", pDeviceObject));
        pDriver->pDeviceObject = pDeviceObject;
        pDriver->pFileObject = pFileObject;
        return VINF_SUCCESS;
    }
    /** @todo return RTErrConvertFromNtStatus(rc)! */
    Log(("vbglDriverOpen VBoxGuest failed with ntstatus=%x\n", rc));
    return rc;

# elif defined (RT_OS_OS2)
    /*
     * Just check whether the connection was made or not.
     */
    if (    g_VBoxGuestIDC.u32Version == VMMDEV_VERSION
        &&  VALID_PTR(g_VBoxGuestIDC.u32Session)
        &&  VALID_PTR(g_VBoxGuestIDC.pfnServiceEP))
    {
        pDriver->u32Session = g_VBoxGuestIDC.u32Session;
        return VINF_SUCCESS;
    }
    pDriver->u32Session = UINT32_MAX;
    Log(("vbglDriverOpen: failed\n"));
    return VERR_FILE_NOT_FOUND;

# else
    uint32_t u32VMMDevVersion;
    pDriver->pvOpaque = VBoxGuestIDCOpen (&u32VMMDevVersion);
    if (    pDriver->pvOpaque
        &&  u32VMMDevVersion == VMMDEV_VERSION)
        return VINF_SUCCESS;

    Log(("vbglDriverOpen: failed\n"));
    return VERR_FILE_NOT_FOUND;
# endif
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:52,代码来源:SysHlp.cpp

示例12: get_device_object

/* get device object by its name */
NTSTATUS
get_device_object(wchar_t *name, PDEVICE_OBJECT *devobj)
{
	UNICODE_STRING str;
	NTSTATUS status;
	PFILE_OBJECT fileobj;

	RtlInitUnicodeString(&str, name);

	status = IoGetDeviceObjectPointer(&str, FILE_ALL_ACCESS, &fileobj, devobj);
	if (status == STATUS_SUCCESS)
		ObDereferenceObject(fileobj);

	return status;
}
开发者ID:340211173,项目名称:hf-2011,代码行数:16,代码来源:tdi_fw.c

示例13: FspGetDeviceObjectPointer

NTSTATUS FspGetDeviceObjectPointer(PUNICODE_STRING ObjectName, ACCESS_MASK DesiredAccess,
    PULONG PFileNameIndex, PFILE_OBJECT *PFileObject, PDEVICE_OBJECT *PDeviceObject)
{
    PAGED_CODE();

    UNICODE_STRING PartialName;
    OBJECT_ATTRIBUTES ObjectAttributes;
    HANDLE Handle;
    NTSTATUS Result;

    PartialName.Length = 0;
    PartialName.MaximumLength = ObjectName->Length;
    PartialName.Buffer = ObjectName->Buffer;

    Result = STATUS_NO_SUCH_DEVICE;
    while (PartialName.MaximumLength > PartialName.Length)
    {
        while (PartialName.MaximumLength > PartialName.Length &&
            L'\\' == PartialName.Buffer[PartialName.Length / sizeof(WCHAR)])
            PartialName.Length += sizeof(WCHAR);
        while (PartialName.MaximumLength > PartialName.Length &&
            L'\\' != PartialName.Buffer[PartialName.Length / sizeof(WCHAR)])
            PartialName.Length += sizeof(WCHAR);

        Result = IoGetDeviceObjectPointer(&PartialName, DesiredAccess, PFileObject, PDeviceObject);
        if (NT_SUCCESS(Result))
        {
            *PFileNameIndex = PartialName.Length;
            break;
        }

        InitializeObjectAttributes(&ObjectAttributes, &PartialName, OBJ_KERNEL_HANDLE, 0, 0);
        Result = ZwOpenDirectoryObject(&Handle, 0, &ObjectAttributes);
        if (!NT_SUCCESS(Result))
        {
            Result = ZwOpenSymbolicLinkObject(&Handle, 0, &ObjectAttributes);
            if (!NT_SUCCESS(Result))
            {
                Result = STATUS_NO_SUCH_DEVICE;
                break;
            }
        }
        ZwClose(Handle);
    }

    return Result;
}
开发者ID:billziss-gh,项目名称:winfsp,代码行数:47,代码来源:util.c

示例14: CFTOpenCom

// 打开一个端口设备
PDEVICE_OBJECT CFTOpenCom(ULONG aId, NTSTATUS *aStatus)
{
	UNICODE_STRING nameString;
	static WCHAR name[32] = {0};
	PFILE_OBJECT fileObject = NULL;
	PDEVICE_OBJECT deviceObject = NULL;

	// 输入字符串
	RtlZeroMemory(name, sizeof(WCHAR)*32);
	RtlStringCchPrintfW(name, 32, L"\\Device\\Serial%d", aId);
	RtlInitUnicodeString(&nameString, name);

	// 打开设备对象
	*aStatus = IoGetDeviceObjectPointer(&nameString, FILE_ALL_ACCESS, &fileObject, &deviceObject);
	if (*aStatus == STATUS_SUCCESS)
		ObDereferenceObject(fileObject);

	return deviceObject;
}
开发者ID:killbug2004,项目名称:wy-windows-driver,代码行数:20,代码来源:wycomflt.cpp

示例15: OpenCom

PDEVICE_OBJECT OpenCom(ULONG id, NTSTATUS* status)
{
	UNICODE_STRING name_str;
	static WCHAR name[32] = { 0 };
	PFILE_OBJECT fileobj = NULL;
	PDEVICE_OBJECT devobj = NULL;

	memset(name, 0, sizeof(WCHAR)* 32);
	RtlStringCchPrintfW(
		name, 32,
		L"\\Device\\Serial%d", id);
	RtlInitUnicodeString(&name_str, name);
	*status = IoGetDeviceObjectPointer(
		&name_str, FILE_ALL_ACCESS,
		&fileobj, &devobj);
	if (*status == STATUS_SUCCESS)
		ObDereferenceObject(fileobj);

	return devobj;
}
开发者ID:61--,项目名称:learn_driver,代码行数:20,代码来源:main.c


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