]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update UID drivers to align with latest UEFI spec 2.3.1.
authorgdong1 <gdong1@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Oct 2011 03:38:19 +0000 (03:38 +0000)
committergdong1 <gdong1@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Oct 2011 03:38:19 +0000 (03:38 +0000)
 Directly use ImageHandle instead of &ImageHandle for wrong usage in TCG physical presence library.

Signed-off-by: gdong1
Reviewed-by: xdu2
Reviewed-by: lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12530 6f19259b-4bc3-4df7-8a09-765794883524

14 files changed:
SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c
SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.c
SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.h
SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProviderDxe.inf
SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProvider.c
SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProvider.h
SecurityPkg/UserIdentification/UsbCredentialProviderDxe/UsbCredentialProviderDxe.inf
SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManager.c
SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManager.h
SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManagerDxe.inf
SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.c
SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h
SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManagerDxe.inf
SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c

index d32cc7aff3d03c46338c77542e1d8e68e6c275fc..18d87ebe745ef7891a6a6a0bf0239656e7e3c709 100644 (file)
@@ -482,7 +482,7 @@ TcgPhysicalPresenceLibConstructor (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  mPpStringPackHandle = HiiAddPackages (&gEfiPhysicalPresenceGuid, &ImageHandle, DxeTcgPhysicalPresenceLibStrings, NULL);\r
+  mPpStringPackHandle = HiiAddPackages (&gEfiPhysicalPresenceGuid, ImageHandle, DxeTcgPhysicalPresenceLibStrings, NULL);\r
   ASSERT (mPpStringPackHandle != NULL);\r
 \r
   return EFI_SUCCESS;\r
   ASSERT (mPpStringPackHandle != NULL);\r
 \r
   return EFI_SUCCESS;\r
index b8513e9515dbeb1085b28076960316528b92833f..0016db86636546ad987da29d3946751fd8036848 100644 (file)
@@ -40,7 +40,7 @@ HII_VENDOR_DEVICE_PATH      mHiiVendorDevicePath = {
   }\r
 };\r
 \r
   }\r
 };\r
 \r
-EFI_USER_CREDENTIAL_PROTOCOL  gPwdCredentialProviderDriver = {\r
+EFI_USER_CREDENTIAL2_PROTOCOL  gPwdCredentialProviderDriver = {\r
   PWD_CREDENTIAL_PROVIDER_GUID,\r
   EFI_USER_CREDENTIAL_CLASS_PASSWORD,\r
   CredentialEnroll,\r
   PWD_CREDENTIAL_PROVIDER_GUID,\r
   EFI_USER_CREDENTIAL_CLASS_PASSWORD,\r
   CredentialEnroll,\r
@@ -52,7 +52,9 @@ EFI_USER_CREDENTIAL_PROTOCOL  gPwdCredentialProviderDriver = {
   CredentialDeselect,\r
   CredentialDefault,\r
   CredentialGetInfo,\r
   CredentialDeselect,\r
   CredentialDefault,\r
   CredentialGetInfo,\r
-  CredentialGetNextInfo\r
+  CredentialGetNextInfo,\r
+  EFI_CREDENTIAL_CAPABILITIES_ENROLL,\r
+  CredentialDelete\r
 };\r
 \r
 \r
 };\r
 \r
 \r
@@ -117,12 +119,12 @@ ExpandTableSize (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  Add or delete info in table, and sync with NV variable.\r
+  Add, update or delete info in table, and sync with NV variable.\r
 \r
 \r
-  @param[in]  Index     The index of the password in table. The index begin from 1.\r
-                        If index is found in table, delete the info, else add the \r
-                        into to table. \r
-  @param[in]  Info      The new password info to add into table.\r
+  @param[in]  Index     The index of the password in table. If index is found in\r
+                        table, update the info, else add the into to table. \r
+  @param[in]  Info      The new password info to add into table.If Info is NULL, \r
+                        delete the info by Index.\r
 \r
   @retval EFI_INVALID_PARAMETER  Info is NULL when save the info.\r
   @retval EFI_SUCCESS            Modify the table successfully.\r
 \r
   @retval EFI_INVALID_PARAMETER  Info is NULL when save the info.\r
   @retval EFI_SUCCESS            Modify the table successfully.\r
@@ -135,23 +137,29 @@ ModifyTable (
   IN  PASSWORD_INFO                             * Info OPTIONAL\r
   )\r
 {\r
   IN  PASSWORD_INFO                             * Info OPTIONAL\r
   )\r
 {\r
-  EFI_STATUS  Status;\r
-  \r
+  EFI_STATUS       Status;\r
+  PASSWORD_INFO    *NewPasswordInfo;\r
+\r
+  NewPasswordInfo = NULL;\r
+\r
   if (Index < mPwdTable->Count) {\r
   if (Index < mPwdTable->Count) {\r
-    //\r
-    // Delete the specified entry.\r
-    //\r
-    mPwdTable->Count--;\r
-    if (Index != mPwdTable->Count) {\r
-      CopyMem (\r
-        &mPwdTable->UserInfo[Index],\r
-        &mPwdTable->UserInfo[mPwdTable->Count],\r
-        sizeof (PASSWORD_INFO)\r
-        );\r
+    if (Info == NULL) {\r
+      //\r
+      // Delete the specified entry.\r
+      //\r
+      mPwdTable->Count--;\r
+      if (Index != mPwdTable->Count) {\r
+        NewPasswordInfo = &mPwdTable->UserInfo[mPwdTable->Count];\r
+      } \r
+    } else {\r
+      //\r
+      // Update the specified entry.\r
+      //\r
+      NewPasswordInfo = Info;\r
     }\r
   } else {\r
     //\r
     }\r
   } else {\r
     //\r
-    // Add a new entry.\r
+    // Add a new password info.\r
     //\r
     if (Info == NULL) {\r
       return EFI_INVALID_PARAMETER;\r
     //\r
     if (Info == NULL) {\r
       return EFI_INVALID_PARAMETER;\r
@@ -161,14 +169,14 @@ ModifyTable (
       ExpandTableSize ();\r
     }\r
 \r
       ExpandTableSize ();\r
     }\r
 \r
-    CopyMem (\r
-      &mPwdTable->UserInfo[mPwdTable->Count], \r
-      Info, \r
-      sizeof (PASSWORD_INFO)\r
-      );\r
+    NewPasswordInfo = Info;\r
     mPwdTable->Count++;\r
   }\r
 \r
     mPwdTable->Count++;\r
   }\r
 \r
+  if (NewPasswordInfo != NULL) {\r
+    CopyMem (&mPwdTable->UserInfo[Index], NewPasswordInfo, sizeof (PASSWORD_INFO));\r
+  }\r
+\r
   //\r
   // Save the credential table.\r
   //\r
   //\r
   // Save the credential table.\r
   //\r
@@ -705,13 +713,11 @@ InitFormBrowser (
 /**\r
   Enroll a user on a credential provider.\r
 \r
 /**\r
   Enroll a user on a credential provider.\r
 \r
-  This function enrolls and deletes a user profile using this credential provider. \r
-  If a user profile is successfully enrolled, it calls the User Manager Protocol \r
-  function Notify() to notify the user manager driver that credential information \r
-  has changed. If an enrolled user does exist, delete the user on the credential \r
-  provider.\r
+  This function enrolls a user on this credential provider. If the user exists on \r
+  this credential provider, update the user information on this credential provider; \r
+  otherwise add the user information on credential provider.\r
   \r
   \r
-  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in] User                The user profile to enroll.\r
  \r
   @retval EFI_SUCCESS            User profile was successfully enrolled.\r
   @param[in] User                The user profile to enroll.\r
  \r
   @retval EFI_SUCCESS            User profile was successfully enrolled.\r
@@ -729,7 +735,7 @@ InitFormBrowser (
 EFI_STATUS\r
 EFIAPI\r
 CredentialEnroll (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialEnroll (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_PROFILE_HANDLE             User\r
   )\r
 {\r
   IN        EFI_USER_PROFILE_HANDLE             User\r
   )\r
 {\r
@@ -741,7 +747,6 @@ CredentialEnroll (
   EFI_INPUT_KEY             Key;\r
   EFI_USER_MANAGER_PROTOCOL *UserManager;\r
   UINT8                     *UserId;\r
   EFI_INPUT_KEY             Key;\r
   EFI_USER_MANAGER_PROTOCOL *UserManager;\r
   UINT8                     *UserId;\r
-  UINT8                     *NewUserId;\r
   CHAR16                    *QuestionStr;\r
   CHAR16                    *PromptStr;\r
 \r
   CHAR16                    *QuestionStr;\r
   CHAR16                    *PromptStr;\r
 \r
@@ -771,23 +776,11 @@ CredentialEnroll (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  //\r
-  // If User exists in mPwdTable, delete User.\r
-  // \r
-  for (Index = 0; Index < mPwdTable->Count; Index++) {\r
-    UserId    = (UINT8 *) &mPwdTable->UserInfo[Index].UserId;\r
-    NewUserId = (UINT8 *) (UserInfo + 1);\r
-    if (CompareMem (UserId, NewUserId, sizeof (EFI_USER_INFO_IDENTIFIER)) == 0) {\r
-      //\r
-      // Delete the existing password.\r
-      //\r
-      FreePool (UserInfo);\r
-      return ModifyTable (Index, NULL);\r
-    }\r
-  }\r
+  CopyMem (PwdInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER)); \r
+  FreePool (UserInfo);\r
 \r
   //\r
 \r
   //\r
-  // The User doesn't exist in mPwdTable; Enroll the new User.\r
+  // Get password from user.\r
   //  \r
   while (TRUE) {\r
     //\r
   //  \r
   while (TRUE) {\r
     //\r
@@ -821,17 +814,23 @@ CredentialEnroll (
     FreePool (PromptStr);\r
   }\r
 \r
     FreePool (PromptStr);\r
   }\r
 \r
-  CopyMem (\r
-    PwdInfo.UserId, \r
-    (UINT8 *) (UserInfo + 1), \r
-    sizeof (EFI_USER_INFO_IDENTIFIER)\r
-    );  \r
-  FreePool (UserInfo);\r
-  \r
   //\r
   //\r
-  // Save the new added entry.\r
+  // Check whether User is ever enrolled in the provider.\r
+  // \r
+  for (Index = 0; Index < mPwdTable->Count; Index++) {\r
+    UserId = (UINT8 *) &mPwdTable->UserInfo[Index].UserId;\r
+    if (CompareMem (UserId, (UINT8 *) &PwdInfo.UserId, sizeof (EFI_USER_INFO_IDENTIFIER)) == 0) {\r
+      //\r
+      // User already exists, update the password.\r
+      //      \r
+      break;\r
+    }\r
+  }\r
+   \r
+  //\r
+  // Enroll the User to the provider.\r
   //\r
   //\r
-  Status = ModifyTable (mPwdTable->Count, &PwdInfo);\r
+  Status = ModifyTable (Index, &PwdInfo);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -854,7 +853,7 @@ CredentialEnroll (
   the user credential provider does not require a form to identify the user, then this\r
   function should return EFI_NOT_FOUND.\r
 \r
   the user credential provider does not require a form to identify the user, then this\r
   function should return EFI_NOT_FOUND.\r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] FormSetId  On return, holds the identifier of the form set which contains\r
                          the form used during user identification.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] FormSetId  On return, holds the identifier of the form set which contains\r
                          the form used during user identification.\r
@@ -869,7 +868,7 @@ CredentialEnroll (
 EFI_STATUS\r
 EFIAPI\r
 CredentialForm (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialForm (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_GUID                            *FormSetId,\r
   OUT       EFI_FORM_ID                         *FormId\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_GUID                            *FormSetId,\r
   OUT       EFI_FORM_ID                         *FormId\r
@@ -895,7 +894,7 @@ CredentialForm (
   of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r
   is returned. \r
 \r
   of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r
   is returned. \r
 \r
-  @param[in]      This    Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This    Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in, out] Width   On entry, points to the desired bitmap width. If NULL then no \r
                           bitmap information will be returned. On exit, points to the \r
                           width of the bitmap returned.\r
   @param[in, out] Width   On entry, points to the desired bitmap width. If NULL then no \r
                           bitmap information will be returned. On exit, points to the \r
                           width of the bitmap returned.\r
@@ -913,7 +912,7 @@ CredentialForm (
 EFI_STATUS\r
 EFIAPI\r
 CredentialTile (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialTile (\r
-  IN  CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN  CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN  OUT    UINTN                               *Width,\r
   IN  OUT    UINTN                               *Height,\r
       OUT    EFI_HII_HANDLE                      *Hii,\r
   IN  OUT    UINTN                               *Width,\r
   IN  OUT    UINTN                               *Height,\r
       OUT    EFI_HII_HANDLE                      *Hii,\r
@@ -933,7 +932,7 @@ CredentialTile (
   This function returns a string which describes the credential provider. If no\r
   such string exists, then EFI_NOT_FOUND is returned. \r
 \r
   This function returns a string which describes the credential provider. If no\r
   such string exists, then EFI_NOT_FOUND is returned. \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] String     On return, holds the HII string identifier.\r
  \r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] String     On return, holds the HII string identifier.\r
  \r
@@ -945,7 +944,7 @@ CredentialTile (
 EFI_STATUS\r
 EFIAPI\r
 CredentialTitle (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialTitle (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_STRING_ID                       *String\r
   )\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_STRING_ID                       *String\r
   )\r
@@ -972,7 +971,7 @@ CredentialTitle (
   submitted on a form, OR after a call to Default() has returned that this credential is\r
   ready to log on.\r
 \r
   submitted on a form, OR after a call to Default() has returned that this credential is\r
   ready to log on.\r
 \r
-  @param[in]  This           Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This           Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in]  User           The user profile handle of the user profile currently being \r
                              considered by the user identity manager. If NULL, then no user\r
                              profile is currently under consideration.\r
   @param[in]  User           The user profile handle of the user profile currently being \r
                              considered by the user identity manager. If NULL, then no user\r
                              profile is currently under consideration.\r
@@ -989,7 +988,7 @@ CredentialTitle (
 EFI_STATUS\r
 EFIAPI\r
 CredentialUser (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialUser (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_PROFILE_HANDLE             User,\r
   OUT       EFI_USER_INFO_IDENTIFIER            *Identifier\r
   )\r
   IN        EFI_USER_PROFILE_HANDLE             User,\r
   OUT       EFI_USER_INFO_IDENTIFIER            *Identifier\r
   )\r
@@ -1067,7 +1066,7 @@ CredentialUser (
   AutoLogon returns FALSE, then the user interface will be constructed by the User\r
   Identity Manager. \r
 \r
   AutoLogon returns FALSE, then the user interface will be constructed by the User\r
   Identity Manager. \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] AutoLogon  On return, points to the credential provider's capabilities \r
                          after the credential provider has been selected by the user. \r
  \r
   @param[out] AutoLogon  On return, points to the credential provider's capabilities \r
                          after the credential provider has been selected by the user. \r
  \r
@@ -1078,7 +1077,7 @@ CredentialUser (
 EFI_STATUS\r
 EFIAPI\r
 CredentialSelect (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialSelect (\r
-  IN  CONST  EFI_USER_CREDENTIAL_PROTOCOL    *This,\r
+  IN  CONST  EFI_USER_CREDENTIAL2_PROTOCOL   *This,\r
   OUT        EFI_CREDENTIAL_LOGON_FLAGS      *AutoLogon\r
   )\r
 {\r
   OUT        EFI_CREDENTIAL_LOGON_FLAGS      *AutoLogon\r
   )\r
 {\r
@@ -1096,7 +1095,7 @@ CredentialSelect (
 \r
   This function is called when a credential provider is deselected by the user.\r
 \r
 \r
   This function is called when a credential provider is deselected by the user.\r
 \r
-  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
  \r
   @retval EFI_SUCCESS    Credential provider successfully deselected.\r
   \r
  \r
   @retval EFI_SUCCESS    Credential provider successfully deselected.\r
   \r
@@ -1104,7 +1103,7 @@ CredentialSelect (
 EFI_STATUS\r
 EFIAPI\r
 CredentialDeselect (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialDeselect (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This\r
   )\r
 {\r
   if (This == NULL) {\r
   )\r
 {\r
   if (This == NULL) {\r
@@ -1119,7 +1118,7 @@ CredentialDeselect (
 \r
   This function reports the default login behavior regarding this credential provider.  \r
 \r
 \r
   This function reports the default login behavior regarding this credential provider.  \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] AutoLogon  On return, holds whether the credential provider should be used\r
                          by default to automatically log on the user.  \r
  \r
   @param[out] AutoLogon  On return, holds whether the credential provider should be used\r
                          by default to automatically log on the user.  \r
  \r
@@ -1130,7 +1129,7 @@ CredentialDeselect (
 EFI_STATUS\r
 EFIAPI\r
 CredentialDefault (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialDefault (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_CREDENTIAL_LOGON_FLAGS          *AutoLogon\r
   )\r
 {\r
   OUT       EFI_CREDENTIAL_LOGON_FLAGS          *AutoLogon\r
   )\r
 {\r
@@ -1148,7 +1147,7 @@ CredentialDefault (
 \r
   This function returns user information. \r
 \r
 \r
   This function returns user information. \r
 \r
-  @param[in]      This          Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This          Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in]      UserInfo      Handle of the user information data record. \r
   @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On\r
                                 exit, holds the user information. If the buffer is too small\r
   @param[in]      UserInfo      Handle of the user information data record. \r
   @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On\r
                                 exit, holds the user information. If the buffer is too small\r
@@ -1168,7 +1167,7 @@ CredentialDefault (
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetInfo (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetInfo (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_INFO_HANDLE                UserInfo,\r
   OUT       EFI_USER_INFO                       *Info,\r
   IN OUT    UINTN                               *InfoSize\r
   IN        EFI_USER_INFO_HANDLE                UserInfo,\r
   OUT       EFI_USER_INFO                       *Info,\r
   IN OUT    UINTN                               *InfoSize\r
@@ -1215,7 +1214,7 @@ CredentialGetInfo (
   another user information record handle until there are no more, at which point UserInfo\r
   will point to NULL. \r
 \r
   another user information record handle until there are no more, at which point UserInfo\r
   will point to NULL. \r
 \r
-  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r
                            to start enumeration. On exit, points to the next user information\r
                            handle or NULL if there is no more user information.\r
   @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r
                            to start enumeration. On exit, points to the next user information\r
                            handle or NULL if there is no more user information.\r
@@ -1228,7 +1227,7 @@ CredentialGetInfo (
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetNextInfo (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetNextInfo (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN OUT    EFI_USER_INFO_HANDLE                *UserInfo\r
   )\r
 {\r
   IN OUT    EFI_USER_INFO_HANDLE                *UserInfo\r
   )\r
 {\r
@@ -1359,6 +1358,71 @@ CredentialGetNextInfo (
   return EFI_NOT_FOUND;\r
 }\r
 \r
   return EFI_NOT_FOUND;\r
 }\r
 \r
+/**\r
+  Delete a user on this credential provider.\r
+\r
+  This function deletes a user on this credential provider. \r
+\r
+  @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
+  @param[in]     User            The user profile handle to delete.\r
+\r
+  @retval EFI_SUCCESS            User profile was successfully deleted.\r
+  @retval EFI_ACCESS_DENIED      Current user profile does not permit deletion on the user profile handle. \r
+                                 Either the user profile cannot delete on any user profile or cannot delete \r
+                                 on a user profile other than the current user profile. \r
+  @retval EFI_UNSUPPORTED        This credential provider does not support deletion in the pre-OS.\r
+  @retval EFI_DEVICE_ERROR       The new credential could not be deleted because of a device error.\r
+  @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CredentialDelete (\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
+  IN        EFI_USER_PROFILE_HANDLE             User\r
+  )\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_USER_INFO             *UserInfo;\r
+  UINT8                     *UserId;\r
+  UINT8                     *NewUserId;\r
+  UINTN                     Index;\r
+  \r
+  if ((This == NULL) || (User == NULL)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  //\r
+  // Get User Identifier.\r
+  //\r
+  UserInfo = NULL;\r
+  Status = FindUserInfoByType (\r
+             User,\r
+             EFI_USER_INFO_IDENTIFIER_RECORD,\r
+             &UserInfo\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  //\r
+  // Find the user by user identifier in mPwdTable.\r
+  // \r
+  for (Index = 0; Index < mPwdTable->Count; Index++) {\r
+    UserId    = (UINT8 *) &mPwdTable->UserInfo[Index].UserId;\r
+    NewUserId = (UINT8 *) (UserInfo + 1);\r
+    if (CompareMem (UserId, NewUserId, sizeof (EFI_USER_INFO_IDENTIFIER)) == 0) {\r
+      //\r
+      // Found the user, delete it.\r
+      //\r
+      ModifyTable (Index, NULL);\r
+      break;\r
+    }\r
+  }\r
+\r
+  FreePool (UserInfo);\r
+  return EFI_SUCCESS;\r
+}\r
+\r
 \r
 /**\r
   Main entry for this driver.\r
 \r
 /**\r
   Main entry for this driver.\r
@@ -1399,7 +1463,7 @@ PasswordProviderInit (
   //\r
   Status = gBS->InstallProtocolInterface (\r
                   &mCallbackInfo->DriverHandle,\r
   //\r
   Status = gBS->InstallProtocolInterface (\r
                   &mCallbackInfo->DriverHandle,\r
-                  &gEfiUserCredentialProtocolGuid,\r
+                  &gEfiUserCredential2ProtocolGuid,\r
                   EFI_NATIVE_INTERFACE,\r
                   &gPwdCredentialProviderDriver\r
                   );\r
                   EFI_NATIVE_INTERFACE,\r
                   &gPwdCredentialProviderDriver\r
                   );\r
index c9ef33b8ac450091459faabf358aa36bd39ac9be..7a51e7d0781266c49a2174286ee293884e7e180b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Password Credential Provider driver header file.\r
     \r
 /** @file\r
   Password Credential Provider driver header file.\r
     \r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\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
 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
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/GlobalVariable.h>\r
 \r
 #include <Protocol/HiiConfigAccess.h>\r
 #include <Guid/GlobalVariable.h>\r
 \r
 #include <Protocol/HiiConfigAccess.h>\r
-#include <Protocol/UserCredential.h>\r
+#include <Protocol/UserCredential2.h>\r
 #include <Protocol/UserManager.h>\r
 \r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Protocol/UserManager.h>\r
 \r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
@@ -92,13 +92,11 @@ typedef struct {
 /**\r
   Enroll a user on a credential provider.\r
 \r
 /**\r
   Enroll a user on a credential provider.\r
 \r
-  This function enrolls and deletes a user profile using this credential provider. \r
-  If a user profile is successfully enrolled, it calls the User Manager Protocol \r
-  function Notify() to notify the user manager driver that credential information \r
-  has changed. If an enrolled user does exist, delete the user on the credential \r
-  provider.\r
-\r
-  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL_PROTOCOL.\r
+  This function enrolls a user on this credential provider. If the user exists on \r
+  this credential provider, update the user information on this credential provider; \r
+  otherwise delete the user information on credential provider.\r
+  \r
+  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in] User                The user profile to enroll.\r
  \r
   @retval EFI_SUCCESS            User profile was successfully enrolled.\r
   @param[in] User                The user profile to enroll.\r
  \r
   @retval EFI_SUCCESS            User profile was successfully enrolled.\r
@@ -116,7 +114,7 @@ typedef struct {
 EFI_STATUS\r
 EFIAPI\r
 CredentialEnroll (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialEnroll (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_PROFILE_HANDLE             User\r
   );\r
 \r
   IN        EFI_USER_PROFILE_HANDLE             User\r
   );\r
 \r
@@ -129,7 +127,7 @@ CredentialEnroll (
   the user credential provider does not require a form to identify the user, then this\r
   function should return EFI_NOT_FOUND.\r
 \r
   the user credential provider does not require a form to identify the user, then this\r
   function should return EFI_NOT_FOUND.\r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] FormSetId  On return, holds the identifier of the form set which contains\r
                          the form used during user identification.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] FormSetId  On return, holds the identifier of the form set which contains\r
                          the form used during user identification.\r
@@ -144,7 +142,7 @@ CredentialEnroll (
 EFI_STATUS\r
 EFIAPI\r
 CredentialForm (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialForm (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_GUID                            *FormSetId,\r
   OUT       EFI_FORM_ID                         *FormId\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_GUID                            *FormSetId,\r
   OUT       EFI_FORM_ID                         *FormId\r
@@ -157,7 +155,7 @@ CredentialForm (
   of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r
   is returned. \r
 \r
   of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r
   is returned. \r
 \r
-  @param[in]      This    Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This    Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in, out] Width   On entry, points to the desired bitmap width. If NULL then no \r
                           bitmap information will be returned. On exit, points to the \r
                           width of the bitmap returned.\r
   @param[in, out] Width   On entry, points to the desired bitmap width. If NULL then no \r
                           bitmap information will be returned. On exit, points to the \r
                           width of the bitmap returned.\r
@@ -175,7 +173,7 @@ CredentialForm (
 EFI_STATUS\r
 EFIAPI\r
 CredentialTile (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialTile (\r
-  IN  CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN  CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN  OUT    UINTN                               *Width,\r
   IN  OUT    UINTN                               *Height,\r
       OUT    EFI_HII_HANDLE                      *Hii,\r
   IN  OUT    UINTN                               *Width,\r
   IN  OUT    UINTN                               *Height,\r
       OUT    EFI_HII_HANDLE                      *Hii,\r
@@ -188,7 +186,7 @@ CredentialTile (
   This function returns a string which describes the credential provider. If no\r
   such string exists, then EFI_NOT_FOUND is returned. \r
 \r
   This function returns a string which describes the credential provider. If no\r
   such string exists, then EFI_NOT_FOUND is returned. \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] String     On return, holds the HII string identifier.\r
  \r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] String     On return, holds the HII string identifier.\r
  \r
@@ -200,7 +198,7 @@ CredentialTile (
 EFI_STATUS\r
 EFIAPI\r
 CredentialTitle (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialTitle (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_STRING_ID                       *String\r
   );\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_STRING_ID                       *String\r
   );\r
@@ -213,7 +211,7 @@ CredentialTitle (
   submitted on a form OR after a call to Default() has returned that this credential is\r
   ready to log on.\r
 \r
   submitted on a form OR after a call to Default() has returned that this credential is\r
   ready to log on.\r
 \r
-  @param[in]  This           Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This           Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in]  User           The user profile handle of the user profile currently being \r
                              considered by the user identity manager. If NULL, then no user\r
                              profile is currently under consideration.\r
   @param[in]  User           The user profile handle of the user profile currently being \r
                              considered by the user identity manager. If NULL, then no user\r
                              profile is currently under consideration.\r
@@ -230,7 +228,7 @@ CredentialTitle (
 EFI_STATUS\r
 EFIAPI\r
 CredentialUser (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialUser (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_PROFILE_HANDLE             User,\r
   OUT       EFI_USER_INFO_IDENTIFIER            *Identifier\r
   );\r
   IN        EFI_USER_PROFILE_HANDLE             User,\r
   OUT       EFI_USER_INFO_IDENTIFIER            *Identifier\r
   );\r
@@ -242,7 +240,7 @@ CredentialUser (
   AutoLogon returns FALSE, then the user interface will be constructed by the User\r
   Identity Manager. \r
 \r
   AutoLogon returns FALSE, then the user interface will be constructed by the User\r
   Identity Manager. \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] AutoLogon  On return, points to the credential provider's capabilities \r
                          after the credential provider has been selected by the user. \r
  \r
   @param[out] AutoLogon  On return, points to the credential provider's capabilities \r
                          after the credential provider has been selected by the user. \r
  \r
@@ -253,7 +251,7 @@ CredentialUser (
 EFI_STATUS\r
 EFIAPI\r
 CredentialSelect (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialSelect (\r
-  IN  CONST  EFI_USER_CREDENTIAL_PROTOCOL    *This,\r
+  IN  CONST  EFI_USER_CREDENTIAL2_PROTOCOL   *This,\r
   OUT        EFI_CREDENTIAL_LOGON_FLAGS      *AutoLogon\r
   );\r
 \r
   OUT        EFI_CREDENTIAL_LOGON_FLAGS      *AutoLogon\r
   );\r
 \r
@@ -262,7 +260,7 @@ CredentialSelect (
 \r
   This function is called when a credential provider is deselected by the user.\r
 \r
 \r
   This function is called when a credential provider is deselected by the user.\r
 \r
-  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
  \r
   @retval EFI_SUCCESS    Credential provider successfully deselected.\r
   \r
  \r
   @retval EFI_SUCCESS    Credential provider successfully deselected.\r
   \r
@@ -270,7 +268,7 @@ CredentialSelect (
 EFI_STATUS\r
 EFIAPI\r
 CredentialDeselect (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialDeselect (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -278,7 +276,7 @@ CredentialDeselect (
 \r
   This function reports the default login behavior regarding this credential provider.  \r
 \r
 \r
   This function reports the default login behavior regarding this credential provider.  \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] AutoLogon  On return, holds whether the credential provider should be used\r
                          by default to automatically log on the user.  \r
  \r
   @param[out] AutoLogon  On return, holds whether the credential provider should be used\r
                          by default to automatically log on the user.  \r
  \r
@@ -289,7 +287,7 @@ CredentialDeselect (
 EFI_STATUS\r
 EFIAPI\r
 CredentialDefault (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialDefault (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_CREDENTIAL_LOGON_FLAGS          *AutoLogon\r
   );\r
 \r
   OUT       EFI_CREDENTIAL_LOGON_FLAGS          *AutoLogon\r
   );\r
 \r
@@ -298,7 +296,7 @@ CredentialDefault (
 \r
   This function returns user information. \r
 \r
 \r
   This function returns user information. \r
 \r
-  @param[in]      This          Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This          Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in]      UserInfo      Handle of the user information data record. \r
   @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On\r
                                 exit, holds the user information. If the buffer is too small\r
   @param[in]      UserInfo      Handle of the user information data record. \r
   @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On\r
                                 exit, holds the user information. If the buffer is too small\r
@@ -318,7 +316,7 @@ CredentialDefault (
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetInfo (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetInfo (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_INFO_HANDLE                UserInfo,\r
   OUT       EFI_USER_INFO                       *Info,\r
   IN OUT    UINTN                               *InfoSize\r
   IN        EFI_USER_INFO_HANDLE                UserInfo,\r
   OUT       EFI_USER_INFO                       *Info,\r
   IN OUT    UINTN                               *InfoSize\r
@@ -333,7 +331,7 @@ CredentialGetInfo (
   another user information record handle until there are no more, at which point UserInfo\r
   will point to NULL. \r
 \r
   another user information record handle until there are no more, at which point UserInfo\r
   will point to NULL. \r
 \r
-  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r
                            to start enumeration. On exit, points to the next user information\r
                            handle or NULL if there is no more user information.\r
   @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r
                            to start enumeration. On exit, points to the next user information\r
                            handle or NULL if there is no more user information.\r
@@ -346,8 +344,31 @@ CredentialGetInfo (
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetNextInfo (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetNextInfo (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN OUT    EFI_USER_INFO_HANDLE                *UserInfo\r
   );\r
 \r
   IN OUT    EFI_USER_INFO_HANDLE                *UserInfo\r
   );\r
 \r
+/**\r
+  Delete a user on this credential provider.\r
+\r
+  This function deletes a user on this credential provider. \r
+\r
+  @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
+  @param[in]     User            The user profile handle to delete.\r
+\r
+  @retval EFI_SUCCESS            User profile was successfully deleted.\r
+  @retval EFI_ACCESS_DENIED      Current user profile does not permit deletion on the user profile handle. \r
+                                 Either the user profile cannot delete on any user profile or cannot delete \r
+                                 on a user profile other than the current user profile. \r
+  @retval EFI_UNSUPPORTED        This credential provider does not support deletion in the pre-OS.\r
+  @retval EFI_DEVICE_ERROR       The new credential could not be deleted because of a device error.\r
+  @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CredentialDelete (\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
+  IN        EFI_USER_PROFILE_HANDLE             User\r
+  );\r
+\r
 #endif\r
 #endif\r
index 3b32fbb962f7010a0f29b9d393cc66f618460339..541fff11feeccc33939e055aa3379ea3beeaa74a 100644 (file)
@@ -50,5 +50,5 @@
 [Protocols]\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
   gEfiHiiConfigAccessProtocolGuid\r
 [Protocols]\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
   gEfiHiiConfigAccessProtocolGuid\r
-  gEfiUserCredentialProtocolGuid\r
+  gEfiUserCredential2ProtocolGuid\r
   gEfiUserManagerProtocolGuid
\ No newline at end of file
   gEfiUserManagerProtocolGuid
\ No newline at end of file
index 726e61c3b1f1dd7722e560e53b58cf08cd0f6793..979cdfd2cb22af85af938824e5c03118f79991a5 100644 (file)
@@ -18,7 +18,7 @@ CREDENTIAL_TABLE            *mUsbTable       = NULL;
 USB_PROVIDER_CALLBACK_INFO  *mCallbackInfo   = NULL;\r
 USB_CREDENTIAL_INFO         *mUsbInfoHandle  = NULL;\r
 \r
 USB_PROVIDER_CALLBACK_INFO  *mCallbackInfo   = NULL;\r
 USB_CREDENTIAL_INFO         *mUsbInfoHandle  = NULL;\r
 \r
-EFI_USER_CREDENTIAL_PROTOCOL  gUsbCredentialProviderDriver = {\r
+EFI_USER_CREDENTIAL2_PROTOCOL  gUsbCredentialProviderDriver = {\r
   USB_CREDENTIAL_PROVIDER_GUID,\r
   EFI_USER_CREDENTIAL_CLASS_SECURE_CARD,\r
   CredentialEnroll,\r
   USB_CREDENTIAL_PROVIDER_GUID,\r
   EFI_USER_CREDENTIAL_CLASS_SECURE_CARD,\r
   CredentialEnroll,\r
@@ -30,7 +30,9 @@ EFI_USER_CREDENTIAL_PROTOCOL  gUsbCredentialProviderDriver = {
   CredentialDeselect,\r
   CredentialDefault,\r
   CredentialGetInfo,\r
   CredentialDeselect,\r
   CredentialDefault,\r
   CredentialGetInfo,\r
-  CredentialGetNextInfo\r
+  CredentialGetNextInfo,\r
+  EFI_CREDENTIAL_CAPABILITIES_ENROLL,\r
+  CredentialDelete\r
 };\r
 \r
 \r
 };\r
 \r
 \r
@@ -95,12 +97,12 @@ ExpandTableSize (
 \r
 \r
 /**\r
 \r
 \r
 /**\r
-  Add or delete info in table, and sync with NV variable.\r
+  Add, update or delete info in table, and sync with NV variable.\r
 \r
 \r
-  @param[in]  Index     The index of the password in table. The index begin from 1.\r
-                        If index is found in table, delete the info, else add the \r
-                        into to table. \r
-  @param[in]  Info      The new password info to add into table.\r
+  @param[in]  Index     The index of the password in table. If index is found in\r
+                        table, update the info, else add the into to table. \r
+  @param[in]  Info      The new credential info to add into table. If Info is NULL, \r
+                        delete the info by Index.\r
 \r
   @retval EFI_INVALID_PARAMETER  Info is NULL when save the info.\r
   @retval EFI_SUCCESS            Modify the table successfully.\r
 \r
   @retval EFI_INVALID_PARAMETER  Info is NULL when save the info.\r
   @retval EFI_SUCCESS            Modify the table successfully.\r
@@ -114,18 +116,23 @@ ModifyTable (
   )\r
 {\r
   EFI_STATUS  Status;\r
   )\r
 {\r
   EFI_STATUS  Status;\r
+  USB_INFO    *NewUsbInfo;\r
   \r
   \r
+  NewUsbInfo = NULL;\r
   if (Index < mUsbTable->Count) {\r
   if (Index < mUsbTable->Count) {\r
-    //\r
-    // Delete the specified entry\r
-    //\r
-    mUsbTable->Count--;\r
-    if (Index != mUsbTable->Count) {\r
-      CopyMem (\r
-        &mUsbTable->UserInfo[Index],\r
-        &mUsbTable->UserInfo[mUsbTable->Count],\r
-        sizeof (USB_INFO)\r
-        );\r
+    if (Info == NULL) {\r
+      //\r
+      // Delete the specified entry.\r
+      //\r
+      mUsbTable->Count--;\r
+      if (Index != mUsbTable->Count) {\r
+        NewUsbInfo = &mUsbTable->UserInfo[mUsbTable->Count];\r
+      } \r
+    } else {\r
+      //\r
+      // Update the specified entry.\r
+      //\r
+      NewUsbInfo = Info;\r
     }\r
   } else {\r
     //\r
     }\r
   } else {\r
     //\r
@@ -139,14 +146,14 @@ ModifyTable (
       ExpandTableSize ();\r
     }\r
 \r
       ExpandTableSize ();\r
     }\r
 \r
-    CopyMem (\r
-      &mUsbTable->UserInfo[mUsbTable->Count], \r
-      Info, \r
-      sizeof (USB_INFO)\r
-      );\r
+    NewUsbInfo = Info;\r
     mUsbTable->Count++;\r
   }\r
 \r
     mUsbTable->Count++;\r
   }\r
 \r
+  if (NewUsbInfo != NULL) {\r
+    CopyMem (&mUsbTable->UserInfo[Index], NewUsbInfo, sizeof (USB_INFO));\r
+  }\r
+\r
   //\r
   // Save the credential table.\r
   //\r
   //\r
   // Save the credential table.\r
   //\r
@@ -636,13 +643,11 @@ InitFormBrowser (
 /**\r
   Enroll a user on a credential provider.\r
 \r
 /**\r
   Enroll a user on a credential provider.\r
 \r
-  This function enrolls and deletes a user profile using this credential provider. \r
-  If a user profile is successfully enrolled, it calls the User Manager Protocol \r
-  function Notify() to notify the user manager driver that credential information \r
-  has changed. If an enrolled user does exist, delete the user on the credential \r
-  provider.\r
+  This function enrolls a user on this credential provider. If the user exists on \r
+  this credential provider, update the user information on this credential provider; \r
+  otherwise add the user information on credential provider.\r
   \r
   \r
-  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in] User                The user profile to enroll.\r
  \r
   @retval EFI_SUCCESS            User profile was successfully enrolled.\r
   @param[in] User                The user profile to enroll.\r
  \r
   @retval EFI_SUCCESS            User profile was successfully enrolled.\r
@@ -660,7 +665,7 @@ InitFormBrowser (
 EFI_STATUS\r
 EFIAPI\r
 CredentialEnroll (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialEnroll (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_PROFILE_HANDLE             User\r
   )\r
 {\r
   IN        EFI_USER_PROFILE_HANDLE             User\r
   )\r
 {\r
@@ -671,8 +676,6 @@ CredentialEnroll (
   EFI_INPUT_KEY             Key;\r
   EFI_USER_MANAGER_PROTOCOL *UserManager;\r
   UINT8                     *UserId;\r
   EFI_INPUT_KEY             Key;\r
   EFI_USER_MANAGER_PROTOCOL *UserManager;\r
   UINT8                     *UserId;\r
-  UINT8                     *NewUserId;\r
-  EFI_TPL                   OldTpl;\r
   CHAR16                    *QuestionStr;\r
   CHAR16                    *PromptStr;\r
 \r
   CHAR16                    *QuestionStr;\r
   CHAR16                    *PromptStr;\r
 \r
@@ -701,22 +704,10 @@ CredentialEnroll (
   if (EFI_ERROR (Status)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
-  //\r
-  // If User exists in mUsbTable, delete User.\r
-  // \r
-  for (Index = 0; Index < mUsbTable->Count; Index++) {\r
-    UserId    = (UINT8 *) &mUsbTable->UserInfo[Index].UserId;\r
-    NewUserId = (UINT8 *) (UserInfo + 1);\r
-    if (CompareMem (UserId, NewUserId, sizeof (EFI_USER_INFO_IDENTIFIER)) == 0) {\r
-      //\r
-      // Delete the exist Token.\r
-      //\r
-      FreePool (UserInfo);\r
-      return ModifyTable (Index, NULL);\r
-    }\r
-  }\r
 \r
 \r
+  CopyMem (UsbInfo.UserId, (UINT8 *) (UserInfo + 1), sizeof (EFI_USER_INFO_IDENTIFIER)); \r
+  FreePool (UserInfo);\r
+  \r
   //\r
   // Get Token and User ID to UsbInfo.\r
   //\r
   //\r
   // Get Token and User ID to UsbInfo.\r
   //\r
@@ -724,8 +715,6 @@ CredentialEnroll (
   if (EFI_ERROR (Status)) {\r
     QuestionStr = GetStringById (STRING_TOKEN (STR_READ_USB_TOKEN_ERROR));\r
     PromptStr   = GetStringById (STRING_TOKEN (STR_INSERT_USB_TOKEN)); \r
   if (EFI_ERROR (Status)) {\r
     QuestionStr = GetStringById (STRING_TOKEN (STR_READ_USB_TOKEN_ERROR));\r
     PromptStr   = GetStringById (STRING_TOKEN (STR_INSERT_USB_TOKEN)); \r
-    OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
-    gBS->RestoreTPL (TPL_APPLICATION);    \r
     CreatePopUp (\r
       EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
       &Key,\r
     CreatePopUp (\r
       EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
       &Key,\r
@@ -734,23 +723,28 @@ CredentialEnroll (
       PromptStr,\r
       NULL\r
       );\r
       PromptStr,\r
       NULL\r
       );\r
-    gBS->RaiseTPL (OldTpl);\r
     FreePool (QuestionStr);\r
     FreePool (PromptStr);\r
     FreePool (QuestionStr);\r
     FreePool (PromptStr);\r
-    FreePool (UserInfo);\r
     return Status;\r
   } \r
     return Status;\r
   } \r
-  CopyMem (\r
-    UsbInfo.UserId,\r
-    (UINT8 *) (UserInfo + 1),\r
-    sizeof (EFI_USER_INFO_IDENTIFIER)\r
-    );\r
-  FreePool (UserInfo);\r
 \r
   //\r
 \r
   //\r
-  // Save the new added entry.\r
+  // Check whether User is ever enrolled in the provider.\r
+  // \r
+  for (Index = 0; Index < mUsbTable->Count; Index++) {\r
+    UserId = (UINT8 *) &mUsbTable->UserInfo[Index].UserId;\r
+    if (CompareMem (UserId, (UINT8 *) &UsbInfo.UserId, sizeof (EFI_USER_INFO_IDENTIFIER)) == 0) {\r
+      //\r
+      // User already exists, update the password.\r
+      //      \r
+      break;\r
+    }\r
+  }\r
+  \r
+  //\r
+  // Enroll the User to the provider.\r
   //\r
   //\r
-  Status = ModifyTable (mUsbTable->Count, &UsbInfo);\r
+  Status = ModifyTable (Index, &UsbInfo);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -773,7 +767,7 @@ CredentialEnroll (
   the user credential provider does not require a form to identify the user, then this\r
   function should return EFI_NOT_FOUND.\r
 \r
   the user credential provider does not require a form to identify the user, then this\r
   function should return EFI_NOT_FOUND.\r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] FormSetId  On return, holds the identifier of the form set which contains\r
                          the form used during user identification.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] FormSetId  On return, holds the identifier of the form set which contains\r
                          the form used during user identification.\r
@@ -788,7 +782,7 @@ CredentialEnroll (
 EFI_STATUS\r
 EFIAPI\r
 CredentialForm (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialForm (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_GUID                            *FormSetId,\r
   OUT       EFI_FORM_ID                         *FormId\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_GUID                            *FormSetId,\r
   OUT       EFI_FORM_ID                         *FormId\r
@@ -809,7 +803,7 @@ CredentialForm (
   of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r
   is returned. \r
 \r
   of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r
   is returned. \r
 \r
-  @param[in]     This    Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]     This    Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in, out] Width  On entry, points to the desired bitmap width. If NULL then no \r
                          bitmap information will be returned. On exit, points to the \r
                          width of the bitmap returned.\r
   @param[in, out] Width  On entry, points to the desired bitmap width. If NULL then no \r
                          bitmap information will be returned. On exit, points to the \r
                          width of the bitmap returned.\r
@@ -827,7 +821,7 @@ CredentialForm (
 EFI_STATUS\r
 EFIAPI\r
 CredentialTile (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialTile (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN OUT    UINTN                               *Width,\r
   IN OUT    UINTN                               *Height,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   IN OUT    UINTN                               *Width,\r
   IN OUT    UINTN                               *Height,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
@@ -847,7 +841,7 @@ CredentialTile (
   This function returns a string which describes the credential provider. If no\r
   such string exists, then EFI_NOT_FOUND is returned. \r
 \r
   This function returns a string which describes the credential provider. If no\r
   such string exists, then EFI_NOT_FOUND is returned. \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] String     On return, holds the HII string identifier.\r
  \r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] String     On return, holds the HII string identifier.\r
  \r
@@ -859,7 +853,7 @@ CredentialTile (
 EFI_STATUS\r
 EFIAPI\r
 CredentialTitle (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialTitle (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_STRING_ID                       *String\r
   )\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_STRING_ID                       *String\r
   )\r
@@ -885,7 +879,7 @@ CredentialTitle (
   submitted on a form OR after a call to Default() has returned that this credential is\r
   ready to log on.\r
 \r
   submitted on a form OR after a call to Default() has returned that this credential is\r
   ready to log on.\r
 \r
-  @param[in]  This           Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This           Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in]  User           The user profile handle of the user profile currently being \r
                              considered by the user identity manager. If NULL, then no user\r
                              profile is currently under consideration.\r
   @param[in]  User           The user profile handle of the user profile currently being \r
                              considered by the user identity manager. If NULL, then no user\r
                              profile is currently under consideration.\r
@@ -902,7 +896,7 @@ CredentialTitle (
 EFI_STATUS\r
 EFIAPI\r
 CredentialUser (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialUser (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_PROFILE_HANDLE             User,\r
   OUT       EFI_USER_INFO_IDENTIFIER            *Identifier\r
   )\r
   IN        EFI_USER_PROFILE_HANDLE             User,\r
   OUT       EFI_USER_INFO_IDENTIFIER            *Identifier\r
   )\r
@@ -1023,7 +1017,7 @@ CredentialUser (
   AutoLogon returns FALSE, then the user interface will be constructed by the User\r
   Identity Manager. \r
 \r
   AutoLogon returns FALSE, then the user interface will be constructed by the User\r
   Identity Manager. \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] AutoLogon  On return, points to the credential provider's capabilities \r
                          after the credential provider has been selected by the user. \r
  \r
   @param[out] AutoLogon  On return, points to the credential provider's capabilities \r
                          after the credential provider has been selected by the user. \r
  \r
@@ -1034,7 +1028,7 @@ CredentialUser (
 EFI_STATUS\r
 EFIAPI\r
 CredentialSelect (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialSelect (\r
-  IN  CONST  EFI_USER_CREDENTIAL_PROTOCOL    *This,\r
+  IN  CONST  EFI_USER_CREDENTIAL2_PROTOCOL   *This,\r
   OUT        EFI_CREDENTIAL_LOGON_FLAGS      *AutoLogon\r
   )\r
 {\r
   OUT        EFI_CREDENTIAL_LOGON_FLAGS      *AutoLogon\r
   )\r
 {\r
@@ -1053,7 +1047,7 @@ CredentialSelect (
 \r
   This function is called when a credential provider is deselected by the user.\r
 \r
 \r
   This function is called when a credential provider is deselected by the user.\r
 \r
-  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
  \r
   @retval EFI_SUCCESS    Credential provider successfully deselected.\r
   \r
  \r
   @retval EFI_SUCCESS    Credential provider successfully deselected.\r
   \r
@@ -1061,7 +1055,7 @@ CredentialSelect (
 EFI_STATUS\r
 EFIAPI\r
 CredentialDeselect (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialDeselect (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This\r
   )\r
 {\r
   if (This == NULL) {\r
   )\r
 {\r
   if (This == NULL) {\r
@@ -1076,7 +1070,7 @@ CredentialDeselect (
 \r
   This function reports the default login behavior regarding this credential provider.  \r
 \r
 \r
   This function reports the default login behavior regarding this credential provider.  \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] AutoLogon  On return, holds whether the credential provider should be used\r
                          by default to automatically log on the user.  \r
  \r
   @param[out] AutoLogon  On return, holds whether the credential provider should be used\r
                          by default to automatically log on the user.  \r
  \r
@@ -1087,7 +1081,7 @@ CredentialDeselect (
 EFI_STATUS\r
 EFIAPI\r
 CredentialDefault (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialDefault (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_CREDENTIAL_LOGON_FLAGS          *AutoLogon\r
   )\r
 {\r
   OUT       EFI_CREDENTIAL_LOGON_FLAGS          *AutoLogon\r
   )\r
 {\r
@@ -1105,7 +1099,7 @@ CredentialDefault (
 \r
   This function returns user information. \r
 \r
 \r
   This function returns user information. \r
 \r
-  @param[in]      This          Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This          Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in]      UserInfo      Handle of the user information data record. \r
   @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On\r
                                 exit, holds the user information. If the buffer is too small\r
   @param[in]      UserInfo      Handle of the user information data record. \r
   @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On\r
                                 exit, holds the user information. If the buffer is too small\r
@@ -1125,7 +1119,7 @@ CredentialDefault (
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetInfo (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetInfo (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_INFO_HANDLE                UserInfo,\r
   OUT       EFI_USER_INFO                       *Info,\r
   IN OUT    UINTN                               *InfoSize\r
   IN        EFI_USER_INFO_HANDLE                UserInfo,\r
   OUT       EFI_USER_INFO                       *Info,\r
   IN OUT    UINTN                               *InfoSize\r
@@ -1173,7 +1167,7 @@ CredentialGetInfo (
   another user information record handle until there are no more, at which point UserInfo\r
   will point to NULL. \r
 \r
   another user information record handle until there are no more, at which point UserInfo\r
   will point to NULL. \r
 \r
-  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r
                            to start enumeration. On exit, points to the next user information\r
                            handle or NULL if there is no more user information.\r
   @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r
                            to start enumeration. On exit, points to the next user information\r
                            handle or NULL if there is no more user information.\r
@@ -1186,7 +1180,7 @@ CredentialGetInfo (
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetNextInfo (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetNextInfo (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN OUT    EFI_USER_INFO_HANDLE                *UserInfo\r
   )\r
 {\r
   IN OUT    EFI_USER_INFO_HANDLE                *UserInfo\r
   )\r
 {\r
@@ -1317,6 +1311,72 @@ CredentialGetNextInfo (
 }\r
 \r
 \r
 }\r
 \r
 \r
+/**\r
+  Delete a user on this credential provider.\r
+\r
+  This function deletes a user on this credential provider. \r
+\r
+  @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
+  @param[in]     User            The user profile handle to delete.\r
+\r
+  @retval EFI_SUCCESS            User profile was successfully deleted.\r
+  @retval EFI_ACCESS_DENIED      Current user profile does not permit deletion on the user profile handle. \r
+                                 Either the user profile cannot delete on any user profile or cannot delete \r
+                                 on a user profile other than the current user profile. \r
+  @retval EFI_UNSUPPORTED        This credential provider does not support deletion in the pre-OS.\r
+  @retval EFI_DEVICE_ERROR       The new credential could not be deleted because of a device error.\r
+  @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CredentialDelete (\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
+  IN        EFI_USER_PROFILE_HANDLE             User\r
+  )\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_USER_INFO             *UserInfo;\r
+  UINT8                     *UserId;\r
+  UINT8                     *NewUserId;\r
+  UINTN                     Index;\r
+  \r
+  if ((This == NULL) || (User == NULL)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  //\r
+  // Get User Identifier.\r
+  //\r
+  UserInfo = NULL;\r
+  Status = FindUserInfoByType (\r
+             User,\r
+             EFI_USER_INFO_IDENTIFIER_RECORD,\r
+             &UserInfo\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  //\r
+  // Find the user by user identifier in mPwdTable.\r
+  // \r
+  for (Index = 0; Index < mUsbTable->Count; Index++) {\r
+    UserId    = (UINT8 *) &mUsbTable->UserInfo[Index].UserId;\r
+    NewUserId = (UINT8 *) (UserInfo + 1);\r
+    if (CompareMem (UserId, NewUserId, sizeof (EFI_USER_INFO_IDENTIFIER)) == 0) {\r
+      //\r
+      // Found the user, delete it.\r
+      //\r
+      ModifyTable (Index, NULL);\r
+      break;\r
+    }\r
+  }\r
+\r
+  FreePool (UserInfo);\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
 /**\r
   Main entry for this driver.\r
 \r
 /**\r
   Main entry for this driver.\r
 \r
@@ -1356,7 +1416,7 @@ UsbProviderInit (
   //\r
   Status = gBS->InstallProtocolInterface (\r
                   &mCallbackInfo->DriverHandle,\r
   //\r
   Status = gBS->InstallProtocolInterface (\r
                   &mCallbackInfo->DriverHandle,\r
-                  &gEfiUserCredentialProtocolGuid,\r
+                  &gEfiUserCredential2ProtocolGuid,\r
                   EFI_NATIVE_INTERFACE,\r
                   &gUsbCredentialProviderDriver\r
                   );\r
                   EFI_NATIVE_INTERFACE,\r
                   &gUsbCredentialProviderDriver\r
                   );\r
index d0295b8de4f27e54d8c3fb61b64364d8036c02c1..83f7f9e2ca4cc422547c337ae7c89a1b2d434bec 100644 (file)
@@ -24,7 +24,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <Protocol/SimpleFileSystem.h>\r
 #include <Protocol/BlockIo.h>\r
 \r
 #include <Protocol/SimpleFileSystem.h>\r
 #include <Protocol/BlockIo.h>\r
-#include <Protocol/UserCredential.h>\r
+#include <Protocol/UserCredential2.h>\r
 #include <Protocol/UserManager.h>\r
 \r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Protocol/UserManager.h>\r
 \r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
@@ -86,7 +86,7 @@ typedef struct {
   has changed. If an enrolled user does exist, delete the user on the credential \r
   provider.\r
 \r
   has changed. If an enrolled user does exist, delete the user on the credential \r
   provider.\r
 \r
-  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in] This                Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in] User                The user profile to enroll.\r
  \r
   @retval EFI_SUCCESS            User profile was successfully enrolled.\r
   @param[in] User                The user profile to enroll.\r
  \r
   @retval EFI_SUCCESS            User profile was successfully enrolled.\r
@@ -104,20 +104,18 @@ typedef struct {
 EFI_STATUS\r
 EFIAPI\r
 CredentialEnroll (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialEnroll (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_PROFILE_HANDLE             User\r
   );\r
 \r
 /**\r
   Returns the user interface information used during user identification.\r
 \r
   IN        EFI_USER_PROFILE_HANDLE             User\r
   );\r
 \r
 /**\r
   Returns the user interface information used during user identification.\r
 \r
-  This function returns information about the form used when interacting with the\r
-  user during user identification. The form is the first enabled form in the form-set\r
-  class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If \r
-  the user credential provider does not require a form to identify the user, then this\r
-  function should return EFI_NOT_FOUND.\r
+  This function enrolls a user on this credential provider. If the user exists on \r
+  this credential provider, update the user information on this credential provider; \r
+  otherwise delete the user information on credential provider.\r
 \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] FormSetId  On return, holds the identifier of the form set which contains\r
                          the form used during user identification.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] FormSetId  On return, holds the identifier of the form set which contains\r
                          the form used during user identification.\r
@@ -132,7 +130,7 @@ CredentialEnroll (
 EFI_STATUS\r
 EFIAPI\r
 CredentialForm (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialForm (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_GUID                            *FormSetId,\r
   OUT       EFI_FORM_ID                         *FormId\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_GUID                            *FormSetId,\r
   OUT       EFI_FORM_ID                         *FormId\r
@@ -145,7 +143,7 @@ CredentialForm (
   of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r
   is returned. \r
 \r
   of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r
   is returned. \r
 \r
-  @param[in]     This    Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]     This    Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in, out] Width  On entry, points to the desired bitmap width. If NULL then no \r
                          bitmap information will be returned. On exit, points to the \r
                          width of the bitmap returned.\r
   @param[in, out] Width  On entry, points to the desired bitmap width. If NULL then no \r
                          bitmap information will be returned. On exit, points to the \r
                          width of the bitmap returned.\r
@@ -163,7 +161,7 @@ CredentialForm (
 EFI_STATUS\r
 EFIAPI\r
 CredentialTile (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialTile (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN OUT    UINTN                               *Width,\r
   IN OUT    UINTN                               *Height,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   IN OUT    UINTN                               *Width,\r
   IN OUT    UINTN                               *Height,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
@@ -176,7 +174,7 @@ CredentialTile (
   This function returns a string which describes the credential provider. If no\r
   such string exists, then EFI_NOT_FOUND is returned. \r
 \r
   This function returns a string which describes the credential provider. If no\r
   such string exists, then EFI_NOT_FOUND is returned. \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] String     On return, holds the HII string identifier.\r
  \r
   @param[out] Hii        On return, holds the HII database handle.\r
   @param[out] String     On return, holds the HII string identifier.\r
  \r
@@ -188,7 +186,7 @@ CredentialTile (
 EFI_STATUS\r
 EFIAPI\r
 CredentialTitle (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialTitle (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_STRING_ID                       *String\r
   );\r
   OUT       EFI_HII_HANDLE                      *Hii,\r
   OUT       EFI_STRING_ID                       *String\r
   );\r
@@ -201,7 +199,7 @@ CredentialTitle (
   submitted on a form OR after a call to Default() has returned that this credential is\r
   ready to log on.\r
 \r
   submitted on a form OR after a call to Default() has returned that this credential is\r
   ready to log on.\r
 \r
-  @param[in]  This           Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This           Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in]  User           The user profile handle of the user profile currently being \r
                              considered by the user identity manager. If NULL, then no user\r
                              profile is currently under consideration.\r
   @param[in]  User           The user profile handle of the user profile currently being \r
                              considered by the user identity manager. If NULL, then no user\r
                              profile is currently under consideration.\r
@@ -218,7 +216,7 @@ CredentialTitle (
 EFI_STATUS\r
 EFIAPI\r
 CredentialUser (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialUser (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_PROFILE_HANDLE             User,\r
   OUT       EFI_USER_INFO_IDENTIFIER            *Identifier\r
   );\r
   IN        EFI_USER_PROFILE_HANDLE             User,\r
   OUT       EFI_USER_INFO_IDENTIFIER            *Identifier\r
   );\r
@@ -230,7 +228,7 @@ CredentialUser (
   AutoLogon returns FALSE, then the user interface will be constructed by the User\r
   Identity Manager. \r
 \r
   AutoLogon returns FALSE, then the user interface will be constructed by the User\r
   Identity Manager. \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] AutoLogon  On return, points to the credential provider's capabilities \r
                          after the credential provider has been selected by the user. \r
  \r
   @param[out] AutoLogon  On return, points to the credential provider's capabilities \r
                          after the credential provider has been selected by the user. \r
  \r
@@ -241,7 +239,7 @@ CredentialUser (
 EFI_STATUS\r
 EFIAPI\r
 CredentialSelect (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialSelect (\r
-  IN  CONST  EFI_USER_CREDENTIAL_PROTOCOL    *This,\r
+  IN  CONST  EFI_USER_CREDENTIAL2_PROTOCOL   *This,\r
   OUT        EFI_CREDENTIAL_LOGON_FLAGS      *AutoLogon\r
   );\r
 \r
   OUT        EFI_CREDENTIAL_LOGON_FLAGS      *AutoLogon\r
   );\r
 \r
@@ -250,7 +248,7 @@ CredentialSelect (
 \r
   This function is called when a credential provider is deselected by the user.\r
 \r
 \r
   This function is called when a credential provider is deselected by the user.\r
 \r
-  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in] This        Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
  \r
   @retval EFI_SUCCESS    Credential provider successfully deselected.\r
   \r
  \r
   @retval EFI_SUCCESS    Credential provider successfully deselected.\r
   \r
@@ -258,7 +256,7 @@ CredentialSelect (
 EFI_STATUS\r
 EFIAPI\r
 CredentialDeselect (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialDeselect (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -266,7 +264,7 @@ CredentialDeselect (
 \r
   This function reports the default login behavior regarding this credential provider.  \r
 \r
 \r
   This function reports the default login behavior regarding this credential provider.  \r
 \r
-  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]  This       Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[out] AutoLogon  On return, holds whether the credential provider should be used\r
                          by default to automatically log on the user.  \r
  \r
   @param[out] AutoLogon  On return, holds whether the credential provider should be used\r
                          by default to automatically log on the user.  \r
  \r
@@ -277,7 +275,7 @@ CredentialDeselect (
 EFI_STATUS\r
 EFIAPI\r
 CredentialDefault (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialDefault (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   OUT       EFI_CREDENTIAL_LOGON_FLAGS          *AutoLogon\r
   );\r
 \r
   OUT       EFI_CREDENTIAL_LOGON_FLAGS          *AutoLogon\r
   );\r
 \r
@@ -286,7 +284,7 @@ CredentialDefault (
 \r
   This function returns user information. \r
 \r
 \r
   This function returns user information. \r
 \r
-  @param[in]      This          Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This          Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in]      UserInfo      Handle of the user information data record. \r
   @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On\r
                                 exit, holds the user information. If the buffer is too small\r
   @param[in]      UserInfo      Handle of the user information data record. \r
   @param[out]     Info          On entry, points to a buffer of at least *InfoSize bytes. On\r
                                 exit, holds the user information. If the buffer is too small\r
@@ -306,7 +304,7 @@ CredentialDefault (
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetInfo (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetInfo (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN        EFI_USER_INFO_HANDLE                UserInfo,\r
   OUT       EFI_USER_INFO                       *Info,\r
   IN OUT    UINTN                               *InfoSize\r
   IN        EFI_USER_INFO_HANDLE                UserInfo,\r
   OUT       EFI_USER_INFO                       *Info,\r
   IN OUT    UINTN                               *InfoSize\r
@@ -320,7 +318,7 @@ CredentialGetInfo (
   another user information record handle until there are no more, at which point UserInfo\r
   will point to NULL. \r
 \r
   another user information record handle until there are no more, at which point UserInfo\r
   will point to NULL. \r
 \r
-  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r
+  @param[in]      This     Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
   @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r
                            to start enumeration. On exit, points to the next user information\r
                            handle or NULL if there is no more user information.\r
   @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r
                            to start enumeration. On exit, points to the next user information\r
                            handle or NULL if there is no more user information.\r
@@ -333,8 +331,31 @@ CredentialGetInfo (
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetNextInfo (\r
 EFI_STATUS\r
 EFIAPI\r
 CredentialGetNextInfo (\r
-  IN CONST  EFI_USER_CREDENTIAL_PROTOCOL        *This,\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
   IN OUT    EFI_USER_INFO_HANDLE                *UserInfo\r
   );\r
 \r
   IN OUT    EFI_USER_INFO_HANDLE                *UserInfo\r
   );\r
 \r
+/**\r
+  Delete a user on this credential provider.\r
+\r
+  This function deletes a user on this credential provider. \r
+\r
+  @param[in]     This            Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
+  @param[in]     User            The user profile handle to delete.\r
+\r
+  @retval EFI_SUCCESS            User profile was successfully deleted.\r
+  @retval EFI_ACCESS_DENIED      Current user profile does not permit deletion on the user profile handle. \r
+                                 Either the user profile cannot delete on any user profile or cannot delete \r
+                                 on a user profile other than the current user profile. \r
+  @retval EFI_UNSUPPORTED        This credential provider does not support deletion in the pre-OS.\r
+  @retval EFI_DEVICE_ERROR       The new credential could not be deleted because of a device error.\r
+  @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile handle.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CredentialDelete (\r
+  IN CONST  EFI_USER_CREDENTIAL2_PROTOCOL       *This,\r
+  IN        EFI_USER_PROFILE_HANDLE             User\r
+  );\r
+\r
 #endif\r
 #endif\r
index 06f212e88a1b2b8b53e1a9f395f41e41e530b097..02f803036285627d2c9ce5b20382125e400f0f03 100644 (file)
@@ -51,7 +51,7 @@
 \r
 [Protocols]\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
 \r
 [Protocols]\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiUserCredentialProtocolGuid\r
+  gEfiUserCredential2ProtocolGuid\r
   gEfiUserManagerProtocolGuid\r
   gEfiBlockIoProtocolGuid\r
   gEfiSimpleFileSystemProtocolGuid\r
   gEfiUserManagerProtocolGuid\r
   gEfiBlockIoProtocolGuid\r
   gEfiSimpleFileSystemProtocolGuid\r
index e846b71f035903562258638bc6dcbd8279c451b5..00826f75896b701d2d59cd63d711f2a43ebb53df 100644 (file)
@@ -1016,6 +1016,8 @@ ExpandUserProfile (
   @param[in]  ByType              If TRUE, Provider is credential class guid.\r
                                   If FALSE, Provider is provider guid.\r
   @param[in]  User                Points to user profile.\r
   @param[in]  ByType              If TRUE, Provider is credential class guid.\r
                                   If FALSE, Provider is provider guid.\r
   @param[in]  User                Points to user profile.\r
+  @param[in]  Delete              If TRUE, delete User from the provider; If FALSE, add  \r
+                                  User info from the provider.\r
 \r
   @retval EFI_SUCCESS      Add or delete record successfully.\r
   @retval Others           Fail to add or delete record.\r
 \r
   @retval EFI_SUCCESS      Add or delete record successfully.\r
   @retval Others           Fail to add or delete record.\r
@@ -1025,17 +1027,17 @@ EFI_STATUS
 ModifyProviderCredential (\r
   IN  EFI_GUID                                  *Provider,\r
   IN  BOOLEAN                                   ByType,\r
 ModifyProviderCredential (\r
   IN  EFI_GUID                                  *Provider,\r
   IN  BOOLEAN                                   ByType,\r
-  IN  USER_PROFILE_ENTRY                        *User\r
+  IN  USER_PROFILE_ENTRY                        *User,\r
+  IN  BOOLEAN                                   Delete\r
   )\r
 {\r
   UINTN                         Index;\r
   )\r
 {\r
   UINTN                         Index;\r
-  EFI_USER_CREDENTIAL_PROTOCOL  *UserCredential;\r
+  EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;\r
   \r
   if (Provider == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   \r
   if (Provider == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  \r
   //\r
   // Find the specified credential provider.\r
   //\r
   //\r
   // Find the specified credential provider.\r
   //\r
@@ -1045,7 +1047,11 @@ ModifyProviderCredential (
     //\r
     UserCredential = mProviderDb->Provider[Index];\r
     if (CompareGuid (&UserCredential->Identifier, Provider)) {\r
     //\r
     UserCredential = mProviderDb->Provider[Index];\r
     if (CompareGuid (&UserCredential->Identifier, Provider)) {\r
-      return UserCredential->Enroll (UserCredential, User);\r
+      if (Delete) {\r
+        return UserCredential->Delete (UserCredential, User);\r
+      } else {\r
+        return UserCredential->Enroll (UserCredential, User);\r
+      }\r
     }\r
   }\r
 \r
     }\r
   }\r
 \r
@@ -1059,9 +1065,11 @@ ModifyProviderCredential (
   Found the providers information in PolicyInfo, and then add or delete the user's credential\r
   record in the providers.\r
 \r
   Found the providers information in PolicyInfo, and then add or delete the user's credential\r
   record in the providers.\r
 \r
-  @param  User                    Points to user profile.\r
-  @param  PolicyInfo              Point to identification policy to be modified.\r
-  @param  InfoLen                 The length of PolicyInfo.\r
+  @param[in]  User                Points to user profile.\r
+  @param[in]  PolicyInfo          Point to identification policy to be modified.\r
+  @param[in]  InfoLen             The length of PolicyInfo.\r
+  @param[in]  Delete              If TRUE, delete User from the provider; If FALSE, add  \r
+                                  User info from the provider.\r
 \r
   @retval EFI_SUCCESS      Modify PolicyInfo successfully.\r
   @retval Others           Fail to modify PolicyInfo.\r
 \r
   @retval EFI_SUCCESS      Modify PolicyInfo successfully.\r
   @retval Others           Fail to modify PolicyInfo.\r
@@ -1071,7 +1079,8 @@ EFI_STATUS
 ModifyCredentialInfo (\r
   IN  USER_PROFILE_ENTRY                        *User,\r
   IN  UINT8                                     *PolicyInfo,\r
 ModifyCredentialInfo (\r
   IN  USER_PROFILE_ENTRY                        *User,\r
   IN  UINT8                                     *PolicyInfo,\r
-  IN  UINTN                                     InfoLen\r
+  IN  UINTN                                     InfoLen,\r
+  IN  BOOLEAN                                   Delete\r
   )\r
 {\r
   EFI_STATUS                    Status;\r
   )\r
 {\r
   EFI_STATUS                    Status;\r
@@ -1089,14 +1098,14 @@ ModifyCredentialInfo (
     Identity = (EFI_USER_INFO_IDENTITY_POLICY *) (PolicyInfo + TotalLen);\r
     switch (Identity->Type) {\r
     case EFI_USER_INFO_IDENTITY_CREDENTIAL_TYPE:\r
     Identity = (EFI_USER_INFO_IDENTITY_POLICY *) (PolicyInfo + TotalLen);\r
     switch (Identity->Type) {\r
     case EFI_USER_INFO_IDENTITY_CREDENTIAL_TYPE:\r
-      Status = ModifyProviderCredential ((EFI_GUID *) (Identity + 1), TRUE, User);\r
+      Status = ModifyProviderCredential ((EFI_GUID *) (Identity + 1), TRUE, User, Delete);\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
       break;\r
 \r
     case EFI_USER_INFO_IDENTITY_CREDENTIAL_PROVIDER:\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
       break;\r
 \r
     case EFI_USER_INFO_IDENTITY_CREDENTIAL_PROVIDER:\r
-      Status = ModifyProviderCredential ((EFI_GUID *) (Identity + 1), FALSE, User);\r
+      Status = ModifyProviderCredential ((EFI_GUID *) (Identity + 1), FALSE, User, Delete);\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
@@ -1372,7 +1381,7 @@ ModifyUserIpInfo (
         //\r
         // The credential is NOT found in the old identity policy; add it.\r
         //\r
         //\r
         // The credential is NOT found in the old identity policy; add it.\r
         //\r
-        Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+        Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, FALSE);\r
         if (EFI_ERROR (Status)) {\r
           break;\r
         }\r
         if (EFI_ERROR (Status)) {\r
           break;\r
         }\r
@@ -1399,7 +1408,7 @@ ModifyUserIpInfo (
             break;\r
           }\r
 \r
             break;\r
           }\r
 \r
-          ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+          ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, TRUE);\r
           CredentialCount--;\r
         }\r
       }\r
           CredentialCount--;\r
         }\r
       }\r
@@ -1426,7 +1435,7 @@ ModifyUserIpInfo (
         //\r
         // The credential is found in the old identity policy, so delete the old credential first.\r
         //\r
         //\r
         // The credential is found in the old identity policy, so delete the old credential first.\r
         //\r
-        Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+        Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, TRUE);\r
         if (EFI_ERROR (Status)) {\r
           //\r
           // Failed to delete old credential.\r
         if (EFI_ERROR (Status)) {\r
           //\r
           // Failed to delete old credential.\r
@@ -1438,7 +1447,7 @@ ModifyUserIpInfo (
         //\r
         // Add the new credential.\r
         //\r
         //\r
         // Add the new credential.\r
         //\r
-        Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+        Status = ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, FALSE);\r
         if (EFI_ERROR (Status)) {\r
           //\r
           // Failed to enroll the user by new identification policy.\r
         if (EFI_ERROR (Status)) {\r
           //\r
           // Failed to enroll the user by new identification policy.\r
@@ -1462,7 +1471,7 @@ ModifyUserIpInfo (
         //\r
         // The credential is NOT found in the new identity policy. Delete the old credential.\r
         //\r
         //\r
         // The credential is NOT found in the new identity policy. Delete the old credential.\r
         //\r
-        ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length);\r
+        ModifyCredentialInfo (User, (UINT8 *) Identity, Identity->Length, TRUE);\r
       }\r
     }\r
     TotalLen += Identity->Length;\r
       }\r
     }\r
     TotalLen += Identity->Length;\r
@@ -1526,7 +1535,8 @@ AddUserInfo (
     Status = ModifyCredentialInfo (\r
               User,\r
               (UINT8 *) ((EFI_USER_INFO *) Info + 1),\r
     Status = ModifyCredentialInfo (\r
               User,\r
               (UINT8 *) ((EFI_USER_INFO *) Info + 1),\r
-              InfoSize - sizeof (EFI_USER_INFO)\r
+              InfoSize - sizeof (EFI_USER_INFO),\r
+              FALSE\r
               );\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
               );\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
@@ -1672,7 +1682,7 @@ DelUserInfo (
   if (Info->InfoType == EFI_USER_INFO_IDENTIFIER_RECORD) {\r
     return EFI_ACCESS_DENIED;\r
   } else if (Info->InfoType == EFI_USER_INFO_IDENTITY_POLICY_RECORD) {\r
   if (Info->InfoType == EFI_USER_INFO_IDENTIFIER_RECORD) {\r
     return EFI_ACCESS_DENIED;\r
   } else if (Info->InfoType == EFI_USER_INFO_IDENTITY_POLICY_RECORD) {\r
-    Status = ModifyCredentialInfo (User, (UINT8 *) (Info + 1), Info->InfoSize - sizeof (EFI_USER_INFO));\r
+    Status = ModifyCredentialInfo (User, (UINT8 *) (Info + 1), Info->InfoSize - sizeof (EFI_USER_INFO), TRUE);\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -2331,7 +2341,7 @@ IdentifyByProviderId (
   EFI_HII_HANDLE                HiiHandle;\r
   EFI_GUID                      FormSetId;\r
   EFI_FORM_ID                   FormId;\r
   EFI_HII_HANDLE                HiiHandle;\r
   EFI_GUID                      FormSetId;\r
   EFI_FORM_ID                   FormId;\r
-  EFI_USER_CREDENTIAL_PROTOCOL  *UserCredential;\r
+  EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;\r
 \r
   if (Provider == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
 \r
   if (Provider == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -2523,7 +2533,7 @@ AddProviderSelection (
   EFI_STRING_ID                 ProvID;\r
   CHAR16                        *ProvStr;\r
   UINTN                         Index;\r
   EFI_STRING_ID                 ProvID;\r
   CHAR16                        *ProvStr;\r
   UINTN                         Index;\r
-  EFI_USER_CREDENTIAL_PROTOCOL  *UserCredential;\r
+  EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;\r
 \r
   for (Index = 0; Index < mProviderDb->Count; Index++) {\r
     UserCredential = mProviderDb->Provider[Index];\r
 \r
   for (Index = 0; Index < mProviderDb->Count; Index++) {\r
     UserCredential = mProviderDb->Provider[Index];\r
@@ -3152,7 +3162,7 @@ InitProviderInfo (
   HandleBuf   = NULL;\r
   Status = gBS->LocateHandleBuffer (\r
                   ByProtocol,\r
   HandleBuf   = NULL;\r
   Status = gBS->LocateHandleBuffer (\r
                   ByProtocol,\r
-                  &gEfiUserCredentialProtocolGuid,\r
+                  &gEfiUserCredential2ProtocolGuid,\r
                   NULL,\r
                   &HandleCount,\r
                   &HandleBuf\r
                   NULL,\r
                   &HandleCount,\r
                   &HandleBuf\r
@@ -3166,8 +3176,8 @@ InitProviderInfo (
   //\r
   mProviderDb = AllocateZeroPool (\r
                   sizeof (CREDENTIAL_PROVIDER_INFO) - \r
   //\r
   mProviderDb = AllocateZeroPool (\r
                   sizeof (CREDENTIAL_PROVIDER_INFO) - \r
-                  sizeof (EFI_USER_CREDENTIAL_PROTOCOL *) + \r
-                  HandleCount * sizeof (EFI_USER_CREDENTIAL_PROTOCOL *)\r
+                  sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) + \r
+                  HandleCount * sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *)\r
                   );\r
   if (mProviderDb == NULL) {\r
     FreePool (HandleBuf);\r
                   );\r
   if (mProviderDb == NULL) {\r
     FreePool (HandleBuf);\r
@@ -3178,7 +3188,7 @@ InitProviderInfo (
   for (Index = 0; Index < HandleCount; Index++) {\r
     Status = gBS->HandleProtocol (\r
                     HandleBuf[Index],\r
   for (Index = 0; Index < HandleCount; Index++) {\r
     Status = gBS->HandleProtocol (\r
                     HandleBuf[Index],\r
-                    &gEfiUserCredentialProtocolGuid,\r
+                    &gEfiUserCredential2ProtocolGuid,\r
                     (VOID **) &mProviderDb->Provider[Index]\r
                     );\r
     if (EFI_ERROR (Status)) {\r
                     (VOID **) &mProviderDb->Provider[Index]\r
                     );\r
     if (EFI_ERROR (Status)) {\r
@@ -3513,7 +3523,7 @@ IdentifyUser (
   EFI_CREDENTIAL_LOGON_FLAGS    AutoLogon;\r
   EFI_USER_INFO                 *IdentifyInfo;\r
   EFI_USER_INFO_IDENTITY_POLICY *Identity;\r
   EFI_CREDENTIAL_LOGON_FLAGS    AutoLogon;\r
   EFI_USER_INFO                 *IdentifyInfo;\r
   EFI_USER_INFO_IDENTITY_POLICY *Identity;\r
-  EFI_USER_CREDENTIAL_PROTOCOL  *UserCredential;\r
+  EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;\r
   USER_PROFILE_ENTRY            *UserEntry;\r
 \r
   //\r
   USER_PROFILE_ENTRY            *UserEntry;\r
 \r
   //\r
@@ -4114,7 +4124,7 @@ UserProfileSetInfo (
   credential and add it.\r
 \r
   @param[in] This          Points to this instance of the EFI_USER_MANAGER_PROTOCOL.\r
   credential and add it.\r
 \r
   @param[in] This          Points to this instance of the EFI_USER_MANAGER_PROTOCOL.\r
-  @param[in] Changed       Handle on which is installed an instance of the EFI_USER_CREDENTIAL_PROTOCOL \r
+  @param[in] Changed       Handle on which is installed an instance of the EFI_USER_CREDENTIAL2_PROTOCOL \r
                            where the user has changed.\r
 \r
   @retval EFI_SUCCESS      The User Identity Manager has handled the notification.\r
                            where the user has changed.\r
 \r
   @retval EFI_SUCCESS      The User Identity Manager has handled the notification.\r
@@ -4130,7 +4140,7 @@ UserProfileNotify (
   )\r
 {\r
   EFI_STATUS                    Status;\r
   )\r
 {\r
   EFI_STATUS                    Status;\r
-  EFI_USER_CREDENTIAL_PROTOCOL  *Provider;\r
+  EFI_USER_CREDENTIAL2_PROTOCOL *Provider;\r
   EFI_USER_INFO_IDENTIFIER      UserId;\r
   EFI_USER_INFO_HANDLE          UserInfo;\r
   EFI_USER_INFO_HANDLE          UserInfo2;\r
   EFI_USER_INFO_IDENTIFIER      UserId;\r
   EFI_USER_INFO_HANDLE          UserInfo;\r
   EFI_USER_INFO_HANDLE          UserInfo2;\r
@@ -4144,7 +4154,7 @@ UserProfileNotify (
   \r
   Status = gBS->HandleProtocol (\r
                   Changed,\r
   \r
   Status = gBS->HandleProtocol (\r
                   Changed,\r
-                  &gEfiUserCredentialProtocolGuid,\r
+                  &gEfiUserCredential2ProtocolGuid,\r
                   (VOID **) &Provider\r
                   );\r
   if (EFI_ERROR (Status)) {\r
                   (VOID **) &Provider\r
                   );\r
   if (EFI_ERROR (Status)) {\r
index b1e078a03e4fd0665424ab8ea7cbaa1c586cd422..fab06057286ba4a8157c28c3a3e204450047acb4 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The header file for User identify Manager driver.\r
     \r
 /** @file\r
   The header file for User identify Manager driver.\r
     \r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\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
 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
@@ -25,7 +25,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/HiiConfigAccess.h>\r
 #include <Protocol/HiiString.h>\r
 #include <Protocol/HiiConfigRouting.h>\r
 #include <Protocol/HiiConfigAccess.h>\r
 #include <Protocol/HiiString.h>\r
 #include <Protocol/HiiConfigRouting.h>\r
-#include <Protocol/UserCredential.h>\r
+#include <Protocol/UserCredential2.h>\r
 #include <Protocol/UserManager.h>\r
 #include <Protocol/DeferredImageLoad.h>\r
 #include <Protocol/SimpleTextOut.h>\r
 #include <Protocol/UserManager.h>\r
 #include <Protocol/DeferredImageLoad.h>\r
 #include <Protocol/SimpleTextOut.h>\r
@@ -67,7 +67,7 @@ extern UINT8                UserIdentifyManagerStrings[];
 //\r
 typedef struct {\r
   UINTN                         Count;\r
 //\r
 typedef struct {\r
   UINTN                         Count;\r
-  EFI_USER_CREDENTIAL_PROTOCOL  *Provider[1];\r
+  EFI_USER_CREDENTIAL2_PROTOCOL *Provider[1];\r
 } CREDENTIAL_PROVIDER_INFO;\r
 \r
 //\r
 } CREDENTIAL_PROVIDER_INFO;\r
 \r
 //\r
index a8d7818597537e1de054a1b7fab27fcd99097879..4963c09d6f0c1c1f420ecf2f2579dc5ee05d3638 100644 (file)
@@ -50,7 +50,7 @@
 [Protocols]\r
   gEfiFormBrowser2ProtocolGuid                  ## CONSUMES\r
   gEfiHiiDatabaseProtocolGuid                   ## CONSUMES\r
 [Protocols]\r
   gEfiFormBrowser2ProtocolGuid                  ## CONSUMES\r
   gEfiHiiDatabaseProtocolGuid                   ## CONSUMES\r
-  gEfiUserCredentialProtocolGuid                ## CONSUMES\r
+  gEfiUserCredential2ProtocolGuid               ## CONSUMES\r
   gEfiDeferredImageLoadProtocolGuid             ## CONSUMES\r
   gEfiHiiConfigAccessProtocolGuid               ## PRODUCES\r
   gEfiUserManagerProtocolGuid                   ## PRODUCES\r
   gEfiDeferredImageLoadProtocolGuid             ## CONSUMES\r
   gEfiHiiConfigAccessProtocolGuid               ## PRODUCES\r
   gEfiUserManagerProtocolGuid                   ## PRODUCES\r
index 83b391c546ba508af51b03a1dfacbbd9a718f95a..6e5bd06502140399f023c3c1c5f348c54e6b9978 100644 (file)
@@ -94,7 +94,7 @@ InitProviderInfo (
   HandleBuf   = NULL;\r
   Status = gBS->LocateHandleBuffer (\r
                   ByProtocol,\r
   HandleBuf   = NULL;\r
   Status = gBS->LocateHandleBuffer (\r
                   ByProtocol,\r
-                  &gEfiUserCredentialProtocolGuid,\r
+                  &gEfiUserCredential2ProtocolGuid,\r
                   NULL,\r
                   &HandleCount,\r
                   &HandleBuf\r
                   NULL,\r
                   &HandleCount,\r
                   &HandleBuf\r
@@ -111,8 +111,8 @@ InitProviderInfo (
   }\r
   mProviderInfo = AllocateZeroPool (\r
                     sizeof (CREDENTIAL_PROVIDER_INFO) - \r
   }\r
   mProviderInfo = AllocateZeroPool (\r
                     sizeof (CREDENTIAL_PROVIDER_INFO) - \r
-                    sizeof (EFI_USER_CREDENTIAL_PROTOCOL *) +\r
-                    HandleCount * sizeof (EFI_USER_CREDENTIAL_PROTOCOL *)\r
+                    sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) +\r
+                    HandleCount * sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *)\r
                     );\r
   if (mProviderInfo == NULL) {\r
     FreePool (HandleBuf);\r
                     );\r
   if (mProviderInfo == NULL) {\r
     FreePool (HandleBuf);\r
@@ -123,7 +123,7 @@ InitProviderInfo (
   for (Index = 0; Index < HandleCount; Index++) {\r
     Status = gBS->HandleProtocol (\r
                     HandleBuf[Index],\r
   for (Index = 0; Index < HandleCount; Index++) {\r
     Status = gBS->HandleProtocol (\r
                     HandleBuf[Index],\r
-                    &gEfiUserCredentialProtocolGuid,\r
+                    &gEfiUserCredential2ProtocolGuid,\r
                     (VOID **) &mProviderInfo->Provider[Index]\r
                     );\r
     if (EFI_ERROR (Status)) {\r
                     (VOID **) &mProviderInfo->Provider[Index]\r
                     );\r
     if (EFI_ERROR (Status)) {\r
index bff953960267974807967c0dbf5c8ffbb9ce4d54..9013d2f88fbe9ec5e08ccb91fa9a2a8bef421953 100644 (file)
@@ -22,7 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <Protocol/HiiConfigAccess.h>\r
 #include <Protocol/DevicePathToText.h>\r
 \r
 #include <Protocol/HiiConfigAccess.h>\r
 #include <Protocol/DevicePathToText.h>\r
-#include <Protocol/UserCredential.h>\r
+#include <Protocol/UserCredential2.h>\r
 #include <Protocol/UserManager.h>\r
 \r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Protocol/UserManager.h>\r
 \r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
@@ -44,7 +44,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 typedef struct {\r
   UINTN                         Count;\r
 //\r
 typedef struct {\r
   UINTN                         Count;\r
-  EFI_USER_CREDENTIAL_PROTOCOL  *Provider[1];\r
+  EFI_USER_CREDENTIAL2_PROTOCOL *Provider[1];\r
 } CREDENTIAL_PROVIDER_INFO;\r
 \r
 //\r
 } CREDENTIAL_PROVIDER_INFO;\r
 \r
 //\r
index b31c37e7b2b1fc79bf9f96e6c8cf0a4ff0d141af..9fb4bf92613826b8b8bb505814938e716fa451d4 100644 (file)
@@ -54,7 +54,7 @@
 [Protocols]\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
   gEfiHiiConfigAccessProtocolGuid\r
 [Protocols]\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
   gEfiHiiConfigAccessProtocolGuid\r
-  gEfiUserCredentialProtocolGuid\r
+  gEfiUserCredential2ProtocolGuid\r
   gEfiUserManagerProtocolGuid\r
   gEfiDevicePathToTextProtocolGuid\r
 \r
   gEfiUserManagerProtocolGuid\r
   gEfiDevicePathToTextProtocolGuid\r
 \r
index 9b0bfbd57a4bae189f909e60b247f2424529e318..1d67b479a8b9b82348a1254e4abe77f1f0c9f238 100644 (file)
@@ -379,7 +379,7 @@ ResolveIdentityPolicy (
   CHAR16                        *ProvStr;\r
   EFI_STRING_ID                 ProvId;\r
   EFI_HII_HANDLE                HiiHandle;\r
   CHAR16                        *ProvStr;\r
   EFI_STRING_ID                 ProvId;\r
   EFI_HII_HANDLE                HiiHandle;\r
-  EFI_USER_CREDENTIAL_PROTOCOL  *UserCredential;\r
+  EFI_USER_CREDENTIAL2_PROTOCOL *UserCredential;\r
  \r
   TmpStr = NULL;\r
   \r
  \r
   TmpStr = NULL;\r
   \r