Previous Next

IoAllocateDriverObjectExtension

The IoAllocateDriverObjectExtension routine allocates a per-driver context area, called a driver object extension, and assigns a unique identifier to it.

NTSTATUS
  IoAllocateDriverObjectExtension(
    IN PDRIVER_OBJECT  DriverObject,
    IN PVOID  ClientIdentificationAddress,
    IN ULONG  DriverObjectExtensionSize,
    OUT PVOID  *DriverObjectExtension
    );

Parameters

DriverObject
Pointer to a driver object to which the context area will be associated.
ClientIdentificationAddress
Specifies a unique identifier for the context area to be allocated.
DriverObjectExtensionSize
Specifies the length, in bytes, of the context area to be allocated.
DriverObjectExtension
Pointer to, on completion, the allocated context area.

Return Value

IoAllocateDriverObjectExtension returns one of the following NTSTATUS codes:

STATUS_SUCCESS
Indicates that the routine allocated an extension of the requested size.
STATUS_INSUFFICENT_RESOURCES
Indicates that the memory could not be allocated for the driver object extension.
STATUS_OBJECT_NAME_COLLISION
Indicates that a driver object extension with the given ClientIdentificationAddress already exists.

Headers

Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.

Comments

Memory allocated by the system for the driver object extension is resident storage and is accessible from a raised IRQL. The allocated storage is automatically freed by the I/O Manager when the driver object is deleted.

Callers of this routine must provide a unique identifier for ClientIdentificationAddress. To retrieve a pointer to the context area, a caller passes the ClientIdentificationAddress to IoGetDriverObjectExtension.

Callers of this routine must be running at IRQL <= DISPATCH_LEVEL.

See Also

IoGetDriverObjectExtension