]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
Remove 2 unnecessary modules (Ps2MouseDxe, Ps2keyboardDxe) for saving size.
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / DmpStore.c
index b41636c7e850a1d052f8dd679130281d01adf63e..f90e11936e97513973724982c5430d04bf7c5a30 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   Main file for DmpStore shell Debug1 function.\r
-\r
+   \r
+  (C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P.\r
   Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -56,7 +57,7 @@ GetAttrType (
     StrnCatGrow (&RetString, &BufLen, L"+NV", 0);\r
   }\r
   if ((Atts & EFI_VARIABLE_RUNTIME_ACCESS) != 0) {\r
-    StrnCatGrow (&RetString, &BufLen, L"+RS+BS", 0);\r
+    StrnCatGrow (&RetString, &BufLen, L"+RT+BS", 0);\r
   } else if ((Atts & EFI_VARIABLE_BOOTSERVICE_ACCESS) != 0) {\r
     StrnCatGrow (&RetString, &BufLen, L"+BS", 0);\r
   }\r
@@ -334,7 +335,7 @@ AppendSingleVariableToFile (
   FreePool (Buffer);\r
 \r
   if (!EFI_ERROR (Status) && \r
-      (BufferSize != sizeof (NameSize) + sizeof (DataSize) + sizeof (*Guid) + sizeof (Attributes) + NameSize + DataSize)\r
+      (BufferSize != sizeof (NameSize) + sizeof (DataSize) + sizeof (*Guid) + sizeof (Attributes) + NameSize + DataSize + sizeof (UINT32))\r
     ) {\r
     Status = EFI_DEVICE_ERROR;\r
   }\r
@@ -405,7 +406,7 @@ CascadeProcessVariables (
     FoundVarName = AllocateZeroPool (NameSize);\r
     if (FoundVarName != NULL) {\r
       if (PrevName != NULL) {\r
-        StrCpy(FoundVarName, PrevName);\r
+        StrnCpy(FoundVarName, PrevName, NameSize/sizeof(CHAR16)-1);\r
       }\r
 \r
       Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);\r
@@ -430,6 +431,11 @@ CascadeProcessVariables (
   //\r
   ShellStatus = CascadeProcessVariables(Name, Guid, Type, FileHandle, FoundVarName, FoundVarGuid, FoundOne);\r
 \r
+  if (ShellGetExecutionBreakFlag() || (ShellStatus == SHELL_ABORTED)) {\r
+    SHELL_FREE_NON_NULL(FoundVarName);\r
+    return (SHELL_ABORTED);\r
+  }\r
+\r
   //\r
   // No matter what happened we process our own variable\r
   // Only continue if Guid and VariableName are each either NULL or a match\r
@@ -635,6 +641,9 @@ ShellCommandRunDmpStore (
       ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"-l or -s", L"-d");\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
+      //\r
+      // Determine the GUID to search for based on -all and -guid parameters\r
+      //\r
       if (!ShellCommandLineGetFlag(Package, L"-all")) {\r
         GuidStr = ShellCommandLineGetValue(Package, L"-guid");\r
         if (GuidStr != NULL) {\r
@@ -647,11 +656,15 @@ ShellCommandRunDmpStore (
         } else  {\r
           Guid = &gEfiGlobalVariableGuid;\r
         }\r
-        Name = ShellCommandLineGetRawValue(Package, 1);\r
       } else {\r
-        Name  = NULL;\r
         Guid  = NULL;\r
       }\r
+\r
+      //\r
+      // Get the Name of the variable to find\r
+      //\r
+      Name = ShellCommandLineGetRawValue(Package, 1);\r
+\r
       if (ShellStatus == SHELL_SUCCESS) {\r
         if (ShellCommandLineGetFlag(Package, L"-s")) {\r
           Type = DmpStoreSave;\r