NdisReadConfiguration 函数 (ndis.h)

The NdisReadConfiguration function returns the value of a named entry of the specified type from the registry, given the handle to an open registry key. This function must be invoked serially with respect to itself and the NdisWriteConfiguration function.

Syntax

VOID NdisReadConfiguration(
  [out] PNDIS_STATUS                  Status,
  [out] PNDIS_CONFIGURATION_PARAMETER *ParameterValue,
  [in]  NDIS_HANDLE                   ConfigurationHandle,
  [in]  PNDIS_STRING                  Keyword,
  [in]  NDIS_PARAMETER_TYPE           ParameterType
);

Parameters

[out] Status

指向调用方提供的变量的指针,在此变量中,此函数将调用的状态作为以下值之一返回。

Value Meaning
NDIS_STATUS_SUCCESS
The buffer at ParameterValue contains the returned configuration information.
NDIS_STATUS_RESOURCES
NDIS 无法分配资源(通常是足够的内存)来返回请求的信息。
NDIS_STATUS_FAILURE
The requested information could not be found under the opened registry key designated by the ConfigurationHandle.

[out] ParameterValue

指向 NDIS 提供指向 的指针的内存位置的指针 NDIS_CONFIGURATION_PARAMETER structure if the call to NdisReadConfiguration is successful. NDIS 为 NDIS_CONFIGURATION_PARAMETER structure.

[in] ConfigurationHandle

The handle to a registry key that was returned by the NdisOpenConfigurationEx, NdisOpenConfigurationKeyByIndex, or NdisOpenConfigurationKeyByName function.

[in] Keyword

指向调用方提供的NDIS_STRING类型的指针,该类型描述系统默认字符集中的计数字符串,指定要返回值的打开注册表项下的条目的名称。

或者,指向调用方提供的NDIS_STRING_CONSTANT的指针,指定以下预定义条目名称之一以及预定义的返回值:

预定义条目名称 预定义的返回值
ProcessorType
  • NdisProcessorX86
  • NdisProcessorAmd64
  • NdisProcessorIA64
  • NdisProcessorAlpha
仅当旧的 (pre-NDIS 6.0) 驱动程序时,才能执行以下作:
  • NdisProcessorMips
  • NdisProcessorPpc
NdisVersion 0xMMMMmmmm, where MMMM is the major version and mmmm is the minor version number. 例如,0x00050000指示系统支持的最高 NDIS 版本是主要版本 5(次要版本 0)。

[in] ParameterType

The type of the value entry that is specified as one of the NDIS_PARAMETER_TYPE enumeration values. 在 Windows NT 及更高版本中忽略此参数。

Return value

None

Remarks

In the configuration registry of Windows 2000 and later versions, an NDIS keyword is a synonym for a value entry name. Such a name is a counted sequence of Unicode characters, terminated with a NULL.

Every NDIS driver can set up configuration information in the registry for itself using the AddReg directive in its INF file. 例如,协议驱动程序可能将其自己的名称存储为具有预格式化字符串值的条目,这些值可以在调用中传递 NdisRegisterProtocolDriver function. 有关详细信息,请参阅网络 INF 文件 中的Add-registry-sections。

每个微型端口驱动程序还具有注册表中的关联值项。 任何特定微型端口驱动程序的值条目本质上都可以依赖于设备。 例如,微型端口驱动程序可能具有诸如 *FlowControl、*SpeedDuplex 和 *InterruptModeration 等关键字。 与此类 NDIS 关键字关联的值可以是整数(ULONG 类型)或字符串(NDIS_STRING类型)。 For example, the set of possible values for the already mentioned *FlowControl entry might be NdisParameterInteger values 0, 1, 2, or 3, or the equivalents in hexadecimal as NdisParameterHexInteger values.

NdisReadConfiguration buffers and copies the caller-supplied string at Keyword and releases the storage it allocates for this copy before it returns control to the caller. 为其分配的内存 NDIS_CONFIGURATION_PARAMETER structure is freed when the driver releases the ConfigurationHandle with the NdisCloseConfiguration function. The caller of NdisReadConfiguration is responsible for releasing the buffered string at Keyword.

请注意,NDIS 不会验证驱动程序从注册表读取的值。 The caller of NdisReadConfiguration must therefore not make any assumptions about such values and must validate each value read from the registry. 如果调用方确定某个值超出界限,则应改用默认值。

有关安装和安装文件的详细信息,请参阅 设备安装概述

Requirements

Requirement Value
最低支持的客户端 Windows Vista 中支持 NDIS 6.0 和 NDIS 5.1 驱动程序(请参阅 NdisReadConfiguration (NDIS 5.1)。 Windows XP 中支持 NDIS 5.1 驱动程序(请参阅 NdisReadConfiguration (NDIS 5.1)。
Target Platform Universal
Header ndis.h (包括 Ndis.h)
Library Ndis.lib
IRQL PASSIVE_LEVEL
DDI 符合性规则 Irql_Miscellaneous_Function(ndis)

See also

ANSI_STRING

NDIS_CONFIGURATION_PARAMETER

NDIS_PARAMETER_TYPE

NdisAnsiStringToUnicodeString

NdisCloseConfiguration

NdisFreeString

NdisInitAnsiString

NdisInitUnicodeString

NdisInitializeString

NdisOpenConfigurationEx

NdisOpenConfigurationKeyByIndex NdisOpenConfigurationKeyByName

NdisReadNetworkAddress

NdisUnicodeStringToAnsiString

NdisWriteConfiguration

UNICODE_STRING