X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=NetworkPkg%2FApplication%2FIfConfig6%2FIfConfig6.c;fp=NetworkPkg%2FApplication%2FIfConfig6%2FIfConfig6.c;h=8bd62437492404b74595dc92f1fc3bcb04acd2b4;hp=8d464b8e616be5cbdb22c9858315186bc564fefc;hb=be6cd654eb27370bfa127dd387846ad983f4ef72;hpb=fa848a4048943251fc057fe8d6c5a82e01d2ffb6 diff --git a/NetworkPkg/Application/IfConfig6/IfConfig6.c b/NetworkPkg/Application/IfConfig6/IfConfig6.c index 8d464b8e61..8bd6243749 100644 --- a/NetworkPkg/Application/IfConfig6/IfConfig6.c +++ b/NetworkPkg/Application/IfConfig6/IfConfig6.c @@ -1,7 +1,7 @@ /** @file The implementation for Shell application IfConfig6. - Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2016, 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 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -46,10 +47,6 @@ SHELL_PARAM_ITEM mIfConfig6CheckList[] = { L"-r", TypeValue }, - { - L"-?", - TypeFlag - }, { NULL, TypeMax @@ -1648,20 +1645,45 @@ IfConfig6Initialize ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; - IFCONFIG6_PRIVATE_DATA *Private; - LIST_ENTRY *ParamPackage; - CONST CHAR16 *ValueStr; - ARG_LIST *ArgList; - CHAR16 *ProblemParam; - CHAR16 *Str; + EFI_STATUS Status; + IFCONFIG6_PRIVATE_DATA *Private; + EFI_HII_PACKAGE_LIST_HEADER *PackageList; + LIST_ENTRY *ParamPackage; + CONST CHAR16 *ValueStr; + ARG_LIST *ArgList; + CHAR16 *ProblemParam; + CHAR16 *Str; Private = NULL; // - // Register our string package with HII and return the handle to it. + // Retrieve HII package list from ImageHandle // - mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, IfConfig6Strings, NULL); + Status = gBS->OpenProtocol ( + ImageHandle, + &gEfiHiiPackageListProtocolGuid, + (VOID **) &PackageList, + ImageHandle, + NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Publish HII package list to HII Database. + // + Status = gHiiDatabase->NewPackageList ( + gHiiDatabase, + PackageList, + NULL, + &mHiiHandle + ); + if (EFI_ERROR (Status)) { + return Status; + } + ASSERT (mHiiHandle != NULL); Status = ShellCommandLineParseEx (mIfConfig6CheckList, &ParamPackage, &ProblemParam, TRUE, FALSE); @@ -1674,7 +1696,7 @@ IfConfig6Initialize ( // To handle no option. // if (!ShellCommandLineGetFlag (ParamPackage, L"-r") && !ShellCommandLineGetFlag (ParamPackage, L"-s") && - !ShellCommandLineGetFlag (ParamPackage, L"-?") && !ShellCommandLineGetFlag (ParamPackage, L"-l")) { + !ShellCommandLineGetFlag (ParamPackage, L"-l")) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_LACK_OPTION), mHiiHandle); goto ON_EXIT; } @@ -1683,20 +1705,10 @@ IfConfig6Initialize ( // if (((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-s"))) || ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) || - ((ShellCommandLineGetFlag (ParamPackage, L"-l")) && (ShellCommandLineGetFlag (ParamPackage, L"-?")))) { + ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l")))) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_CONFLICT_OPTIONS), mHiiHandle); goto ON_EXIT; } - // - // To show the help information of ifconfig6 command. - // - if (ShellCommandLineGetFlag (ParamPackage, L"-?")) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_HELP), mHiiHandle); - goto ON_EXIT; - } Status = EFI_INVALID_PARAMETER;