summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/DriverSampleDxe
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-20 01:48:39 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-20 01:48:39 +0000
commit5a829f56880a176dc9a90e9d3653c961f9350aa0 (patch)
tree15453e93f3ee948cc9e35008500936e3fdcc0bc0 /MdeModulePkg/Universal/DriverSampleDxe
parentd64ac715659ab70b6e1eaf681575bfedc6ee2e75 (diff)
downloadedk2-platforms-5a829f56880a176dc9a90e9d3653c961f9350aa0.tar.xz
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
Diffstat (limited to 'MdeModulePkg/Universal/DriverSampleDxe')
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index 64805ff83d..e470a82cc7 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -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,