1 diff -urN Shell1.04\Shell/Library/DPath.c EdkCompatibilityPkg\Shell/Library/DPath.c
2 --- Shell1.04\Shell/Library/DPath.c 2007-11-15 14:38:52.000000000 +0800
3 +++ EdkCompatibilityPkg\Shell/Library/DPath.c 2008-02-25 13:38:07.000000000 +0800
7 -Copyright (c) 2005 - 2007, Intel Corporation
8 +Copyright (c) 2005 - 2008, Intel Corporation
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 @@ -1294,17 +1294,8 @@
14 ASSERT (DevPath != NULL);
16 - if (ST->Hdr.Revision > 0x00020000) {
18 - CatPrint (Str, L"Fv(%g)", &FvPath->NameGuid);
19 - } else if (ST->Hdr.Revision < 0x00020000) {
21 - // MEDIA_FV_FILEPATH_DP_EFI_1_10 == MEDIA_FV_DP == 0x06
23 - _DevPathFvFilePath (Str, DevPath);
25 - _DevPathNodeUnknown (Str, DevPath);
28 + CatPrint (Str, L"Fv(%g)", &FvPath->NameGuid);
32 @@ -2006,16 +1997,11 @@
33 #if (EFI_SPECIFICATION_VERSION > 0x00020000)
34 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH_EFI_2_00 *FvDevicePathNodeUefi_2_00;
36 - if (ST->Hdr.Revision > 0x00020000) {
37 + if (ST->Hdr.Revision != 0x00020000) {
38 if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH &&
39 DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_FV_FILEPATH_DP) {
40 return &FvDevicePathNode->NameGuid;
42 - } else if (ST->Hdr.Revision < 0x00020000) {
43 - if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH &&
44 - DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_FV_FILEPATH_DP_EFI_1_10) {
45 - return &FvDevicePathNode->NameGuid;
48 FvDevicePathNodeUefi_2_00 = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH_EFI_2_00 *)FvDevicePathNode;
49 if (DevicePathType (&FvDevicePathNodeUefi_2_00->Piwg.Header) == MEDIA_DEVICE_PATH &&
50 diff -urN Shell1.04\Shell/Library/DPath.h EdkCompatibilityPkg\Shell/Library/DPath.h
51 --- Shell1.04\Shell/Library/DPath.h 2007-11-14 22:48:14.000000000 +0800
52 +++ EdkCompatibilityPkg\Shell/Library/DPath.h 2008-02-25 13:38:07.000000000 +0800
56 -Copyright (c) 2005 - 2007, Intel Corporation
57 +Copyright (c) 2005 - 2008, Intel Corporation
58 All rights reserved. This program and the accompanying materials
59 are licensed and made available under the terms and conditions of the BSD License
60 which accompanies this distribution. The full text of the license may be found at
63 #if (EFI_SPECIFICATION_VERSION > 0x00020000)
65 -// For EFI1.10 FV file device path
67 -#define MEDIA_FV_FILEPATH_DP_EFI_1_10 0x06
70 // For UEFI2.0 FV file device path
73 diff -urN Shell1.04\Shell/Library/FileIO.c EdkCompatibilityPkg\Shell/Library/FileIO.c
74 --- Shell1.04\Shell/Library/FileIO.c 2006-03-15 11:54:44.000000000 +0800
75 +++ EdkCompatibilityPkg\Shell/Library/FileIO.c 2008-03-24 13:44:52.000000000 +0800
79 -Copyright (c) 2005, Intel Corporation
80 +Copyright (c) 2005 - 2008, Intel Corporation
81 All rights reserved. This program and the accompanying materials
82 are licensed and made available under the terms and conditions of the BSD License
83 which accompanies this distribution. The full text of the license may be found at
89 - EFI_FILE_HANDLE LastHandle;
90 - FILEPATH_DEVICE_PATH *FilePathNode;
92 + EFI_FILE_HANDLE LastHandle;
93 + FILEPATH_DEVICE_PATH *FilePathNode;
94 + EFI_DEVICE_PATH_PROTOCOL *AlignedFilePath;
96 ASSERT (FilePath != NULL);
97 ASSERT (DeviceHandle != NULL);
98 ASSERT (FileHandle != NULL);
101 + AlignedFilePath = NULL;
103 // File the file system for this file path
105 @@ -274,12 +276,26 @@
106 *FileHandle = LibOpenRoot (*DeviceHandle);
107 Status = *FileHandle ? EFI_SUCCESS : EFI_UNSUPPORTED;
109 + if (EFI_ERROR (Status)) {
114 + // Duplicate FilePath to make sure it is aligned so that
115 + // FilePathNode->PathName below is 16-bit aligned.
117 + AlignedFilePath = DuplicateDevicePath(*FilePath);
118 + if (AlignedFilePath == NULL) {
119 + (*FileHandle)->Close (*FileHandle);
120 + *FileHandle = NULL;
121 + return EFI_OUT_OF_RESOURCES;
123 + FilePathNode = (FILEPATH_DEVICE_PATH *)AlignedFilePath;
125 // To access as a file system, the file path should only
126 // contain file path components. Follow the file path nodes
127 // and find the target file
129 - FilePathNode = (FILEPATH_DEVICE_PATH *) *FilePath;
130 while (!IsDevicePathEnd (&FilePathNode->Header)) {
132 // For file system access each node should be a file path component
134 if (EFI_ERROR (Status)) {
137 + FreePool(AlignedFilePath);
141 diff -urN Shell1.04\Shell/shellenv/var.c EdkCompatibilityPkg\Shell/shellenv/var.c
142 --- Shell1.04\Shell/shellenv/var.c 2006-03-07 16:20:44.000000000 +0800
143 +++ EdkCompatibilityPkg\Shell/shellenv/var.c 2008-02-25 13:38:08.000000000 +0800
148 + UINTN RoundUpValueSize;
150 - Size = sizeof (VARIABLE_ID) + StrSize (Name) + ValueSize;
152 + // Variable buffer layout: VARIABLE_ID + Value + Name
153 + // We need to round up the variable size to make sure Name is aligned (for IPF).
155 + RoundUpValueSize = (ValueSize % 2) ? (ValueSize + 1) : ValueSize;
157 + Size = sizeof (VARIABLE_ID) + StrSize (Name) + RoundUpValueSize;
158 Var = AllocateZeroPool (Size);
163 Var->Signature = VARIABLE_SIGNATURE;
164 Var->u.Value = ((UINT8 *) Var) + sizeof (VARIABLE_ID);
165 - Var->Name = (CHAR16 *) (Var->u.Value + ValueSize);
166 + Var->Name = (CHAR16 *) (Var->u.Value + RoundUpValueSize);
167 Var->ValueSize = ValueSize;
168 CopyMem (Var->u.Value, Value, ValueSize);
169 StrCpy (Var->Name, Name);
170 diff -urN Shell1.04\Shell/ver/Ver.inf EdkCompatibilityPkg\Shell/ver/Ver.inf
171 --- Shell1.04\Shell/ver/Ver.inf 2007-03-04 23:30:48.000000000 +0800
172 +++ EdkCompatibilityPkg\Shell/ver/Ver.inf 2008-03-03 13:36:05.000000000 +0800
176 -# Copyright (c) 2005 - 2007, Intel Corporation
177 +# Copyright (c) 2005 - 2008, Intel Corporation
178 # All rights reserved. This program and the accompanying materials
179 # are licensed and made available under the terms and conditions of the BSD License
180 # which accompanies this distribution. The full text of the license may be found at
186 +[sources.ia32,sources.x64]