--- /dev/null
+diff -urN Shell1.04\Shell/Library/DPath.c EdkCompatibilityPkg\Shell/Library/DPath.c\r
+--- Shell1.04\Shell/Library/DPath.c 2007-11-15 14:38:52.000000000 +0800\r
++++ EdkCompatibilityPkg\Shell/Library/DPath.c 2008-02-25 13:38:07.000000000 +0800\r
+@@ -1,6 +1,6 @@\r
+ /*++\r
+ \r
+-Copyright (c) 2005 - 2007, Intel Corporation \r
++Copyright (c) 2005 - 2008, Intel Corporation \r
+ All rights reserved. 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
+@@ -1294,17 +1294,8 @@\r
+ ASSERT (Str != NULL);\r
+ ASSERT (DevPath != NULL);\r
+ \r
+- if (ST->Hdr.Revision > 0x00020000) {\r
+- FvPath = DevPath;\r
+- CatPrint (Str, L"Fv(%g)", &FvPath->NameGuid);\r
+- } else if (ST->Hdr.Revision < 0x00020000) {\r
+- //\r
+- // MEDIA_FV_FILEPATH_DP_EFI_1_10 == MEDIA_FV_DP == 0x06\r
+- //\r
+- _DevPathFvFilePath (Str, DevPath); \r
+- } else {\r
+- _DevPathNodeUnknown (Str, DevPath);\r
+- }\r
++ FvPath = DevPath;\r
++ CatPrint (Str, L"Fv(%g)", &FvPath->NameGuid);\r
+ }\r
+ #endif\r
+ \r
+@@ -2006,16 +1997,11 @@\r
+ #if (EFI_SPECIFICATION_VERSION > 0x00020000)\r
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH_EFI_2_00 *FvDevicePathNodeUefi_2_00;\r
+ \r
+- if (ST->Hdr.Revision > 0x00020000) {\r
++ if (ST->Hdr.Revision != 0x00020000) {\r
+ if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH &&\r
+ DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_FV_FILEPATH_DP) {\r
+ return &FvDevicePathNode->NameGuid;\r
+ } \r
+- } else if (ST->Hdr.Revision < 0x00020000) {\r
+- if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH &&\r
+- DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_FV_FILEPATH_DP_EFI_1_10) {\r
+- return &FvDevicePathNode->NameGuid;\r
+- } \r
+ } else {\r
+ FvDevicePathNodeUefi_2_00 = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH_EFI_2_00 *)FvDevicePathNode;\r
+ if (DevicePathType (&FvDevicePathNodeUefi_2_00->Piwg.Header) == MEDIA_DEVICE_PATH &&\r
+diff -urN Shell1.04\Shell/Library/DPath.h EdkCompatibilityPkg\Shell/Library/DPath.h\r
+--- Shell1.04\Shell/Library/DPath.h 2007-11-14 22:48:14.000000000 +0800\r
++++ EdkCompatibilityPkg\Shell/Library/DPath.h 2008-02-25 13:38:07.000000000 +0800\r
+@@ -1,6 +1,6 @@\r
+ /*++\r
+ \r
+-Copyright (c) 2005 - 2007, Intel Corporation \r
++Copyright (c) 2005 - 2008, Intel Corporation \r
+ All rights reserved. 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
+@@ -161,11 +161,6 @@\r
+ \r
+ #if (EFI_SPECIFICATION_VERSION > 0x00020000)\r
+ //\r
+-// For EFI1.10 FV file device path\r
+-//\r
+-#define MEDIA_FV_FILEPATH_DP_EFI_1_10 0x06\r
+-\r
+-//\r
+ // For UEFI2.0 FV file device path\r
+ //\r
+ typedef struct {\r
+diff -urN Shell1.04\Shell/Library/FileIO.c EdkCompatibilityPkg\Shell/Library/FileIO.c\r
+--- Shell1.04\Shell/Library/FileIO.c 2006-03-15 11:54:44.000000000 +0800\r
++++ EdkCompatibilityPkg\Shell/Library/FileIO.c 2008-03-24 13:44:52.000000000 +0800\r
+@@ -1,6 +1,6 @@\r
+ /*++\r
+ \r
+-Copyright (c) 2005, Intel Corporation \r
++Copyright (c) 2005 - 2008, Intel Corporation \r
+ All rights reserved. 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
+@@ -253,14 +253,16 @@\r
+ \r
+ --*/\r
+ {\r
+- EFI_STATUS Status;\r
+- EFI_FILE_HANDLE LastHandle;\r
+- FILEPATH_DEVICE_PATH *FilePathNode;\r
++ EFI_STATUS Status;\r
++ EFI_FILE_HANDLE LastHandle;\r
++ FILEPATH_DEVICE_PATH *FilePathNode;\r
++ EFI_DEVICE_PATH_PROTOCOL *AlignedFilePath;\r
+ \r
+ ASSERT (FilePath != NULL);\r
+ ASSERT (DeviceHandle != NULL);\r
+ ASSERT (FileHandle != NULL);\r
+- \r
++\r
++ AlignedFilePath = NULL;\r
+ //\r
+ // File the file system for this file path\r
+ //\r
+@@ -274,12 +276,26 @@\r
+ *FileHandle = LibOpenRoot (*DeviceHandle);\r
+ Status = *FileHandle ? EFI_SUCCESS : EFI_UNSUPPORTED;\r
+ \r
++ if (EFI_ERROR (Status)) {\r
++ return Status;\r
++ }\r
++\r
++ //\r
++ // Duplicate FilePath to make sure it is aligned so that\r
++ // FilePathNode->PathName below is 16-bit aligned.\r
++ //\r
++ AlignedFilePath = DuplicateDevicePath(*FilePath);\r
++ if (AlignedFilePath == NULL) {\r
++ (*FileHandle)->Close (*FileHandle);\r
++ *FileHandle = NULL;\r
++ return EFI_OUT_OF_RESOURCES;\r
++ }\r
++ FilePathNode = (FILEPATH_DEVICE_PATH *)AlignedFilePath;\r
+ //\r
+ // To access as a file system, the file path should only\r
+ // contain file path components. Follow the file path nodes\r
+ // and find the target file\r
+ //\r
+- FilePathNode = (FILEPATH_DEVICE_PATH *) *FilePath;\r
+ while (!IsDevicePathEnd (&FilePathNode->Header)) {\r
+ //\r
+ // For file system access each node should be a file path component\r
+@@ -332,6 +348,7 @@\r
+ if (EFI_ERROR (Status)) {\r
+ *FileHandle = NULL;\r
+ }\r
++ FreePool(AlignedFilePath);\r
+ \r
+ return Status;\r
+ }\r
+diff -urN Shell1.04\Shell/shellenv/var.c EdkCompatibilityPkg\Shell/shellenv/var.c\r
+--- Shell1.04\Shell/shellenv/var.c 2006-03-07 16:20:44.000000000 +0800\r
++++ EdkCompatibilityPkg\Shell/shellenv/var.c 2008-02-25 13:38:08.000000000 +0800\r
+@@ -389,8 +389,15 @@\r
+ {\r
+ UINTN Size;\r
+ VARIABLE_ID *Var;\r
++ UINTN RoundUpValueSize;\r
+ \r
+- Size = sizeof (VARIABLE_ID) + StrSize (Name) + ValueSize;\r
++ //\r
++ // Variable buffer layout: VARIABLE_ID + Value + Name\r
++ // We need to round up the variable size to make sure Name is aligned (for IPF).\r
++ //\r
++ RoundUpValueSize = (ValueSize % 2) ? (ValueSize + 1) : ValueSize; \r
++\r
++ Size = sizeof (VARIABLE_ID) + StrSize (Name) + RoundUpValueSize;\r
+ Var = AllocateZeroPool (Size);\r
+ if (Var == NULL) {\r
+ return NULL;\r
+@@ -398,7 +405,7 @@\r
+ \r
+ Var->Signature = VARIABLE_SIGNATURE;\r
+ Var->u.Value = ((UINT8 *) Var) + sizeof (VARIABLE_ID);\r
+- Var->Name = (CHAR16 *) (Var->u.Value + ValueSize);\r
++ Var->Name = (CHAR16 *) (Var->u.Value + RoundUpValueSize);\r
+ Var->ValueSize = ValueSize;\r
+ CopyMem (Var->u.Value, Value, ValueSize);\r
+ StrCpy (Var->Name, Name);\r
+diff -urN Shell1.04\Shell/ver/Ver.inf EdkCompatibilityPkg\Shell/ver/Ver.inf\r
+--- Shell1.04\Shell/ver/Ver.inf 2007-03-04 23:30:48.000000000 +0800\r
++++ EdkCompatibilityPkg\Shell/ver/Ver.inf 2008-03-03 13:36:05.000000000 +0800\r
+@@ -1,6 +1,6 @@\r
+ #/*++\r
+ #\r
+-# Copyright (c) 2005 - 2007, Intel Corporation \r
++# Copyright (c) 2005 - 2008, Intel Corporation \r
+ # All rights reserved. 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
+@@ -45,7 +45,7 @@\r
+ Ver.c\r
+ Ver.h \r
+ \r
+-[sources.ia32|x64]\r
++[sources.ia32,sources.x64]\r
+ ia32\ver32.c\r
+ \r
+ [sources.ipf]\r