+ } else if (StrStr(Param1Copy, L":") == NULL) {\r
+ //\r
+ // change directory without a drive identifier\r
+ //\r
+ if (ShellGetCurrentDir(NULL) == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle, L"cd"); \r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ } else {\r
+ ASSERT((Drive == NULL && DriveSize == 0) || (Drive != NULL));\r
+ Drive = StrnCatGrow(&Drive, &DriveSize, ShellGetCurrentDir(NULL), 0);\r
+ if (*Param1Copy == L'\\') {\r
+ while (PathRemoveLastItem(Drive)) ;\r
+ Drive = StrnCatGrow(&Drive, &DriveSize, Param1Copy+1, 0);\r
+ } else {\r
+ Drive = StrnCatGrow(&Drive, &DriveSize, Param1Copy, 0);\r
+ }\r
+ //\r
+ // Verify that this is a valid directory\r
+ //\r
+ Status = gEfiShellProtocol->OpenFileByName(Drive, &Handle, EFI_FILE_MODE_READ);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, L"cd", Drive); \r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ } else if (EFI_ERROR(FileHandleIsDirectory(Handle))) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, L"cd", Drive); \r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ if (ShellStatus == SHELL_SUCCESS && Drive != NULL) {\r
+ //\r
+ // change directory on current drive letter\r
+ //\r
+ Status = gEfiShellProtocol->SetCurDir(NULL, Drive);\r
+ if (Status == EFI_NOT_FOUND) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CD_NF), gShellLevel2HiiHandle, L"cd"); \r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ }\r
+ if (Handle != NULL) {\r
+ gEfiShellProtocol->CloseFile(Handle);\r
+ DEBUG_CODE(Handle = NULL;);\r
+ }\r