ASSERT (0);\r
}\r
\r
- for (Pointer = Str; *(Pointer + Count); Pointer++) {\r
- *Pointer = *(Pointer + Count);\r
+ if (Count != 0) {\r
+ for (Pointer = Str; *(Pointer + Count); Pointer++) {\r
+ *Pointer = *(Pointer + Count);\r
+ }\r
+ *Pointer = *(Pointer + Count); \r
}\r
-\r
- *Pointer = *(Pointer + Count);\r
}\r
\r
\r
CHAR16 TempChar;\r
DWORD LastError;\r
UINTN Count;\r
- BOOLEAN TrailingDash;\r
BOOLEAN LoopFinish;\r
UINTN InfoSize;\r
EFI_FILE_INFO *Info;\r
\r
- TrailingDash = FALSE;\r
-\r
//\r
// Check for obvious invalid parameters.\r
//\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ //\r
+ // Init local variables\r
+ //\r
PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);\r
PrivateRoot = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);\r
NewPrivateFile = NULL;\r
\r
+ //\r
+ // Allocate buffer for FileName as the passed in FileName may be read only\r
+ //\r
+ Status = gBS->AllocatePool (\r
+ EfiBootServicesData,\r
+ StrSize (FileName),\r
+ &TempFileName\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ StrCpy (TempFileName, FileName);\r
+ FileName = TempFileName;\r
+\r
//\r
// BUGBUG: assume an open of root\r
// if current location, return current data\r
}\r
\r
if (FileName[StrLen (FileName) - 1] == L'\\') {\r
- TrailingDash = TRUE;\r
FileName[StrLen (FileName) - 1] = 0;\r
}\r
\r
}\r
\r
Done: ;\r
- if (TrailingDash) {\r
- FileName[StrLen (FileName) + 1] = 0;\r
- FileName[StrLen (FileName)] = L'\\';\r
- }\r
+ gBS->FreePool (FileName);\r
\r
if (EFI_ERROR (Status)) {\r
if (NewPrivateFile) {\r