/** @file\r
The functions to delete a user profile.\r
- \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
+\r
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
/**\r
Get the username from the specified user.\r
\r
- @param[in] User Handle of a user profile. \r
+ @param[in] User Handle of a user profile.\r
\r
@retval EFI_STRING_ID The String Id of the user's username.\r
\r
**/\r
-EFI_STRING_ID \r
+EFI_STRING_ID\r
GetUserName (\r
IN EFI_USER_PROFILE_HANDLE User\r
)\r
UINTN NameLen;\r
CHAR16 UserName[USER_NAME_LENGTH];\r
EFI_STRING_ID UserId;\r
- \r
+\r
//\r
// Allocate user information memory.\r
//\r
MemSize = sizeof (EFI_USER_INFO) + 63;\r
Info = AllocateZeroPool (MemSize);\r
ASSERT (Info != NULL);\r
- \r
+\r
//\r
// Get user name information.\r
//\r
/**\r
Add a username item in form.\r
\r
- @param[in] User Points to the user profile whose username is added. \r
+ @param[in] User Points to the user profile whose username is added.\r
@param[in] Index The index of the user in the user name list\r
@param[in] OpCodeHandle Points to container for dynamic created opcodes.\r
\r
if (NameId == 0) {\r
return ;\r
}\r
- \r
+\r
//\r
// Create user name option.\r
//\r
/**\r
Delete the user specified by UserIndex in user profile database.\r
\r
- @param[in] UserIndex The index of user in the user name list \r
+ @param[in] UserIndex The index of user in the user name list\r
to be deleted.\r
\r
**/\r
EFI_STATUS Status;\r
EFI_USER_PROFILE_HANDLE User;\r
EFI_INPUT_KEY Key;\r
+ EFI_USER_INFO_HANDLE UserInfo;\r
+ EFI_USER_INFO *Info;\r
+ UINTN InfoSize;\r
\r
//\r
// Find specified user profile and delete it.\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
- \r
+\r
while (UserIndex > 1) {\r
Status = mUserManager->GetNext (mUserManager, &User);\r
if (EFI_ERROR (Status)) {\r
}\r
\r
if (UserIndex == 1) {\r
+ //\r
+ // Get the identification policy.\r
+ //\r
+ Status = FindInfoByType (User, EFI_USER_INFO_IDENTITY_POLICY_RECORD, &UserInfo);\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ InfoSize = 0;\r
+ Info = NULL;\r
+ Status = mUserManager->GetInfo (mUserManager, User, UserInfo, Info, &InfoSize);\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ Info = AllocateZeroPool (InfoSize);\r
+ if (Info == NULL) {\r
+ goto Done;\r
+ }\r
+ Status = mUserManager->GetInfo (mUserManager, User, UserInfo, Info, &InfoSize);\r
+ }\r
+\r
+ //\r
+ // Delete the user on the credential providers by its identification policy.\r
+ //\r
+ ASSERT (Info != NULL);\r
+ DeleteCredentialFromProviders ((UINT8 *)(Info + 1), Info->InfoSize - sizeof (EFI_USER_INFO), User);\r
+ FreePool (Info);\r
+\r
Status = mUserManager->Delete (mUserManager, User);\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
L"Please Press Any Key to Continue ...",\r
NULL\r
);\r
- return ; \r
+ return ;\r
}\r
\r
Done:\r