📄 config.c
字号:
else
puValue->u8Uint8 = MIB_PROTOCOL_802_11G;
break;
case CFG_REGULATORY_DOMAIN:
*pusObjectID = MIB_CURRENT_REG_DOMAIN;
// puValue->u8Uint8 = (UCHAR)psCFG->eDomain;
puValue->u8Uint8 = (UCHAR)psWlan->ulRegDomain;
break;
case CFG_BASIC_RATE_SET:
*pusObjectID = MIB_FORCE_RATE;
// puValue->u32Uint32 = (ULONG)psCFG->eRateSelect;
puValue->u32Uint32 = psWlan->ulForcedRate;
break;
case CFG_FRAGMENT_THRESHOLD:
*pusObjectID = MIB_FRAGMENT_THRESHOLD;
// puValue->u16Uint16 = psCFG->usFragmentThreshold;
puValue->u16Uint16 = (USHORT)psWlan->ulFragmentThreshold;
break;
case CFG_RTSCTS_THRESHOLD:
*pusObjectID = MIB_RTS_THRESHOLD;
// puValue->u16Uint16 = psCFG->usRTSCTSThreshold;
puValue->u16Uint16 = (USHORT)psWlan->ulRTSThreshold;
break;
// case CFG_BEACON_PERIOD:
// *pusObjectID = MIB_BEACON_PERIOD;
// puValue->u16Uint16 = psCFG->usBeaconPeriod;
// break;
case CFG_LISTEN_INTERVAL:
*pusObjectID = MIB_LISTEN_INTERVAL;
// puValue->u16Uint16 = psCFG->usListenInterval;
puValue->u16Uint16 = (USHORT)psWlan->ulListenInterval;
break;
case CFG_SHORT_PREAMBLE:
*pusObjectID = MIB_SHORT_PREAMBLE_OPTION_IMPLEMENTED;
// puValue->u8Uint8 = (UCHAR)psCFG->boShortPreamble;
puValue->u8Uint8 = (UCHAR)psWlan->boShortPreamble;
break;
case CFG_UWA_SENS_LOCKOUT:
*pusObjectID = MIB_UWA_SENS_LOCKOUT;
puValue->u8Uint8 = (UCHAR)psCFG->boUwaSensLockout;
break;
case CFG_RESTRICTED_CHANNEL:
*pusObjectID = MIB_RESTRICTED_CHANNEL_NUMBER;
// puValue->u16Uint16 = psCFG->usChannel;
puValue->u16Uint16 = (USHORT)psWlan->ulRestrChannel;
break;
case CFG_IBSS_CHANNEL:
*pusObjectID = MIB_IBSS_CHANNEL_NUMBER;
puValue->u16Uint16 = (USHORT)psWlan->ulIbssChannel;
break;
case CFG_WMM_SUPPORT:
*pusObjectID = MIB_WME_ENABLED;
puValue->u8Uint8 = (UCHAR)psCFG->boWMMSupported;
break;
case CFG_BACKGROUND_SCAN_CONFIG:
*pusObjectID = MIB_BACKGROUND_SCAN_PARAMS;
puValue->sBckgrndScanParams.u16CamScanIntervalSec = (USHORT)psWlan->sBckGrndScanConfig.ulCamScanInterval;
puValue->sBckgrndScanParams.u16PsScanIntervalSec = (USHORT)psWlan->sBckGrndScanConfig.ulPsScanInterval;
break;
case CFG_MULTI_DOMAIN_CAPABILITY:
*pusObjectID = MIB_MULTI_DOMAIN_CAP_ENABLED;
puValue->u8Uint8 = (UCHAR)psWlan->boMultiDomainCapabilityEnabled;
break;
case CFG_RADIO_MEASUREMENT_CAPABILITY:
*pusObjectID = MIB_RADIO_MEASUREMENT_CAP_ENABLED;
puValue->u8Uint8 = (UCHAR)psWlan->boRadioMeasurementCapabilityEnabled;
break;
case CFG_CCX_CAPABILITY:
*pusObjectID = MIB_CCX_CAP_ENABLED;
puValue->u8Uint8 = (UCHAR)psWlan->boCcxCapabilityEnabled;
break;
case CFG_BLUETOOTH_COEX_CAPABILITY:
*pusObjectID = MIB_BLUETOOTH_COEX_CAP_ENABLED;
puValue->u8Uint8 = (UCHAR)psWlan->boBluetoothCoexCapabilityEnabled;
break;
/*
case CFG_AGGRESSIVE_RATE_SELECTION:
*pusObjectID = MIB_AGGRESSIVE_RATE_SEL_ENABLED;
puValue->u8Uint8 = (UCHAR)psWlan->boAggressiveRateSelectionEnabled;
break;
*/
/* Add handling for extra MIB items here. */
default:
DBG_LEV0(("ERROR: Unrecognized MIB Item, %d.\n",
psCFG->eMibItem));
break;
}
psCFG->eMibItem++;
boItem = TRUE;
}
}
return boItem;
}
/*****************************************************************************/
/*** Private Functions ***/
/*****************************************************************************/
/*****************************************************************************
**
** NAME iCFGcreateCodeImage
**
** PARAMETERS hRegistryHandle Handle to open registry key.
** sKeyword NDIS string constant that identifies
** the registry key containing the
** code image.
**
** RETURNS NDIS_STATUS_SUCCESS or error code. See ndis.h.
**
** DESCRIPTION This function should be called to create a code image which
** will be used to boot the device. The function opens the
** specified registry key containing the filename of the code
** from which an image should be created. This file will be
** opened and memory mapped. Then a block of non-paged memory
** will be allocated and the code data copied into it. The file
** can then be unmapped and closed.
**
******************************************************************************/
static NDIS_STATUS
iCFGcreateCodeImage(IN NDIS_HANDLE hRegistryHandle,
IN CONST NDIS_STRING sKeyword,
OUT PCFG_CODE_IMAGE psCode)
{
NDIS_STATUS iStatus = NDIS_STATUS_FAILURE;
PNDIS_CONFIGURATION_PARAMETER psFilename = NULL;
NDIS_HANDLE hFileHandle = NULL;
PVOID pvSource = NULL;
UINT uiLength;
ASSERT (psCode != NULL);
psCode->paucImage = NULL;
psCode->ulLength = 0;
/*
* Read the filename of the bootloader from the registry, open the file
* and memory map it. Allocate a block of non-paged memory for the image
* and copy the contents of the file to it.
*/
if (!boENDreadValue(hRegistryHandle, &psFilename, sKeyword,
NdisParameterString))
{
DBG_LEV0(("ERROR: Couldn't read filename from registry.\n"));
}
else
{
NdisOpenFile(&iStatus, &hFileHandle, &uiLength,
&psFilename->ParameterData.StringData,
sHighestPossibleAddress);
if (iStatus != NDIS_STATUS_SUCCESS)
{
DBG_LEV0(("ERROR: Couldn't open file.\n"));
}
else
{
NdisMapFile(&iStatus, &pvSource, hFileHandle);
if (iStatus != NDIS_STATUS_SUCCESS)
{
DBG_LEV0(("ERROR: Couldn't memory map file.\n"));
}
else
{
iStatus = NdisAllocateMemoryWithTag(&psCode->paucImage,
uiLength,
'ifAC');
if (iStatus != NDIS_STATUS_SUCCESS)
{
DBG_LEV0(("ERROR: Couldn't allocate memory for "
"code image.\n"));
}
else
{
NdisMoveMemory(psCode->paucImage,
pvSource, uiLength);
psCode->ulLength = uiLength;
}
}
}
}
if (pvSource != NULL) NdisUnmapFile(hFileHandle);
if (hFileHandle != NULL) NdisCloseFile(hFileHandle);
return iStatus;
}
/*****************************************************************************
**
** NAME boCFGreadBoolean
**
** PARAMETERS hRegistryHandle Handle to open registry key.
** sKeyword NDIS string constant that identifies
** the registry key containing the
** parameter.
** pboValue Location where parameter value should
** be stored.
**
** RETURNS A boolean indicating whether the parameter was successfully
** read from the the registry.
**
** DESCRIPTION This function should be called to read a boolean parameter from
** the registry.
**
******************************************************************************/
static BOOLEAN
boCFGreadBoolean(IN NDIS_HANDLE hRegistryHandle,
IN CONST NDIS_STRING sKeyword,
OUT PBOOLEAN pboValue)
{
PNDIS_CONFIGURATION_PARAMETER psParam;
BOOLEAN boResult = FALSE;
if (boENDreadValue(hRegistryHandle, &psParam, sKeyword,
NdisParameterInteger))
{
if ((UINT)psParam->ParameterData.IntegerData > 1)
{
DBG_LEV0(("ERROR: Invalid value for boolean parameter %d.\n",
psParam->ParameterData.IntegerData));
}
else
{
*pboValue = (psParam->ParameterData.IntegerData != 0);
boResult = TRUE;
}
}
return boResult;
}
/*****************************************************************************
**
** NAME boCFGreadString
**
** PARAMETERS hRegistryHandle Handle to open registry key.
** sKeyword NDIS string constant that identifies
** the registry key containing the
** parameter.
** ulMaxLength Maximum length of string.
** pacValue Pointer to location where string should
** be stored.
** pulLength Length of string read from registry.
**
** RETURNS A boolean indicating whether the parameter was successfully
** read from the the registry.
**
** DESCRIPTION This function should be called to read a string parameter from
** the registry.
**
******************************************************************************/
static BOOLEAN
boCFGreadString(IN NDIS_HANDLE hRegistryHandle,
IN CONST NDIS_STRING sKeyword,
IN ULONG ulMaxLength,
OUT PCHAR pacValue,
OUT PULONG pulLength)
{
PNDIS_CONFIGURATION_PARAMETER psParam;
BOOLEAN boResult = FALSE;
ANSI_STRING sAnsiString;
NDIS_STATUS iStatus;
*pulLength = 0;
if (boENDreadValue(hRegistryHandle, &psParam, sKeyword,
NdisParameterString))
{
if (psParam->ParameterData.StringData.Length > ulMaxLength * 2)
{
DBG_LEV0(("ERROR: String parameter too long %d, max %d.\n",
psParam->ParameterData.StringData.Length, ulMaxLength * 2));
}
else
{
sAnsiString.MaximumLength = (USHORT)ulMaxLength;
sAnsiString.Buffer = pacValue;
iStatus = NdisUnicodeStringToAnsiString(&sAnsiString,
&psParam->ParameterData.StringData);
if (iStatus != NDIS_STATUS_SUCCESS)
{
DBG_LEV0(("ERROR: Couldn't convert unicode string %s to ansi.\n",
&psParam->ParameterData.StringData));
}
else
{
*pulLength = sAnsiString.Length;
boResult = TRUE;
}
}
}
return boResult;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -