]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c
comp - add comments and add input verification
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / SmbiosView / SmbiosView.c
index b9ff013d602c36cbc43f418c5527564e6d8d65e0..a45a721df320215adf469c57cfddcd22ad399316 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Tools of clarify the content of the smbios table.\r
 \r
-  Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2005 - 2011, 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
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -52,7 +52,7 @@ ShellCommandRunSmbiosView (
   Package             = NULL;\r
   ShellStatus         = SHELL_SUCCESS;\r
 \r
-  Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+  Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
   if (EFI_ERROR(Status)) {\r
     if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
       ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
@@ -65,11 +65,21 @@ ShellCommandRunSmbiosView (
     if (ShellCommandLineGetCount(Package) > 1) {\r
       ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
+    } else if (\r
+        (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-h")) ||\r
+        (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-s")) ||\r
+        (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-a")) ||\r
+        (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetFlag(Package, L"-s")) ||\r
+        (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetFlag(Package, L"-a")) ||\r
+        (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-a"))\r
+      ) {\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+      ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
 \r
       //\r
       // Init Lib\r
-      //\r
+      \r
       Status = LibSmbiosInit ();\r
       if (EFI_ERROR (Status)) {\r
         ShellStatus = SHELL_NOT_FOUND;\r
@@ -370,7 +380,7 @@ InitSmbiosTableStatistics (
     mStatisticsTable = NULL;\r
   }\r
 \r
-  mStatisticsTable = (STRUCTURE_STATISTICS *) AllocatePool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS));\r
+  mStatisticsTable = (STRUCTURE_STATISTICS *) AllocateZeroPool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS));\r
 \r
   if (mStatisticsTable == NULL) {\r
     ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle);\r