NdisWriteConfiguration

VOID
NdisWriteConfiguration(

OUT PNDIS_STATUS Status,
IN NDIS_HANDLE WrapperConfigurationContext,
IN PNDIS_STRING Keyword,
IN PNDIS_CONFIGURATION_PARAMETER *ParameterValue
);

NdisWriteConfiguration writes a caller-supplied value for a specified entry into the registry.

Parameters

Status

Points to a caller-supplied variable in which this function returns the status of the call as one of the following:

NDIS_STATUS_SUCCESS

The supplied value at ParameterValue was written into the registry. If this is a new entry, the name at Keyword also was written into the registry.

NDIS_STATUS_NOT_SUPPORTED

The supplied ParameterType is invalid.

NDIS_STATUS_RESOURCES

NDIS could not allocate resources, usually enough memory, to transfer the requested information to the registry.

NDIS_STATUS_FAILURE

The requested information could not be written.

WrapperConfigurationContext

Specifies the handle returned by NdisOpenConfiguration or NdisOpenProtocolConfiguration.

Keyword

Points to a caller-supplied counted string, in the system-default character set, specifying the name of an entry for which to write the value. For Windows NT drivers, this string contains Unicode characters.

ParameterValue

Points to a caller-supplied variable set to the address of a filled-in NDIS_CONFIGURATION_PARAMETER structure, defined as follows:

typedef struct _NDIS_CONFIGURATION_PARAMETER {

NDIS_PARAMETER_TYPE ParameterType;

union {

ULONG IntegerData;

NDIS_STRING StringData;

} ParameterData;

} NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER;

The members of this structure can contain the following data:

ParameterType

Specifies the type of the value entry as one of the following:

NdisParameterInteger

Specifies an integer in decimal notation.

NdisParameterHexInteger

Specifies an integer in hexadecimal notation.

NdisParameterString

Specifies a string of type NDIS_STRING.

For Windows NT drivers, this is a counted Unicode string.

NdisParameterMultiString

Specifies a multistring parameter of the
Windows NT-defined REG_MULTI_SZ type.

ParameterData

Specifies the value of the given named entry in the notation of the specified ParameterType. If ParameterType is a string type, this member is a pointer to a buffered counted string in the system-default character set.

For Windows NT drivers, such a string contains Unicode characters.

Comments

If an entry of the same name as at Keyword already exists under the opened registry key, NdisWriteConfiguration replaces its current value with the caller-supplied value. Otherwise, NdisWriteConfiguration adds a new value entry with the given name and supplied value to the registry.

In the Windows NT configuration registry, an NDIS keyword is a synonym for a value entry name. Such a name is a counted sequence of Unicode characters, terminated with a zero.

NdisWriteConfiguration buffers and copies the caller-supplied string at Keyword and the caller-supplied data specified at ParameterValue. This memory is freed when the driver releases the ConfigurationHandle with NdisCloseConfiguration. The caller of NdisWriteConfiguration is responsible for releasing the buffered string at Keyword and the memory allocated for the NDIS_CONFIGURATION_PARAMETER structure.

As an alternative to calling NdisWriteConfiguration, every NDIS driver can set up configuration information in the registry for itself under the driver's Parameters key using an installation script.

For more information about Windows NT setup and installation scripts, see the Programmer's Guide.

Callers of NdisWriteConfiguration run at IRQL PASSIVE_LEVEL.

See Also

MiniportInitialize, NdisAnsiStringToUnicodeString, NdisCloseConfiguration, NdisFreeMemory, NdisFreeString, NdisInitAnsiString, NdisInitializeString, NdisInitUnicodeString, NdisOpenConfiguration, NdisOpenProtocolConfiguration, NdisReadConfiguration, NdisUnicodeStringToAnsiString