共用方式為


NdisMSetAttributes function

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.

NdisMSetAttributes informs the NDIS library about significant features of the caller's NIC during initialization.

Syntax

VOID NdisMSetAttributes(
  _In_ NDIS_HANDLE         MiniportAdapterHandle,
  _In_ NDIS_HANDLE         MiniportAdapterContext,
  _In_ BOOLEAN             BusMaster,
  _In_ NDIS_INTERFACE_TYPE AdapterType
);

Parameters

  • MiniportAdapterHandle [in]
    Specifies the handle input to MiniportInitialize.

  • MiniportAdapterContext [in]
    Specifies a handle for a resident context area allocated by MiniportInitialize.

  • BusMaster [in]
    Specifies TRUE if the caller's NIC is a bus-master DMA device.

  • AdapterType [in]
    Specifies the I/O bus interface type of the caller's NIC, which usually is the type of I/O bus on which the NIC is connected, as one of the following:

    • NdisInterfaceInternal
      Specifies a host-specific internal interface.

    • NdisInterfaceIsa
      Specifies the ISA interface.

    • NdisInterfaceEisa
      Specifies the extended ISA (EISA) interface.

    • NdisInterfaceMca
      This refers to the MCA bus, which is no longer supported.

    • NdisInterfaceTurboChannel
      Specifies the Turbo Channel interface.

    • NdisInterfacePci
      Specifies the Peripheral Component Interconnect (PCI) interface.

    • NdisInterfacePcMcia
      Specifies the Personal Computer Memory Card International Association (PC Card) interface.

Return value

None

Remarks

A MiniportInitialize function must call NdisMSetAttributes or NdisMSetAttributesEx before calling any other NdisMRegisterXxx or NdisXxx function that depends on the information supplied to NdisMSetAttributes(Ex). For example, a call to NdisMAllocateMapRegisters will fail if MiniportInitialize has not yet called NdisMSetAttributes with BusMaster set to TRUE or NdisMSetAttributesEx with NDIS_ATTRIBUTE_BUS_MASTER set in the AttributeFlags.

In general, a NIC driver must call NdisMSetAttributes(Ex) before it calls any NdisXxx function that claims hardware resources in the registry for its NIC, because NDIS must have the BusMaster or AttributeFlags value, respectively, before such a call is made and because the driver usually needs the memory at MiniportAdapterContext to store information for these calls. This restriction implies that a NIC driver's MiniportInitialize function cannot call the following NdisXxx before it calls NdisMSetAttributes(Ex):

However, before calling NdisMSetAttributes(Ex), a NIC driver can call the Ndis..Configuration functions to retrieve configuration information installed in the registry and the NdisImmediateXxx, such as NdisImmediateReadPciSlotInformation or NdisImmediateReadSharedMemory, as well as the NdisImmediate..PortXxx functions. MiniportInitialize also can call the bus-type-specific NdisReadXxx functions, such as NdisReadPciSlotInformation, as long as the installed registry entry for the driver's interface type matches the bus-type-specific NdisReadXxxMiniportInitialize calls.

The MiniportAdapterContext handle supplied to NdisMSetAttributes(Ex) becomes an input parameter to all MiniportXxx functions that were registered, along with MiniportInitialize, in the call to NdisMRegisterMiniport. Usually, this handle is a pointer to resident memory, allocated by MiniportInitialize, in which the driver maintains NIC-specific run-time state.

Intermediate drivers must call NdisMSetAttributesEx, rather than NdisMSetAttributes. NIC drivers can call either of these functions, but NdisMSetAttributesEx allows a miniport driver to adjust the intervals at which its MiniportCheckForHang and MiniportReset functions are called.

Requirements

Target platform

Universal

Version

Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisMSetMiniportAttributesinstead. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.

Header

Ndis.h (include Ndis.h)

Library

Ndis.lib

IRQL

PASSIVE_LEVEL

See also

MiniportCheckForHang

MiniportInitialize

MiniportReset

NdisAllocateMemoryWithTag

NdisImmediateReadPciSlotInformation

NdisImmediateReadPortUchar

NdisImmediateReadPortUlong

NdisImmediateReadPortUshort

NdisImmediateReadSharedMemory

NdisIMRegisterLayeredMiniport

NdisMAllocateMapRegisters

NdisMAllocateSharedMemory

NdisMMapIoSpace

NdisMPciAssignResources

NdisMRegisterDmaChannel

NdisMRegisterInterrupt

NdisMRegisterIoPortRange

NdisMRegisterMiniport

NdisMSetAttributesEx

NdisOpenConfiguration

NdisReadEisaSlotInformation

NdisReadEisaSlotInformationEx

NdisReadPciSlotInformation

NdisWritePciSlotInformation

 

 

Send comments about this topic to Microsoft