Compartir a través de


UNIT_OpenUnitDeviceObject (Windows CE 5.0)

Send Feedback

This function permits a subunit driver to open the appropriate unit filter driver.

NTSTATUS UNIT_OpenUnitDeviceObject(PDEVICE_OBJECT SubunitParentDeviceObject, PFILE_OBJECT* UnitFileObject, PDEVICE_OBJECT* UnitDeviceObject);

Parameters

  • SubunitParentDeviceObject
    [in] This should be the device object that the subunit obtained by calling IoAttachDeviceToDeviceStack in the AddDevice function for the subunit.
  • UnitFileObject
    [in] After completing successfully, this will be completed with a pointer to the FILE_OBJECT representing the newly opened unit device.
  • UnitDeviceObject
    [in] After completing successfully, this will be completed with a pointer to the DEVICE_OBJECT of the unit filter driver.

Return Values

If the operation was successful, the subunit should return STATUS_SUCCESS. Otherwise, an appropriate error code should be returned. Any error code will cause the request from the external device to be rejected.

Remarks

This function is required. The unit driver resides in the system as a filter driver above the AVC driver. It is not in the same device stack as the virtual subunit.

Locating the device object for the unit driver is complicated by the fact that there may be multiple instantiations of the unit driver in the case where multiple IEEE 1394 controllers exist.

In that case, finding the unit driver is not enough; you have to locate the correct device object. The unit driver itself exports a function to facilitate this process.

After calling the function, you will receive both a file object and a device object to the unit driver. The device object, and the file object, which should be used in IO_STACK_LOCATION structures, is used for actually sending IRPs to the unit driver.

Your subunit will call this function in your IRP_MN_START_DEVICE processing. When finished with the unit driver, likely in your IRP_MN_STOP_DEVICE processing, you must call UNIT_CloseUnitDeviceObject.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Avc_unit.h.
Link Library: Avc_unit.lib.

See Also

UNIT_CloseUnitDeviceObject

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.