📄 oidproc.c
字号:
//dralee 081005, V4
//(PrevEncryptionStatus != Ndis802_11Encryption2Enabled) )
((PrevEncryptionStatus != Ndis802_11Encryption2Enabled) &&
(PrevEncryptionStatus != Ndis802_11Encryption3Enabled) )
)
{
USHORT usCommand;
// Adapter is connected and there is a mode change
// Disconnect first
if ( Adapter->InfrastructureMode == Ndis802_11Infrastructure )
{
usCommand = HostCmd_CMD_802_11_DEAUTHENTICATE;
}
else
{
usCommand = HostCmd_CMD_802_11_AD_HOC_STOP;
}
// completely clean up
Status=PrepareAndSendCommand(
Adapter,
usCommand,
0,
HostCmd_OPTION_USE_INT,
Oid,
HostCmd_PENDING_ON_NONE,
0,
FALSE,
NULL,
NULL,
NULL,
NULL);
#ifdef DEBUG_PARA_ROAMING
#ifdef PARA_WPA_1X
if((!priv.bAutoRoamingInProcess) && (!priv.bManualRoamingInProcess)||IsRoamingWantWZCWorkProperly())
#else
if((!priv.bAutoRoamingInProcess) && (!priv.bManualRoamingInProcess))
#endif
{
#endif
ResetDisconnectStatus(Adapter);
#ifdef DEBUG_PARA_ROAMING
}
#endif
}
if ( (PrevEncryptionStatus == Ndis802_11Encryption1Enabled) ||
(PrevEncryptionStatus == Ndis802_11Encryption1KeyAbsent) )
{
// disable WEP
/* dralee 081005, V4
Adapter->usMacControlRecord |=
( HostCmd_ACT_MAC_RX_ON |
HostCmd_ACT_MAC_TX_ON |
HostCmd_ACT_MAC_INT_ENABLE);
Adapter->usMacControlRecord &=
~HostCmd_STATUS_MAC_WEP_ENABLE;
*/
Action = HostCmd_STATUS_MAC_RX_ON |
HostCmd_STATUS_MAC_TX_ON |
HostCmd_STATUS_MAC_INT_ENABLE;
Status=PrepareAndSendCommand(
Adapter,
HostCmd_CMD_MAC_CONTROL,
//Adapter->usMacControlRecord,
Action,
HostCmd_OPTION_USE_INT,
Oid,
HostCmd_PENDING_ON_NONE,
0,
FALSE,
NULL,
BytesRead,
BytesNeeded,
InformationBuffer);
}
#ifdef PARA_WPA_1X
{
// tt broadcom mix mode ++
if(EncryptionStatus==Ndis802_11Encryption3Enabled||EncryptionStatus==Ndis802_11Encryption3KeyAbsent)
Adapter->EncryptionStatus = Ndis802_11Encryption3KeyAbsent;
else
Adapter->EncryptionStatus = Ndis802_11Encryption2KeyAbsent;
// tt broadcom mix mode --
}
#else
Adapter->EncryptionStatus = Ndis802_11Encryption2KeyAbsent;
#endif
// plus added (for WEP -> WPA-PSK TKIP)
Adapter->WEPStatus = Ndis802_11WEPDisabled;
// Enabling FW WPA will occur just right before association
// command is sent down
Status = NDIS_STATUS_SUCCESS;
break;
case Ndis802_11Encryption1Enabled:
case Ndis802_11Encryption1KeyAbsent:
Adapter->WPAEnabled = FALSE;
// disable RSN if previous status is 2 or 3
if ( (PrevEncryptionStatus == Ndis802_11Encryption2Enabled) ||
(PrevEncryptionStatus == Ndis802_11Encryption3Enabled) ||
(PrevEncryptionStatus == Ndis802_11Encryption2KeyAbsent) ||
(PrevEncryptionStatus == Ndis802_11Encryption3KeyAbsent))
{
// check if it is necessary to disconnect
if ( Adapter->MediaConnectStatus == NdisMediaStateConnected )
{
USHORT usCommand;
// Adapter is connected and there is a mode change
// Disconnect first
if ( Adapter->InfrastructureMode == Ndis802_11Infrastructure )
{
usCommand = HostCmd_CMD_802_11_DEAUTHENTICATE;
}
else
{
usCommand = HostCmd_CMD_802_11_AD_HOC_STOP;
}
// completely clean up
Status=PrepareAndSendCommand(
Adapter,
usCommand,
0,
HostCmd_OPTION_USE_INT,
Oid,
HostCmd_PENDING_ON_NONE,
0,
FALSE,
NULL,
NULL,
NULL,
NULL);
#ifdef DEBUG_PARA_ROAMING
#ifdef PARA_WPA_1X
if((!priv.bAutoRoamingInProcess) && (!priv.bManualRoamingInProcess)||IsRoamingWantWZCWorkProperly())
#else
if((!priv.bAutoRoamingInProcess) && (!priv.bManualRoamingInProcess))
#endif
{
#endif
ResetDisconnectStatus(Adapter);
#ifdef DEBUG_PARA_ROAMING
}
#endif
}
Status = PrepareAndSendCommand(
Adapter,
HostCmd_CMD_802_11_ENABLE_RSN,
HostCmd_ACT_SET,
HostCmd_OPTION_USE_INT,
Oid,
HostCmd_PENDING_ON_NONE,
0,
FALSE,
NULL,
BytesRead,
BytesNeeded,
InformationBuffer);
}
Adapter->EncryptionStatus = Ndis802_11Encryption1Enabled;
Adapter->WEPStatus = Ndis802_11WEPEnabled;
// Enable WEP
// TODO: May need to check for previous status, not sure
// if OS disable WPA first if WPA is used in previous association
/* dralee 081005, V4
Adapter->usMacControlRecord |=
(HostCmd_ACT_MAC_RX_ON |
HostCmd_ACT_MAC_TX_ON |
HostCmd_ACT_MAC_WEP_ENABLE |
HostCmd_ACT_MAC_INT_ENABLE);
*/
Action = HostCmd_STATUS_MAC_RX_ON |
HostCmd_STATUS_MAC_TX_ON |
HostCmd_STATUS_MAC_WEP_ENABLE |
HostCmd_STATUS_MAC_INT_ENABLE;
//BugFix
if(Adapter->LastAddedWEPKey.KeyLength==13)
{
//WEP 128bit
Action = Action |HostCmd_ACT_MAC_WEP_TYPE;
DBGPRINT(DBG_DEBUGUSE,("MrvDrvSetEncryptionStatus: SetCMD 0x28 WEP 128bit\n"));
}else
{
//WEP 64bit
Action = Action&(~HostCmd_ACT_MAC_WEP_TYPE);
DBGPRINT(DBG_DEBUGUSE,("MrvDrvSetEncryptionStatus: SetCMD 0x28 WEP 64bit\n"));
}
Status=PrepareAndSendCommand(
Adapter,
HostCmd_CMD_MAC_CONTROL,
//Adapter->usMacControlRecord, //dralee 081005, V4
Action,
HostCmd_OPTION_USE_INT,
Oid,
HostCmd_PENDING_ON_SET_OID,
0,
FALSE,
NULL,
BytesRead,
BytesNeeded,
InformationBuffer);
if (Status == NDIS_STATUS_FAILURE || Status == NDIS_STATUS_RESOURCES)
{
// return Status;
}
else
{
Status = NDIS_STATUS_PENDING;
}
break;
case Ndis802_11EncryptionDisabled:
Adapter->WPAEnabled = FALSE;
switch ( Adapter->EncryptionStatus )
{
case Ndis802_11Encryption3Enabled:
case Ndis802_11Encryption2Enabled:
case Ndis802_11Encryption2KeyAbsent:
case Ndis802_11Encryption3KeyAbsent:
// disable TKIP/WPA
Status = PrepareAndSendCommand(
Adapter,
HostCmd_CMD_802_11_ENABLE_RSN,
HostCmd_ACT_SET,
HostCmd_OPTION_USE_INT,
Oid,
HostCmd_PENDING_ON_SET_OID,
0,
FALSE,
NULL,
BytesRead,
BytesNeeded,
InformationBuffer);
if (Status == NDIS_STATUS_FAILURE || Status == NDIS_STATUS_RESOURCES)
{
//return Status;
}
else
{
Status = NDIS_STATUS_PENDING;
}
break;
case Ndis802_11Encryption1Enabled:
case Ndis802_11Encryption1KeyAbsent:
// disable WEP
/* dralee 081005, V4
Adapter->usMacControlRecord |=
( HostCmd_ACT_MAC_RX_ON |
HostCmd_ACT_MAC_TX_ON |
HostCmd_ACT_MAC_INT_ENABLE);
Adapter->usMacControlRecord &=
~HostCmd_STATUS_MAC_WEP_ENABLE;
*/
Action = HostCmd_STATUS_MAC_RX_ON |
HostCmd_STATUS_MAC_TX_ON |
HostCmd_STATUS_MAC_INT_ENABLE;
Status=PrepareAndSendCommand(
Adapter,
HostCmd_CMD_MAC_CONTROL,
//Adapter->usMacControlRecord, //dralee 081005, V4
Action,
HostCmd_OPTION_USE_INT,
Oid,
HostCmd_PENDING_ON_SET_OID,
0,
FALSE,
NULL,
BytesRead,
BytesNeeded,
InformationBuffer);
if (Status == NDIS_STATUS_FAILURE || Status == NDIS_STATUS_RESOURCES)
{
//return Status;
}
else
{
Status = NDIS_STATUS_PENDING;
}
break;
default:
// do nothing
Status = NDIS_STATUS_SUCCESS;
break;
} //switch ( Adapter->EncryptionStatus )
Adapter->EncryptionStatus = Ndis802_11EncryptionDisabled;
Adapter->WEPStatus = Ndis802_11WEPDisabled;
break; //case Ndis802_11EncryptionDisabled:
default:
DBGPRINT(DBG_OID | DBG_WPA, ("Not supported EncryptionStatus: %d\n",
EncryptionStatus));
Status = NDIS_STATUS_INVALID_DATA;
}
return Status;
}
#endif // #ifdef WPA
/******************************************************************************
*
* Name: MrvDrvQueryInformation()
*
* Description: NDIS miniport get information handler
*
* Conditions for Use: NDIS wrapper will call this handler to get device information
*
* Arguments:
* IN NDIS_HANDLE MiniportAdapterContext
* IN NDIS_OID Oid
* IN PVOID InformationBuffer
* IN ULONG InformationBufferLength
* OUT PULONG BytesWritten
* OUT PULONG BytesNeeded
*
* Return Value:
* NDIS_STATUS_SUCCESS
* NDIS_STATUS_PENDING
* NDIS_STATUS_BUFFER_TOO_SHORT
* NDIS_STATUS_NOT_SUPPORTED
*
* Notes:
*
*****************************************************************************/
NDIS_STATUS
MrvDrvQueryInformation(
IN NDIS_HANDLE MiniportAdapterContext,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG BytesWritten,
OUT PULONG BytesNeeded
)
{
// String describing our adapter
char VendorDescriptor[] = VENDORDESCRIPTOR;
PMRVDRV_ADAPTER Adapter;
//UCHAR VendorId[4];
ULONGLONG GenericULONGLONG;
ULONG GenericULONG;
LONG GenericLONG;
USHORT GenericUSHORT;
UCHAR GenericArray[6];
NDIS_STATUS Status;
NDIS_PNP_CAPABILITIES PMCap;
NDIS_DEVICE_POWER_STATE NewPowerState;
// NDIS_PM_PACKET_PATTERN PMPattern;
PNDIS_802_11_STATISTICS pn11Stat;
// PUCHAR PUchar;
PVOID MoveSource;
ULONG MoveBytes;
ULONG ulRequiredSize;
#ifdef WMM
POID_MRVL_DS_WMM_STATE pWmmState;
#endif
#ifdef DEBUG_PARA_ROAMING
int wait_count;
#endif
//RETAILMSG(1,(L"MrvDrvQueryInformation,Oid=0x%x,hd=0x%x\r\n",Oid,MiniportAdapterContext));
// ULONG ulRcvOK;
// Common variables for pointing to result of query
MoveSource = (PVOID) (&GenericULONG);
MoveBytes = sizeof(GenericULONG);
//DBGPRINT(DBG_OID,("REQUEST - Enter MrvDrvQueryInformation - 0x%x \n", Oid));
Adapter = (PMRVDRV_ADAPTER)(MiniportAdapterContext);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -