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
);
IoAllocateDriverObjectExtension returns one of the following NTSTATUS codes:
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
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.