Initializing, Setting, and Retrieving VLAN Identifiers (NDIS 5.1)
Note NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.
A miniport driver that supports packets that are marked with a VLAN identifier (ID) maintains a configured VLAN ID for each NIC. During the miniport driver's MiniportInitializeroutine for a particular NIC, the driver initially sets the NIC's VLAN ID to zero. The driver's MiniportInitializeroutine then reads the following configuration parameter from the registry and, if the parameter is present, sets the NIC's VLAN ID to the parameter's value.
VlanId, REG_DWORD
The NIC's VLAN ID is configured in the registry when the NIC is installed on the operating system. To configure the NIC's VLAN ID, the miniport driver's information (INF) file must contain the VlanID keyword and a DWORD that identifies the VLAN to associate with the NIC.
The following is an example of an add-registry-section in a miniport driver's INF file that adds the VlanId subkey to the Ndi\params key.
[a1.params.AddReg]
HKR, Ndi\params\VlanID, ParamDesc, 0, %VlanID%
HKR, Ndi\params\VlanID, default, 0, "777"
HKR, Ndi\params\VlanID, type, 0, "long"
HKR, Ndi\params\VlanID, min, 0, "0"
HKR, Ndi\params\VlanID, max, 0, "4095"
HKR, Ndi\params\VlanID, step, 0, "1"
HKR, Ndi\params\VlanID, base, 0, "10"
A miniport driver that supports VLAN ID-marked packets must also support the OID_GEN_VLAN_IDquery and set code. When a higher-layer driver uses OID_GEN_VLAN_ID in a query, the miniport driver returns the currently configured VLAN ID for the NIC. When used in a set, the miniport driver sets the NIC's VLAN ID to the specified value.