summaryrefslogtreecommitdiff
path: root/EdkModulePkg
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2007-04-18 08:32:27 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2007-04-18 08:32:27 +0000
commita0586cb857b8eec638106350a47573129307b222 (patch)
treebc2dc475e4f9c8ae3e7d69cb139f73648cdc6a72 /EdkModulePkg
parent7689c0808e654d53f28c7993cb97a5dd9ecc9627 (diff)
downloadedk2-a0586cb857b8eec638106350a47573129307b222.zip
edk2-a0586cb857b8eec638106350a47573129307b222.tar.gz
edk2-a0586cb857b8eec638106350a47573129307b222.tar.bz2
Fix the issue that Windows Server 2003 installation fails on Tiger.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2575 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg')
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 589217a..cd38536 100644
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -59,6 +59,39 @@ ReleaseLockOnlyAtBootTime (
}
}
+/**
+ A temparaty function that returns the size of a Null-terminated Unicode
+ string in bytes, including the Null terminator.
+
+ This function returns the size, in bytes, of the Null-terminated Unicode
+ string specified by String. It duplicates the functionality of StrSize()
+ in MDE library, but avoids using PCD, because IPF currently cannot convert
+ address of global variable for runtime.
+
+ If String is NULL, then ASSERT().
+ If String is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param String Pointer to a Null-terminated Unicode string.
+
+ @return The size of String.
+
+**/
+STATIC
+UINTN
+StrSizeOfVariableName (
+ IN CONST CHAR16 *String
+ )
+{
+ UINTN Length;
+
+ ASSERT (String != NULL);
+ ASSERT (((UINTN) String & 0x01) == 0);
+
+ for (Length = 0; *String != L'\0'; String++, Length++);
+
+ return (Length + 1) * sizeof (*String);
+}
+
STATIC
BOOLEAN
EFIAPI
@@ -835,7 +868,7 @@ Returns:
//
Status = EFI_WRITE_PROTECTED;
goto Done;
- } else if (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE) {
+ } else if (sizeof (VARIABLE_HEADER) + StrSizeOfVariableName (VariableName) + DataSize > MAX_VARIABLE_SIZE) {
//
// The size of the VariableName, including the Unicode Null in bytes plus
// the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.
@@ -944,7 +977,7 @@ Returns:
//
NextVariable->Reserved = 0;
VarNameOffset = sizeof (VARIABLE_HEADER);
- VarNameSize = StrSize (VariableName);
+ VarNameSize = StrSizeOfVariableName (VariableName);
CopyMem (
(UINT8 *) ((UINTN) NextVariable + VarNameOffset),
VariableName,