summaryrefslogtreecommitdiffstats
path: root/EdkNt32Pkg
diff options
context:
space:
mode:
authorxgu3 <xgu3@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-26 08:35:57 +0000
committerxgu3 <xgu3@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-26 08:35:57 +0000
commitc7916981cc01e37d189e1802463fa68d10a17bf2 (patch)
treefb7f0fd15763f7cfeebd373adeda5ec033019467 /EdkNt32Pkg
parentb4667b1105d09e64cbad2e9d0343a89a3cc0cb3e (diff)
downloadedk2-c7916981cc01e37d189e1802463fa68d10a17bf2.tar.gz
edk2-c7916981cc01e37d189e1802463fa68d10a17bf2.tar.bz2
edk2-c7916981cc01e37d189e1802463fa68d10a17bf2.zip
To fix,
cd ...... works unnormally in shell USB CBI1 driver has no component name protocol git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2328 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkNt32Pkg')
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
index bea7de40f8..30f5476d5a 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
@@ -689,6 +689,32 @@ OpenRoot:
}
//
+ // If file name does not equal to "." or "..",
+ // then we trim the leading/trailing blanks and trailing dots
+ //
+ if (StrCmp (FileName, L".") != 0 && StrCmp (FileName, L"..") != 0) {
+ //
+ // Trim leading blanks
+ //
+ Count = 0;
+ for (TempFileName = FileName;
+ *TempFileName != 0 && *TempFileName == L' ';
+ TempFileName++) {
+ Count++;
+ }
+ CutPrefix (FileName, Count);
+ //
+ // Trim trailing dots and blanks
+ //
+ for (TempFileName = FileName + StrLen (FileName) - 1;
+ TempFileName >= FileName && (*TempFileName == L' ' || *TempFileName == L'.');
+ TempFileName--) {
+ ;
+ }
+ *(TempFileName + 1) = 0;
+ }
+
+ //
// Attempt to open the file
//
Status = gBS->AllocatePool (
@@ -738,8 +764,13 @@ OpenRoot:
StrCat (NewPrivateFile->FileName, FileName + 1);
} else {
StrCpy (NewPrivateFile->FileName, NewPrivateFile->FilePath);
- StrCat (NewPrivateFile->FileName, L"\\");
- StrCat (NewPrivateFile->FileName, FileName);
+ if (StrCmp (FileName, L"") != 0) {
+ //
+ // In case the filename becomes empty, especially after trimming dots and blanks
+ //
+ StrCat (NewPrivateFile->FileName, L"\\");
+ StrCat (NewPrivateFile->FileName, FileName);
+ }
}
//