diff options
Diffstat (limited to 'NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c')
-rw-r--r-- | NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c | 1282 |
1 files changed, 660 insertions, 622 deletions
diff --git a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c index 881592efd9..b49825bcb7 100644 --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c @@ -17,8 +17,8 @@ HII_VENDOR_DEVICE_PATH mWifiMgrDxeHiiVendorDevicePath = { HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
{
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
WIFI_CONNECTION_MANAGER_CONFIG_GUID
@@ -27,8 +27,8 @@ HII_VENDOR_DEVICE_PATH mWifiMgrDxeHiiVendorDevicePath = { END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
{
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ (UINT8)(END_DEVICE_PATH_LENGTH),
+ (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
}
}
};
@@ -37,13 +37,13 @@ HII_VENDOR_DEVICE_PATH mWifiMgrDxeHiiVendorDevicePath = { // HII Config Access Protocol instance
//
GLOBAL_REMOVE_IF_UNREFERENCED
-EFI_HII_CONFIG_ACCESS_PROTOCOL gWifiMgrDxeHiiConfigAccess = {
+EFI_HII_CONFIG_ACCESS_PROTOCOL gWifiMgrDxeHiiConfigAccess = {
WifiMgrDxeHiiConfigAccessExtractConfig,
WifiMgrDxeHiiConfigAccessRouteConfig,
WifiMgrDxeHiiConfigAccessCallback
};
-CHAR16* mSecurityType[] = {
+CHAR16 *mSecurityType[] = {
L"OPEN ",
L"WPA-Enterprise ",
L"WPA2-Enterprise",
@@ -53,7 +53,7 @@ CHAR16* mSecurityType[] = { L"UnKnown "
};
-CHAR16* mSignalStrengthBar[] = {
+CHAR16 *mSignalStrengthBar[] = {
L"[-----]",
L"[*----]",
L"[**---]",
@@ -67,7 +67,7 @@ CHAR16* mSignalStrengthBar[] = { #define NET_LIST_FOR_EACH_FROM_NODE(Entry, Node, ListHead) \
for(Entry = Node->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
-extern EFI_GUID gWifiConfigFormSetGuid;
+extern EFI_GUID gWifiConfigFormSetGuid;
/**
Create Hii Extend Label OpCode as the start opcode and end opcode.
@@ -86,16 +86,16 @@ extern EFI_GUID gWifiConfigFormSetGuid; **/
EFI_STATUS
WifiMgrCreateOpCode (
- IN UINT16 StartLabelNumber,
- OUT VOID **StartOpCodeHandle,
- OUT VOID **EndOpCodeHandle
+ IN UINT16 StartLabelNumber,
+ OUT VOID **StartOpCodeHandle,
+ OUT VOID **EndOpCodeHandle
)
{
- EFI_STATUS Status;
- EFI_IFR_GUID_LABEL *InternalStartLabel;
- EFI_IFR_GUID_LABEL *InternalEndLabel;
+ EFI_STATUS Status;
+ EFI_IFR_GUID_LABEL *InternalStartLabel;
+ EFI_IFR_GUID_LABEL *InternalEndLabel;
- if (StartOpCodeHandle == NULL || EndOpCodeHandle == NULL) {
+ if ((StartOpCodeHandle == NULL) || (EndOpCodeHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -110,6 +110,7 @@ WifiMgrCreateOpCode ( if (*StartOpCodeHandle == NULL) {
goto Exit;
}
+
*EndOpCodeHandle = HiiAllocateOpCodeHandle ();
if (*EndOpCodeHandle == NULL) {
goto Exit;
@@ -118,30 +119,32 @@ WifiMgrCreateOpCode ( //
// Create Hii Extend Label OpCode as the start opcode.
//
- InternalStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
- *StartOpCodeHandle,
- &gEfiIfrTianoGuid,
- NULL,
- sizeof (EFI_IFR_GUID_LABEL)
- );
+ InternalStartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
+ *StartOpCodeHandle,
+ &gEfiIfrTianoGuid,
+ NULL,
+ sizeof (EFI_IFR_GUID_LABEL)
+ );
if (InternalStartLabel == NULL) {
goto Exit;
}
+
InternalStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
InternalStartLabel->Number = StartLabelNumber;
//
// Create Hii Extend Label OpCode as the end opcode.
//
- InternalEndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
- *EndOpCodeHandle,
- &gEfiIfrTianoGuid,
- NULL,
- sizeof (EFI_IFR_GUID_LABEL)
- );
+ InternalEndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
+ *EndOpCodeHandle,
+ &gEfiIfrTianoGuid,
+ NULL,
+ sizeof (EFI_IFR_GUID_LABEL)
+ );
if (InternalEndLabel == NULL) {
goto Exit;
}
+
InternalEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
InternalEndLabel->Number = LABEL_END;
@@ -152,9 +155,11 @@ Exit: if (*StartOpCodeHandle != NULL) {
HiiFreeOpCodeHandle (*StartOpCodeHandle);
}
+
if (*EndOpCodeHandle != NULL) {
HiiFreeOpCodeHandle (*EndOpCodeHandle);
}
+
return Status;
}
@@ -169,18 +174,18 @@ Exit: **/
EFI_STATUS
WifiMgrShowNicList (
- IN WIFI_MGR_PRIVATE_DATA *Private
-)
+ IN WIFI_MGR_PRIVATE_DATA *Private
+ )
{
- EFI_STATUS Status;
- CHAR16 MacString[WIFI_MGR_MAX_MAC_STRING_LEN];
- CHAR16 PortString[WIFI_STR_MAX_SIZE];
- EFI_STRING_ID PortTitleToken;
- EFI_STRING_ID PortTitleHelpToken;
- WIFI_MGR_DEVICE_DATA *Nic;
- LIST_ENTRY *Entry;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
+ EFI_STATUS Status;
+ CHAR16 MacString[WIFI_MGR_MAX_MAC_STRING_LEN];
+ CHAR16 PortString[WIFI_STR_MAX_SIZE];
+ EFI_STRING_ID PortTitleToken;
+ EFI_STRING_ID PortTitleHelpToken;
+ WIFI_MGR_DEVICE_DATA *Nic;
+ LIST_ENTRY *Entry;
+ VOID *StartOpCodeHandle;
+ VOID *EndOpCodeHandle;
if (Private == NULL) {
return EFI_INVALID_PARAMETER;
@@ -228,7 +233,7 @@ WifiMgrShowNicList ( PortTitleToken,
PortTitleHelpToken,
EFI_IFR_FLAG_CALLBACK,
- (UINT16) (KEY_MAC_ENTRY_BASE + Nic->NicIndex)
+ (UINT16)(KEY_MAC_ENTRY_BASE + Nic->NicIndex)
);
}
@@ -256,29 +261,28 @@ Exit: @return the unicode string of AKM suite list or "None".
**/
-CHAR16*
+CHAR16 *
WifiMgrGetStrAKMList (
- IN WIFI_MGR_NETWORK_PROFILE *Profile
-)
+ IN WIFI_MGR_NETWORK_PROFILE *Profile
+ )
{
- UINT8 Index;
- UINT16 AKMSuiteCount;
- CHAR16 *AKMListDisplay;
+ UINT8 Index;
+ UINT16 AKMSuiteCount;
+ CHAR16 *AKMListDisplay;
AKMListDisplay = NULL;
- if (Profile == NULL || Profile->Network.AKMSuite == NULL) {
+ if ((Profile == NULL) || (Profile->Network.AKMSuite == NULL)) {
goto Exit;
}
AKMSuiteCount = Profile->Network.AKMSuite->AKMSuiteCount;
if (AKMSuiteCount != 0) {
-
//
// Current AKM Suite is between 1-9
//
- AKMListDisplay = (CHAR16 *) AllocateZeroPool(sizeof (CHAR16) * AKMSuiteCount * 2);
+ AKMListDisplay = (CHAR16 *)AllocateZeroPool (sizeof (CHAR16) * AKMSuiteCount * 2);
if (AKMListDisplay != NULL) {
- for (Index = 0; Index < AKMSuiteCount; Index ++) {
+ for (Index = 0; Index < AKMSuiteCount; Index++) {
UnicodeSPrint (
AKMListDisplay + (Index * 2),
sizeof (CHAR16) * 2,
@@ -297,6 +301,7 @@ Exit: if (AKMListDisplay == NULL) {
AKMListDisplay = AllocateCopyPool (sizeof (L"None"), L"None");
}
+
return AKMListDisplay;
}
@@ -309,29 +314,28 @@ Exit: @return the unicode string of Cipher suite list or "None".
**/
-CHAR16*
+CHAR16 *
WifiMgrGetStrCipherList (
- IN WIFI_MGR_NETWORK_PROFILE *Profile
-)
+ IN WIFI_MGR_NETWORK_PROFILE *Profile
+ )
{
- UINT8 Index;
- UINT16 CipherSuiteCount;
- CHAR16 *CipherListDisplay;
+ UINT8 Index;
+ UINT16 CipherSuiteCount;
+ CHAR16 *CipherListDisplay;
CipherListDisplay = NULL;
- if (Profile == NULL || Profile->Network.CipherSuite == NULL) {
+ if ((Profile == NULL) || (Profile->Network.CipherSuite == NULL)) {
goto Exit;
}
- CipherSuiteCount = Profile->Network.CipherSuite->CipherSuiteCount;
+ CipherSuiteCount = Profile->Network.CipherSuite->CipherSuiteCount;
if (CipherSuiteCount != 0) {
-
//
// Current Cipher Suite is between 1-9
//
- CipherListDisplay = (CHAR16 *) AllocateZeroPool(sizeof (CHAR16) * CipherSuiteCount * 2);
+ CipherListDisplay = (CHAR16 *)AllocateZeroPool (sizeof (CHAR16) * CipherSuiteCount * 2);
if (CipherListDisplay != NULL) {
- for (Index = 0; Index < CipherSuiteCount; Index ++) {
+ for (Index = 0; Index < CipherSuiteCount; Index++) {
UnicodeSPrint (
CipherListDisplay + (Index * 2),
sizeof (CHAR16) * 2,
@@ -350,6 +354,7 @@ Exit: if (CipherListDisplay == NULL) {
CipherListDisplay = AllocateCopyPool (sizeof (L"None"), L"None");
}
+
return CipherListDisplay;
}
@@ -367,25 +372,25 @@ Exit: **/
EFI_STATUS
WifiMgrRefreshNetworkList (
- IN WIFI_MGR_PRIVATE_DATA *Private,
- OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData
+ IN WIFI_MGR_PRIVATE_DATA *Private,
+ OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData
)
{
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- UINT32 AvailableCount;
- EFI_STRING_ID PortPromptToken;
- EFI_STRING_ID PortTextToken;
- EFI_STRING_ID PortHelpToken;
- WIFI_MGR_NETWORK_PROFILE *Profile;
- LIST_ENTRY *Entry;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
- CHAR16 *AKMListDisplay;
- CHAR16 *CipherListDisplay;
- CHAR16 PortString[WIFI_STR_MAX_SIZE];
- UINTN PortStringSize;
- WIFI_MGR_NETWORK_PROFILE *ConnectedProfile;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ UINT32 AvailableCount;
+ EFI_STRING_ID PortPromptToken;
+ EFI_STRING_ID PortTextToken;
+ EFI_STRING_ID PortHelpToken;
+ WIFI_MGR_NETWORK_PROFILE *Profile;
+ LIST_ENTRY *Entry;
+ VOID *StartOpCodeHandle;
+ VOID *EndOpCodeHandle;
+ CHAR16 *AKMListDisplay;
+ CHAR16 *CipherListDisplay;
+ CHAR16 PortString[WIFI_STR_MAX_SIZE];
+ UINTN PortStringSize;
+ WIFI_MGR_NETWORK_PROFILE *ConnectedProfile;
if (Private->CurrentNic == NULL) {
return EFI_SUCCESS;
@@ -400,7 +405,7 @@ WifiMgrRefreshNetworkList ( return Status;
}
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
AvailableCount = 0;
PortStringSize = sizeof (PortString);
ConnectedProfile = NULL;
@@ -408,23 +413,23 @@ WifiMgrRefreshNetworkList ( CipherListDisplay = NULL;
if (Private->CurrentNic->ConnectState == WifiMgrConnectedToAp) {
-
//
// Display the current connected network.
// Find the current operate network under connected status.
//
- if (Private->CurrentNic->CurrentOperateNetwork != NULL &&
- Private->CurrentNic->CurrentOperateNetwork->IsAvailable) {
-
+ if ((Private->CurrentNic->CurrentOperateNetwork != NULL) &&
+ Private->CurrentNic->CurrentOperateNetwork->IsAvailable)
+ {
Profile = Private->CurrentNic->CurrentOperateNetwork;
- AvailableCount ++;
+ AvailableCount++;
AKMListDisplay = WifiMgrGetStrAKMList (Profile);
if (AKMListDisplay == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
- CipherListDisplay = WifiMgrGetStrCipherList(Profile);
+
+ CipherListDisplay = WifiMgrGetStrCipherList (Profile);
if (CipherListDisplay == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
@@ -439,6 +444,7 @@ WifiMgrRefreshNetworkList ( UnicodeSPrint (PortString, PortStringSize, L"AKMSuite: %s CipherSuite: %s", AKMListDisplay, CipherListDisplay);
PortHelpToken = HiiSetString (Private->RegisteredHandle, 0, PortString, NULL);
}
+
FreePool (AKMListDisplay);
FreePool (CipherListDisplay);
AKMListDisplay = NULL;
@@ -450,7 +456,7 @@ WifiMgrRefreshNetworkList ( PortPromptToken,
PortHelpToken,
EFI_IFR_FLAG_CALLBACK,
- (UINT16) (KEY_AVAILABLE_NETWORK_ENTRY_BASE + Profile->ProfileIndex)
+ (UINT16)(KEY_AVAILABLE_NETWORK_ENTRY_BASE + Profile->ProfileIndex)
);
UnicodeSPrint (
@@ -459,7 +465,7 @@ WifiMgrRefreshNetworkList ( L"%s %s %s",
(Profile->SecurityType != SECURITY_TYPE_NONE ? L"Secured" : L"Open "),
mSecurityType[Profile->SecurityType],
- RSSI_TO_SIGNAL_STRENGTH_BAR(Profile->NetworkQuality)
+ RSSI_TO_SIGNAL_STRENGTH_BAR (Profile->NetworkQuality)
);
PortTextToken = HiiSetString (Private->RegisteredHandle, 0, PortString, NULL);
@@ -468,7 +474,7 @@ WifiMgrRefreshNetworkList ( PortTextToken,
0,
0
- );
+ );
ConnectedProfile = Profile;
} else {
@@ -480,7 +486,6 @@ WifiMgrRefreshNetworkList ( // Display all supported available networks.
//
NET_LIST_FOR_EACH (Entry, &Private->CurrentNic->ProfileList) {
-
Profile = NET_LIST_USER_STRUCT_S (
Entry,
WIFI_MGR_NETWORK_PROFILE,
@@ -490,16 +495,17 @@ WifiMgrRefreshNetworkList ( if (ConnectedProfile == Profile) {
continue;
}
- if (Profile->IsAvailable && Profile->CipherSuiteSupported) {
- AvailableCount ++;
+ if (Profile->IsAvailable && Profile->CipherSuiteSupported) {
+ AvailableCount++;
AKMListDisplay = WifiMgrGetStrAKMList (Profile);
if (AKMListDisplay == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
- CipherListDisplay = WifiMgrGetStrCipherList(Profile);
+
+ CipherListDisplay = WifiMgrGetStrCipherList (Profile);
if (CipherListDisplay == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
@@ -518,7 +524,8 @@ WifiMgrRefreshNetworkList ( PortString,
PortStringSize,
L"AKMSuite: %s CipherSuite: %s",
- AKMListDisplay, CipherListDisplay
+ AKMListDisplay,
+ CipherListDisplay
);
PortHelpToken = HiiSetString (Private->RegisteredHandle, 0, PortString, NULL);
if (PortHelpToken == 0) {
@@ -526,6 +533,7 @@ WifiMgrRefreshNetworkList ( goto Exit;
}
}
+
FreePool (AKMListDisplay);
FreePool (CipherListDisplay);
AKMListDisplay = NULL;
@@ -537,7 +545,7 @@ WifiMgrRefreshNetworkList ( PortPromptToken,
PortHelpToken,
EFI_IFR_FLAG_CALLBACK,
- (UINT16) (KEY_AVAILABLE_NETWORK_ENTRY_BASE + Profile->ProfileIndex)
+ (UINT16)(KEY_AVAILABLE_NETWORK_ENTRY_BASE + Profile->ProfileIndex)
);
UnicodeSPrint (
@@ -546,13 +554,14 @@ WifiMgrRefreshNetworkList ( L"%s %s %s",
(Profile->SecurityType != SECURITY_TYPE_NONE ? L"Secured" : L"Open "),
mSecurityType[Profile->SecurityType],
- RSSI_TO_SIGNAL_STRENGTH_BAR(Profile->NetworkQuality)
+ RSSI_TO_SIGNAL_STRENGTH_BAR (Profile->NetworkQuality)
);
PortTextToken = HiiSetString (Private->RegisteredHandle, 0, PortString, NULL);
if (PortTextToken == 0) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
+
HiiCreateTextOpCode (
StartOpCodeHandle,
PortTextToken,
@@ -566,7 +575,6 @@ WifiMgrRefreshNetworkList ( // Display all Unsupported available networks.
//
NET_LIST_FOR_EACH (Entry, &Private->CurrentNic->ProfileList) {
-
Profile = NET_LIST_USER_STRUCT_S (
Entry,
WIFI_MGR_NETWORK_PROFILE,
@@ -576,16 +584,17 @@ WifiMgrRefreshNetworkList ( if (ConnectedProfile == Profile) {
continue;
}
- if (Profile->IsAvailable && !Profile->CipherSuiteSupported) {
- AvailableCount ++;
+ if (Profile->IsAvailable && !Profile->CipherSuiteSupported) {
+ AvailableCount++;
AKMListDisplay = WifiMgrGetStrAKMList (Profile);
if (AKMListDisplay == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
- CipherListDisplay = WifiMgrGetStrCipherList(Profile);
+
+ CipherListDisplay = WifiMgrGetStrCipherList (Profile);
if (CipherListDisplay == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
@@ -598,16 +607,19 @@ WifiMgrRefreshNetworkList ( PortString,
PortStringSize,
L"AKMSuite: %s CipherSuite(UnSupported): %s",
- AKMListDisplay, CipherListDisplay
+ AKMListDisplay,
+ CipherListDisplay
);
} else {
UnicodeSPrint (
PortString,
PortStringSize,
L"AKMSuite(UnSupported): %s CipherSuite(UnSupported): %s",
- AKMListDisplay, CipherListDisplay
+ AKMListDisplay,
+ CipherListDisplay
);
}
+
FreePool (AKMListDisplay);
FreePool (CipherListDisplay);
AKMListDisplay = NULL;
@@ -621,7 +633,7 @@ WifiMgrRefreshNetworkList ( PortPromptToken,
PortHelpToken,
EFI_IFR_FLAG_CALLBACK,
- (UINT16) (KEY_AVAILABLE_NETWORK_ENTRY_BASE + Profile->ProfileIndex)
+ (UINT16)(KEY_AVAILABLE_NETWORK_ENTRY_BASE + Profile->ProfileIndex)
);
UnicodeSPrint (
@@ -630,7 +642,7 @@ WifiMgrRefreshNetworkList ( L"%s %s %s",
L"UnSupported",
mSecurityType[Profile->SecurityType],
- RSSI_TO_SIGNAL_STRENGTH_BAR(Profile->NetworkQuality)
+ RSSI_TO_SIGNAL_STRENGTH_BAR (Profile->NetworkQuality)
);
PortTextToken = HiiSetString (Private->RegisteredHandle, 0, PortString, NULL);
@@ -658,6 +670,7 @@ Exit: if (AKMListDisplay != NULL) {
FreePool (AKMListDisplay);
}
+
if (CipherListDisplay != NULL) {
FreePool (CipherListDisplay);
}
@@ -680,17 +693,17 @@ Exit: **/
EFI_STATUS
WifiMgrRefreshHiddenList (
- IN WIFI_MGR_PRIVATE_DATA *Private
+ IN WIFI_MGR_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- UINTN Index;
- EFI_STRING_ID StringId;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
- WIFI_HIDDEN_NETWORK_DATA *HiddenNetwork;
- LIST_ENTRY *Entry;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ UINTN Index;
+ EFI_STRING_ID StringId;
+ VOID *StartOpCodeHandle;
+ VOID *EndOpCodeHandle;
+ WIFI_HIDDEN_NETWORK_DATA *HiddenNetwork;
+ LIST_ENTRY *Entry;
if (Private == NULL) {
return EFI_SUCCESS;
@@ -709,7 +722,6 @@ WifiMgrRefreshHiddenList ( Index = 0;
NET_LIST_FOR_EACH (Entry, &Private->HiddenNetworkList) {
-
HiddenNetwork = NET_LIST_USER_STRUCT_S (
Entry,
WIFI_HIDDEN_NETWORK_DATA,
@@ -720,16 +732,16 @@ WifiMgrRefreshHiddenList ( HiiCreateCheckBoxOpCode (
StartOpCodeHandle,
- (EFI_QUESTION_ID) (KEY_HIDDEN_NETWORK_ENTRY_BASE + Index),
+ (EFI_QUESTION_ID)(KEY_HIDDEN_NETWORK_ENTRY_BASE + Index),
MANAGER_VARSTORE_ID,
- (UINT16) (HIDDEN_NETWORK_LIST_VAR_OFFSET + Index),
+ (UINT16)(HIDDEN_NETWORK_LIST_VAR_OFFSET + Index),
StringId,
0,
0,
0,
NULL
);
- Index ++;
+ Index++;
}
Status = HiiUpdateForm (
@@ -746,7 +758,6 @@ WifiMgrRefreshHiddenList ( return Status;
}
-
/**
Callback function for user to select a Nic.
@@ -759,23 +770,24 @@ WifiMgrRefreshHiddenList ( **/
EFI_STATUS
WifiMgrSelectNic (
- IN WIFI_MGR_PRIVATE_DATA *Private,
- IN EFI_QUESTION_ID KeyValue
+ IN WIFI_MGR_PRIVATE_DATA *Private,
+ IN EFI_QUESTION_ID KeyValue
)
{
- WIFI_MGR_DEVICE_DATA *Nic;
- UINT32 NicIndex;
- CHAR16 MacString[WIFI_MGR_MAX_MAC_STRING_LEN];
+ WIFI_MGR_DEVICE_DATA *Nic;
+ UINT32 NicIndex;
+ CHAR16 MacString[WIFI_MGR_MAX_MAC_STRING_LEN];
NicIndex = KeyValue - KEY_MAC_ENTRY_BASE;
Nic = WifiMgrGetNicByIndex (Private, NicIndex);
if (Nic == NULL) {
return EFI_NOT_FOUND;
}
+
Private->CurrentNic = Nic;
WifiMgrMacAddrToStr (&Nic->MacAddress, sizeof (MacString), MacString);
- HiiSetString (Private->RegisteredHandle, STRING_TOKEN(STR_MAC_ADDRESS), MacString, NULL);
+ HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_MAC_ADDRESS), MacString, NULL);
return EFI_SUCCESS;
}
@@ -788,7 +800,7 @@ WifiMgrSelectNic ( **/
VOID
WifiMgrCleanUserInput (
- IN WIFI_MGR_PRIVATE_DATA *Private
+ IN WIFI_MGR_PRIVATE_DATA *Private
)
{
Private->SecurityType = SECURITY_TYPE_NONE;
@@ -809,13 +821,13 @@ WifiMgrCleanUserInput ( **/
EFI_STATUS
-WifiMgrUserSelectProfileToConnect(
- IN WIFI_MGR_PRIVATE_DATA *Private,
- IN UINT32 ProfileIndex
+WifiMgrUserSelectProfileToConnect (
+ IN WIFI_MGR_PRIVATE_DATA *Private,
+ IN UINT32 ProfileIndex
)
{
- WIFI_MGR_NETWORK_PROFILE *Profile;
- WIFI_MGR_DEVICE_DATA *Nic;
+ WIFI_MGR_NETWORK_PROFILE *Profile;
+ WIFI_MGR_DEVICE_DATA *Nic;
Nic = Private->CurrentNic;
if (Nic == NULL) {
@@ -823,14 +835,15 @@ WifiMgrUserSelectProfileToConnect( }
//
- //Initialize the connection page
+ // Initialize the connection page
//
- WifiMgrCleanUserInput(Private);
+ WifiMgrCleanUserInput (Private);
Profile = WifiMgrGetProfileByProfileIndex (ProfileIndex, &Nic->ProfileList);
if (Profile == NULL) {
return EFI_NOT_FOUND;
}
+
Private->CurrentNic->UserSelectedProfile = Profile;
return EFI_SUCCESS;
@@ -851,15 +864,15 @@ WifiMgrUserSelectProfileToConnect( **/
EFI_STATUS
WifiMgrRecordPassword (
- IN WIFI_MGR_PRIVATE_DATA *Private,
- IN EFI_STRING_ID StringId,
- IN CHAR16 *StringBuffer,
- IN UINTN StringBufferLen
+ IN WIFI_MGR_PRIVATE_DATA *Private,
+ IN EFI_STRING_ID StringId,
+ IN CHAR16 *StringBuffer,
+ IN UINTN StringBufferLen
)
{
- CHAR16 *Password;
+ CHAR16 *Password;
- if (StringId == 0 || StringBuffer == NULL || StringBufferLen <= 0) {
+ if ((StringId == 0) || (StringBuffer == NULL) || (StringBufferLen <= 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -867,10 +880,12 @@ WifiMgrRecordPassword ( if (Password == NULL) {
return EFI_NOT_FOUND;
}
+
if (StrLen (Password) > StringBufferLen) {
FreePool (Password);
return EFI_NOT_FOUND;
}
+
StrnCpyS (StringBuffer, StringBufferLen, Password, StrLen (Password));
ZeroMem (Password, (StrLen (Password) + 1) * sizeof (CHAR16));
FreePool (Password);
@@ -896,16 +911,16 @@ WifiMgrRecordPassword ( **/
VOID
WifiMgrUpdateConnectMessage (
- IN WIFI_MGR_DEVICE_DATA *Nic,
- IN BOOLEAN ConnectStateChanged,
- IN EFI_STRING ConnectStatusMessage
+ IN WIFI_MGR_DEVICE_DATA *Nic,
+ IN BOOLEAN ConnectStateChanged,
+ IN EFI_STRING ConnectStatusMessage
)
{
- CHAR16 ConnectStatusStr[WIFI_STR_MAX_SIZE];
- WIFI_MGR_PRIVATE_DATA *Private;
+ CHAR16 ConnectStatusStr[WIFI_STR_MAX_SIZE];
+ WIFI_MGR_PRIVATE_DATA *Private;
Private = Nic->Private;
- if (Private == NULL || Private->CurrentNic != Nic) {
+ if ((Private == NULL) || (Private->CurrentNic != Nic)) {
return;
}
@@ -916,22 +931,30 @@ WifiMgrUpdateConnectMessage ( HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_CONNECT_STATUS), ConnectStatusMessage, NULL);
} else {
if (Nic->ConnectState == WifiMgrConnectedToAp) {
-
- UnicodeSPrint (ConnectStatusStr, sizeof (ConnectStatusStr), L"Connected to %s",
- Nic->CurrentOperateNetwork->SSId);
+ UnicodeSPrint (
+ ConnectStatusStr,
+ sizeof (ConnectStatusStr),
+ L"Connected to %s",
+ Nic->CurrentOperateNetwork->SSId
+ );
HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_CONNECT_STATUS), ConnectStatusStr, NULL);
} else if (Nic->ConnectState == WifiMgrDisconnected) {
-
HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_CONNECT_STATUS), L"Disconnected", NULL);
} else if (Nic->ConnectState == WifiMgrConnectingToAp) {
-
- UnicodeSPrint (ConnectStatusStr, sizeof (ConnectStatusStr), L"Connecting to %s ...",
- Nic->CurrentOperateNetwork->SSId);
+ UnicodeSPrint (
+ ConnectStatusStr,
+ sizeof (ConnectStatusStr),
+ L"Connecting to %s ...",
+ Nic->CurrentOperateNetwork->SSId
+ );
HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_CONNECT_STATUS), ConnectStatusStr, NULL);
} else if (Nic->ConnectState == WifiMgrDisconnectingToAp) {
-
- UnicodeSPrint (ConnectStatusStr, sizeof (ConnectStatusStr), L"Disconnecting from %s ...",
- Nic->CurrentOperateNetwork->SSId);
+ UnicodeSPrint (
+ ConnectStatusStr,
+ sizeof (ConnectStatusStr),
+ L"Disconnecting from %s ...",
+ Nic->CurrentOperateNetwork->SSId
+ );
HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_CONNECT_STATUS), ConnectStatusStr, NULL);
} else {
return;
@@ -941,25 +964,31 @@ WifiMgrUpdateConnectMessage ( //
// Update Connect Button
//
- if (Nic->ConnectState == WifiMgrConnectedToAp && Nic->UserSelectedProfile == Nic->CurrentOperateNetwork) {
-
- HiiSetString (Private->RegisteredHandle,
- STRING_TOKEN (STR_CONNECT_NOW), L"Disconnect from this Network", NULL);
+ if ((Nic->ConnectState == WifiMgrConnectedToAp) && (Nic->UserSelectedProfile == Nic->CurrentOperateNetwork)) {
+ HiiSetString (
+ Private->RegisteredHandle,
+ STRING_TOKEN (STR_CONNECT_NOW),
+ L"Disconnect from this Network",
+ NULL
+ );
} else {
HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_CONNECT_NOW), L"Connect to this Network", NULL);
}
+
gBS->SignalEvent (Private->ConnectFormRefreshEvent);
//
// Update Main Page and Network List
//
if (ConnectStateChanged) {
-
if (Nic->ConnectState == WifiMgrConnectedToAp) {
-
HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_CONNECTION_INFO), L"Connected to", NULL);
- HiiSetString (Private->RegisteredHandle,
- STRING_TOKEN (STR_CONNECTED_SSID), Nic->CurrentOperateNetwork->SSId, NULL);
+ HiiSetString (
+ Private->RegisteredHandle,
+ STRING_TOKEN (STR_CONNECTED_SSID),
+ Nic->CurrentOperateNetwork->SSId,
+ NULL
+ );
} else {
HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_CONNECTION_INFO), L"Disconnected", NULL);
HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_CONNECTED_SSID), L"", NULL);
@@ -981,8 +1010,8 @@ WifiMgrUpdateConnectMessage ( **/
EFI_STATUS
WifiMgrConvertConfigDataToIfrNvData (
- IN WIFI_MGR_PRIVATE_DATA *Private,
- OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData
+ IN WIFI_MGR_PRIVATE_DATA *Private,
+ OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData
)
{
//
@@ -1010,8 +1039,8 @@ WifiMgrConvertConfigDataToIfrNvData ( **/
EFI_STATUS
WifiMgrConvertIfrNvDataToConfigData (
- IN WIFI_MGR_PRIVATE_DATA *Private,
- IN OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData
+ IN WIFI_MGR_PRIVATE_DATA *Private,
+ IN OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData
)
{
return EFI_SUCCESS;
@@ -1096,22 +1125,23 @@ WifiMgrDxeHiiConfigAccessExtractConfig ( OUT EFI_STRING *Results
)
{
- WIFI_MGR_PRIVATE_DATA *Private;
- WIFI_MANAGER_IFR_NVDATA *IfrNvData;
- EFI_STRING ConfigRequestHdr;
- EFI_STRING ConfigRequest;
- UINTN Size;
- BOOLEAN AllocatedRequest;
- UINTN BufferSize;
- EFI_STATUS Status;
-
- if (This == NULL || Progress == NULL || Results == NULL) {
+ WIFI_MGR_PRIVATE_DATA *Private;
+ WIFI_MANAGER_IFR_NVDATA *IfrNvData;
+ EFI_STRING ConfigRequestHdr;
+ EFI_STRING ConfigRequest;
+ UINTN Size;
+ BOOLEAN AllocatedRequest;
+ UINTN BufferSize;
+ EFI_STATUS Status;
+
+ if ((This == NULL) || (Progress == NULL) || (Results == NULL)) {
return EFI_INVALID_PARAMETER;
}
*Progress = Request;
if ((Request != NULL) &&
- !HiiIsConfigHdrMatch (Request, &gWifiConfigFormSetGuid, mVendorStorageName)) {
+ !HiiIsConfigHdrMatch (Request, &gWifiConfigFormSetGuid, mVendorStorageName))
+ {
return EFI_NOT_FOUND;
}
@@ -1120,10 +1150,10 @@ WifiMgrDxeHiiConfigAccessExtractConfig ( AllocatedRequest = FALSE;
Size = 0;
- Private = WIFI_MGR_PRIVATE_DATA_FROM_CONFIG_ACCESS (This);
+ Private = WIFI_MGR_PRIVATE_DATA_FROM_CONFIG_ACCESS (This);
BufferSize = sizeof (WIFI_MANAGER_IFR_NVDATA);
- IfrNvData = AllocateZeroPool (BufferSize);
+ IfrNvData = AllocateZeroPool (BufferSize);
if (IfrNvData == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -1140,16 +1170,16 @@ WifiMgrDxeHiiConfigAccessExtractConfig ( ConfigRequestHdr = HiiConstructConfigHdr (
&gWifiConfigFormSetGuid,
mVendorStorageName,
- Private->DriverHandle);
+ Private->DriverHandle
+ );
if (ConfigRequestHdr == NULL) {
FreePool (IfrNvData);
return EFI_OUT_OF_RESOURCES;
}
- Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
+ Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
ConfigRequest = AllocateZeroPool (Size);
if (ConfigRequest == NULL) {
-
FreePool (IfrNvData);
FreePool (ConfigRequestHdr);
return EFI_OUT_OF_RESOURCES;
@@ -1161,7 +1191,7 @@ WifiMgrDxeHiiConfigAccessExtractConfig ( Size,
L"%s&OFFSET=0&WIDTH=%016LX",
ConfigRequestHdr,
- (UINT64) BufferSize
+ (UINT64)BufferSize
);
FreePool (ConfigRequestHdr);
}
@@ -1172,7 +1202,7 @@ WifiMgrDxeHiiConfigAccessExtractConfig ( Status = gHiiConfigRouting->BlockToConfig (
gHiiConfigRouting,
ConfigRequest,
- (UINT8 *) IfrNvData,
+ (UINT8 *)IfrNvData,
BufferSize,
Results,
Progress
@@ -1186,6 +1216,7 @@ WifiMgrDxeHiiConfigAccessExtractConfig ( FreePool (ConfigRequest);
ConfigRequest = NULL;
}
+
//
// Set Progress string to the original request string.
//
@@ -1245,12 +1276,12 @@ WifiMgrDxeHiiConfigAccessRouteConfig ( OUT EFI_STRING *Progress
)
{
- EFI_STATUS Status;
- UINTN BufferSize;
- WIFI_MGR_PRIVATE_DATA *Private;
- WIFI_MANAGER_IFR_NVDATA *IfrNvData;
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ WIFI_MGR_PRIVATE_DATA *Private;
+ WIFI_MANAGER_IFR_NVDATA *IfrNvData;
- if (Configuration == NULL || Progress == NULL) {
+ if ((Configuration == NULL) || (Progress == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -1273,7 +1304,7 @@ WifiMgrDxeHiiConfigAccessRouteConfig ( Status = gHiiConfigRouting->ConfigToBlock (
gHiiConfigRouting,
Configuration,
- (UINT8*) IfrNvData,
+ (UINT8 *)IfrNvData,
&BufferSize,
Progress
);
@@ -1316,39 +1347,40 @@ WifiMgrDxeHiiConfigAccessRouteConfig ( EFI_STATUS
EFIAPI
WifiMgrDxeHiiConfigAccessCallback (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN OUT EFI_IFR_TYPE_VALUE *Value,
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN EFI_BROWSER_ACTION Action,
+ IN EFI_QUESTION_ID QuestionId,
+ IN UINT8 Type,
+ IN OUT EFI_IFR_TYPE_VALUE *Value,
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- UINTN BufferSize;
- WIFI_MGR_PRIVATE_DATA *Private;
- WIFI_MANAGER_IFR_NVDATA *IfrNvData;
- EFI_DEVICE_PATH_PROTOCOL *FilePath;
- WIFI_MGR_NETWORK_PROFILE *Profile;
- WIFI_MGR_NETWORK_PROFILE *ProfileToConnect;
- WIFI_HIDDEN_NETWORK_DATA *HiddenNetwork;
- UINTN TempDataSize;
- VOID *TempData;
- LIST_ENTRY *Entry;
- UINT32 Index;
- UINT32 RemoveCount;
- CHAR16 *TempPassword;
- CHAR16 *ErrorMessage;
-
- if (Action != EFI_BROWSER_ACTION_FORM_OPEN &&
- Action != EFI_BROWSER_ACTION_FORM_CLOSE &&
- Action != EFI_BROWSER_ACTION_CHANGING &&
- Action != EFI_BROWSER_ACTION_CHANGED &&
- Action != EFI_BROWSER_ACTION_RETRIEVE) {
-
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ UINTN BufferSize;
+ WIFI_MGR_PRIVATE_DATA *Private;
+ WIFI_MANAGER_IFR_NVDATA *IfrNvData;
+ EFI_DEVICE_PATH_PROTOCOL *FilePath;
+ WIFI_MGR_NETWORK_PROFILE *Profile;
+ WIFI_MGR_NETWORK_PROFILE *ProfileToConnect;
+ WIFI_HIDDEN_NETWORK_DATA *HiddenNetwork;
+ UINTN TempDataSize;
+ VOID *TempData;
+ LIST_ENTRY *Entry;
+ UINT32 Index;
+ UINT32 RemoveCount;
+ CHAR16 *TempPassword;
+ CHAR16 *ErrorMessage;
+
+ if ((Action != EFI_BROWSER_ACTION_FORM_OPEN) &&
+ (Action != EFI_BROWSER_ACTION_FORM_CLOSE) &&
+ (Action != EFI_BROWSER_ACTION_CHANGING) &&
+ (Action != EFI_BROWSER_ACTION_CHANGED) &&
+ (Action != EFI_BROWSER_ACTION_RETRIEVE))
+ {
return EFI_UNSUPPORTED;
}
+
if ((Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -1363,525 +1395,531 @@ WifiMgrDxeHiiConfigAccessCallback ( // Retrieve uncommitted data from Browser
//
BufferSize = sizeof (WIFI_MANAGER_IFR_NVDATA);
- IfrNvData = AllocateZeroPool (BufferSize);
+ IfrNvData = AllocateZeroPool (BufferSize);
if (IfrNvData == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- HiiGetBrowserData (&gWifiConfigFormSetGuid, mVendorStorageName, BufferSize, (UINT8 *) IfrNvData);
+
+ HiiGetBrowserData (&gWifiConfigFormSetGuid, mVendorStorageName, BufferSize, (UINT8 *)IfrNvData);
if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
switch (QuestionId) {
+ case KEY_MAC_LIST:
- case KEY_MAC_LIST:
+ Status = WifiMgrShowNicList (Private);
+ break;
- Status = WifiMgrShowNicList (Private);
- break;
+ case KEY_REFRESH_NETWORK_LIST:
- case KEY_REFRESH_NETWORK_LIST:
+ if (Private->CurrentNic->UserSelectedProfile != NULL) {
+ Profile = Private->CurrentNic->UserSelectedProfile;
- if (Private->CurrentNic->UserSelectedProfile != NULL) {
+ //
+ // Erase secrets since user has left Connection Page
+ // Connection Page may direct to Network List Page or Eap Configuration Page,
+ // secrets only need to be erased when head to Network List Page
+ //
+ WifiMgrCleanProfileSecrets (Profile);
+
+ Private->CurrentNic->UserSelectedProfile = NULL;
+ }
+
+ break;
+
+ case KEY_CONNECT_ACTION:
+
+ if (Private->CurrentNic->UserSelectedProfile == NULL) {
+ break;
+ }
Profile = Private->CurrentNic->UserSelectedProfile;
//
- // Erase secrets since user has left Connection Page
- // Connection Page may direct to Network List Page or Eap Configuration Page,
- // secrets only need to be erased when head to Network List Page
+ // Enter the network connection configuration page
+ // Recovery from restored data
//
- WifiMgrCleanProfileSecrets (Profile);
-
- Private->CurrentNic->UserSelectedProfile = NULL;
- }
+ if (HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_SSID), Profile->SSId, NULL) == 0) {
+ return EFI_OUT_OF_RESOURCES;
+ }
- break;
+ IfrNvData->SecurityType = Profile->SecurityType;
+ if (HiiSetString (
+ Private->RegisteredHandle,
+ STRING_TOKEN (STR_SECURITY_TYPE),
+ mSecurityType[IfrNvData->SecurityType],
+ NULL
+ ) == 0)
+ {
+ return EFI_OUT_OF_RESOURCES;
+ }
- case KEY_CONNECT_ACTION:
+ if (IfrNvData->SecurityType == SECURITY_TYPE_WPA2_ENTERPRISE) {
+ IfrNvData->EapAuthMethod = Profile->EapAuthMethod;
+ IfrNvData->EapSecondAuthMethod = Profile->EapSecondAuthMethod;
+ StrCpyS (IfrNvData->EapIdentity, EAP_IDENTITY_SIZE, Profile->EapIdentity);
+ }
- if (Private->CurrentNic->UserSelectedProfile == NULL) {
break;
- }
- Profile = Private->CurrentNic->UserSelectedProfile;
-
- //
- //Enter the network connection configuration page
- //Recovery from restored data
- //
- if (HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_SSID), Profile->SSId, NULL) == 0) {
- return EFI_OUT_OF_RESOURCES;
- }
- IfrNvData->SecurityType = Profile->SecurityType;
- if (HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_SECURITY_TYPE),
- mSecurityType[IfrNvData->SecurityType], NULL) == 0) {
- return EFI_OUT_OF_RESOURCES;
- }
- if (IfrNvData->SecurityType == SECURITY_TYPE_WPA2_ENTERPRISE) {
+ case KEY_ENROLLED_CERT_NAME:
- IfrNvData->EapAuthMethod = Profile->EapAuthMethod;
- IfrNvData->EapSecondAuthMethod = Profile->EapSecondAuthMethod;
- StrCpyS (IfrNvData->EapIdentity, EAP_IDENTITY_SIZE, Profile->EapIdentity);
- }
+ if (Private->CurrentNic->UserSelectedProfile == NULL) {
+ break;
+ }
- break;
+ Profile = Private->CurrentNic->UserSelectedProfile;
- case KEY_ENROLLED_CERT_NAME:
+ //
+ // Enter the key enrollment page
+ // For TTLS and PEAP, only CA cert needs to be cared
+ //
+ if (Private->FileType == FileTypeCACert) {
+ if (Profile->CACertData != NULL) {
+ HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), Profile->CACertName, NULL);
+ } else {
+ HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), L"", NULL);
+ }
+ } else if (Private->FileType == FileTypeClientCert) {
+ if (Profile->ClientCertData != NULL) {
+ HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), Profile->ClientCertName, NULL);
+ } else {
+ HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), L"", NULL);
+ }
+ }
- if (Private->CurrentNic->UserSelectedProfile == NULL) {
break;
- }
- Profile = Private->CurrentNic->UserSelectedProfile;
- //
- //Enter the key enrollment page
- //For TTLS and PEAP, only CA cert needs to be cared
- //
- if (Private->FileType == FileTypeCACert) {
+ case KEY_ENROLLED_PRIVATE_KEY_NAME:
- if (Profile->CACertData != NULL) {
- HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), Profile->CACertName, NULL);
- } else {
- HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), L"", NULL);
+ if (Private->CurrentNic->UserSelectedProfile == NULL) {
+ break;
}
- } else if (Private->FileType == FileTypeClientCert) {
- if (Profile->ClientCertData != NULL) {
- HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), Profile->ClientCertName, NULL);
+ Profile = Private->CurrentNic->UserSelectedProfile;
+
+ if (Profile->PrivateKeyData != NULL) {
+ HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_PRIVATE_KEY_NAME), Profile->PrivateKeyName, NULL);
} else {
- HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), L"", NULL);
+ HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_PRIVATE_KEY_NAME), L"", NULL);
}
- }
- break;
- case KEY_ENROLLED_PRIVATE_KEY_NAME:
-
- if (Private->CurrentNic->UserSelectedProfile == NULL) {
break;
- }
- Profile = Private->CurrentNic->UserSelectedProfile;
- if (Profile->PrivateKeyData != NULL) {
- HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_PRIVATE_KEY_NAME), Profile->PrivateKeyName, NULL);
- } else {
- HiiSetString (Private->RegisteredHandle, STRING_TOKEN (STR_EAP_ENROLLED_PRIVATE_KEY_NAME), L"", NULL);
- }
- break;
-
- default:
- break;
+ default:
+ break;
}
} else if (Action == EFI_BROWSER_ACTION_FORM_CLOSE) {
switch (QuestionId) {
+ case KEY_CONNECT_ACTION:
- case KEY_CONNECT_ACTION:
+ if (Private->CurrentNic->UserSelectedProfile == NULL) {
+ break;
+ }
- if (Private->CurrentNic->UserSelectedProfile == NULL) {
- break;
- }
- Profile = Private->CurrentNic->UserSelectedProfile;
+ Profile = Private->CurrentNic->UserSelectedProfile;
- //
- //Restore User Config Data for Page recovery
- //
- if (IfrNvData->SecurityType == SECURITY_TYPE_WPA2_ENTERPRISE) {
+ //
+ // Restore User Config Data for Page recovery
+ //
+ if (IfrNvData->SecurityType == SECURITY_TYPE_WPA2_ENTERPRISE) {
+ Profile->EapAuthMethod = IfrNvData->EapAuthMethod;
+ Profile->EapSecondAuthMethod = IfrNvData->EapSecondAuthMethod;
+ StrCpyS (Profile->EapIdentity, EAP_IDENTITY_SIZE, IfrNvData->EapIdentity);
+ }
- Profile->EapAuthMethod = IfrNvData->EapAuthMethod;
- Profile->EapSecondAuthMethod = IfrNvData->EapSecondAuthMethod;
- StrCpyS (Profile->EapIdentity, EAP_IDENTITY_SIZE, IfrNvData->EapIdentity);
- }
- break;
+ break;
- default:
- break;
+ default:
+ break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGING) {
switch (QuestionId) {
+ case KEY_NETWORK_LIST:
- case KEY_NETWORK_LIST:
-
- //
- //User triggered a scan process.
- //
- Private->CurrentNic->OneTimeScanRequest = TRUE;
- break;
-
- case KEY_PASSWORD_CONNECT_NETWORK:
- case KEY_EAP_PASSWORD_CONNECT_NETWORK:
- case KEY_PRIVATE_KEY_PASSWORD:
-
- if (Private->CurrentNic->UserSelectedProfile == NULL) {
- break;
- }
- Profile = Private->CurrentNic->UserSelectedProfile;
-
- if (QuestionId == KEY_PASSWORD_CONNECT_NETWORK) {
- TempPassword = Profile->Password;
- } else if (QuestionId == KEY_EAP_PASSWORD_CONNECT_NETWORK) {
- TempPassword = Profile->EapPassword;
- } else {
- TempPassword = Profile->PrivateKeyPassword;
- }
-
- Status = WifiMgrRecordPassword (Private, Value->string, TempPassword, PASSWORD_STORAGE_SIZE);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Error: Failed to input password!"));
+ //
+ // User triggered a scan process.
+ //
+ Private->CurrentNic->OneTimeScanRequest = TRUE;
break;
- }
- //
- // This password is not a new created password, so no need to confirm.
- //
- Status = EFI_NOT_FOUND;
- break;
+ case KEY_PASSWORD_CONNECT_NETWORK:
+ case KEY_EAP_PASSWORD_CONNECT_NETWORK:
+ case KEY_PRIVATE_KEY_PASSWORD:
- case KEY_CONNECT_ACTION:
+ if (Private->CurrentNic->UserSelectedProfile == NULL) {
+ break;
+ }
- ErrorMessage = NULL;
- ProfileToConnect = NULL;
+ Profile = Private->CurrentNic->UserSelectedProfile;
- if (Private->CurrentNic->UserSelectedProfile == NULL) {
- break;
- }
- Profile = Private->CurrentNic->UserSelectedProfile;
+ if (QuestionId == KEY_PASSWORD_CONNECT_NETWORK) {
+ TempPassword = Profile->Password;
+ } else if (QuestionId == KEY_EAP_PASSWORD_CONNECT_NETWORK) {
+ TempPassword = Profile->EapPassword;
+ } else {
+ TempPassword = Profile->PrivateKeyPassword;
+ }
- if (Private->CurrentNic->ConnectState == WifiMgrDisconnected ||
- Profile != Private->CurrentNic->CurrentOperateNetwork) {
+ Status = WifiMgrRecordPassword (Private, Value->string, TempPassword, PASSWORD_STORAGE_SIZE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Error: Failed to input password!"));
+ break;
+ }
//
- // When this network is not currently connected, pend it to connect.
+ // This password is not a new created password, so no need to confirm.
//
- if (Profile->AKMSuiteSupported && Profile->CipherSuiteSupported) {
-
- if (Profile->SecurityType == SECURITY_TYPE_NONE || Profile->SecurityType == SECURITY_TYPE_WPA2_PERSONAL) {
+ Status = EFI_NOT_FOUND;
+ break;
- //
- // For Open network, connect directly.
- //
- ProfileToConnect = Profile;
+ case KEY_CONNECT_ACTION:
- } else if (Profile->SecurityType == SECURITY_TYPE_WPA2_ENTERPRISE) {
+ ErrorMessage = NULL;
+ ProfileToConnect = NULL;
- //
- // For WPA/WPA2-Enterprise network, conduct eap configuration first.
- // Only EAP-TLS, TTLS and PEAP is supported now!
- //
- Profile->EapAuthMethod = IfrNvData->EapAuthMethod;
- StrCpyS (Profile->EapIdentity, EAP_IDENTITY_SIZE, IfrNvData->EapIdentity);
+ if (Private->CurrentNic->UserSelectedProfile == NULL) {
+ break;
+ }
- if (IfrNvData->EapAuthMethod == EAP_AUTH_METHOD_TTLS || IfrNvData->EapAuthMethod == EAP_AUTH_METHOD_PEAP) {
+ Profile = Private->CurrentNic->UserSelectedProfile;
- Profile->EapSecondAuthMethod = IfrNvData->EapSecondAuthMethod;
- ProfileToConnect = Profile;
- } else if (IfrNvData->EapAuthMethod == EAP_AUTH_METHOD_TLS) {
+ if ((Private->CurrentNic->ConnectState == WifiMgrDisconnected) ||
+ (Profile != Private->CurrentNic->CurrentOperateNetwork))
+ {
+ //
+ // When this network is not currently connected, pend it to connect.
+ //
+ if (Profile->AKMSuiteSupported && Profile->CipherSuiteSupported) {
+ if ((Profile->SecurityType == SECURITY_TYPE_NONE) || (Profile->SecurityType == SECURITY_TYPE_WPA2_PERSONAL)) {
+ //
+ // For Open network, connect directly.
+ //
ProfileToConnect = Profile;
+ } else if (Profile->SecurityType == SECURITY_TYPE_WPA2_ENTERPRISE) {
+ //
+ // For WPA/WPA2-Enterprise network, conduct eap configuration first.
+ // Only EAP-TLS, TTLS and PEAP is supported now!
+ //
+ Profile->EapAuthMethod = IfrNvData->EapAuthMethod;
+ StrCpyS (Profile->EapIdentity, EAP_IDENTITY_SIZE, IfrNvData->EapIdentity);
+
+ if ((IfrNvData->EapAuthMethod == EAP_AUTH_METHOD_TTLS) || (IfrNvData->EapAuthMethod == EAP_AUTH_METHOD_PEAP)) {
+ Profile->EapSecondAuthMethod = IfrNvData->EapSecondAuthMethod;
+ ProfileToConnect = Profile;
+ } else if (IfrNvData->EapAuthMethod == EAP_AUTH_METHOD_TLS) {
+ ProfileToConnect = Profile;
+ } else {
+ ErrorMessage = L"ERROR: Only EAP-TLS, TTLS or PEAP is supported now!";
+ }
} else {
- ErrorMessage = L"ERROR: Only EAP-TLS, TTLS or PEAP is supported now!";
+ ErrorMessage = L"ERROR: Can't connect to this network!";
}
} else {
- ErrorMessage = L"ERROR: Can't connect to this network!";
+ ErrorMessage = L"ERROR: This network is not supported!";
}
- } else {
- ErrorMessage = L"ERROR: This network is not supported!";
- }
-
- if (ErrorMessage != NULL) {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- ErrorMessage,
- NULL
- );
- }
- if (ProfileToConnect != NULL) {
+ if (ErrorMessage != NULL) {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ ErrorMessage,
+ NULL
+ );
+ }
- Private->CurrentNic->OneTimeConnectRequest = TRUE;
- Private->CurrentNic->ConnectPendingNetwork = ProfileToConnect;
+ if (ProfileToConnect != NULL) {
+ Private->CurrentNic->OneTimeConnectRequest = TRUE;
+ Private->CurrentNic->ConnectPendingNetwork = ProfileToConnect;
+ }
+ } else if (Private->CurrentNic->ConnectState == WifiMgrConnectedToAp) {
+ //
+ // This network is currently connected, just disconnect from it.
+ //
+ Private->CurrentNic->OneTimeDisconnectRequest = TRUE;
+ Private->CurrentNic->HasDisconnectPendingNetwork = TRUE;
}
- } else if (Private->CurrentNic->ConnectState == WifiMgrConnectedToAp) {
- //
- // This network is currently connected, just disconnect from it.
- //
- Private->CurrentNic->OneTimeDisconnectRequest = TRUE;
- Private->CurrentNic->HasDisconnectPendingNetwork = TRUE;
- }
- break;
-
- case KEY_ENROLL_CA_CERT_CONNECT_NETWORK:
-
- Private->FileType = FileTypeCACert;
- break;
-
- case KEY_ENROLL_CLIENT_CERT_CONNECT_NETWORK:
-
- Private->FileType = FileTypeClientCert;
- break;
-
- case KEY_EAP_ENROLL_PRIVATE_KEY_FROM_FILE:
+ break;
- FilePath = NULL;
- ChooseFile (NULL, NULL, NULL, &FilePath);
+ case KEY_ENROLL_CA_CERT_CONNECT_NETWORK:
- if (FilePath != NULL) {
+ Private->FileType = FileTypeCACert;
+ break;
- UpdatePrivateKeyFromFile(Private, FilePath);
- FreePool (FilePath);
- }
- break;
+ case KEY_ENROLL_CLIENT_CERT_CONNECT_NETWORK:
- case KEY_EAP_ENROLL_CERT_FROM_FILE:
+ Private->FileType = FileTypeClientCert;
+ break;
- //
- //User will select a cert file from File Explore
- //
- FilePath = NULL;
- ChooseFile( NULL, NULL, NULL, &FilePath);
+ case KEY_EAP_ENROLL_PRIVATE_KEY_FROM_FILE:
- if (FilePath != NULL) {
+ FilePath = NULL;
+ ChooseFile (NULL, NULL, NULL, &FilePath);
- UpdateCAFromFile(Private, FilePath);
- FreePool (FilePath);
- }
- break;
+ if (FilePath != NULL) {
+ UpdatePrivateKeyFromFile (Private, FilePath);
+ FreePool (FilePath);
+ }
- case KEY_SAVE_PRIVATE_KEY_TO_MEM:
+ break;
- if (Private->FileContext != NULL && Private->FileContext->FHandle != NULL &&
- Private->CurrentNic->UserSelectedProfile != NULL) {
+ case KEY_EAP_ENROLL_CERT_FROM_FILE:
//
- // Read Private Key file to Buffer
+ // User will select a cert file from File Explore
//
- Profile = Private->CurrentNic->UserSelectedProfile;
- if (Profile->PrivateKeyData != NULL) {
+ FilePath = NULL;
+ ChooseFile (NULL, NULL, NULL, &FilePath);
- ZeroMem (Profile->PrivateKeyData, Profile->PrivateKeyDataSize);
- FreePool (Profile->PrivateKeyData);
- Profile->PrivateKeyData = NULL;
+ if (FilePath != NULL) {
+ UpdateCAFromFile (Private, FilePath);
+ FreePool (FilePath);
}
- Status = WifiMgrReadFileToBuffer (
- Private->FileContext,
- &TempData,
- &TempDataSize
- );
- if (EFI_ERROR (Status)) {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"ERROR: Can't read this private key file!",
- NULL
- );
- } else {
-
- ASSERT (Private->FileContext->FileName != NULL);
-
- Profile->PrivateKeyData = TempData;
- Profile->PrivateKeyDataSize = TempDataSize;
- StrCpyS(Profile->PrivateKeyName, WIFI_FILENAME_STR_MAX_SIZE, Private->FileContext->FileName);
-
- DEBUG ((DEBUG_INFO, "[WiFi Connection Manager] Private Key: %s has been enrolled! Size: %d\n",
- Profile->PrivateKeyName, Profile->PrivateKeyDataSize));
- }
- }
- break;
-
- case KEY_SAVE_CERT_TO_MEM:
-
- if (Private->FileContext != NULL && Private->FileContext->FHandle != NULL &&
- Private->CurrentNic->UserSelectedProfile != NULL) {
-
- //
- // Read Cert file to Buffer
- //
- Profile = Private->CurrentNic->UserSelectedProfile;
-
- if (Private->FileType == FileTypeCACert) {
- if (Profile->CACertData != NULL) {
+ break;
- ZeroMem (Profile->CACertData, Profile->CACertSize);
- FreePool (Profile->CACertData);
- Profile->CACertData = NULL;
+ case KEY_SAVE_PRIVATE_KEY_TO_MEM:
+
+ if ((Private->FileContext != NULL) && (Private->FileContext->FHandle != NULL) &&
+ (Private->CurrentNic->UserSelectedProfile != NULL))
+ {
+ //
+ // Read Private Key file to Buffer
+ //
+ Profile = Private->CurrentNic->UserSelectedProfile;
+ if (Profile->PrivateKeyData != NULL) {
+ ZeroMem (Profile->PrivateKeyData, Profile->PrivateKeyDataSize);
+ FreePool (Profile->PrivateKeyData);
+ Profile->PrivateKeyData = NULL;
}
- } else if (Private->FileType == FileTypeClientCert) {
- if (Profile->ClientCertData != NULL) {
- ZeroMem (Profile->ClientCertData, Profile->ClientCertSize);
- FreePool (Profile->ClientCertData);
- Profile->ClientCertData = NULL;
+ Status = WifiMgrReadFileToBuffer (
+ Private->FileContext,
+ &TempData,
+ &TempDataSize
+ );
+ if (EFI_ERROR (Status)) {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"ERROR: Can't read this private key file!",
+ NULL
+ );
+ } else {
+ ASSERT (Private->FileContext->FileName != NULL);
+
+ Profile->PrivateKeyData = TempData;
+ Profile->PrivateKeyDataSize = TempDataSize;
+ StrCpyS (Profile->PrivateKeyName, WIFI_FILENAME_STR_MAX_SIZE, Private->FileContext->FileName);
+
+ DEBUG ((
+ DEBUG_INFO,
+ "[WiFi Connection Manager] Private Key: %s has been enrolled! Size: %d\n",
+ Profile->PrivateKeyName,
+ Profile->PrivateKeyDataSize
+ ));
}
- } else {
- break;
}
- Status = WifiMgrReadFileToBuffer (
- Private->FileContext,
- &TempData,
- &TempDataSize
- );
- if (EFI_ERROR (Status)) {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"ERROR: Can't read this certificate file!",
- NULL
- );
- } else {
+ break;
- ASSERT (Private->FileContext->FileName != NULL);
- if (Private->FileType == FileTypeCACert) {
+ case KEY_SAVE_CERT_TO_MEM:
+
+ if ((Private->FileContext != NULL) && (Private->FileContext->FHandle != NULL) &&
+ (Private->CurrentNic->UserSelectedProfile != NULL))
+ {
+ //
+ // Read Cert file to Buffer
+ //
+ Profile = Private->CurrentNic->UserSelectedProfile;
- Profile->CACertData = TempData;
- Profile->CACertSize = TempDataSize;
- StrCpyS(Profile->CACertName, WIFI_FILENAME_STR_MAX_SIZE, Private->FileContext->FileName);
- DEBUG ((DEBUG_INFO, "[WiFi Connection Manager] CA Cert: %s has been enrolled! Size: %d\n",
- Profile->CACertName, Profile->CACertSize));
+ if (Private->FileType == FileTypeCACert) {
+ if (Profile->CACertData != NULL) {
+ ZeroMem (Profile->CACertData, Profile->CACertSize);
+ FreePool (Profile->CACertData);
+ Profile->CACertData = NULL;
+ }
+ } else if (Private->FileType == FileTypeClientCert) {
+ if (Profile->ClientCertData != NULL) {
+ ZeroMem (Profile->ClientCertData, Profile->ClientCertSize);
+ FreePool (Profile->ClientCertData);
+ Profile->ClientCertData = NULL;
+ }
} else {
+ break;
+ }
- Profile->ClientCertData = TempData;
- Profile->ClientCertSize = TempDataSize;
- StrCpyS(Profile->ClientCertName, WIFI_FILENAME_STR_MAX_SIZE, Private->FileContext->FileName);
- DEBUG ((DEBUG_INFO, "[WiFi Connection Manager] Client Cert: %s has been enrolled! Size: %d\n",
- Profile->ClientCertName, Profile->ClientCertSize));
+ Status = WifiMgrReadFileToBuffer (
+ Private->FileContext,
+ &TempData,
+ &TempDataSize
+ );
+ if (EFI_ERROR (Status)) {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"ERROR: Can't read this certificate file!",
+ NULL
+ );
+ } else {
+ ASSERT (Private->FileContext->FileName != NULL);
+ if (Private->FileType == FileTypeCACert) {
+ Profile->CACertData = TempData;
+ Profile->CACertSize = TempDataSize;
+ StrCpyS (Profile->CACertName, WIFI_FILENAME_STR_MAX_SIZE, Private->FileContext->FileName);
+ DEBUG ((
+ DEBUG_INFO,
+ "[WiFi Connection Manager] CA Cert: %s has been enrolled! Size: %d\n",
+ Profile->CACertName,
+ Profile->CACertSize
+ ));
+ } else {
+ Profile->ClientCertData = TempData;
+ Profile->ClientCertSize = TempDataSize;
+ StrCpyS (Profile->ClientCertName, WIFI_FILENAME_STR_MAX_SIZE, Private->FileContext->FileName);
+ DEBUG ((
+ DEBUG_INFO,
+ "[WiFi Connection Manager] Client Cert: %s has been enrolled! Size: %d\n",
+ Profile->ClientCertName,
+ Profile->ClientCertSize
+ ));
+ }
}
}
- }
- break;
- case KEY_ADD_HIDDEN_NETWORK:
-
- //
- // Add a Hidden Network
- //
- if (StrLen (IfrNvData->SSId) < SSID_MIN_LEN ||
- Private->HiddenNetworkCount >= HIDDEN_NETWORK_LIST_COUNT_MAX) {
-
- Status = EFI_ABORTED;
break;
- } else {
+
+ case KEY_ADD_HIDDEN_NETWORK:
//
- // Check if this SSId is already in Hidden Network List
+ // Add a Hidden Network
//
- NET_LIST_FOR_EACH (Entry, &Private->HiddenNetworkList) {
-
- HiddenNetwork = NET_LIST_USER_STRUCT_S (Entry, WIFI_HIDDEN_NETWORK_DATA,
- Link, WIFI_MGR_HIDDEN_NETWORK_SIGNATURE);
- if (StrCmp (HiddenNetwork->SSId, IfrNvData->SSId) == 0) {
-
- Status = EFI_ABORTED;
- break;
+ if ((StrLen (IfrNvData->SSId) < SSID_MIN_LEN) ||
+ (Private->HiddenNetworkCount >= HIDDEN_NETWORK_LIST_COUNT_MAX))
+ {
+ Status = EFI_ABORTED;
+ break;
+ } else {
+ //
+ // Check if this SSId is already in Hidden Network List
+ //
+ NET_LIST_FOR_EACH (Entry, &Private->HiddenNetworkList) {
+ HiddenNetwork = NET_LIST_USER_STRUCT_S (
+ Entry,
+ WIFI_HIDDEN_NETWORK_DATA,
+ Link,
+ WIFI_MGR_HIDDEN_NETWORK_SIGNATURE
+ );
+ if (StrCmp (HiddenNetwork->SSId, IfrNvData->SSId) == 0) {
+ Status = EFI_ABORTED;
+ break;
+ }
}
}
- }
-
- HiddenNetwork = (WIFI_HIDDEN_NETWORK_DATA *) AllocateZeroPool (sizeof (WIFI_HIDDEN_NETWORK_DATA));
- if (HiddenNetwork == NULL) {
-
- Status = EFI_OUT_OF_RESOURCES;
- break;
- }
- HiddenNetwork->Signature = WIFI_MGR_HIDDEN_NETWORK_SIGNATURE;
- StrCpyS (HiddenNetwork->SSId, SSID_STORAGE_SIZE, IfrNvData->SSId);
-
- InsertTailList (&Private->HiddenNetworkList, &HiddenNetwork->Link);
- Private->HiddenNetworkCount ++;
- WifiMgrRefreshHiddenList (Private);
- break;
-
- case KEY_REMOVE_HIDDEN_NETWORK:
-
- //
- // Remove Hidden Networks
- //
- Entry = GetFirstNode (&Private->HiddenNetworkList);
- RemoveCount = 0;
- for (Index = 0; Index < Private->HiddenNetworkCount; Index ++) {
- if (IfrNvData->HiddenNetworkList[Index] != 0) {
+ HiddenNetwork = (WIFI_HIDDEN_NETWORK_DATA *)AllocateZeroPool (sizeof (WIFI_HIDDEN_NETWORK_DATA));
+ if (HiddenNetwork == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ break;
+ }
- HiddenNetwork = NET_LIST_USER_STRUCT_S (Entry, WIFI_HIDDEN_NETWORK_DATA, Link, WIFI_MGR_HIDDEN_NETWORK_SIGNATURE);
- Entry = RemoveEntryList (Entry);
- RemoveCount ++;
+ HiddenNetwork->Signature = WIFI_MGR_HIDDEN_NETWORK_SIGNATURE;
+ StrCpyS (HiddenNetwork->SSId, SSID_STORAGE_SIZE, IfrNvData->SSId);
- FreePool (HiddenNetwork);
- } else {
- Entry = GetNextNode (&Private->HiddenNetworkList, Entry);
- }
- }
+ InsertTailList (&Private->HiddenNetworkList, &HiddenNetwork->Link);
+ Private->HiddenNetworkCount++;
- Private->HiddenNetworkCount -= RemoveCount;
- WifiMgrRefreshHiddenList (Private);
- break;
+ WifiMgrRefreshHiddenList (Private);
+ break;
- default:
+ case KEY_REMOVE_HIDDEN_NETWORK:
- if (QuestionId >= KEY_MAC_ENTRY_BASE && QuestionId < KEY_MAC_ENTRY_BASE + Private->NicCount) {
//
- // User selects a wireless NIC.
+ // Remove Hidden Networks
//
- Status = WifiMgrSelectNic (Private, QuestionId);
- if (EFI_ERROR (Status)) {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"ERROR: Fail to operate the wireless NIC!",
- NULL
- );
+ Entry = GetFirstNode (&Private->HiddenNetworkList);
+ RemoveCount = 0;
+ for (Index = 0; Index < Private->HiddenNetworkCount; Index++) {
+ if (IfrNvData->HiddenNetworkList[Index] != 0) {
+ HiddenNetwork = NET_LIST_USER_STRUCT_S (Entry, WIFI_HIDDEN_NETWORK_DATA, Link, WIFI_MGR_HIDDEN_NETWORK_SIGNATURE);
+ Entry = RemoveEntryList (Entry);
+ RemoveCount++;
+
+ FreePool (HiddenNetwork);
+ } else {
+ Entry = GetNextNode (&Private->HiddenNetworkList, Entry);
+ }
}
- } else if (Private->CurrentNic != NULL) {
- if (QuestionId >= KEY_AVAILABLE_NETWORK_ENTRY_BASE &&
- QuestionId <= KEY_AVAILABLE_NETWORK_ENTRY_BASE + Private->CurrentNic->MaxProfileIndex) {
- Status = WifiMgrUserSelectProfileToConnect (Private, QuestionId - KEY_AVAILABLE_NETWORK_ENTRY_BASE);
- if (!EFI_ERROR (Status)) {
- WifiMgrUpdateConnectMessage(Private->CurrentNic, FALSE, NULL);
+ Private->HiddenNetworkCount -= RemoveCount;
+ WifiMgrRefreshHiddenList (Private);
+ break;
+
+ default:
+
+ if ((QuestionId >= KEY_MAC_ENTRY_BASE) && (QuestionId < KEY_MAC_ENTRY_BASE + Private->NicCount)) {
+ //
+ // User selects a wireless NIC.
+ //
+ Status = WifiMgrSelectNic (Private, QuestionId);
+ if (EFI_ERROR (Status)) {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"ERROR: Fail to operate the wireless NIC!",
+ NULL
+ );
+ }
+ } else if (Private->CurrentNic != NULL) {
+ if ((QuestionId >= KEY_AVAILABLE_NETWORK_ENTRY_BASE) &&
+ (QuestionId <= KEY_AVAILABLE_NETWORK_ENTRY_BASE + Private->CurrentNic->MaxProfileIndex))
+ {
+ Status = WifiMgrUserSelectProfileToConnect (Private, QuestionId - KEY_AVAILABLE_NETWORK_ENTRY_BASE);
+ if (!EFI_ERROR (Status)) {
+ WifiMgrUpdateConnectMessage (Private->CurrentNic, FALSE, NULL);
+ }
}
- }
- if (EFI_ERROR (Status)) {
- CreatePopUp (
- EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
- &Key,
- L"ERROR: Fail to operate this profile!",
- NULL
- );
+ if (EFI_ERROR (Status)) {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"ERROR: Fail to operate this profile!",
+ NULL
+ );
+ }
}
- }
- break;
+ break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (QuestionId) {
+ case KEY_SAVE_CERT_TO_MEM:
+ case KEY_SAVE_PRIVATE_KEY_TO_MEM:
- case KEY_SAVE_CERT_TO_MEM:
- case KEY_SAVE_PRIVATE_KEY_TO_MEM:
-
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
- break;
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
+ break;
- case KEY_NO_SAVE_CERT_TO_MEM:
- case KEY_NO_SAVE_PRIVATE_KEY_TO_MEM:
+ case KEY_NO_SAVE_CERT_TO_MEM:
+ case KEY_NO_SAVE_PRIVATE_KEY_TO_MEM:
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
- break;
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
+ break;
- default:
+ default:
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
- break;
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
+ break;
}
} else if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
-
switch (QuestionId) {
+ case KEY_REFRESH_NETWORK_LIST:
- case KEY_REFRESH_NETWORK_LIST:
-
- WifiMgrRefreshNetworkList (Private, IfrNvData);
- break;
+ WifiMgrRefreshNetworkList (Private, IfrNvData);
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -1890,7 +1928,7 @@ WifiMgrDxeHiiConfigAccessCallback ( // Pass changed uncommitted data back to Form Browser.
//
BufferSize = sizeof (WIFI_MANAGER_IFR_NVDATA);
- HiiSetBrowserData (&gWifiConfigFormSetGuid, mVendorStorageName, BufferSize, (UINT8 *) IfrNvData, NULL);
+ HiiSetBrowserData (&gWifiConfigFormSetGuid, mVendorStorageName, BufferSize, (UINT8 *)IfrNvData, NULL);
}
ZeroMem (IfrNvData, sizeof (WIFI_MANAGER_IFR_NVDATA));
@@ -1911,10 +1949,10 @@ WifiMgrDxeHiiConfigAccessCallback ( **/
EFI_STATUS
WifiMgrDxeConfigFormInit (
- WIFI_MGR_PRIVATE_DATA *Private
-)
+ WIFI_MGR_PRIVATE_DATA *Private
+ )
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (Private == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1981,17 +2019,16 @@ WifiMgrDxeConfigFormInit ( **/
EFI_STATUS
WifiMgrDxeConfigFormUnload (
- WIFI_MGR_PRIVATE_DATA *Private
-)
+ WIFI_MGR_PRIVATE_DATA *Private
+ )
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (Private == NULL) {
return EFI_INVALID_PARAMETER;
}
if (Private->FileContext != NULL) {
-
if (Private->FileContext->FHandle != NULL) {
Private->FileContext->FHandle->Close (Private->FileContext->FHandle);
}
@@ -1999,19 +2036,20 @@ WifiMgrDxeConfigFormUnload ( if (Private->FileContext->FileName != NULL) {
FreePool (Private->FileContext->FileName);
}
+
FreePool (Private->FileContext);
}
- HiiRemovePackages(Private->RegisteredHandle);
+ HiiRemovePackages (Private->RegisteredHandle);
Status = gBS->UninstallMultipleProtocolInterfaces (
- Private->DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mWifiMgrDxeHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &Private->ConfigAccess,
- NULL
- );
+ Private->DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mWifiMgrDxeHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &Private->ConfigAccess,
+ NULL
+ );
return Status;
}
|