K8: add new variable PasswordSize to remove immeidate constant.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7307 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2009-01-20 01:48:39 +00:00
parent d64ac71565
commit 5a829f5688
1 changed files with 7 additions and 4 deletions

View File

@ -33,7 +33,7 @@ CHAR16 VariableName[] = L"MyIfrNVData";
VOID
EncodePassword (
IN CHAR16 *Password,
IN UINT8 MaxSize
IN UINTN MaxSize
)
{
UINTN Index;
@ -167,6 +167,7 @@ SetPassword (
EFI_STATUS Status;
UINTN BufferSize;
CHAR16 *Password;
UINTN PasswordSize;
DRIVER_SAMPLE_CONFIGURATION *Configuration;
//
@ -188,7 +189,9 @@ SetPassword (
// Get user input password
//
Password = &PrivateData->Configuration.WhatIsThePassword2[0];
ZeroMem (Password, 20 * sizeof (CHAR16));
PasswordSize = sizeof (PrivateData->Configuration.WhatIsThePassword2);
ZeroMem (Password, PasswordSize);
Status = HiiLibGetString (PrivateData->HiiHandle[0], StringId, Password, &BufferSize);
if (EFI_ERROR (Status)) {
return Status;
@ -205,7 +208,7 @@ SetPassword (
//
// Update password's clear text in the screen
//
CopyMem (Configuration->PasswordClearText, Password, 20 * sizeof (CHAR16));
CopyMem (Configuration->PasswordClearText, Password, PasswordSize);
//
// Update uncommitted data of Browser
@ -224,7 +227,7 @@ SetPassword (
//
// Set password
//
EncodePassword (Password, 20 * sizeof (CHAR16));
EncodePassword (Password, PasswordSize);
Status = gRT->SetVariable(
VariableName,
&mFormSetGuid,