NdisRegisterDeviceEx function (ndis.h)

The NdisRegisterDeviceEx function creates a device object that is based upon the specified attributes.

Syntax

NDIS_STATUS NdisRegisterDeviceEx(
  [in]  NDIS_HANDLE                    NdisHandle,
  [in]  PNDIS_DEVICE_OBJECT_ATTRIBUTES DeviceObjectAttributes,
  [out] PDEVICE_OBJECT                 *pDeviceObject,
  [out] PNDIS_HANDLE                   NdisDeviceHandle
);

Parameters

[in] NdisHandle

A miniport driver handle or filter driver handle that the caller obtained by calling the NdisMRegisterMiniportDriver function or the NdisFRegisterFilterDriver function respectively.

[in] DeviceObjectAttributes

A pointer to an NDIS_DEVICE_OBJECT_ATTRIBUTES structure that contains the attributes for the new device.

[out] pDeviceObject

A pointer that points to a pointer to a newly created DEVICE_OBJECT structure, if the call succeeds. If the call fails, pDeviceObject is set to point to NULL.

[out] NdisDeviceHandle

A pointer to a caller-supplied variable in which this function, if it succeeds, returns a handle to the device object. This handle is a required parameter to the NdisDeregisterDeviceEx function that the driver calls subsequently.

Return value

NdisRegisterDeviceEx returns one of the following status values:

Return code Description
NDIS_STATUS_SUCCESS
NdisRegisterDeviceEx successfully registered the device.
NDIS_STATUS_NOT_SUPPORTED
The caller is not an NDIS driver.
NDIS_STATUS_XXX or NTSTATUS_XXX
The driver's attempt to register the device failed. Usually, such an error status is propagated from an NdisXxx function or a kernel-mode support routine.

Remarks

Miniport drivers and filter drivers can call NdisRegisterDeviceEx to register a virtual device.

Note  NDIS drivers must not modify the DeviceExtension member of the DEVICE_OBJECT structure that NdisRegisterDeviceEx created.
 
If an NDIS driver requires space for context information in the device object, the driver can pass a nonzero value for the ExtensionSize member in the NDIS_DEVICE_OBJECT_ATTRIBUTES structure at the DeviceObjectAttributes parameter. In this case, NDIS allocates the extension for the driver, and the driver can call the NdisGetDeviceReservedExtension function to get a pointer to the extension.

The driver must subsequently call the NdisDeregisterDeviceEx function when the device is no longer needed. If NdisRegisterDeviceEx allocated an extension, NdisDeregisterDeviceEx frees the extension.

Requirements

Requirement Value
Minimum supported client Supported in NDIS 6.0 and later.
Target Platform Universal
Header ndis.h (include Ndis.h)
Library Ndis.lib
IRQL PASSIVE_LEVEL
DDI compliance rules Irql_Miscellaneous_Function(ndis)

See also

DEVICE_OBJECT

NDIS_DEVICE_OBJECT_ATTRIBUTES

NdisDeregisterDeviceEx

NdisFRegisterFilterDriver

NdisGetDeviceReservedExtension

NdisMRegisterMiniportDriver