IO Create Device - Pdf 21

IoCreateDevice
The IoCreateDevice routine creates a device object for use by a driver.
NTSTATUS 

  
IoCreateDevice(

    IN PDRIVER_OBJECT
  DriverObject
,

    IN ULONG
  DeviceExtensionSize
,

    IN PUNICODE_STRING
  DeviceName  
OPTIONAL,

    IN DEVICE_TYPE
  DeviceType
,

    IN ULONG
  DeviceCharacteristics
,

    IN BOOLEAN
  Exclusive
,


Return Value
IoCreateDevice returns STATUS_SUCCESS on success, or the appropriate NTSTATUS error code on failure. A
partial list of the failure codes returned by this function include:
STATUS_INSUFFICIENT_RESOURCES
STATUS_OBJECT_NAME_EXISTS
STATUS_OBJECT_NAME_COLLISION
Headers
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
Comments
IoCreateDevice creates a device object and returns a pointer to the object. The caller is responsible for deleting
the object when it is no longer needed by calling IoDeleteDevice.
IoCreateDevice can only be used to create an unnamed device object, or a named device object for which a
security descriptor is set by an INF file. Otherwise, drivers must use IoCreateDeviceSecure to create named
device objects. For more information, see Creating a Device Object. The caller is responsible for setting certain
members of the returned device object. For more information, see Initializing a Device Object and the device-
 Kernel-Mode Driver Architecture: Windows DDK
Page 1 of 2IoCreateDevice
9/19/2010mk:@MSITStore:E:\WINDDK\3790.1830\help\kmarch.chm::/hh/kmarch/k104_1e38a631-...
type-specific documentation for your device.
Be careful to specify the DeviceType and DeviceCharacteristics values in the correct parameters. Both parameters
use system-defined FILE_XXX constants and some driver writers specify the values in the wrong parameters by
mistake.
Device objects for disks, tapes, CD-ROMs, and RAM disks are given a Volume Parameter Block (VPB) that is
initialized to indicate that the volume has never been mounted on the device.
If a driver's call to IoCreateDevice returns an error, the driver should release any resources that it allocated for
that device.
Callers of IoCreateDevice must be running at IRQL <= APC_LEVEL.
See Also
DEVICE_OBJECT, IoAttachDevice, IoAttachDeviceToDeviceStack, IoCreateDeviceSecure,
IoCreateSymbolicLink, IoDeleteDevice


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status