10c18794ea4289f03fefc7117b56740414cc0536cgdong/** @file 20c18794ea4289f03fefc7117b56740414cc0536cgdong The functions to modify a user profile. 30c18794ea4289f03fefc7117b56740414cc0536cgdong 4c2a65e233ae82090b63e9d170401fad546957fdfZhang LuboCopyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> 50c18794ea4289f03fefc7117b56740414cc0536cgdongThis program and the accompanying materials 60c18794ea4289f03fefc7117b56740414cc0536cgdongare licensed and made available under the terms and conditions of the BSD License 70c18794ea4289f03fefc7117b56740414cc0536cgdongwhich accompanies this distribution. The full text of the license may be found at 80c18794ea4289f03fefc7117b56740414cc0536cgdonghttp://opensource.org/licenses/bsd-license.php 90c18794ea4289f03fefc7117b56740414cc0536cgdong 100c18794ea4289f03fefc7117b56740414cc0536cgdongTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 110c18794ea4289f03fefc7117b56740414cc0536cgdongWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 120c18794ea4289f03fefc7117b56740414cc0536cgdong 130c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 140c18794ea4289f03fefc7117b56740414cc0536cgdong 150c18794ea4289f03fefc7117b56740414cc0536cgdong#include "UserProfileManager.h" 160c18794ea4289f03fefc7117b56740414cc0536cgdong 170c18794ea4289f03fefc7117b56740414cc0536cgdongEFI_USER_PROFILE_HANDLE mModifyUser = NULL; 180c18794ea4289f03fefc7117b56740414cc0536cgdong 190c18794ea4289f03fefc7117b56740414cc0536cgdong/** 200c18794ea4289f03fefc7117b56740414cc0536cgdong Display user select form, cab select a user to modify. 210c18794ea4289f03fefc7117b56740414cc0536cgdong 220c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 230c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 240c18794ea4289f03fefc7117b56740414cc0536cgdongSelectUserToModify ( 250c18794ea4289f03fefc7117b56740414cc0536cgdong VOID 260c18794ea4289f03fefc7117b56740414cc0536cgdong ) 270c18794ea4289f03fefc7117b56740414cc0536cgdong{ 280c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_STATUS Status; 290c18794ea4289f03fefc7117b56740414cc0536cgdong UINT8 Index; 300c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_PROFILE_HANDLE User; 310c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_PROFILE_HANDLE CurrentUser; 320c18794ea4289f03fefc7117b56740414cc0536cgdong UINT32 CurrentAccessRight; 330c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *StartOpCodeHandle; 340c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *EndOpCodeHandle; 350c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_GUID_LABEL *StartLabel; 360c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_GUID_LABEL *EndLabel; 370c18794ea4289f03fefc7117b56740414cc0536cgdong 380c18794ea4289f03fefc7117b56740414cc0536cgdong // 390c18794ea4289f03fefc7117b56740414cc0536cgdong // Initialize the container for dynamic opcodes. 400c18794ea4289f03fefc7117b56740414cc0536cgdong // 410c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle = HiiAllocateOpCodeHandle (); 420c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (StartOpCodeHandle != NULL); 430c18794ea4289f03fefc7117b56740414cc0536cgdong 440c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle = HiiAllocateOpCodeHandle (); 450c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (EndOpCodeHandle != NULL); 460c18794ea4289f03fefc7117b56740414cc0536cgdong 470c18794ea4289f03fefc7117b56740414cc0536cgdong // 480c18794ea4289f03fefc7117b56740414cc0536cgdong // Create Hii Extend Label OpCode. 490c18794ea4289f03fefc7117b56740414cc0536cgdong // 500c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 510c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, 520c18794ea4289f03fefc7117b56740414cc0536cgdong &gEfiIfrTianoGuid, 530c18794ea4289f03fefc7117b56740414cc0536cgdong NULL, 540c18794ea4289f03fefc7117b56740414cc0536cgdong sizeof (EFI_IFR_GUID_LABEL) 550c18794ea4289f03fefc7117b56740414cc0536cgdong ); 560c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 570c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel->Number = LABEL_USER_MOD_FUNC; 580c18794ea4289f03fefc7117b56740414cc0536cgdong 590c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 600c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle, 610c18794ea4289f03fefc7117b56740414cc0536cgdong &gEfiIfrTianoGuid, 620c18794ea4289f03fefc7117b56740414cc0536cgdong NULL, 630c18794ea4289f03fefc7117b56740414cc0536cgdong sizeof (EFI_IFR_GUID_LABEL) 640c18794ea4289f03fefc7117b56740414cc0536cgdong ); 650c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 660c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel->Number = LABEL_END; 670c18794ea4289f03fefc7117b56740414cc0536cgdong 680c18794ea4289f03fefc7117b56740414cc0536cgdong // 690c18794ea4289f03fefc7117b56740414cc0536cgdong // Add each user can be modified. 700c18794ea4289f03fefc7117b56740414cc0536cgdong // 710c18794ea4289f03fefc7117b56740414cc0536cgdong User = NULL; 720c18794ea4289f03fefc7117b56740414cc0536cgdong Index = 1; 730c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager->Current (mUserManager, &CurrentUser); 740c18794ea4289f03fefc7117b56740414cc0536cgdong while (TRUE) { 750c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetNext (mUserManager, &User); 760c18794ea4289f03fefc7117b56740414cc0536cgdong if (EFI_ERROR (Status)) { 770c18794ea4289f03fefc7117b56740414cc0536cgdong break; 780c18794ea4289f03fefc7117b56740414cc0536cgdong } 790c18794ea4289f03fefc7117b56740414cc0536cgdong 800c18794ea4289f03fefc7117b56740414cc0536cgdong Status = GetAccessRight (&CurrentAccessRight); 810c18794ea4289f03fefc7117b56740414cc0536cgdong if (EFI_ERROR (Status)) { 820c18794ea4289f03fefc7117b56740414cc0536cgdong CurrentAccessRight = EFI_USER_INFO_ACCESS_ENROLL_SELF; 830c18794ea4289f03fefc7117b56740414cc0536cgdong } 840c18794ea4289f03fefc7117b56740414cc0536cgdong 850c18794ea4289f03fefc7117b56740414cc0536cgdong if ((CurrentAccessRight == EFI_USER_INFO_ACCESS_MANAGE) || (User == CurrentUser)) { 860c18794ea4289f03fefc7117b56740414cc0536cgdong AddUserToForm (User, (UINT16)(KEY_MODIFY_USER | KEY_SELECT_USER | Index), StartOpCodeHandle); 870c18794ea4289f03fefc7117b56740414cc0536cgdong } 880c18794ea4289f03fefc7117b56740414cc0536cgdong Index++; 890c18794ea4289f03fefc7117b56740414cc0536cgdong } 900c18794ea4289f03fefc7117b56740414cc0536cgdong 910c18794ea4289f03fefc7117b56740414cc0536cgdong HiiUpdateForm ( 920c18794ea4289f03fefc7117b56740414cc0536cgdong mCallbackInfo->HiiHandle, // HII handle 93a0c56a8219ec268d8ac4e051035f1636545cc478lgao &gUserProfileManagerGuid, // Formset GUID 940c18794ea4289f03fefc7117b56740414cc0536cgdong FORMID_MODIFY_USER, // Form ID 950c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Label for where to insert opcodes 960c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle // Replace data 970c18794ea4289f03fefc7117b56740414cc0536cgdong ); 980c18794ea4289f03fefc7117b56740414cc0536cgdong 990c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (StartOpCodeHandle); 1000c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (EndOpCodeHandle); 1010c18794ea4289f03fefc7117b56740414cc0536cgdong} 1020c18794ea4289f03fefc7117b56740414cc0536cgdong 1030c18794ea4289f03fefc7117b56740414cc0536cgdong 1040c18794ea4289f03fefc7117b56740414cc0536cgdong/** 1050c18794ea4289f03fefc7117b56740414cc0536cgdong Get all the user info from mModifyUser in the user manager, and save on the 1060c18794ea4289f03fefc7117b56740414cc0536cgdong global variable. 1070c18794ea4289f03fefc7117b56740414cc0536cgdong 1080c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 1090c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 1100c18794ea4289f03fefc7117b56740414cc0536cgdongGetAllUserInfo ( 1110c18794ea4289f03fefc7117b56740414cc0536cgdong VOID 1120c18794ea4289f03fefc7117b56740414cc0536cgdong ) 1130c18794ea4289f03fefc7117b56740414cc0536cgdong{ 1140c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_STATUS Status; 1150c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_HANDLE UserInfo; 1160c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO *Info; 1170c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN InfoSize; 1180c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN MemSize; 1190c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN DataLen; 1200c18794ea4289f03fefc7117b56740414cc0536cgdong 1210c18794ea4289f03fefc7117b56740414cc0536cgdong // 1220c18794ea4289f03fefc7117b56740414cc0536cgdong // Init variable to default value. 1230c18794ea4289f03fefc7117b56740414cc0536cgdong // 1240c18794ea4289f03fefc7117b56740414cc0536cgdong mProviderChoice = 0; 1250c18794ea4289f03fefc7117b56740414cc0536cgdong mConncetLogical = 0; 1260c18794ea4289f03fefc7117b56740414cc0536cgdong 1270c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.CreateDateExist = FALSE; 1280c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.UsageDateExist = FALSE; 1290c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.UsageCount = 0; 1300c18794ea4289f03fefc7117b56740414cc0536cgdong 1310c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.AccessPolicyLen = 0; 1320c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.AccessPolicyModified = FALSE; 1330c18794ea4289f03fefc7117b56740414cc0536cgdong if (mUserInfo.AccessPolicy != NULL) { 1340c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (mUserInfo.AccessPolicy); 1350c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.AccessPolicy = NULL; 1360c18794ea4289f03fefc7117b56740414cc0536cgdong } 1370c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.IdentityPolicyLen = 0; 1380c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.IdentityPolicyModified = FALSE; 1390c18794ea4289f03fefc7117b56740414cc0536cgdong if (mUserInfo.IdentityPolicy != NULL) { 1400c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (mUserInfo.IdentityPolicy); 1410c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.IdentityPolicy = NULL; 1420c18794ea4289f03fefc7117b56740414cc0536cgdong } 1430c18794ea4289f03fefc7117b56740414cc0536cgdong 1440c18794ea4289f03fefc7117b56740414cc0536cgdong // 1450c18794ea4289f03fefc7117b56740414cc0536cgdong // Allocate user information memory. 1460c18794ea4289f03fefc7117b56740414cc0536cgdong // 1470c18794ea4289f03fefc7117b56740414cc0536cgdong MemSize = sizeof (EFI_USER_INFO) + 63; 1480c18794ea4289f03fefc7117b56740414cc0536cgdong Info = AllocateZeroPool (MemSize); 1490c18794ea4289f03fefc7117b56740414cc0536cgdong if (Info == NULL) { 1500c18794ea4289f03fefc7117b56740414cc0536cgdong return ; 1510c18794ea4289f03fefc7117b56740414cc0536cgdong } 1520c18794ea4289f03fefc7117b56740414cc0536cgdong 1530c18794ea4289f03fefc7117b56740414cc0536cgdong // 1540c18794ea4289f03fefc7117b56740414cc0536cgdong // Get each user information. 1550c18794ea4289f03fefc7117b56740414cc0536cgdong // 1560c18794ea4289f03fefc7117b56740414cc0536cgdong UserInfo = NULL; 1570c18794ea4289f03fefc7117b56740414cc0536cgdong while (TRUE) { 1580c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetNextInfo (mUserManager, mModifyUser, &UserInfo); 1590c18794ea4289f03fefc7117b56740414cc0536cgdong if (EFI_ERROR (Status)) { 1600c18794ea4289f03fefc7117b56740414cc0536cgdong break; 1610c18794ea4289f03fefc7117b56740414cc0536cgdong } 1620c18794ea4289f03fefc7117b56740414cc0536cgdong // 1630c18794ea4289f03fefc7117b56740414cc0536cgdong // Get information. 1640c18794ea4289f03fefc7117b56740414cc0536cgdong // 1650c18794ea4289f03fefc7117b56740414cc0536cgdong InfoSize = MemSize; 1660c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetInfo ( 1670c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager, 1680c18794ea4289f03fefc7117b56740414cc0536cgdong mModifyUser, 1690c18794ea4289f03fefc7117b56740414cc0536cgdong UserInfo, 1700c18794ea4289f03fefc7117b56740414cc0536cgdong Info, 1710c18794ea4289f03fefc7117b56740414cc0536cgdong &InfoSize 1720c18794ea4289f03fefc7117b56740414cc0536cgdong ); 1730c18794ea4289f03fefc7117b56740414cc0536cgdong if (Status == EFI_BUFFER_TOO_SMALL) { 1740c18794ea4289f03fefc7117b56740414cc0536cgdong MemSize = InfoSize; 1750c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (Info); 1760c18794ea4289f03fefc7117b56740414cc0536cgdong Info = AllocateZeroPool (MemSize); 1770c18794ea4289f03fefc7117b56740414cc0536cgdong if (Info == NULL) { 1780c18794ea4289f03fefc7117b56740414cc0536cgdong return ; 1790c18794ea4289f03fefc7117b56740414cc0536cgdong } 1800c18794ea4289f03fefc7117b56740414cc0536cgdong 1810c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetInfo ( 1820c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager, 1830c18794ea4289f03fefc7117b56740414cc0536cgdong mModifyUser, 1840c18794ea4289f03fefc7117b56740414cc0536cgdong UserInfo, 1850c18794ea4289f03fefc7117b56740414cc0536cgdong Info, 1860c18794ea4289f03fefc7117b56740414cc0536cgdong &InfoSize 1870c18794ea4289f03fefc7117b56740414cc0536cgdong ); 1880c18794ea4289f03fefc7117b56740414cc0536cgdong } 1890c18794ea4289f03fefc7117b56740414cc0536cgdong 1900c18794ea4289f03fefc7117b56740414cc0536cgdong if (Status == EFI_SUCCESS) { 1910c18794ea4289f03fefc7117b56740414cc0536cgdong // 1920c18794ea4289f03fefc7117b56740414cc0536cgdong // Deal with each information according to informaiton type. 1930c18794ea4289f03fefc7117b56740414cc0536cgdong // 1940c18794ea4289f03fefc7117b56740414cc0536cgdong DataLen = Info->InfoSize - sizeof (EFI_USER_INFO); 1950c18794ea4289f03fefc7117b56740414cc0536cgdong switch (Info->InfoType) { 1960c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_NAME_RECORD: 1970c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (&mUserInfo.UserName, (UINT8 *) (Info + 1), DataLen); 1980c18794ea4289f03fefc7117b56740414cc0536cgdong break; 1990c18794ea4289f03fefc7117b56740414cc0536cgdong 2000c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_CREATE_DATE_RECORD: 2010c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (&mUserInfo.CreateDate, (UINT8 *) (Info + 1), DataLen); 2020c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.CreateDateExist = TRUE; 2030c18794ea4289f03fefc7117b56740414cc0536cgdong break; 2040c18794ea4289f03fefc7117b56740414cc0536cgdong 2050c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_USAGE_DATE_RECORD: 2060c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (&mUserInfo.UsageDate, (UINT8 *) (Info + 1), DataLen); 2070c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.UsageDateExist = TRUE; 2080c18794ea4289f03fefc7117b56740414cc0536cgdong break; 2090c18794ea4289f03fefc7117b56740414cc0536cgdong 2100c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_USAGE_COUNT_RECORD: 2110c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (&mUserInfo.UsageCount, (UINT8 *) (Info + 1), DataLen); 2120c18794ea4289f03fefc7117b56740414cc0536cgdong break; 2130c18794ea4289f03fefc7117b56740414cc0536cgdong 2140c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_POLICY_RECORD: 2150c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.AccessPolicy = AllocateZeroPool (DataLen); 2160c18794ea4289f03fefc7117b56740414cc0536cgdong if (mUserInfo.AccessPolicy == NULL) { 2170c18794ea4289f03fefc7117b56740414cc0536cgdong break; 2180c18794ea4289f03fefc7117b56740414cc0536cgdong } 2190c18794ea4289f03fefc7117b56740414cc0536cgdong 2200c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (mUserInfo.AccessPolicy, (UINT8 *) (Info + 1), DataLen); 2210c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.AccessPolicyLen = DataLen; 2220c18794ea4289f03fefc7117b56740414cc0536cgdong break; 2230c18794ea4289f03fefc7117b56740414cc0536cgdong 2240c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_IDENTITY_POLICY_RECORD: 2250c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.IdentityPolicy = AllocateZeroPool (DataLen); 2260c18794ea4289f03fefc7117b56740414cc0536cgdong if (mUserInfo.IdentityPolicy == NULL) { 2270c18794ea4289f03fefc7117b56740414cc0536cgdong break; 2280c18794ea4289f03fefc7117b56740414cc0536cgdong } 2290c18794ea4289f03fefc7117b56740414cc0536cgdong 2300c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (mUserInfo.IdentityPolicy, (UINT8 *) (Info + 1), DataLen); 2310c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.IdentityPolicyLen = DataLen; 2320c18794ea4289f03fefc7117b56740414cc0536cgdong break; 2330c18794ea4289f03fefc7117b56740414cc0536cgdong 2340c18794ea4289f03fefc7117b56740414cc0536cgdong default: 2350c18794ea4289f03fefc7117b56740414cc0536cgdong break; 2360c18794ea4289f03fefc7117b56740414cc0536cgdong } 2370c18794ea4289f03fefc7117b56740414cc0536cgdong } 2380c18794ea4289f03fefc7117b56740414cc0536cgdong } 2390c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (Info); 2400c18794ea4289f03fefc7117b56740414cc0536cgdong} 2410c18794ea4289f03fefc7117b56740414cc0536cgdong 2420c18794ea4289f03fefc7117b56740414cc0536cgdong 2430c18794ea4289f03fefc7117b56740414cc0536cgdong/** 2440c18794ea4289f03fefc7117b56740414cc0536cgdong Convert the Date to a string, and update the Hii database DateID string with it. 2450c18794ea4289f03fefc7117b56740414cc0536cgdong 2460c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] Date Points to the date to be converted. 2470c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] DateId String ID in the HII database to be replaced. 2480c18794ea4289f03fefc7117b56740414cc0536cgdong 2490c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 2500c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 2510c18794ea4289f03fefc7117b56740414cc0536cgdongResolveDate ( 2520c18794ea4289f03fefc7117b56740414cc0536cgdong IN EFI_TIME *Date, 2530c18794ea4289f03fefc7117b56740414cc0536cgdong IN EFI_STRING_ID DateId 2540c18794ea4289f03fefc7117b56740414cc0536cgdong ) 2550c18794ea4289f03fefc7117b56740414cc0536cgdong{ 2560c18794ea4289f03fefc7117b56740414cc0536cgdong CHAR16 *Str; 2570c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN DateBufLen; 2580c18794ea4289f03fefc7117b56740414cc0536cgdong 2590c18794ea4289f03fefc7117b56740414cc0536cgdong // 2600c18794ea4289f03fefc7117b56740414cc0536cgdong // Convert date to string. 2610c18794ea4289f03fefc7117b56740414cc0536cgdong // 2620c18794ea4289f03fefc7117b56740414cc0536cgdong DateBufLen = 64; 2630c18794ea4289f03fefc7117b56740414cc0536cgdong Str = AllocateZeroPool (DateBufLen); 2640c18794ea4289f03fefc7117b56740414cc0536cgdong if (Str == NULL) { 2650c18794ea4289f03fefc7117b56740414cc0536cgdong return ; 2660c18794ea4289f03fefc7117b56740414cc0536cgdong } 2670c18794ea4289f03fefc7117b56740414cc0536cgdong 2680c18794ea4289f03fefc7117b56740414cc0536cgdong UnicodeSPrint ( 2690c18794ea4289f03fefc7117b56740414cc0536cgdong Str, 2700c18794ea4289f03fefc7117b56740414cc0536cgdong DateBufLen, 2710c18794ea4289f03fefc7117b56740414cc0536cgdong L"%4d-%2d-%2d ", 2720c18794ea4289f03fefc7117b56740414cc0536cgdong Date->Year, 2730c18794ea4289f03fefc7117b56740414cc0536cgdong Date->Month, 2740c18794ea4289f03fefc7117b56740414cc0536cgdong Date->Day 2750c18794ea4289f03fefc7117b56740414cc0536cgdong ); 2760c18794ea4289f03fefc7117b56740414cc0536cgdong 2770c18794ea4289f03fefc7117b56740414cc0536cgdong // 2780c18794ea4289f03fefc7117b56740414cc0536cgdong // Convert time to string. 2790c18794ea4289f03fefc7117b56740414cc0536cgdong // 2800c18794ea4289f03fefc7117b56740414cc0536cgdong DateBufLen -= StrLen (Str); 2810c18794ea4289f03fefc7117b56740414cc0536cgdong UnicodeSPrint ( 2820c18794ea4289f03fefc7117b56740414cc0536cgdong Str + StrLen (Str), 2830c18794ea4289f03fefc7117b56740414cc0536cgdong DateBufLen, 2840c18794ea4289f03fefc7117b56740414cc0536cgdong L"%2d:%2d:%2d", 2850c18794ea4289f03fefc7117b56740414cc0536cgdong Date->Hour, 2860c18794ea4289f03fefc7117b56740414cc0536cgdong Date->Minute, 2870c18794ea4289f03fefc7117b56740414cc0536cgdong Date->Second 2880c18794ea4289f03fefc7117b56740414cc0536cgdong ); 2890c18794ea4289f03fefc7117b56740414cc0536cgdong 2900c18794ea4289f03fefc7117b56740414cc0536cgdong HiiSetString (mCallbackInfo->HiiHandle, DateId, Str, NULL); 2910c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (Str); 2920c18794ea4289f03fefc7117b56740414cc0536cgdong} 2930c18794ea4289f03fefc7117b56740414cc0536cgdong 2940c18794ea4289f03fefc7117b56740414cc0536cgdong 2950c18794ea4289f03fefc7117b56740414cc0536cgdong/** 2960c18794ea4289f03fefc7117b56740414cc0536cgdong Convert the CountVal to a string, and update the Hii database CountId string 2970c18794ea4289f03fefc7117b56740414cc0536cgdong with it. 2980c18794ea4289f03fefc7117b56740414cc0536cgdong 2990c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] CountVal The hex value to convert. 3000c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] CountId String ID in the HII database to be replaced. 3010c18794ea4289f03fefc7117b56740414cc0536cgdong 3020c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 3030c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 3040c18794ea4289f03fefc7117b56740414cc0536cgdongResolveCount ( 3050c18794ea4289f03fefc7117b56740414cc0536cgdong IN UINT32 CountVal, 3060c18794ea4289f03fefc7117b56740414cc0536cgdong IN EFI_STRING_ID CountId 3070c18794ea4289f03fefc7117b56740414cc0536cgdong ) 3080c18794ea4289f03fefc7117b56740414cc0536cgdong{ 3090c18794ea4289f03fefc7117b56740414cc0536cgdong CHAR16 Count[10]; 3100c18794ea4289f03fefc7117b56740414cc0536cgdong 3110c18794ea4289f03fefc7117b56740414cc0536cgdong UnicodeSPrint (Count, 20, L"%d", CountVal); 3120c18794ea4289f03fefc7117b56740414cc0536cgdong HiiSetString (mCallbackInfo->HiiHandle, CountId, Count, NULL); 3130c18794ea4289f03fefc7117b56740414cc0536cgdong} 3140c18794ea4289f03fefc7117b56740414cc0536cgdong 3150c18794ea4289f03fefc7117b56740414cc0536cgdong 3160c18794ea4289f03fefc7117b56740414cc0536cgdong/** 3170c18794ea4289f03fefc7117b56740414cc0536cgdong Concatenates one Null-terminated Unicode string to another Null-terminated 3180c18794ea4289f03fefc7117b56740414cc0536cgdong Unicode string. 3190c18794ea4289f03fefc7117b56740414cc0536cgdong 3200c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in, out] Source1 On entry, point to a Null-terminated Unicode string. 3210c18794ea4289f03fefc7117b56740414cc0536cgdong On exit, point to a new concatenated Unicode string 3220c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] Source2 Pointer to a Null-terminated Unicode string. 3230c18794ea4289f03fefc7117b56740414cc0536cgdong 3240c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 3250c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 3260c18794ea4289f03fefc7117b56740414cc0536cgdongAddStr ( 3270c18794ea4289f03fefc7117b56740414cc0536cgdong IN OUT CHAR16 **Source1, 3280c18794ea4289f03fefc7117b56740414cc0536cgdong IN CONST CHAR16 *Source2 3290c18794ea4289f03fefc7117b56740414cc0536cgdong ) 3300c18794ea4289f03fefc7117b56740414cc0536cgdong{ 3310c18794ea4289f03fefc7117b56740414cc0536cgdong CHAR16 *TmpStr; 3320c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN StrLength; 3330c18794ea4289f03fefc7117b56740414cc0536cgdong 3340c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (Source1 != NULL); 3350c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (Source2 != NULL); 3360c18794ea4289f03fefc7117b56740414cc0536cgdong 3370c18794ea4289f03fefc7117b56740414cc0536cgdong if (*Source1 == NULL) { 3380c18794ea4289f03fefc7117b56740414cc0536cgdong StrLength = StrSize (Source2); 3390c18794ea4289f03fefc7117b56740414cc0536cgdong } else { 3400c18794ea4289f03fefc7117b56740414cc0536cgdong StrLength = StrSize (*Source1); 341cc976d20ffbab731ef6db7e3baa485de825d4b7eZhang Lubo StrLength += StrSize (Source2) - 2; 3420c18794ea4289f03fefc7117b56740414cc0536cgdong } 3430c18794ea4289f03fefc7117b56740414cc0536cgdong 3440c18794ea4289f03fefc7117b56740414cc0536cgdong TmpStr = AllocateZeroPool (StrLength); 3450c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (TmpStr != NULL); 3460c18794ea4289f03fefc7117b56740414cc0536cgdong 3470c18794ea4289f03fefc7117b56740414cc0536cgdong if (*Source1 == NULL) { 348c2a65e233ae82090b63e9d170401fad546957fdfZhang Lubo StrCpyS (TmpStr, StrLength / sizeof (CHAR16), Source2); 3490c18794ea4289f03fefc7117b56740414cc0536cgdong } else { 350c2a65e233ae82090b63e9d170401fad546957fdfZhang Lubo StrCpyS (TmpStr, StrLength / sizeof (CHAR16), *Source1); 3510c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (*Source1); 352c2a65e233ae82090b63e9d170401fad546957fdfZhang Lubo StrCatS (TmpStr, StrLength / sizeof (CHAR16),Source2); 3530c18794ea4289f03fefc7117b56740414cc0536cgdong } 3540c18794ea4289f03fefc7117b56740414cc0536cgdong 3550c18794ea4289f03fefc7117b56740414cc0536cgdong *Source1 = TmpStr; 3560c18794ea4289f03fefc7117b56740414cc0536cgdong} 3570c18794ea4289f03fefc7117b56740414cc0536cgdong 3580c18794ea4289f03fefc7117b56740414cc0536cgdong 3590c18794ea4289f03fefc7117b56740414cc0536cgdong/** 3600c18794ea4289f03fefc7117b56740414cc0536cgdong Convert the identity policy to a unicode string and update the Hii database 3610c18794ea4289f03fefc7117b56740414cc0536cgdong IpStringId string with it. 3620c18794ea4289f03fefc7117b56740414cc0536cgdong 3630c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] Ip Points to identity policy. 3640c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] IpLen The identity policy length. 3650c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] IpStringId String ID in the HII database to be replaced. 3660c18794ea4289f03fefc7117b56740414cc0536cgdong 3670c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 3680c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 3690c18794ea4289f03fefc7117b56740414cc0536cgdongResolveIdentityPolicy ( 3700c18794ea4289f03fefc7117b56740414cc0536cgdong IN UINT8 *Ip, 3710c18794ea4289f03fefc7117b56740414cc0536cgdong IN UINTN IpLen, 3720c18794ea4289f03fefc7117b56740414cc0536cgdong IN EFI_STRING_ID IpStringId 3730c18794ea4289f03fefc7117b56740414cc0536cgdong ) 3740c18794ea4289f03fefc7117b56740414cc0536cgdong{ 3750c18794ea4289f03fefc7117b56740414cc0536cgdong CHAR16 *TmpStr; 3760c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN ChkLen; 3770c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_IDENTITY_POLICY *Identity; 3780c18794ea4289f03fefc7117b56740414cc0536cgdong UINT16 Index; 3790c18794ea4289f03fefc7117b56740414cc0536cgdong CHAR16 *ProvStr; 3800c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_STRING_ID ProvId; 3810c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_HII_HANDLE HiiHandle; 3826f0b864812b3313b79e7beade487f0ca8ca5f28dgdong EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential; 3830c18794ea4289f03fefc7117b56740414cc0536cgdong 3840c18794ea4289f03fefc7117b56740414cc0536cgdong TmpStr = NULL; 3850c18794ea4289f03fefc7117b56740414cc0536cgdong 3860c18794ea4289f03fefc7117b56740414cc0536cgdong // 3870c18794ea4289f03fefc7117b56740414cc0536cgdong // Resolve each policy. 3880c18794ea4289f03fefc7117b56740414cc0536cgdong // 3890c18794ea4289f03fefc7117b56740414cc0536cgdong ChkLen = 0; 3900c18794ea4289f03fefc7117b56740414cc0536cgdong while (ChkLen < IpLen) { 3910c18794ea4289f03fefc7117b56740414cc0536cgdong Identity = (EFI_USER_INFO_IDENTITY_POLICY *) (Ip + ChkLen); 3920c18794ea4289f03fefc7117b56740414cc0536cgdong switch (Identity->Type) { 3930c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_IDENTITY_FALSE: 3940c18794ea4289f03fefc7117b56740414cc0536cgdong AddStr (&TmpStr, L"False"); 3950c18794ea4289f03fefc7117b56740414cc0536cgdong break; 3960c18794ea4289f03fefc7117b56740414cc0536cgdong 3970c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_IDENTITY_TRUE: 3980c18794ea4289f03fefc7117b56740414cc0536cgdong AddStr (&TmpStr, L"None"); 3990c18794ea4289f03fefc7117b56740414cc0536cgdong break; 4000c18794ea4289f03fefc7117b56740414cc0536cgdong 4010c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_IDENTITY_NOT: 4020c18794ea4289f03fefc7117b56740414cc0536cgdong AddStr (&TmpStr, L"! "); 4030c18794ea4289f03fefc7117b56740414cc0536cgdong break; 4040c18794ea4289f03fefc7117b56740414cc0536cgdong 4050c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_IDENTITY_AND: 4060c18794ea4289f03fefc7117b56740414cc0536cgdong AddStr (&TmpStr, L" && "); 4070c18794ea4289f03fefc7117b56740414cc0536cgdong break; 4080c18794ea4289f03fefc7117b56740414cc0536cgdong 4090c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_IDENTITY_OR: 4100c18794ea4289f03fefc7117b56740414cc0536cgdong AddStr (&TmpStr, L" || "); 4110c18794ea4289f03fefc7117b56740414cc0536cgdong break; 4120c18794ea4289f03fefc7117b56740414cc0536cgdong 4130c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_IDENTITY_CREDENTIAL_TYPE: 4140c18794ea4289f03fefc7117b56740414cc0536cgdong for (Index = 0; Index < mProviderInfo->Count; Index++) { 4150c18794ea4289f03fefc7117b56740414cc0536cgdong UserCredential = mProviderInfo->Provider[Index]; 4160c18794ea4289f03fefc7117b56740414cc0536cgdong if (CompareGuid ((EFI_GUID *) (Identity + 1), &UserCredential->Type)) { 4170c18794ea4289f03fefc7117b56740414cc0536cgdong UserCredential->Title ( 4180c18794ea4289f03fefc7117b56740414cc0536cgdong UserCredential, 4190c18794ea4289f03fefc7117b56740414cc0536cgdong &HiiHandle, 4200c18794ea4289f03fefc7117b56740414cc0536cgdong &ProvId 4210c18794ea4289f03fefc7117b56740414cc0536cgdong ); 4220c18794ea4289f03fefc7117b56740414cc0536cgdong ProvStr = HiiGetString (HiiHandle, ProvId, NULL); 4230c18794ea4289f03fefc7117b56740414cc0536cgdong if (ProvStr != NULL) { 4240c18794ea4289f03fefc7117b56740414cc0536cgdong AddStr (&TmpStr, ProvStr); 4250c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (ProvStr); 4260c18794ea4289f03fefc7117b56740414cc0536cgdong } 4270c18794ea4289f03fefc7117b56740414cc0536cgdong break; 4280c18794ea4289f03fefc7117b56740414cc0536cgdong } 4290c18794ea4289f03fefc7117b56740414cc0536cgdong } 4300c18794ea4289f03fefc7117b56740414cc0536cgdong break; 4310c18794ea4289f03fefc7117b56740414cc0536cgdong 4320c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_IDENTITY_CREDENTIAL_PROVIDER: 4330c18794ea4289f03fefc7117b56740414cc0536cgdong for (Index = 0; Index < mProviderInfo->Count; Index++) { 4340c18794ea4289f03fefc7117b56740414cc0536cgdong UserCredential = mProviderInfo->Provider[Index]; 4350c18794ea4289f03fefc7117b56740414cc0536cgdong if (CompareGuid ((EFI_GUID *) (Identity + 1), &UserCredential->Identifier)) { 4360c18794ea4289f03fefc7117b56740414cc0536cgdong UserCredential->Title ( 4370c18794ea4289f03fefc7117b56740414cc0536cgdong UserCredential, 4380c18794ea4289f03fefc7117b56740414cc0536cgdong &HiiHandle, 4390c18794ea4289f03fefc7117b56740414cc0536cgdong &ProvId 4400c18794ea4289f03fefc7117b56740414cc0536cgdong ); 4410c18794ea4289f03fefc7117b56740414cc0536cgdong ProvStr = HiiGetString (HiiHandle, ProvId, NULL); 4420c18794ea4289f03fefc7117b56740414cc0536cgdong if (ProvStr != NULL) { 4430c18794ea4289f03fefc7117b56740414cc0536cgdong AddStr (&TmpStr, ProvStr); 4440c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (ProvStr); 4450c18794ea4289f03fefc7117b56740414cc0536cgdong } 4460c18794ea4289f03fefc7117b56740414cc0536cgdong break; 4470c18794ea4289f03fefc7117b56740414cc0536cgdong } 4480c18794ea4289f03fefc7117b56740414cc0536cgdong } 4490c18794ea4289f03fefc7117b56740414cc0536cgdong break; 4500c18794ea4289f03fefc7117b56740414cc0536cgdong } 4510c18794ea4289f03fefc7117b56740414cc0536cgdong 4520c18794ea4289f03fefc7117b56740414cc0536cgdong ChkLen += Identity->Length; 4530c18794ea4289f03fefc7117b56740414cc0536cgdong } 4540c18794ea4289f03fefc7117b56740414cc0536cgdong 4550c18794ea4289f03fefc7117b56740414cc0536cgdong if (TmpStr != NULL) { 4560c18794ea4289f03fefc7117b56740414cc0536cgdong HiiSetString (mCallbackInfo->HiiHandle, IpStringId, TmpStr, NULL); 4570c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (TmpStr); 4580c18794ea4289f03fefc7117b56740414cc0536cgdong } 4590c18794ea4289f03fefc7117b56740414cc0536cgdong} 4600c18794ea4289f03fefc7117b56740414cc0536cgdong 4610c18794ea4289f03fefc7117b56740414cc0536cgdong 4620c18794ea4289f03fefc7117b56740414cc0536cgdong/** 4630c18794ea4289f03fefc7117b56740414cc0536cgdong Display modify user information form. 4640c18794ea4289f03fefc7117b56740414cc0536cgdong 4650c18794ea4289f03fefc7117b56740414cc0536cgdong This form displays, username, create Date, usage date, usage count, identity policy, 4660c18794ea4289f03fefc7117b56740414cc0536cgdong and access policy. 4670c18794ea4289f03fefc7117b56740414cc0536cgdong 4680c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] UserIndex The index of the user in display list to modify. 4690c18794ea4289f03fefc7117b56740414cc0536cgdong 4700c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 4710c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 4720c18794ea4289f03fefc7117b56740414cc0536cgdongModifyUserInfo ( 4730c18794ea4289f03fefc7117b56740414cc0536cgdong IN UINT8 UserIndex 4740c18794ea4289f03fefc7117b56740414cc0536cgdong ) 4750c18794ea4289f03fefc7117b56740414cc0536cgdong{ 4760c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_STATUS Status; 4770c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_PROFILE_HANDLE CurrentUser; 4780c18794ea4289f03fefc7117b56740414cc0536cgdong UINT32 CurrentAccessRight; 4790c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *StartOpCodeHandle; 4800c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *EndOpCodeHandle; 4810c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_GUID_LABEL *StartLabel; 4820c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_GUID_LABEL *EndLabel; 4830c18794ea4289f03fefc7117b56740414cc0536cgdong 4840c18794ea4289f03fefc7117b56740414cc0536cgdong // 4850c18794ea4289f03fefc7117b56740414cc0536cgdong // Initialize the container for dynamic opcodes. 4860c18794ea4289f03fefc7117b56740414cc0536cgdong // 4870c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle = HiiAllocateOpCodeHandle (); 4880c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (StartOpCodeHandle != NULL); 4890c18794ea4289f03fefc7117b56740414cc0536cgdong 4900c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle = HiiAllocateOpCodeHandle (); 4910c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (EndOpCodeHandle != NULL); 4920c18794ea4289f03fefc7117b56740414cc0536cgdong 4930c18794ea4289f03fefc7117b56740414cc0536cgdong // 4940c18794ea4289f03fefc7117b56740414cc0536cgdong // Create Hii Extend Label OpCode. 4950c18794ea4289f03fefc7117b56740414cc0536cgdong // 4960c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 4970c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, 4980c18794ea4289f03fefc7117b56740414cc0536cgdong &gEfiIfrTianoGuid, 4990c18794ea4289f03fefc7117b56740414cc0536cgdong NULL, 5000c18794ea4289f03fefc7117b56740414cc0536cgdong sizeof (EFI_IFR_GUID_LABEL) 5010c18794ea4289f03fefc7117b56740414cc0536cgdong ); 5020c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 5030c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel->Number = LABEL_USER_INFO_FUNC; 5040c18794ea4289f03fefc7117b56740414cc0536cgdong 5050c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 5060c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle, 5070c18794ea4289f03fefc7117b56740414cc0536cgdong &gEfiIfrTianoGuid, 5080c18794ea4289f03fefc7117b56740414cc0536cgdong NULL, 5090c18794ea4289f03fefc7117b56740414cc0536cgdong sizeof (EFI_IFR_GUID_LABEL) 5100c18794ea4289f03fefc7117b56740414cc0536cgdong ); 5110c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 5120c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel->Number = LABEL_END; 5130c18794ea4289f03fefc7117b56740414cc0536cgdong 5140c18794ea4289f03fefc7117b56740414cc0536cgdong // 5150c18794ea4289f03fefc7117b56740414cc0536cgdong // Find the user profile to be modified. 5160c18794ea4289f03fefc7117b56740414cc0536cgdong // 5170c18794ea4289f03fefc7117b56740414cc0536cgdong mModifyUser = NULL; 5180c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetNext (mUserManager, &mModifyUser); 5190c18794ea4289f03fefc7117b56740414cc0536cgdong if (EFI_ERROR (Status)) { 5200c18794ea4289f03fefc7117b56740414cc0536cgdong return ; 5210c18794ea4289f03fefc7117b56740414cc0536cgdong } 5220c18794ea4289f03fefc7117b56740414cc0536cgdong 5230c18794ea4289f03fefc7117b56740414cc0536cgdong while (UserIndex > 1) { 5240c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetNext (mUserManager, &mModifyUser); 5250c18794ea4289f03fefc7117b56740414cc0536cgdong if (EFI_ERROR (Status)) { 5260c18794ea4289f03fefc7117b56740414cc0536cgdong return ; 5270c18794ea4289f03fefc7117b56740414cc0536cgdong } 5280c18794ea4289f03fefc7117b56740414cc0536cgdong UserIndex--; 5290c18794ea4289f03fefc7117b56740414cc0536cgdong } 5300c18794ea4289f03fefc7117b56740414cc0536cgdong 5310c18794ea4289f03fefc7117b56740414cc0536cgdong // 5320c18794ea4289f03fefc7117b56740414cc0536cgdong // Get user profile information. 5330c18794ea4289f03fefc7117b56740414cc0536cgdong // 5340c18794ea4289f03fefc7117b56740414cc0536cgdong GetAllUserInfo (); 5350c18794ea4289f03fefc7117b56740414cc0536cgdong 5360c18794ea4289f03fefc7117b56740414cc0536cgdong // 5370c18794ea4289f03fefc7117b56740414cc0536cgdong // Update user name. 5380c18794ea4289f03fefc7117b56740414cc0536cgdong HiiSetString ( 5390c18794ea4289f03fefc7117b56740414cc0536cgdong mCallbackInfo->HiiHandle, 5400c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_USER_NAME_VAL), 5410c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.UserName, 5420c18794ea4289f03fefc7117b56740414cc0536cgdong NULL 5430c18794ea4289f03fefc7117b56740414cc0536cgdong ); 5440c18794ea4289f03fefc7117b56740414cc0536cgdong 5450c18794ea4289f03fefc7117b56740414cc0536cgdong // 5460c18794ea4289f03fefc7117b56740414cc0536cgdong // Update create date. 5470c18794ea4289f03fefc7117b56740414cc0536cgdong // 5480c18794ea4289f03fefc7117b56740414cc0536cgdong if (mUserInfo.CreateDateExist) { 5490c18794ea4289f03fefc7117b56740414cc0536cgdong ResolveDate (&mUserInfo.CreateDate, STRING_TOKEN (STR_CREATE_DATE_VAL)); 5500c18794ea4289f03fefc7117b56740414cc0536cgdong } else { 5510c18794ea4289f03fefc7117b56740414cc0536cgdong HiiSetString ( 5520c18794ea4289f03fefc7117b56740414cc0536cgdong mCallbackInfo->HiiHandle, 5530c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_CREATE_DATE_VAL), 5540c18794ea4289f03fefc7117b56740414cc0536cgdong L"", 5550c18794ea4289f03fefc7117b56740414cc0536cgdong NULL 5560c18794ea4289f03fefc7117b56740414cc0536cgdong ); 5570c18794ea4289f03fefc7117b56740414cc0536cgdong } 5580c18794ea4289f03fefc7117b56740414cc0536cgdong 5590c18794ea4289f03fefc7117b56740414cc0536cgdong // 5600c18794ea4289f03fefc7117b56740414cc0536cgdong // Add usage date. 5610c18794ea4289f03fefc7117b56740414cc0536cgdong // 5620c18794ea4289f03fefc7117b56740414cc0536cgdong if (mUserInfo.UsageDateExist) { 5630c18794ea4289f03fefc7117b56740414cc0536cgdong ResolveDate (&mUserInfo.UsageDate, STRING_TOKEN (STR_USAGE_DATE_VAL)); 5640c18794ea4289f03fefc7117b56740414cc0536cgdong } else { 5650c18794ea4289f03fefc7117b56740414cc0536cgdong HiiSetString ( 5660c18794ea4289f03fefc7117b56740414cc0536cgdong mCallbackInfo->HiiHandle, 5670c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_USAGE_DATE_VAL), 5680c18794ea4289f03fefc7117b56740414cc0536cgdong L"", 5690c18794ea4289f03fefc7117b56740414cc0536cgdong NULL 5700c18794ea4289f03fefc7117b56740414cc0536cgdong ); 5710c18794ea4289f03fefc7117b56740414cc0536cgdong } 5720c18794ea4289f03fefc7117b56740414cc0536cgdong 5730c18794ea4289f03fefc7117b56740414cc0536cgdong // 5740c18794ea4289f03fefc7117b56740414cc0536cgdong // Add usage count. 5750c18794ea4289f03fefc7117b56740414cc0536cgdong // 5760c18794ea4289f03fefc7117b56740414cc0536cgdong ResolveCount ((UINT32) mUserInfo.UsageCount, STRING_TOKEN (STR_USAGE_COUNT_VAL)); 5770c18794ea4289f03fefc7117b56740414cc0536cgdong 5780c18794ea4289f03fefc7117b56740414cc0536cgdong // 5790c18794ea4289f03fefc7117b56740414cc0536cgdong // Add identity policy. 5800c18794ea4289f03fefc7117b56740414cc0536cgdong // 5810c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager->Current (mUserManager, &CurrentUser); 5820c18794ea4289f03fefc7117b56740414cc0536cgdong if (mModifyUser == CurrentUser) { 5830c18794ea4289f03fefc7117b56740414cc0536cgdong ResolveIdentityPolicy ( 5840c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.IdentityPolicy, 5850c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.IdentityPolicyLen, 5860c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_IDENTIFY_POLICY_VAL) 5870c18794ea4289f03fefc7117b56740414cc0536cgdong ); 5880c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateGotoOpCode ( 5890c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Container for opcodes 5900c18794ea4289f03fefc7117b56740414cc0536cgdong FORMID_MODIFY_IP, // Target Form ID 5910c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_IDENTIFY_POLICY), // Prompt text 5920c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_IDENTIFY_POLICY_VAL), // Help text 5930c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_FLAG_CALLBACK, // Question flag 5940c18794ea4289f03fefc7117b56740414cc0536cgdong KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_IP // Question ID 5950c18794ea4289f03fefc7117b56740414cc0536cgdong ); 5960c18794ea4289f03fefc7117b56740414cc0536cgdong } 5970c18794ea4289f03fefc7117b56740414cc0536cgdong 5980c18794ea4289f03fefc7117b56740414cc0536cgdong // 5990c18794ea4289f03fefc7117b56740414cc0536cgdong // Add access policy. 6000c18794ea4289f03fefc7117b56740414cc0536cgdong // 6010c18794ea4289f03fefc7117b56740414cc0536cgdong Status = GetAccessRight (&CurrentAccessRight); 6020c18794ea4289f03fefc7117b56740414cc0536cgdong if (EFI_ERROR (Status)) { 6030c18794ea4289f03fefc7117b56740414cc0536cgdong CurrentAccessRight = EFI_USER_INFO_ACCESS_ENROLL_SELF; 6040c18794ea4289f03fefc7117b56740414cc0536cgdong } 6050c18794ea4289f03fefc7117b56740414cc0536cgdong 6060c18794ea4289f03fefc7117b56740414cc0536cgdong if (CurrentAccessRight == EFI_USER_INFO_ACCESS_MANAGE) { 6070c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateGotoOpCode ( 6080c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Container for opcodes 6090c18794ea4289f03fefc7117b56740414cc0536cgdong FORMID_MODIFY_AP, // Target Form ID 6100c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_ACCESS_POLICY), // Prompt text 6110c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_NULL_STRING), // Help text 6120c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_FLAG_CALLBACK, // Question flag 6130c18794ea4289f03fefc7117b56740414cc0536cgdong KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_AP // Question ID 6140c18794ea4289f03fefc7117b56740414cc0536cgdong ); 6150c18794ea4289f03fefc7117b56740414cc0536cgdong } 6160c18794ea4289f03fefc7117b56740414cc0536cgdong 6170c18794ea4289f03fefc7117b56740414cc0536cgdong HiiUpdateForm ( 6180c18794ea4289f03fefc7117b56740414cc0536cgdong mCallbackInfo->HiiHandle, // HII handle 619a0c56a8219ec268d8ac4e051035f1636545cc478lgao &gUserProfileManagerGuid, // Formset GUID 6200c18794ea4289f03fefc7117b56740414cc0536cgdong FORMID_USER_INFO, // Form ID 6210c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Label 6220c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle // Replace data 6230c18794ea4289f03fefc7117b56740414cc0536cgdong ); 6240c18794ea4289f03fefc7117b56740414cc0536cgdong 6250c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (StartOpCodeHandle); 6260c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (EndOpCodeHandle); 6270c18794ea4289f03fefc7117b56740414cc0536cgdong} 6280c18794ea4289f03fefc7117b56740414cc0536cgdong 6290c18794ea4289f03fefc7117b56740414cc0536cgdong 6300c18794ea4289f03fefc7117b56740414cc0536cgdong/** 6310c18794ea4289f03fefc7117b56740414cc0536cgdong Get all the access policy info from current user info, and save in the global 6320c18794ea4289f03fefc7117b56740414cc0536cgdong variable. 6330c18794ea4289f03fefc7117b56740414cc0536cgdong 6340c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 6350c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 6360c18794ea4289f03fefc7117b56740414cc0536cgdongResolveAccessPolicy ( 6370c18794ea4289f03fefc7117b56740414cc0536cgdong VOID 6380c18794ea4289f03fefc7117b56740414cc0536cgdong ) 6390c18794ea4289f03fefc7117b56740414cc0536cgdong{ 6400c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN OffSet; 6410c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_ACCESS_CONTROL Control; 6420c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN ValLen; 6430c18794ea4289f03fefc7117b56740414cc0536cgdong UINT8 *AccessData; 6440c18794ea4289f03fefc7117b56740414cc0536cgdong 6450c18794ea4289f03fefc7117b56740414cc0536cgdong // 6460c18794ea4289f03fefc7117b56740414cc0536cgdong // Set default value 6470c18794ea4289f03fefc7117b56740414cc0536cgdong // 6480c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessRight = EFI_USER_INFO_ACCESS_ENROLL_SELF; 6490c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessSetup = ACCESS_SETUP_RESTRICTED; 6500c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessBootOrder = EFI_USER_INFO_ACCESS_BOOT_ORDER_INSERT; 6510c18794ea4289f03fefc7117b56740414cc0536cgdong 6520c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.LoadPermitLen = 0; 6530c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.LoadForbidLen = 0; 6540c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.ConnectPermitLen = 0; 6550c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.ConnectForbidLen = 0; 6560c18794ea4289f03fefc7117b56740414cc0536cgdong 6570c18794ea4289f03fefc7117b56740414cc0536cgdong // 6580c18794ea4289f03fefc7117b56740414cc0536cgdong // Get each user access policy. 6590c18794ea4289f03fefc7117b56740414cc0536cgdong // 6600c18794ea4289f03fefc7117b56740414cc0536cgdong OffSet = 0; 6610c18794ea4289f03fefc7117b56740414cc0536cgdong while (OffSet < mUserInfo.AccessPolicyLen) { 6620c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (&Control, mUserInfo.AccessPolicy + OffSet, sizeof (Control)); 6630c18794ea4289f03fefc7117b56740414cc0536cgdong ValLen = Control.Size - sizeof (Control); 6640c18794ea4289f03fefc7117b56740414cc0536cgdong switch (Control.Type) { 6650c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_ENROLL_SELF: 6660c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessRight = EFI_USER_INFO_ACCESS_ENROLL_SELF; 6670c18794ea4289f03fefc7117b56740414cc0536cgdong break; 6680c18794ea4289f03fefc7117b56740414cc0536cgdong 6690c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_ENROLL_OTHERS: 6700c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessRight = EFI_USER_INFO_ACCESS_ENROLL_OTHERS; 6710c18794ea4289f03fefc7117b56740414cc0536cgdong break; 6720c18794ea4289f03fefc7117b56740414cc0536cgdong 6730c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_MANAGE: 6740c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessRight = EFI_USER_INFO_ACCESS_MANAGE; 6750c18794ea4289f03fefc7117b56740414cc0536cgdong break; 6760c18794ea4289f03fefc7117b56740414cc0536cgdong 6770c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_SETUP: 6780c18794ea4289f03fefc7117b56740414cc0536cgdong AccessData = mUserInfo.AccessPolicy + OffSet + sizeof (Control); 6790c18794ea4289f03fefc7117b56740414cc0536cgdong if (CompareGuid ((EFI_GUID *) AccessData, &gEfiUserInfoAccessSetupNormalGuid)) { 6800c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessSetup = ACCESS_SETUP_NORMAL; 6810c18794ea4289f03fefc7117b56740414cc0536cgdong } else if (CompareGuid ((EFI_GUID *) AccessData, &gEfiUserInfoAccessSetupRestrictedGuid)) { 6820c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessSetup = ACCESS_SETUP_RESTRICTED; 6830c18794ea4289f03fefc7117b56740414cc0536cgdong } else if (CompareGuid ((EFI_GUID *) AccessData, &gEfiUserInfoAccessSetupAdminGuid)) { 6840c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessSetup = ACCESS_SETUP_ADMIN; 6850c18794ea4289f03fefc7117b56740414cc0536cgdong } 6860c18794ea4289f03fefc7117b56740414cc0536cgdong break; 6870c18794ea4289f03fefc7117b56740414cc0536cgdong 6880c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_BOOT_ORDER: 6890c18794ea4289f03fefc7117b56740414cc0536cgdong AccessData = mUserInfo.AccessPolicy + OffSet + sizeof (Control); 6900c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (&mAccessInfo.AccessBootOrder, AccessData, sizeof (UINT32)); 6910c18794ea4289f03fefc7117b56740414cc0536cgdong break; 6920c18794ea4289f03fefc7117b56740414cc0536cgdong 6930c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_FORBID_LOAD: 6940c18794ea4289f03fefc7117b56740414cc0536cgdong if (mAccessInfo.LoadForbid != NULL) { 6950c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (mAccessInfo.LoadForbid); 6960c18794ea4289f03fefc7117b56740414cc0536cgdong } 6970c18794ea4289f03fefc7117b56740414cc0536cgdong 6980c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.LoadForbid = AllocateZeroPool (ValLen); 6990c18794ea4289f03fefc7117b56740414cc0536cgdong if (mAccessInfo.LoadForbid != NULL) { 7000c18794ea4289f03fefc7117b56740414cc0536cgdong AccessData = mUserInfo.AccessPolicy + OffSet + sizeof (Control); 7010c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (mAccessInfo.LoadForbid, AccessData, ValLen); 7020c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.LoadForbidLen = ValLen; 7030c18794ea4289f03fefc7117b56740414cc0536cgdong } 7040c18794ea4289f03fefc7117b56740414cc0536cgdong break; 7050c18794ea4289f03fefc7117b56740414cc0536cgdong 7060c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_PERMIT_LOAD: 7070c18794ea4289f03fefc7117b56740414cc0536cgdong if (mAccessInfo.LoadPermit != NULL) { 7080c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (mAccessInfo.LoadPermit); 7090c18794ea4289f03fefc7117b56740414cc0536cgdong } 7100c18794ea4289f03fefc7117b56740414cc0536cgdong 7110c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.LoadPermit = AllocateZeroPool (ValLen); 7120c18794ea4289f03fefc7117b56740414cc0536cgdong if (mAccessInfo.LoadPermit != NULL) { 7130c18794ea4289f03fefc7117b56740414cc0536cgdong AccessData = mUserInfo.AccessPolicy + OffSet + sizeof (Control); 7140c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (mAccessInfo.LoadPermit, AccessData, ValLen); 7150c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.LoadPermitLen = ValLen; 7160c18794ea4289f03fefc7117b56740414cc0536cgdong } 7170c18794ea4289f03fefc7117b56740414cc0536cgdong break; 7180c18794ea4289f03fefc7117b56740414cc0536cgdong 7190c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_FORBID_CONNECT: 7200c18794ea4289f03fefc7117b56740414cc0536cgdong if (mAccessInfo.ConnectForbid != NULL) { 7210c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (mAccessInfo.ConnectForbid); 7220c18794ea4289f03fefc7117b56740414cc0536cgdong } 7230c18794ea4289f03fefc7117b56740414cc0536cgdong 7240c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.ConnectForbid = AllocateZeroPool (ValLen); 7250c18794ea4289f03fefc7117b56740414cc0536cgdong if (mAccessInfo.ConnectForbid != NULL) { 7260c18794ea4289f03fefc7117b56740414cc0536cgdong AccessData = mUserInfo.AccessPolicy + OffSet + sizeof (Control); 7270c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (mAccessInfo.ConnectForbid, AccessData, ValLen); 7280c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.ConnectForbidLen = ValLen; 7290c18794ea4289f03fefc7117b56740414cc0536cgdong } 7300c18794ea4289f03fefc7117b56740414cc0536cgdong break; 7310c18794ea4289f03fefc7117b56740414cc0536cgdong 7320c18794ea4289f03fefc7117b56740414cc0536cgdong case EFI_USER_INFO_ACCESS_PERMIT_CONNECT: 7330c18794ea4289f03fefc7117b56740414cc0536cgdong if (mAccessInfo.ConnectPermit != NULL) { 7340c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (mAccessInfo.ConnectPermit); 7350c18794ea4289f03fefc7117b56740414cc0536cgdong } 7360c18794ea4289f03fefc7117b56740414cc0536cgdong 7370c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.ConnectPermit = AllocateZeroPool (ValLen); 7380c18794ea4289f03fefc7117b56740414cc0536cgdong if (mAccessInfo.ConnectPermit != NULL) { 7390c18794ea4289f03fefc7117b56740414cc0536cgdong AccessData = mUserInfo.AccessPolicy + OffSet + sizeof (Control); 7400c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (mAccessInfo.ConnectPermit, AccessData, ValLen); 7410c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.ConnectPermitLen = ValLen; 7420c18794ea4289f03fefc7117b56740414cc0536cgdong } 7430c18794ea4289f03fefc7117b56740414cc0536cgdong break; 7440c18794ea4289f03fefc7117b56740414cc0536cgdong } 7450c18794ea4289f03fefc7117b56740414cc0536cgdong 7460c18794ea4289f03fefc7117b56740414cc0536cgdong OffSet += Control.Size; 7470c18794ea4289f03fefc7117b56740414cc0536cgdong } 7480c18794ea4289f03fefc7117b56740414cc0536cgdong} 7490c18794ea4289f03fefc7117b56740414cc0536cgdong 7500c18794ea4289f03fefc7117b56740414cc0536cgdong 7510c18794ea4289f03fefc7117b56740414cc0536cgdong/** 7520c5b25f021a815d4ddce306139cc077db9afddfdgdong Find the specified info in User profile by the InfoType. 7530c18794ea4289f03fefc7117b56740414cc0536cgdong 7540c5b25f021a815d4ddce306139cc077db9afddfdgdong @param[in] User Handle of the user whose information will be searched. 7550c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] InfoType The user information type to find. 7560c18794ea4289f03fefc7117b56740414cc0536cgdong @param[out] UserInfo Points to user information handle found. 7570c18794ea4289f03fefc7117b56740414cc0536cgdong 7580c18794ea4289f03fefc7117b56740414cc0536cgdong @retval EFI_SUCCESS Find the user information successfully. 7590c18794ea4289f03fefc7117b56740414cc0536cgdong @retval Others Fail to find the user information. 7600c18794ea4289f03fefc7117b56740414cc0536cgdong 7610c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 7620c18794ea4289f03fefc7117b56740414cc0536cgdongEFI_STATUS 7630c18794ea4289f03fefc7117b56740414cc0536cgdongFindInfoByType ( 7640c5b25f021a815d4ddce306139cc077db9afddfdgdong IN EFI_USER_PROFILE_HANDLE User, 7650c18794ea4289f03fefc7117b56740414cc0536cgdong IN UINT8 InfoType, 7660c18794ea4289f03fefc7117b56740414cc0536cgdong OUT EFI_USER_INFO_HANDLE *UserInfo 7670c18794ea4289f03fefc7117b56740414cc0536cgdong ) 7680c18794ea4289f03fefc7117b56740414cc0536cgdong{ 7690c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_STATUS Status; 7700c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO *Info; 7710c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN InfoSize; 7720c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN MemSize; 7730c18794ea4289f03fefc7117b56740414cc0536cgdong 7740c18794ea4289f03fefc7117b56740414cc0536cgdong if (UserInfo == NULL) { 7750c18794ea4289f03fefc7117b56740414cc0536cgdong return EFI_INVALID_PARAMETER; 7760c18794ea4289f03fefc7117b56740414cc0536cgdong } 7770c18794ea4289f03fefc7117b56740414cc0536cgdong 7780c18794ea4289f03fefc7117b56740414cc0536cgdong *UserInfo = NULL; 7790c18794ea4289f03fefc7117b56740414cc0536cgdong // 7800c18794ea4289f03fefc7117b56740414cc0536cgdong // Allocate user information memory. 7810c18794ea4289f03fefc7117b56740414cc0536cgdong // 7820c18794ea4289f03fefc7117b56740414cc0536cgdong MemSize = sizeof (EFI_USER_INFO) + 63; 7830c18794ea4289f03fefc7117b56740414cc0536cgdong Info = AllocateZeroPool (MemSize); 7840c18794ea4289f03fefc7117b56740414cc0536cgdong if (Info == NULL) { 7850c18794ea4289f03fefc7117b56740414cc0536cgdong return EFI_OUT_OF_RESOURCES; 7860c18794ea4289f03fefc7117b56740414cc0536cgdong } 7870c18794ea4289f03fefc7117b56740414cc0536cgdong 7880c18794ea4289f03fefc7117b56740414cc0536cgdong // 7890c18794ea4289f03fefc7117b56740414cc0536cgdong // Get each user information. 7900c18794ea4289f03fefc7117b56740414cc0536cgdong // 7910c18794ea4289f03fefc7117b56740414cc0536cgdong while (TRUE) { 7920c5b25f021a815d4ddce306139cc077db9afddfdgdong Status = mUserManager->GetNextInfo (mUserManager, User, UserInfo); 7930c18794ea4289f03fefc7117b56740414cc0536cgdong if (EFI_ERROR (Status)) { 7940c18794ea4289f03fefc7117b56740414cc0536cgdong break; 7950c18794ea4289f03fefc7117b56740414cc0536cgdong } 7960c18794ea4289f03fefc7117b56740414cc0536cgdong // 7970c18794ea4289f03fefc7117b56740414cc0536cgdong // Get information. 7980c18794ea4289f03fefc7117b56740414cc0536cgdong // 7990c18794ea4289f03fefc7117b56740414cc0536cgdong InfoSize = MemSize; 8000c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetInfo ( 8010c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager, 8020c5b25f021a815d4ddce306139cc077db9afddfdgdong User, 8030c18794ea4289f03fefc7117b56740414cc0536cgdong *UserInfo, 8040c18794ea4289f03fefc7117b56740414cc0536cgdong Info, 8050c18794ea4289f03fefc7117b56740414cc0536cgdong &InfoSize 8060c18794ea4289f03fefc7117b56740414cc0536cgdong ); 8070c18794ea4289f03fefc7117b56740414cc0536cgdong if (Status == EFI_BUFFER_TOO_SMALL) { 8080c18794ea4289f03fefc7117b56740414cc0536cgdong MemSize = InfoSize; 8090c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (Info); 8100c18794ea4289f03fefc7117b56740414cc0536cgdong Info = AllocateZeroPool (MemSize); 8110c18794ea4289f03fefc7117b56740414cc0536cgdong if (Info == NULL) { 8120c18794ea4289f03fefc7117b56740414cc0536cgdong return EFI_OUT_OF_RESOURCES; 8130c18794ea4289f03fefc7117b56740414cc0536cgdong } 8140c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetInfo ( 8150c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager, 8160c5b25f021a815d4ddce306139cc077db9afddfdgdong User, 8170c18794ea4289f03fefc7117b56740414cc0536cgdong *UserInfo, 8180c18794ea4289f03fefc7117b56740414cc0536cgdong Info, 8190c18794ea4289f03fefc7117b56740414cc0536cgdong &InfoSize 8200c18794ea4289f03fefc7117b56740414cc0536cgdong ); 8210c18794ea4289f03fefc7117b56740414cc0536cgdong } 8220c18794ea4289f03fefc7117b56740414cc0536cgdong if (Status == EFI_SUCCESS) { 8230c18794ea4289f03fefc7117b56740414cc0536cgdong if (Info->InfoType == InfoType) { 8240c18794ea4289f03fefc7117b56740414cc0536cgdong break; 8250c18794ea4289f03fefc7117b56740414cc0536cgdong } 8260c18794ea4289f03fefc7117b56740414cc0536cgdong } 8270c18794ea4289f03fefc7117b56740414cc0536cgdong } 8280c18794ea4289f03fefc7117b56740414cc0536cgdong 8290c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (Info); 8300c18794ea4289f03fefc7117b56740414cc0536cgdong return Status; 8310c18794ea4289f03fefc7117b56740414cc0536cgdong} 8320c18794ea4289f03fefc7117b56740414cc0536cgdong 8330c18794ea4289f03fefc7117b56740414cc0536cgdong 8340c18794ea4289f03fefc7117b56740414cc0536cgdong/** 8350c18794ea4289f03fefc7117b56740414cc0536cgdong Display modify user access policy form. 8360c18794ea4289f03fefc7117b56740414cc0536cgdong 8370c18794ea4289f03fefc7117b56740414cc0536cgdong In this form, access right, access setup and access boot order are dynamically 8380c18794ea4289f03fefc7117b56740414cc0536cgdong added. Load devicepath and connect devicepath are displayed too. 8390c18794ea4289f03fefc7117b56740414cc0536cgdong 8400c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 8410c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 8420c18794ea4289f03fefc7117b56740414cc0536cgdongModidyAccessPolicy ( 8430c18794ea4289f03fefc7117b56740414cc0536cgdong VOID 8440c18794ea4289f03fefc7117b56740414cc0536cgdong ) 8450c18794ea4289f03fefc7117b56740414cc0536cgdong{ 8460c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *StartOpCodeHandle; 8470c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *EndOpCodeHandle; 8480c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *OptionsOpCodeHandle; 8490c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_GUID_LABEL *StartLabel; 8500c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_GUID_LABEL *EndLabel; 8510c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *DefaultOpCodeHandle; 8520c18794ea4289f03fefc7117b56740414cc0536cgdong 8530c18794ea4289f03fefc7117b56740414cc0536cgdong // 8540c18794ea4289f03fefc7117b56740414cc0536cgdong // Initialize the container for dynamic opcodes. 8550c18794ea4289f03fefc7117b56740414cc0536cgdong // 8560c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle = HiiAllocateOpCodeHandle (); 8570c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (StartOpCodeHandle != NULL); 8580c18794ea4289f03fefc7117b56740414cc0536cgdong 8590c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle = HiiAllocateOpCodeHandle (); 8600c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (EndOpCodeHandle != NULL); 8610c18794ea4289f03fefc7117b56740414cc0536cgdong 8620c18794ea4289f03fefc7117b56740414cc0536cgdong // 8630c18794ea4289f03fefc7117b56740414cc0536cgdong // Create Hii Extend Label OpCode. 8640c18794ea4289f03fefc7117b56740414cc0536cgdong // 8650c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 8660c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, 8670c18794ea4289f03fefc7117b56740414cc0536cgdong &gEfiIfrTianoGuid, 8680c18794ea4289f03fefc7117b56740414cc0536cgdong NULL, 8690c18794ea4289f03fefc7117b56740414cc0536cgdong sizeof (EFI_IFR_GUID_LABEL) 8700c18794ea4289f03fefc7117b56740414cc0536cgdong ); 8710c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 8720c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel->Number = LABEL_AP_MOD_FUNC; 8730c18794ea4289f03fefc7117b56740414cc0536cgdong 8740c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 8750c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle, 8760c18794ea4289f03fefc7117b56740414cc0536cgdong &gEfiIfrTianoGuid, 8770c18794ea4289f03fefc7117b56740414cc0536cgdong NULL, 8780c18794ea4289f03fefc7117b56740414cc0536cgdong sizeof (EFI_IFR_GUID_LABEL) 8790c18794ea4289f03fefc7117b56740414cc0536cgdong ); 8800c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 8810c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel->Number = LABEL_END; 8820c18794ea4289f03fefc7117b56740414cc0536cgdong 8830c18794ea4289f03fefc7117b56740414cc0536cgdong 8840c18794ea4289f03fefc7117b56740414cc0536cgdong // 8850c18794ea4289f03fefc7117b56740414cc0536cgdong // Resolve access policy information. 8860c18794ea4289f03fefc7117b56740414cc0536cgdong // 8870c18794ea4289f03fefc7117b56740414cc0536cgdong ResolveAccessPolicy (); 8880c18794ea4289f03fefc7117b56740414cc0536cgdong 8890c18794ea4289f03fefc7117b56740414cc0536cgdong // 8900c18794ea4289f03fefc7117b56740414cc0536cgdong // Add access right one-of-code. 8910c18794ea4289f03fefc7117b56740414cc0536cgdong // 8920c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); 8930c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (OptionsOpCodeHandle != NULL); 8940c18794ea4289f03fefc7117b56740414cc0536cgdong DefaultOpCodeHandle = HiiAllocateOpCodeHandle (); 8950c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (DefaultOpCodeHandle != NULL); 8960c18794ea4289f03fefc7117b56740414cc0536cgdong 8970c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 8980c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 8990c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_NORMAL), 9000c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 9010c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 9020c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_ACCESS_ENROLL_SELF 9030c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9040c18794ea4289f03fefc7117b56740414cc0536cgdong 9050c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 9060c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 9070c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_ENROLL), 9080c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 9090c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 9100c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_ACCESS_ENROLL_OTHERS 9110c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9120c18794ea4289f03fefc7117b56740414cc0536cgdong 9130c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 9140c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 9150c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_MANAGE), 9160c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 9170c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 9180c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_ACCESS_MANAGE 9190c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9200c18794ea4289f03fefc7117b56740414cc0536cgdong 9210c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateDefaultOpCode ( 9220c18794ea4289f03fefc7117b56740414cc0536cgdong DefaultOpCodeHandle, 9230c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_HII_DEFAULT_CLASS_STANDARD, 9240c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 9250c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessRight 9260c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9270c18794ea4289f03fefc7117b56740414cc0536cgdong 9280c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOpCode ( 9290c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Container for dynamic created opcodes 9300c18794ea4289f03fefc7117b56740414cc0536cgdong KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_AP | KEY_MODIFY_RIGHT, // Question ID 9310c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // VarStore ID 9320c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // Offset in Buffer Storage 9330c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_ACCESS_RIGHT), // Question prompt text 9340c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_ACCESS_RIGHT_HELP), // Question help text 9350c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_FLAG_CALLBACK, // Question flag 9360c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value 9370c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, // Option Opcode list 9380c18794ea4289f03fefc7117b56740414cc0536cgdong DefaultOpCodeHandle // Default Opcode 9390c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9400c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (DefaultOpCodeHandle); 9410c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (OptionsOpCodeHandle); 9420c18794ea4289f03fefc7117b56740414cc0536cgdong 9430c18794ea4289f03fefc7117b56740414cc0536cgdong 9440c18794ea4289f03fefc7117b56740414cc0536cgdong // 9450c18794ea4289f03fefc7117b56740414cc0536cgdong // Add setup type one-of-code. 9460c18794ea4289f03fefc7117b56740414cc0536cgdong // 9470c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); 9480c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (OptionsOpCodeHandle != NULL); 9490c18794ea4289f03fefc7117b56740414cc0536cgdong DefaultOpCodeHandle = HiiAllocateOpCodeHandle (); 9500c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (DefaultOpCodeHandle != NULL); 9510c18794ea4289f03fefc7117b56740414cc0536cgdong 9520c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 9530c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 9540c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_RESTRICTED), 9550c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 9560c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 9570c18794ea4289f03fefc7117b56740414cc0536cgdong ACCESS_SETUP_RESTRICTED 9580c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9590c18794ea4289f03fefc7117b56740414cc0536cgdong 9600c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 9610c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 9620c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_NORMAL), 9630c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 9640c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 9650c18794ea4289f03fefc7117b56740414cc0536cgdong ACCESS_SETUP_NORMAL 9660c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9670c18794ea4289f03fefc7117b56740414cc0536cgdong 9680c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 9690c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 9700c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_ADMIN), 9710c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 9720c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 9730c18794ea4289f03fefc7117b56740414cc0536cgdong ACCESS_SETUP_ADMIN 9740c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9750c18794ea4289f03fefc7117b56740414cc0536cgdong 9760c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateDefaultOpCode ( 9770c18794ea4289f03fefc7117b56740414cc0536cgdong DefaultOpCodeHandle, 9780c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_HII_DEFAULT_CLASS_STANDARD, 9790c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 9800c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessSetup 9810c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9820c18794ea4289f03fefc7117b56740414cc0536cgdong 9830c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOpCode ( 9840c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Container for dynamic created opcodes 9850c18794ea4289f03fefc7117b56740414cc0536cgdong KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_AP | KEY_MODIFY_SETUP, // Question ID 9860c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // VarStore ID 9870c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // Offset in Buffer Storage 9880c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_ACCESS_SETUP), // Question prompt text 9890c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_ACCESS_SETUP_HELP), // Question help text 9900c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_FLAG_CALLBACK, // Question flag 9910c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value 9920c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, // Option Opcode list 9930c18794ea4289f03fefc7117b56740414cc0536cgdong DefaultOpCodeHandle // Default Opcode 9940c18794ea4289f03fefc7117b56740414cc0536cgdong ); 9950c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (DefaultOpCodeHandle); 9960c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (OptionsOpCodeHandle); 9970c18794ea4289f03fefc7117b56740414cc0536cgdong 9980c18794ea4289f03fefc7117b56740414cc0536cgdong // 9990c18794ea4289f03fefc7117b56740414cc0536cgdong // Add boot order one-of-code. 10000c18794ea4289f03fefc7117b56740414cc0536cgdong // 10010c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); 10020c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (OptionsOpCodeHandle != NULL); 10030c18794ea4289f03fefc7117b56740414cc0536cgdong DefaultOpCodeHandle = HiiAllocateOpCodeHandle (); 10040c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (DefaultOpCodeHandle != NULL); 10050c18794ea4289f03fefc7117b56740414cc0536cgdong 10060c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 10070c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 10080c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_INSERT), 10090c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 10100c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_4, 10110c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_ACCESS_BOOT_ORDER_INSERT 10120c18794ea4289f03fefc7117b56740414cc0536cgdong ); 10130c18794ea4289f03fefc7117b56740414cc0536cgdong 10140c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 10150c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 10160c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_APPEND), 10170c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 10180c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_4, 10190c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_ACCESS_BOOT_ORDER_APPEND 10200c18794ea4289f03fefc7117b56740414cc0536cgdong ); 10210c18794ea4289f03fefc7117b56740414cc0536cgdong 10220c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 10230c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 10240c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_REPLACE), 10250c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 10260c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_4, 10270c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_ACCESS_BOOT_ORDER_REPLACE 10280c18794ea4289f03fefc7117b56740414cc0536cgdong ); 10290c18794ea4289f03fefc7117b56740414cc0536cgdong 10300c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 10310c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 10320c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_NODEFAULT), 10330c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 10340c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_4, 10350c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_ACCESS_BOOT_ORDER_NODEFAULT 10360c18794ea4289f03fefc7117b56740414cc0536cgdong ); 10370c18794ea4289f03fefc7117b56740414cc0536cgdong 10380c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateDefaultOpCode ( 10390c18794ea4289f03fefc7117b56740414cc0536cgdong DefaultOpCodeHandle, 10400c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_HII_DEFAULT_CLASS_STANDARD, 10410c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_4, 10420c18794ea4289f03fefc7117b56740414cc0536cgdong mAccessInfo.AccessBootOrder 10430c18794ea4289f03fefc7117b56740414cc0536cgdong ); 10440c18794ea4289f03fefc7117b56740414cc0536cgdong 10450c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOpCode ( 10460c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Container for dynamic created opcodes 10470c18794ea4289f03fefc7117b56740414cc0536cgdong KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_AP | KEY_MODIFY_BOOT, // Question ID 10480c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // VarStore ID 10490c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // Offset in Buffer Storage 10500c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_BOOR_ORDER), // Question prompt text 10510c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_BOOT_ORDER_HELP), // Question help text 10520c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_FLAG_CALLBACK, // Question flag 10530c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value 10540c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, // Option Opcode list 10550c18794ea4289f03fefc7117b56740414cc0536cgdong DefaultOpCodeHandle // Default Opcode 10560c18794ea4289f03fefc7117b56740414cc0536cgdong ); 10570c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (DefaultOpCodeHandle); 10580c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (OptionsOpCodeHandle); 10590c18794ea4289f03fefc7117b56740414cc0536cgdong 10600c18794ea4289f03fefc7117b56740414cc0536cgdong // 10610c18794ea4289f03fefc7117b56740414cc0536cgdong // Update Form. 10620c18794ea4289f03fefc7117b56740414cc0536cgdong // 10630c18794ea4289f03fefc7117b56740414cc0536cgdong HiiUpdateForm ( 10640c18794ea4289f03fefc7117b56740414cc0536cgdong mCallbackInfo->HiiHandle, // HII handle 1065a0c56a8219ec268d8ac4e051035f1636545cc478lgao &gUserProfileManagerGuid, // Formset GUID 10660c18794ea4289f03fefc7117b56740414cc0536cgdong FORMID_MODIFY_AP, // Form ID 10670c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Label for where to insert opcodes 10680c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle // Replace data 10690c18794ea4289f03fefc7117b56740414cc0536cgdong ); 10700c18794ea4289f03fefc7117b56740414cc0536cgdong 10710c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (StartOpCodeHandle); 10720c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (EndOpCodeHandle); 10730c18794ea4289f03fefc7117b56740414cc0536cgdong} 10740c18794ea4289f03fefc7117b56740414cc0536cgdong 10750c18794ea4289f03fefc7117b56740414cc0536cgdong 10760c18794ea4289f03fefc7117b56740414cc0536cgdong/** 10770c18794ea4289f03fefc7117b56740414cc0536cgdong Expand access policy memory size. 10780c18794ea4289f03fefc7117b56740414cc0536cgdong 10790c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] ValidLen The valid access policy length. 10800c18794ea4289f03fefc7117b56740414cc0536cgdong @param[in] ExpandLen The length that is needed to expand. 10810c18794ea4289f03fefc7117b56740414cc0536cgdong 10820c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 10830c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 10840c18794ea4289f03fefc7117b56740414cc0536cgdongExpandMemory ( 10850c18794ea4289f03fefc7117b56740414cc0536cgdong IN UINTN ValidLen, 10860c18794ea4289f03fefc7117b56740414cc0536cgdong IN UINTN ExpandLen 10870c18794ea4289f03fefc7117b56740414cc0536cgdong ) 10880c18794ea4289f03fefc7117b56740414cc0536cgdong{ 10890c18794ea4289f03fefc7117b56740414cc0536cgdong UINT8 *Mem; 10900c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN Len; 10910c18794ea4289f03fefc7117b56740414cc0536cgdong 10920c18794ea4289f03fefc7117b56740414cc0536cgdong // 10930c18794ea4289f03fefc7117b56740414cc0536cgdong // Expand memory. 10940c18794ea4289f03fefc7117b56740414cc0536cgdong // 10950c18794ea4289f03fefc7117b56740414cc0536cgdong Len = mUserInfo.AccessPolicyLen + (ExpandLen / 64 + 1) * 64; 10960c18794ea4289f03fefc7117b56740414cc0536cgdong Mem = AllocateZeroPool (Len); 10970c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (Mem != NULL); 10980c18794ea4289f03fefc7117b56740414cc0536cgdong 10990c18794ea4289f03fefc7117b56740414cc0536cgdong if (mUserInfo.AccessPolicy != NULL) { 11000c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (Mem, mUserInfo.AccessPolicy, ValidLen); 11010c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (mUserInfo.AccessPolicy); 11020c18794ea4289f03fefc7117b56740414cc0536cgdong } 11030c18794ea4289f03fefc7117b56740414cc0536cgdong 11040c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.AccessPolicy = Mem; 11050c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.AccessPolicyLen = Len; 11060c18794ea4289f03fefc7117b56740414cc0536cgdong} 11070c18794ea4289f03fefc7117b56740414cc0536cgdong 11080c18794ea4289f03fefc7117b56740414cc0536cgdong 11090c18794ea4289f03fefc7117b56740414cc0536cgdong/** 11100c18794ea4289f03fefc7117b56740414cc0536cgdong Get the username from user input, and update username string in the Hii 11110c18794ea4289f03fefc7117b56740414cc0536cgdong database with it. 11120c18794ea4289f03fefc7117b56740414cc0536cgdong 11130c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 11140c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 11150c18794ea4289f03fefc7117b56740414cc0536cgdongModifyUserName ( 11160c18794ea4289f03fefc7117b56740414cc0536cgdong VOID 11170c18794ea4289f03fefc7117b56740414cc0536cgdong ) 11180c18794ea4289f03fefc7117b56740414cc0536cgdong{ 11190c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_STATUS Status; 11200c18794ea4289f03fefc7117b56740414cc0536cgdong CHAR16 UserName[USER_NAME_LENGTH]; 11210c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN Len; 11220c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_INPUT_KEY Key; 11230c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_HANDLE UserInfo; 11240c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO *Info; 11250c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_PROFILE_HANDLE TempUser; 11260c18794ea4289f03fefc7117b56740414cc0536cgdong 11270c18794ea4289f03fefc7117b56740414cc0536cgdong // 11280c18794ea4289f03fefc7117b56740414cc0536cgdong // Get the new user name. 11290c18794ea4289f03fefc7117b56740414cc0536cgdong // 11300c18794ea4289f03fefc7117b56740414cc0536cgdong Len = sizeof (UserName); 11310c18794ea4289f03fefc7117b56740414cc0536cgdong Status = GetUserNameInput (&Len, UserName); 11320c18794ea4289f03fefc7117b56740414cc0536cgdong if (EFI_ERROR (Status)) { 11330c18794ea4289f03fefc7117b56740414cc0536cgdong if (Status != EFI_ABORTED) { 11340c18794ea4289f03fefc7117b56740414cc0536cgdong CreatePopUp ( 11350c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, 11360c18794ea4289f03fefc7117b56740414cc0536cgdong &Key, 11370c18794ea4289f03fefc7117b56740414cc0536cgdong L"Failed To Get User Name.", 11380c18794ea4289f03fefc7117b56740414cc0536cgdong L"", 11390c18794ea4289f03fefc7117b56740414cc0536cgdong L"Please Press Any Key to Continue ...", 11400c18794ea4289f03fefc7117b56740414cc0536cgdong NULL 11410c18794ea4289f03fefc7117b56740414cc0536cgdong ); 11420c18794ea4289f03fefc7117b56740414cc0536cgdong } 11430c18794ea4289f03fefc7117b56740414cc0536cgdong return ; 11440c18794ea4289f03fefc7117b56740414cc0536cgdong } 11450c18794ea4289f03fefc7117b56740414cc0536cgdong 11460c18794ea4289f03fefc7117b56740414cc0536cgdong // 11470c18794ea4289f03fefc7117b56740414cc0536cgdong // Check whether the username had been used or not. 11480c18794ea4289f03fefc7117b56740414cc0536cgdong // 11490c18794ea4289f03fefc7117b56740414cc0536cgdong Info = AllocateZeroPool (sizeof (EFI_USER_INFO) + Len); 11500c18794ea4289f03fefc7117b56740414cc0536cgdong if (Info == NULL) { 11510c18794ea4289f03fefc7117b56740414cc0536cgdong return ; 11520c18794ea4289f03fefc7117b56740414cc0536cgdong } 11530c18794ea4289f03fefc7117b56740414cc0536cgdong 11540c18794ea4289f03fefc7117b56740414cc0536cgdong Info->InfoType = EFI_USER_INFO_NAME_RECORD; 11550c18794ea4289f03fefc7117b56740414cc0536cgdong Info->InfoAttribs = EFI_USER_INFO_STORAGE_PLATFORM_NV | 11560c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_PUBLIC | 11570c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_EXCLUSIVE; 11580c18794ea4289f03fefc7117b56740414cc0536cgdong Info->InfoSize = (UINT32) (sizeof (EFI_USER_INFO) + Len); 11590c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem ((UINT8 *) (Info + 1), UserName, Len); 11600c18794ea4289f03fefc7117b56740414cc0536cgdong 11610c18794ea4289f03fefc7117b56740414cc0536cgdong TempUser = NULL; 11620c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->Find ( 11630c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager, 11640c18794ea4289f03fefc7117b56740414cc0536cgdong &TempUser, 11650c18794ea4289f03fefc7117b56740414cc0536cgdong NULL, 11660c18794ea4289f03fefc7117b56740414cc0536cgdong Info, 11670c18794ea4289f03fefc7117b56740414cc0536cgdong Info->InfoSize 11680c18794ea4289f03fefc7117b56740414cc0536cgdong ); 11690c18794ea4289f03fefc7117b56740414cc0536cgdong if (!EFI_ERROR (Status)) { 11700c18794ea4289f03fefc7117b56740414cc0536cgdong CreatePopUp ( 11710c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, 11720c18794ea4289f03fefc7117b56740414cc0536cgdong &Key, 11730c18794ea4289f03fefc7117b56740414cc0536cgdong L"The User Name Had Been Used.", 11740c18794ea4289f03fefc7117b56740414cc0536cgdong L"", 11750c18794ea4289f03fefc7117b56740414cc0536cgdong L"Please Use Other User Name", 11760c18794ea4289f03fefc7117b56740414cc0536cgdong NULL 11770c18794ea4289f03fefc7117b56740414cc0536cgdong ); 11780c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (Info); 11790c18794ea4289f03fefc7117b56740414cc0536cgdong return ; 11800c18794ea4289f03fefc7117b56740414cc0536cgdong } 11810c18794ea4289f03fefc7117b56740414cc0536cgdong 11820c18794ea4289f03fefc7117b56740414cc0536cgdong // 11830c18794ea4289f03fefc7117b56740414cc0536cgdong // Update username display in the form. 11840c18794ea4289f03fefc7117b56740414cc0536cgdong // 11850c18794ea4289f03fefc7117b56740414cc0536cgdong CopyMem (mUserInfo.UserName, UserName, Len); 11860c18794ea4289f03fefc7117b56740414cc0536cgdong HiiSetString ( 11870c18794ea4289f03fefc7117b56740414cc0536cgdong mCallbackInfo->HiiHandle, 11880c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_USER_NAME_VAL), 11890c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.UserName, 11900c18794ea4289f03fefc7117b56740414cc0536cgdong NULL 11910c18794ea4289f03fefc7117b56740414cc0536cgdong ); 11920c18794ea4289f03fefc7117b56740414cc0536cgdong 11930c18794ea4289f03fefc7117b56740414cc0536cgdong // 11940c18794ea4289f03fefc7117b56740414cc0536cgdong // Save the user name. 11950c18794ea4289f03fefc7117b56740414cc0536cgdong // 11960c5b25f021a815d4ddce306139cc077db9afddfdgdong Status = FindInfoByType (mModifyUser, EFI_USER_INFO_NAME_RECORD, &UserInfo); 11970c18794ea4289f03fefc7117b56740414cc0536cgdong if (!EFI_ERROR (Status)) { 11980c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager->SetInfo ( 11990c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager, 12000c18794ea4289f03fefc7117b56740414cc0536cgdong mModifyUser, 12010c18794ea4289f03fefc7117b56740414cc0536cgdong &UserInfo, 12020c18794ea4289f03fefc7117b56740414cc0536cgdong Info, 12030c18794ea4289f03fefc7117b56740414cc0536cgdong Info->InfoSize 12040c18794ea4289f03fefc7117b56740414cc0536cgdong ); 12050c18794ea4289f03fefc7117b56740414cc0536cgdong } 12060c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (Info); 12070c18794ea4289f03fefc7117b56740414cc0536cgdong} 12080c18794ea4289f03fefc7117b56740414cc0536cgdong 12090c18794ea4289f03fefc7117b56740414cc0536cgdong 12100c18794ea4289f03fefc7117b56740414cc0536cgdong/** 12110c18794ea4289f03fefc7117b56740414cc0536cgdong Display the form of the modifying user identity policy. 12120c18794ea4289f03fefc7117b56740414cc0536cgdong 12130c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 12140c18794ea4289f03fefc7117b56740414cc0536cgdongVOID 12150c18794ea4289f03fefc7117b56740414cc0536cgdongModifyIdentityPolicy ( 12160c18794ea4289f03fefc7117b56740414cc0536cgdong VOID 12170c18794ea4289f03fefc7117b56740414cc0536cgdong ) 12180c18794ea4289f03fefc7117b56740414cc0536cgdong{ 12190c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN Index; 12200c18794ea4289f03fefc7117b56740414cc0536cgdong CHAR16 *ProvStr; 12210c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_STRING_ID ProvID; 12220c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_HII_HANDLE HiiHandle; 12230c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *OptionsOpCodeHandle; 12240c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *StartOpCodeHandle; 12250c18794ea4289f03fefc7117b56740414cc0536cgdong VOID *EndOpCodeHandle; 12260c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_GUID_LABEL *StartLabel; 12270c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_GUID_LABEL *EndLabel; 12280c18794ea4289f03fefc7117b56740414cc0536cgdong 12290c18794ea4289f03fefc7117b56740414cc0536cgdong // 12300c18794ea4289f03fefc7117b56740414cc0536cgdong // Initialize the container for dynamic opcodes. 12310c18794ea4289f03fefc7117b56740414cc0536cgdong // 12320c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle = HiiAllocateOpCodeHandle (); 12330c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (StartOpCodeHandle != NULL); 12340c18794ea4289f03fefc7117b56740414cc0536cgdong 12350c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle = HiiAllocateOpCodeHandle (); 12360c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (EndOpCodeHandle != NULL); 12370c18794ea4289f03fefc7117b56740414cc0536cgdong 12380c18794ea4289f03fefc7117b56740414cc0536cgdong // 12390c18794ea4289f03fefc7117b56740414cc0536cgdong // Create Hii Extend Label OpCode. 12400c18794ea4289f03fefc7117b56740414cc0536cgdong // 12410c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 12420c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, 12430c18794ea4289f03fefc7117b56740414cc0536cgdong &gEfiIfrTianoGuid, 12440c18794ea4289f03fefc7117b56740414cc0536cgdong NULL, 12450c18794ea4289f03fefc7117b56740414cc0536cgdong sizeof (EFI_IFR_GUID_LABEL) 12460c18794ea4289f03fefc7117b56740414cc0536cgdong ); 12470c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 12480c18794ea4289f03fefc7117b56740414cc0536cgdong StartLabel->Number = LABEL_IP_MOD_FUNC; 12490c18794ea4289f03fefc7117b56740414cc0536cgdong 12500c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode ( 12510c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle, 12520c18794ea4289f03fefc7117b56740414cc0536cgdong &gEfiIfrTianoGuid, 12530c18794ea4289f03fefc7117b56740414cc0536cgdong NULL, 12540c18794ea4289f03fefc7117b56740414cc0536cgdong sizeof (EFI_IFR_GUID_LABEL) 12550c18794ea4289f03fefc7117b56740414cc0536cgdong ); 12560c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; 12570c18794ea4289f03fefc7117b56740414cc0536cgdong EndLabel->Number = LABEL_END; 12580c18794ea4289f03fefc7117b56740414cc0536cgdong 12590c18794ea4289f03fefc7117b56740414cc0536cgdong // 12600c18794ea4289f03fefc7117b56740414cc0536cgdong // Add credential providers 12610c18794ea4289f03fefc7117b56740414cc0536cgdong //. 12620c18794ea4289f03fefc7117b56740414cc0536cgdong if (mProviderInfo->Count > 0) { 12630c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); 12640c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (OptionsOpCodeHandle != NULL); 12650c18794ea4289f03fefc7117b56740414cc0536cgdong 12660c18794ea4289f03fefc7117b56740414cc0536cgdong // 12670c18794ea4289f03fefc7117b56740414cc0536cgdong // Add credential provider Option OpCode. 12680c18794ea4289f03fefc7117b56740414cc0536cgdong // 12690c18794ea4289f03fefc7117b56740414cc0536cgdong for (Index = 0; Index < mProviderInfo->Count; Index++) { 12700c18794ea4289f03fefc7117b56740414cc0536cgdong mProviderInfo->Provider[Index]->Title ( 12710c18794ea4289f03fefc7117b56740414cc0536cgdong mProviderInfo->Provider[Index], 12720c18794ea4289f03fefc7117b56740414cc0536cgdong &HiiHandle, 12730c18794ea4289f03fefc7117b56740414cc0536cgdong &ProvID 12740c18794ea4289f03fefc7117b56740414cc0536cgdong ); 12750c18794ea4289f03fefc7117b56740414cc0536cgdong ProvStr = HiiGetString (HiiHandle, ProvID, NULL); 12760c18794ea4289f03fefc7117b56740414cc0536cgdong ProvID = HiiSetString (mCallbackInfo->HiiHandle, 0, ProvStr, NULL); 12770c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (ProvStr); 12780c18794ea4289f03fefc7117b56740414cc0536cgdong if (ProvID == 0) { 12790c18794ea4289f03fefc7117b56740414cc0536cgdong return ; 12800c18794ea4289f03fefc7117b56740414cc0536cgdong } 12810c18794ea4289f03fefc7117b56740414cc0536cgdong 12820c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 12830c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 12840c18794ea4289f03fefc7117b56740414cc0536cgdong ProvID, 12850c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 12860c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 12870c18794ea4289f03fefc7117b56740414cc0536cgdong (UINT8) Index 12880c18794ea4289f03fefc7117b56740414cc0536cgdong ); 12890c18794ea4289f03fefc7117b56740414cc0536cgdong } 12900c18794ea4289f03fefc7117b56740414cc0536cgdong 12910c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOpCode ( 12920c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Container for dynamic created opcodes 12930c18794ea4289f03fefc7117b56740414cc0536cgdong KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_IP | KEY_MODIFY_PROV, // Question ID 12940c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // VarStore ID 12950c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // Offset in Buffer Storage 12960c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_PROVIDER), // Question prompt text 12970c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_PROVIDER_HELP), // Question help text 12980c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_FLAG_CALLBACK, // Question flag 12990c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value 13000c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, // Option Opcode list 13010c18794ea4289f03fefc7117b56740414cc0536cgdong NULL // Default Opcode is NULl 13020c18794ea4289f03fefc7117b56740414cc0536cgdong ); 13030c18794ea4289f03fefc7117b56740414cc0536cgdong 13040c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (OptionsOpCodeHandle); 13050c18794ea4289f03fefc7117b56740414cc0536cgdong } 13060c18794ea4289f03fefc7117b56740414cc0536cgdong 13070c18794ea4289f03fefc7117b56740414cc0536cgdong // 13080c18794ea4289f03fefc7117b56740414cc0536cgdong // Add logical connector Option OpCode. 13090c18794ea4289f03fefc7117b56740414cc0536cgdong // 13100c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); 13110c18794ea4289f03fefc7117b56740414cc0536cgdong ASSERT (OptionsOpCodeHandle != NULL); 13120c18794ea4289f03fefc7117b56740414cc0536cgdong 13130c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 13140c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 13150c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_AND_CON), 13160c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 13170c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 13180c18794ea4289f03fefc7117b56740414cc0536cgdong 0 13190c18794ea4289f03fefc7117b56740414cc0536cgdong ); 13200c18794ea4289f03fefc7117b56740414cc0536cgdong 13210c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOptionOpCode ( 13220c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, 13230c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_OR_CON), 13240c18794ea4289f03fefc7117b56740414cc0536cgdong 0, 13250c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, 13260c18794ea4289f03fefc7117b56740414cc0536cgdong 1 13270c18794ea4289f03fefc7117b56740414cc0536cgdong ); 13280c18794ea4289f03fefc7117b56740414cc0536cgdong 13290c18794ea4289f03fefc7117b56740414cc0536cgdong HiiCreateOneOfOpCode ( 13300c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Container for dynamic created opcodes 13310c18794ea4289f03fefc7117b56740414cc0536cgdong KEY_MODIFY_USER | KEY_SELECT_USER | KEY_MODIFY_IP | KEY_MODIFY_CONN, // Question ID 13320c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // VarStore ID 13330c18794ea4289f03fefc7117b56740414cc0536cgdong 0, // Offset in Buffer Storage 13340c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_CONNECTOR), // Question prompt text 13350c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_CONNECTOR_HELP), // Question help text 13360c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_FLAG_CALLBACK, // Question flag 13370c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value 13380c18794ea4289f03fefc7117b56740414cc0536cgdong OptionsOpCodeHandle, // Option Opcode list 13390c18794ea4289f03fefc7117b56740414cc0536cgdong NULL // Default Opcode is NULl 13400c18794ea4289f03fefc7117b56740414cc0536cgdong ); 13410c18794ea4289f03fefc7117b56740414cc0536cgdong 13420c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (OptionsOpCodeHandle); 13430c18794ea4289f03fefc7117b56740414cc0536cgdong 13440c18794ea4289f03fefc7117b56740414cc0536cgdong // 13450c18794ea4289f03fefc7117b56740414cc0536cgdong // Update identity policy in the form. 13460c18794ea4289f03fefc7117b56740414cc0536cgdong // 13470c18794ea4289f03fefc7117b56740414cc0536cgdong ResolveIdentityPolicy ( 13480c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.IdentityPolicy, 13490c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.IdentityPolicyLen, 13500c18794ea4289f03fefc7117b56740414cc0536cgdong STRING_TOKEN (STR_IDENTIFY_POLICY_VALUE) 13510c18794ea4289f03fefc7117b56740414cc0536cgdong ); 13520c18794ea4289f03fefc7117b56740414cc0536cgdong 13530c18794ea4289f03fefc7117b56740414cc0536cgdong if (mUserInfo.NewIdentityPolicy != NULL) { 13540c18794ea4289f03fefc7117b56740414cc0536cgdong FreePool (mUserInfo.NewIdentityPolicy); 13550c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.NewIdentityPolicy = NULL; 13560c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.NewIdentityPolicyLen = 0; 13570c18794ea4289f03fefc7117b56740414cc0536cgdong mUserInfo.NewIdentityPolicyModified = FALSE; 13580c18794ea4289f03fefc7117b56740414cc0536cgdong } 13590c18794ea4289f03fefc7117b56740414cc0536cgdong mProviderChoice = 0; 13600c18794ea4289f03fefc7117b56740414cc0536cgdong mConncetLogical = 0; 13610c18794ea4289f03fefc7117b56740414cc0536cgdong 13620c18794ea4289f03fefc7117b56740414cc0536cgdong HiiUpdateForm ( 13630c18794ea4289f03fefc7117b56740414cc0536cgdong mCallbackInfo->HiiHandle, // HII handle 1364a0c56a8219ec268d8ac4e051035f1636545cc478lgao &gUserProfileManagerGuid, // Formset GUID 13650c18794ea4289f03fefc7117b56740414cc0536cgdong FORMID_MODIFY_IP, // Form ID 13660c18794ea4289f03fefc7117b56740414cc0536cgdong StartOpCodeHandle, // Label for where to insert opcodes 13670c18794ea4289f03fefc7117b56740414cc0536cgdong EndOpCodeHandle // Replace data 13680c18794ea4289f03fefc7117b56740414cc0536cgdong ); 13690c18794ea4289f03fefc7117b56740414cc0536cgdong 13700c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (StartOpCodeHandle); 13710c18794ea4289f03fefc7117b56740414cc0536cgdong HiiFreeOpCodeHandle (EndOpCodeHandle); 13720c18794ea4289f03fefc7117b56740414cc0536cgdong} 13730c18794ea4289f03fefc7117b56740414cc0536cgdong 13740c18794ea4289f03fefc7117b56740414cc0536cgdong 13750c18794ea4289f03fefc7117b56740414cc0536cgdong/** 13760c5b25f021a815d4ddce306139cc077db9afddfdgdong Get current user's access right. 13770c5b25f021a815d4ddce306139cc077db9afddfdgdong 13780c5b25f021a815d4ddce306139cc077db9afddfdgdong @param[out] AccessRight Points to the buffer used for user's access right. 13790c5b25f021a815d4ddce306139cc077db9afddfdgdong 13800c5b25f021a815d4ddce306139cc077db9afddfdgdong @retval EFI_SUCCESS Get current user access right successfully. 13810c5b25f021a815d4ddce306139cc077db9afddfdgdong @retval others Fail to get current user access right. 13820c18794ea4289f03fefc7117b56740414cc0536cgdong 13830c18794ea4289f03fefc7117b56740414cc0536cgdong**/ 13840c5b25f021a815d4ddce306139cc077db9afddfdgdongEFI_STATUS 13850c5b25f021a815d4ddce306139cc077db9afddfdgdongGetAccessRight ( 13860c5b25f021a815d4ddce306139cc077db9afddfdgdong OUT UINT32 *AccessRight 13870c18794ea4289f03fefc7117b56740414cc0536cgdong ) 13880c18794ea4289f03fefc7117b56740414cc0536cgdong{ 13890c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_STATUS Status; 13900c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO_HANDLE UserInfo; 13910c18794ea4289f03fefc7117b56740414cc0536cgdong EFI_USER_INFO *Info; 13920c18794ea4289f03fefc7117b56740414cc0536cgdong UINTN InfoSize; 13930c5b25f021a815d4ddce306139cc077db9afddfdgdong UINTN MemSize; 13940c5b25f021a815d4ddce306139cc077db9afddfdgdong EFI_USER_INFO_ACCESS_CONTROL Access; 13950c5b25f021a815d4ddce306139cc077db9afddfdgdong EFI_USER_PROFILE_HANDLE CurrentUser; 13960c5b25f021a815d4ddce306139cc077db9afddfdgdong UINTN TotalLen; 13970c5b25f021a815d4ddce306139cc077db9afddfdgdong UINTN CheckLen; 13980c18794ea4289f03fefc7117b56740414cc0536cgdong 13990c5b25f021a815d4ddce306139cc077db9afddfdgdong // 14000c5b25f021a815d4ddce306139cc077db9afddfdgdong // Allocate user information memory. 14010c5b25f021a815d4ddce306139cc077db9afddfdgdong // 14020c5b25f021a815d4ddce306139cc077db9afddfdgdong MemSize = sizeof (EFI_USER_INFO) + 63; 14030c5b25f021a815d4ddce306139cc077db9afddfdgdong Info = AllocateZeroPool (MemSize); 14040c5b25f021a815d4ddce306139cc077db9afddfdgdong if (Info == NULL) { 14050c5b25f021a815d4ddce306139cc077db9afddfdgdong return EFI_OUT_OF_RESOURCES; 14060c18794ea4289f03fefc7117b56740414cc0536cgdong } 14070c5b25f021a815d4ddce306139cc077db9afddfdgdong 14080c18794ea4289f03fefc7117b56740414cc0536cgdong // 14090c5b25f021a815d4ddce306139cc077db9afddfdgdong // Get user access information. 14100c18794ea4289f03fefc7117b56740414cc0536cgdong // 14110c5b25f021a815d4ddce306139cc077db9afddfdgdong UserInfo = NULL; 14120c5b25f021a815d4ddce306139cc077db9afddfdgdong mUserManager->Current (mUserManager, &CurrentUser); 14130c5b25f021a815d4ddce306139cc077db9afddfdgdong while (TRUE) { 14140c5b25f021a815d4ddce306139cc077db9afddfdgdong InfoSize = MemSize; 14150c18794ea4289f03fefc7117b56740414cc0536cgdong // 14160c5b25f021a815d4ddce306139cc077db9afddfdgdong // Get next user information. 14170c18794ea4289f03fefc7117b56740414cc0536cgdong // 14180c5b25f021a815d4ddce306139cc077db9afddfdgdong Status = mUserManager->GetNextInfo (mUserManager, CurrentUser, &UserInfo); 14190c5b25f021a815d4ddce306139cc077db9afddfdgdong if (EFI_ERROR (Status)) { 14200c18794ea4289f03fefc7117b56740414cc0536cgdong break; 14210c18794ea4289f03fefc7117b56740414cc0536cgdong } 14220c18794ea4289f03fefc7117b56740414cc0536cgdong 14230c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetInfo ( 14240c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager, 14250c5b25f021a815d4ddce306139cc077db9afddfdgdong CurrentUser, 14260c18794ea4289f03fefc7117b56740414cc0536cgdong UserInfo, 14270c18794ea4289f03fefc7117b56740414cc0536cgdong Info, 14280c18794ea4289f03fefc7117b56740414cc0536cgdong &InfoSize 14290c18794ea4289f03fefc7117b56740414cc0536cgdong ); 14300c18794ea4289f03fefc7117b56740414cc0536cgdong if (Status == EFI_BUFFER_TOO_SMALL) { 14310c5b25f021a815d4ddce306139cc077db9afddfdgdong MemSize = InfoSize; 14320c5b25f021a815d4ddce306139cc077db9afddfdgdong FreePool (Info); 14330c5b25f021a815d4ddce306139cc077db9afddfdgdong Info = AllocateZeroPool (MemSize); 14340c5b25f021a815d4ddce306139cc077db9afddfdgdong if (Info == NULL) { 14350c5b25f021a815d4ddce306139cc077db9afddfdgdong return EFI_OUT_OF_RESOURCES; 14360c5b25f021a815d4ddce306139cc077db9afddfdgdong } 14370c18794ea4289f03fefc7117b56740414cc0536cgdong Status = mUserManager->GetInfo ( 14380c18794ea4289f03fefc7117b56740414cc0536cgdong mUserManager, 14390c5b25f021a815d4ddce306139cc077db9afddfdgdong CurrentUser, 14400c18794ea4289f03fefc7117b56740414cc0536cgdong UserInfo, 14410c18794ea4289f03fefc7117b56740414cc0536cgdong Info, 14420c18794ea4289f03fefc7117b56740414cc0536cgdong &InfoSize 14430c18794ea4289f03fefc7117b56740414cc0536cgdong ); 14440c18794ea4289f03fefc7117b56740414cc0536cgdong } 14450c5b25f021a815d4ddce306139cc077db9afddfdgdong if (EFI_ERROR (Status)) { 14460c5b25f021a815d4ddce306139cc077db9afddfdgdong break; 14470c18794ea4289f03fefc7117b56740414cc0536cgdong } 14480c5b25f021a815d4ddce306139cc077db9afddfdgdong 14490c18794ea4289f03fefc7117b56740414cc0536cgdong // 14500c5b25f021a815d4ddce306139cc077db9afddfdgdong // Check user information. 14510c18794ea4289f03fefc7117b56740414cc0536cgdong // 14520c5b25f021a815d4ddce306139cc077db9afddfdgdong if (Info->InfoType == EFI_USER_INFO_ACCESS_POLICY_RECORD) { 14530c5b25f021a815d4ddce306139cc077db9afddfdgdong TotalLen = Info->InfoSize - sizeof (EFI_USER_INFO); 14540c5b25f021a815d4ddce306139cc077db9afddfdgdong CheckLen = 0; 14550c5b25f021a815d4ddce306139cc077db9afddfdgdong // 14560c5b25f021a815d4ddce306139cc077db9afddfdgdong // Get specified access information. 14570c5b25f021a815d4ddce306139cc077db9afddfdgdong // 14580c5b25f021a815d4ddce306139cc077db9afddfdgdong while (CheckLen < TotalLen) { 14590c5b25f021a815d4ddce306139cc077db9afddfdgdong CopyMem (&Access, (UINT8 *) (Info + 1) + CheckLen, sizeof (Access)); 14600c5b25f021a815d4ddce306139cc077db9afddfdgdong if ((Access.Type == EFI_USER_INFO_ACCESS_ENROLL_SELF) || 14610c5b25f021a815d4ddce306139cc077db9afddfdgdong (Access.Type == EFI_USER_INFO_ACCESS_ENROLL_OTHERS) || 14620c5b25f021a815d4ddce306139cc077db9afddfdgdong (Access.Type == EFI_USER_INFO_ACCESS_MANAGE) 14630c5b25f021a815d4ddce306139cc077db9afddfdgdong ) { 14640c5b25f021a815d4ddce306139cc077db9afddfdgdong *AccessRight = Access.Type; 14650c5b25f021a815d4ddce306139cc077db9afddfdgdong FreePool (Info); 14660c5b25f021a815d4ddce306139cc077db9afddfdgdong return EFI_SUCCESS; 14670c5b25f021a815d4ddce306139cc077db9afddfdgdong } 14680c5b25f021a815d4ddce306139cc077db9afddfdgdong CheckLen += Access.Size; 14690c18794ea4289f03fefc7117b56740414cc0536cgdong } 14700c18794ea4289f03fefc7117b56740414cc0536cgdong } 14710c18794ea4289f03fefc7117b56740414cc0536cgdong } 14720c5b25f021a815d4ddce306139cc077db9afddfdgdong FreePool (Info); 14730c5b25f021a815d4ddce306139cc077db9afddfdgdong return EFI_NOT_FOUND; 14740c18794ea4289f03fefc7117b56740414cc0536cgdong} 14750c18794ea4289f03fefc7117b56740414cc0536cgdong 1476