From 361a8267362f755cca29495afa79efa0e9fd9714 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Fri, 25 Mar 2011 21:13:43 +0000 Subject: connect - add comments and add input verification devices - add comments and add input verification devtree - add comments and add input verification dh - add comments, add input verification, add support for "-d" disconnect - add comments and add input verification drivers - add comments drvcfg - add comment drvdiag - add comments, add input verification, and fix language use openinfo - add comments and add input verification reconnect - add comment unload - add input verification. main library files: add comments, #define protection, and more output to the user. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11434 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c') diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c index 239ac4aae2..940f72d89a 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c @@ -1,7 +1,7 @@ /** @file Main file for Unload shell Driver1 function. - Copyright (c) 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -145,10 +145,13 @@ ShellCommandRunUnload ( EFI_HANDLE TheHandle; CONST CHAR16 *Param1; SHELL_PROMPT_RESPONSE *Resp; + UINT64 Value; ShellStatus = SHELL_SUCCESS; Package = NULL; Resp = NULL; + Value = 0; + TheHandle = NULL; // // initialize the shell lib (we must be in non-auto-init...) @@ -179,24 +182,28 @@ ShellCommandRunUnload ( ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDriver1HiiHandle); ShellStatus = SHELL_INVALID_PARAMETER; } else { - Param1 = ShellCommandLineGetRawValue(Package, 1); - if (Param1 == NULL || ConvertHandleIndexToHandle(StrHexToUintn(Param1)) == NULL){ + Param1 = ShellCommandLineGetRawValue(Package, 1); + if (Param1 != NULL) { + Status = ShellConvertStringToUint64(Param1, &Value, TRUE, FALSE); + TheHandle = ConvertHandleIndexToHandle((UINTN)Value); + } + + if (EFI_ERROR(Status) || Param1 == NULL || TheHandle == NULL){ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param1); ShellStatus = SHELL_INVALID_PARAMETER; } else { - TheHandle = ConvertHandleIndexToHandle(StrHexToUintn(Param1)); ASSERT(TheHandle != NULL); if (ShellCommandLineGetFlag(Package, L"-v") || ShellCommandLineGetFlag(Package, L"-verbose")) { DumpLoadedImageProtocolInfo(TheHandle); } if (!ShellCommandLineGetFlag(Package, L"-n")) { - Status = ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_UNLOAD_CONF), gShellDriver1HiiHandle, StrHexToUintn(Param1)); + Status = ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_UNLOAD_CONF), gShellDriver1HiiHandle, (UINTN)TheHandle); Status = ShellPromptForResponse(ShellPromptResponseTypeYesNo, NULL, (VOID**)&Resp); } if (ShellCommandLineGetFlag(Package, L"-n") || (Resp != NULL && *Resp == ShellPromptResponseYes)) { Status = gBS->UnloadImage(TheHandle); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Unload", StrHexToUintn(Param1), Status); + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HANDLE_RESULT), gShellDriver1HiiHandle, L"Unload", (UINTN)TheHandle, Status); } SHELL_FREE_NON_NULL(Resp); } -- cgit v1.2.3