From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 398B981FA5 for ; Tue, 31 Jan 2017 10:45:28 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 31 Jan 2017 10:45:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,315,1477983600"; d="scan'208";a="815517673" Received: from mdkinney-mobl.amr.corp.intel.com ([10.254.107.104]) by FMSMGA003.fm.intel.com with ESMTP; 31 Jan 2017 10:45:27 -0800 From: Michael Kinney To: edk2-devel@lists.01.org Cc: Andrew Fish , Supreeth Venkatesh Date: Tue, 31 Jan 2017 10:45:20 -0800 Message-Id: <1485888322-56072-5-git-send-email-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.6.3.windows.1 In-Reply-To: <1485888322-56072-1-git-send-email-michael.d.kinney@intel.com> References: <1485888322-56072-1-git-send-email-michael.d.kinney@intel.com> Subject: [staging/edk2-test PATCH 4/6] TestFrameworkPkg: Fix GCC compatibility issues X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2017 18:45:28 -0000 Cc: Andrew Fish Cc: Supreeth Venkatesh Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney --- TestFrameworkPkg/Eftp/ComponentName.c | 4 + TestFrameworkPkg/Eftp/EftpDriver.h | 5 + TestFrameworkPkg/Eftp/EftpMain.c | 2 + TestFrameworkPkg/Eftp/EftpRRQ.c | 6 + TestFrameworkPkg/Eftp/EftpRRQ.h | 8 +- TestFrameworkPkg/Eftp/EftpWRQ.c | 4 + TestFrameworkPkg/Eftp/EftpWRQ.h | 2 + TestFrameworkPkg/Include/Library/EntsLib.h | 225 ------- TestFrameworkPkg/Include/Protocol/WBTest.h | 84 --- TestFrameworkPkg/Include/Protocol/WbTest.h | 84 +++ TestFrameworkPkg/Library/EasLib/EntsContext.c | 83 +-- TestFrameworkPkg/Library/EasLib/EntsDpath.c | 60 +- TestFrameworkPkg/Library/EasLib/EntsGuid.c | 113 ++-- TestFrameworkPkg/Library/EasLib/EntsLib.c | 21 +- TestFrameworkPkg/Library/EasLib/EntsLib.inf | 1 + TestFrameworkPkg/Library/EasLib/EntsStr.c | 690 --------------------- TestFrameworkPkg/Library/EasLib/EntsSupport.c | 11 +- TestFrameworkPkg/Library/EasLib/EntsTime.c | 2 +- TestFrameworkPkg/Library/EfiTestLib/EfiTestLib.c | 4 + .../IP4NetworkMonitor/IP4NetworkMonitor.c | 25 +- .../IP4NetworkMonitor/IP4NetworkMonitor.h | 8 +- .../ManagedNetworkMonitor/ManagedNetworkMonitor.c | 22 +- .../ManagedNetworkMonitor/ManagedNetworkMonitor.h | 6 + .../Sct/ENTS/EasDispatcher/Rivl/RivlType.c | 5 +- TestFrameworkPkg/Sct/Execute/ExecuteSupport.c | 1 + TestFrameworkPkg/Sct/Execute/ExecuteSupport.h | 1 + TestFrameworkPkg/Sct/Include/SctCore.h | 1 + TestFrameworkPkg/Sct/Include/SctDef.h | 2 +- TestFrameworkPkg/Sct/Misc/SctMisc.c | 2 +- TestFrameworkPkg/Sct/UI/BuildMenu.c | 2 + TestFrameworkPkg/Sct/UI/BuildMenu.h | 11 +- TestFrameworkPkg/Sct/UI/ConfigMenu.c | 10 +- TestFrameworkPkg/Sct/UI/Dialog.h | 2 +- TestFrameworkPkg/Sct/UI/DisplayUi.c | 12 + TestFrameworkPkg/Sct/UI/FileDialog.h | 2 +- TestFrameworkPkg/Sct/UI/KeyFunction.c | 18 + TestFrameworkPkg/Sct/UI/LogFileDialog.c | 4 +- TestFrameworkPkg/Sct/UI/LogFileDialog.h | 2 +- TestFrameworkPkg/Sct/UI/MainMenu.c | 18 + TestFrameworkPkg/Sct/UI/TestNodeMenu.c | 12 + TestFrameworkPkg/Sct/UI/TestNodeMenu.h | 2 +- TestFrameworkPkg/Sct/UI/UI.h | 16 + TestFrameworkPkg/Support/TestProfile/TestProfile.c | 656 ++++++-------------- .../Support/TestProfile/TestProfile.inf | 1 + 44 files changed, 564 insertions(+), 1686 deletions(-) delete mode 100644 TestFrameworkPkg/Include/Protocol/WBTest.h create mode 100644 TestFrameworkPkg/Include/Protocol/WbTest.h diff --git a/TestFrameworkPkg/Eftp/ComponentName.c b/TestFrameworkPkg/Eftp/ComponentName.c index 7956658..3ab1bfc 100644 --- a/TestFrameworkPkg/Eftp/ComponentName.c +++ b/TestFrameworkPkg/Eftp/ComponentName.c @@ -17,6 +17,7 @@ // EFI Component Name Functions // EFI_STATUS +EFIAPI EftpComponentNameGetDriverName ( IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN CHAR8 *Language, @@ -24,6 +25,7 @@ EftpComponentNameGetDriverName ( ); EFI_STATUS +EFIAPI EftpComponentNameGetControllerName ( IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, @@ -53,6 +55,7 @@ static EFI_UNICODE_STRING_TABLE mEftpDriverNameTable[] = { }; EFI_STATUS +EFIAPI EftpComponentNameGetDriverName ( IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN CHAR8 *Language, @@ -94,6 +97,7 @@ EftpComponentNameGetDriverName ( } EFI_STATUS +EFIAPI EftpComponentNameGetControllerName ( IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, diff --git a/TestFrameworkPkg/Eftp/EftpDriver.h b/TestFrameworkPkg/Eftp/EftpDriver.h index a6fac3f..4bcefbe 100644 --- a/TestFrameworkPkg/Eftp/EftpDriver.h +++ b/TestFrameworkPkg/Eftp/EftpDriver.h @@ -80,6 +80,7 @@ typedef struct _EFTP_SERVICE_BINDING_PRIVATE { } EFTP_SERVICE_BINDING_PRIVATE; EFI_STATUS +EFIAPI EftpDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, @@ -106,6 +107,7 @@ Returns: ; EFI_STATUS +EFIAPI EftpDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, @@ -133,6 +135,7 @@ Returns: ; EFI_STATUS +EFIAPI EftpDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, @@ -160,6 +163,7 @@ EftpDriverBindingStop ( ; EFI_STATUS +EFIAPI EftpServiceBindingCreateChild ( IN EFI_SERVICE_BINDING_PROTOCOL *This, IN OUT EFI_HANDLE *ChildHandle @@ -185,6 +189,7 @@ Returns: ; EFI_STATUS +EFIAPI EftpServiceBindingDestroyChild ( IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE ChildHandle diff --git a/TestFrameworkPkg/Eftp/EftpMain.c b/TestFrameworkPkg/Eftp/EftpMain.c index f9e84c5..e88dfe8 100644 --- a/TestFrameworkPkg/Eftp/EftpMain.c +++ b/TestFrameworkPkg/Eftp/EftpMain.c @@ -458,6 +458,7 @@ CleanUp: } EFI_STATUS +EFIAPI EftpReadFile ( IN EFI_EFTP_PROTOCOL *This, IN EFI_EFTP_TOKEN *Token @@ -581,6 +582,7 @@ Returns: } EFI_STATUS +EFIAPI EftpConfigure ( IN EFI_EFTP_PROTOCOL *This, IN EFI_EFTP_CONFIG_DATA *EftpConfigData // OPTIONAL diff --git a/TestFrameworkPkg/Eftp/EftpRRQ.c b/TestFrameworkPkg/Eftp/EftpRRQ.c index 9c6d952..6b87a83 100644 --- a/TestFrameworkPkg/Eftp/EftpRRQ.c +++ b/TestFrameworkPkg/Eftp/EftpRRQ.c @@ -55,6 +55,7 @@ EftpListIntegrityCheck ( STATIC VOID +EFIAPI EftpRrqTxCallback ( IN EFI_EVENT Event, IN VOID *Context @@ -156,6 +157,7 @@ Returns: } VOID +EFIAPI EftpRrqRxCallback ( IN EFI_EVENT Event, IN VOID *Context @@ -527,6 +529,7 @@ Returns: } VOID +EFIAPI EftpRrqTimer ( IN EFI_EVENT Event, IN VOID *Context @@ -664,6 +667,7 @@ Returns: STATIC VOID +EFIAPI EftpRrqTxCallback ( IN EFI_EVENT Event, IN VOID *Context @@ -1081,6 +1085,7 @@ Returns: STATIC VOID +EFIAPI EftpRrqInitTimer ( IN EFI_EVENT Event, IN VOID *Context @@ -1503,6 +1508,7 @@ Returns: STATIC VOID +EFIAPI EftpRrqActiveTimer ( IN EFI_EVENT Event, IN VOID *Context diff --git a/TestFrameworkPkg/Eftp/EftpRRQ.h b/TestFrameworkPkg/Eftp/EftpRRQ.h index 16008f9..6bb6c85 100644 --- a/TestFrameworkPkg/Eftp/EftpRRQ.h +++ b/TestFrameworkPkg/Eftp/EftpRRQ.h @@ -146,6 +146,7 @@ Returns: ; VOID +EFIAPI EftpRrqRxCallback ( IN EFI_EVENT Event, IN VOID *Context @@ -169,7 +170,12 @@ Returns: --*/ ; -VOID EftpRrqTimer (IN EFI_EVENT Event, IN VOID *Context) +VOID +EFIAPI +EftpRrqTimer ( + IN EFI_EVENT Event, + IN VOID *Context + ) /*++ Routine Description: diff --git a/TestFrameworkPkg/Eftp/EftpWRQ.c b/TestFrameworkPkg/Eftp/EftpWRQ.c index 495b2a2..7c95417 100644 --- a/TestFrameworkPkg/Eftp/EftpWRQ.c +++ b/TestFrameworkPkg/Eftp/EftpWRQ.c @@ -16,6 +16,7 @@ STATIC VOID +EFIAPI EftpWrqTxCallback ( IN EFI_EVENT Event, IN VOID *Context @@ -143,6 +144,7 @@ Returns: } VOID +EFIAPI EftpWrqRxCallback ( IN EFI_EVENT Event, IN VOID *Context @@ -400,6 +402,7 @@ CleanUp: STATIC VOID +EFIAPI EftpWrqTxCallback ( IN EFI_EVENT Event, IN VOID *Context @@ -472,6 +475,7 @@ Returns: } VOID +EFIAPI EftpWrqTimer ( IN EFI_EVENT Event, IN VOID *Context diff --git a/TestFrameworkPkg/Eftp/EftpWRQ.h b/TestFrameworkPkg/Eftp/EftpWRQ.h index 55585e2..4201bf9 100644 --- a/TestFrameworkPkg/Eftp/EftpWRQ.h +++ b/TestFrameworkPkg/Eftp/EftpWRQ.h @@ -67,6 +67,7 @@ Returns: ; VOID +EFIAPI EftpWrqRxCallback ( IN EFI_EVENT Event, IN VOID *Context @@ -113,6 +114,7 @@ Returns: ; VOID +EFIAPI EftpWrqTimer ( IN EFI_EVENT Event, IN VOID *Context diff --git a/TestFrameworkPkg/Include/Library/EntsLib.h b/TestFrameworkPkg/Include/Library/EntsLib.h index 03cfcab..c324765 100644 --- a/TestFrameworkPkg/Include/Library/EntsLib.h +++ b/TestFrameworkPkg/Include/Library/EntsLib.h @@ -247,29 +247,6 @@ EntsStrDuplicate ( ) ; -INTN -EntsLibStubStriCmp ( - IN EFI_UNICODE_COLLATION_PROTOCOL *This, - IN CHAR16 *s1, - IN CHAR16 *s2 - ) -; - -VOID -EntsLibStubStrLwrUpr ( - IN EFI_UNICODE_COLLATION_PROTOCOL *This, - IN CHAR16 *Str - ) -; - -BOOLEAN -EntsLibStubMetaiMatch ( - IN EFI_UNICODE_COLLATION_PROTOCOL *This, - IN CHAR16 *String, - IN CHAR16 *Pattern - ) -; - EFI_STATUS Char16ToChar8 ( IN CHAR16 *Src, @@ -361,23 +338,6 @@ strtok_line ( ; CHAR16 * -strtok_arg ( - CHAR16 *s, - const CHAR16 *ct - ) -/*++ - -Routine Description: - - Find the next token in a string - Tokens are separated by separators defined in "ct" - If enclosed in double quotations, other separators are invalid. Then token is - the content in the quotations. - ---*/ -; - -CHAR16 * strtok_field ( CHAR16 *s, const CHAR16 *ct @@ -406,30 +366,6 @@ EntsHexStrToUINTN ( ; EFI_STATUS -EntsStrToValue ( - IN CHAR16 *Buffer, - OUT UINTN *Value - ) -/*++ - -Routine Description: - - Convert a string to a value. - -Arguments: - - Buffer - String buffer. - Value - Pointer to receive the converted value. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_SUCCESS - Operation succeeded. - ---*/ -; - -EFI_STATUS EntsValueToStr ( IN UINTN Value, OUT CHAR16 *Buffer @@ -453,103 +389,6 @@ Returns: --*/ ; -EFI_STATUS -EntsHexValueToStr ( - IN UINTN Value, - OUT CHAR16 *Buffer - ) -/*++ - -Routine Description: - - Convert a hexadecimal value to a string. - -Arguments: - - Value - Value to be converted. - Buffer - Pointer to string receive buffer. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_SUCCESS - Operation succeeded. - ---*/ -; - -EFI_STATUS -EntsStrToHexValue ( - IN CHAR16 *Buffer, - OUT UINTN *Value - ) -/*++ - -Routine Description: - - Convert a string to a hexadecimal value. - -Arguments: - - Buffer - String buffer to be converted. - Value - Receive value pointer. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_SUCCESS - Operation succeeded. - ---*/ -; - -EFI_STATUS -EntsBooleanToStr ( - IN BOOLEAN Value, - OUT CHAR16 *Buffer - ) -/*++ - -Routine Description: - - Convert a boolean to a string. - -Arguments: - - Value - Boolean value. - Buffer - Receive string buffer. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_SUCCESS - Operation succeeded. - ---*/ -; - -EFI_STATUS -EntsStrToBoolean ( - IN CHAR16 *Buffer, - OUT BOOLEAN *Value - ) -/*++ - -Routine Description: - - Convert a string to a boolean. - -Arguments: - - Buffer - String buffer to be converted. - Value - Receive value pointer. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_UNSUPPORTED - String not supported. - EFI_SUCCESS - Operation succeeded. - ---*/ -; - BOOLEAN EntsStrBeginWith ( IN CHAR16 *Str, @@ -581,12 +420,6 @@ Returns: --*/ ; -CHAR16 * -EntsStrChr ( - IN CHAR16 *Str, - IN CHAR16 c - ); - UINTN EntsStrStr ( IN CHAR16 *Str, @@ -611,70 +444,12 @@ Returns: --*/ ; -UINTN -HexStringToValue ( - IN CHAR16 *String, - IN UINTN Length - ) -/*++ - -Routine Description: - - Convert a hex string to a value. - -Arguments: - - String - Hex string buffer. - Length - Hex string length. - -Returns: - - Converted value. - ---*/ -; - INTN a2i ( IN CHAR16 Ch ) ; -CHAR16 -i2A ( - UINTN x - ) -; - -CHAR16 -i2a ( - UINTN x - ) -; - -EFI_STATUS -EntsIpToStr ( - IN EFI_IP_ADDRESS *IpAddr, - IN UINTN StrSize, - IN OUT CHAR16 *Str - ) -; - -EFI_STATUS -EntsStrToMac ( - IN CHAR16 *Str, - IN OUT EFI_MAC_ADDRESS *MacAddr - ) -; - -EFI_STATUS -EntsMacToStr ( - IN EFI_MAC_ADDRESS *MacAddr, - IN UINTN StrSize, - IN OUT CHAR16 *Str - ) -; - EFI_STATUS EntsTimeToStr ( IN EFI_TIME *Time, diff --git a/TestFrameworkPkg/Include/Protocol/WBTest.h b/TestFrameworkPkg/Include/Protocol/WBTest.h deleted file mode 100644 index b85b6ae..0000000 --- a/TestFrameworkPkg/Include/Protocol/WBTest.h +++ /dev/null @@ -1,84 +0,0 @@ -/** @file - This file defines the EFI White-Box Test Protocol. - - Copyright (c) 2006 - 2017, 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 - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _EFI_WB_TEST_H_ -#define _EFI_WB_TEST_H_ - -// -// Includes -// -#include - -// -// EFI White-Box Test Protocol Definitions -// - -#define EFI_WB_TEST_GUID \ - { 0x0B486CED, 0x25EB, 0x448a, {0xB2, 0xB2, 0x22, 0x4E, 0x7A, 0x20, 0xCF, 0x57 } } - -#define EFI_WB_TEST_REVISION 0x00010000 - -// -// Forward reference for pure ANSI compatibility -// -typedef struct _EFI_WB_TEST_ENTRY EFI_WB_TEST_ENTRY; -typedef struct _EFI_WB_TEST_PROTOCOL EFI_WB_TEST_PROTOCOL; - -// -// EFI White-Box Test Entry Point -// - -typedef -EFI_STATUS -(EFIAPI *EFI_WB_ENTRY_POINT) ( - IN EFI_WB_TEST_PROTOCOL *This, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ); - -// -// EFI White-Box Test Entry -// - -struct _EFI_WB_TEST_ENTRY { - EFI_WB_TEST_ENTRY *Next; - EFI_GUID EntryId; - CHAR16 *Name; - CHAR16 *Description; - EFI_TEST_LEVEL TestLevelSupportMap; - EFI_GUID *SupportProtocols; - EFI_TEST_ATTRIBUTE CaseAttribute; - EFI_WB_ENTRY_POINT EntryPoint; -} ; - -// -// EFI White-Box Test Protocol -// - -struct _EFI_WB_TEST_PROTOCOL { - UINT64 TestRevision; - EFI_GUID CategoryGuid; - EFI_HANDLE ClientHandle; - CHAR16 *Name; - CHAR16 *Description; - EFI_WB_TEST_ENTRY *EntryList; -}; - -// -// Global ID for EFI White-Box Test Protocol -// - -extern EFI_GUID gEfiWbTestGuid; - -#endif diff --git a/TestFrameworkPkg/Include/Protocol/WbTest.h b/TestFrameworkPkg/Include/Protocol/WbTest.h new file mode 100644 index 0000000..b85b6ae --- /dev/null +++ b/TestFrameworkPkg/Include/Protocol/WbTest.h @@ -0,0 +1,84 @@ +/** @file + This file defines the EFI White-Box Test Protocol. + + Copyright (c) 2006 - 2017, 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 + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _EFI_WB_TEST_H_ +#define _EFI_WB_TEST_H_ + +// +// Includes +// +#include + +// +// EFI White-Box Test Protocol Definitions +// + +#define EFI_WB_TEST_GUID \ + { 0x0B486CED, 0x25EB, 0x448a, {0xB2, 0xB2, 0x22, 0x4E, 0x7A, 0x20, 0xCF, 0x57 } } + +#define EFI_WB_TEST_REVISION 0x00010000 + +// +// Forward reference for pure ANSI compatibility +// +typedef struct _EFI_WB_TEST_ENTRY EFI_WB_TEST_ENTRY; +typedef struct _EFI_WB_TEST_PROTOCOL EFI_WB_TEST_PROTOCOL; + +// +// EFI White-Box Test Entry Point +// + +typedef +EFI_STATUS +(EFIAPI *EFI_WB_ENTRY_POINT) ( + IN EFI_WB_TEST_PROTOCOL *This, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + +// +// EFI White-Box Test Entry +// + +struct _EFI_WB_TEST_ENTRY { + EFI_WB_TEST_ENTRY *Next; + EFI_GUID EntryId; + CHAR16 *Name; + CHAR16 *Description; + EFI_TEST_LEVEL TestLevelSupportMap; + EFI_GUID *SupportProtocols; + EFI_TEST_ATTRIBUTE CaseAttribute; + EFI_WB_ENTRY_POINT EntryPoint; +} ; + +// +// EFI White-Box Test Protocol +// + +struct _EFI_WB_TEST_PROTOCOL { + UINT64 TestRevision; + EFI_GUID CategoryGuid; + EFI_HANDLE ClientHandle; + CHAR16 *Name; + CHAR16 *Description; + EFI_WB_TEST_ENTRY *EntryList; +}; + +// +// Global ID for EFI White-Box Test Protocol +// + +extern EFI_GUID gEfiWbTestGuid; + +#endif diff --git a/TestFrameworkPkg/Library/EasLib/EntsContext.c b/TestFrameworkPkg/Library/EasLib/EntsContext.c index 0433877..f3072a3 100644 --- a/TestFrameworkPkg/Library/EasLib/EntsContext.c +++ b/TestFrameworkPkg/Library/EasLib/EntsContext.c @@ -94,65 +94,6 @@ _RecordListPrint( #define RecordListPrint(RecordList) #endif -/*--------------------------Internal string library function---------------------------*/ -STATIC -UINTN -strlen( - CHAR8 *str - ) -{ - CHAR8 *s; - - for (s = str; *s; ++s) - ; - return (UINTN)(s - str); -} - -STATIC -CHAR8 * -strcpy( - CHAR8 *to, - CHAR8 *from - ) -{ - CHAR8 *save; - - save = to; - for (; (*to = *from) != 0 ; ++from, ++to) - ; - return(save); -} - -STATIC -INTN -strcmp( - CHAR8 *s1, - CHAR8 *s2 - ) -{ - while (*s1 == *s2++) { - if (*s1++ == 0) - return 0; - } - return (*s1 - *s2 - 1); -} - -STATIC -CHAR8 * -strchr ( - CHAR8 *p, - INTN ch - ) -{ - for (; ; ++p) { - if (*p == ch) - return((CHAR8 *)p); - if (!*p) - return((CHAR8 *)NULL); - } - /* NOTREACHED */ -} - /*-------------------------------------------------------------------------------------*/ STATIC EFI_STATUS @@ -188,7 +129,7 @@ ParseRecordLine ( VOID *ValueBuf; UINTN ValueSize; - TmpStr = strchr(LineBuf, '|'); + TmpStr = AsciiStrStr(LineBuf, "|"); if (TmpStr == NULL) { return EFI_INVALID_PARAMETER; } @@ -197,7 +138,7 @@ ParseRecordLine ( if (KeyBuf == NULL) { return EFI_OUT_OF_RESOURCES; } - strcpy (KeyBuf, LineBuf); + AsciiStrCpy (KeyBuf, LineBuf); TmpStr++; CopyMem(&ValueSize, TmpStr, sizeof(UINTN)); ValueBuf = (VOID *)AllocateZeroPool (ValueSize); @@ -347,8 +288,8 @@ WriteRecordsToFile( FileHandle = Context->FileHandle; for (Record = RecordListHead; Record != NULL; Record = Record->Next) { - strcpy(Buffer, Record->Key); - Index = strlen(Record->Key); + AsciiStrCpy(Buffer, Record->Key); + Index = AsciiStrLen(Record->Key); Buffer[Index++] = '|'; CopyMem(Buffer + Index, &Record->Size, sizeof(UINTN)); Index += sizeof(UINTN); @@ -385,7 +326,7 @@ SetRecord ( } for (Record = RecordListHead; Record != NULL; Record = Record->Next) { - if (strcmp(Key, Record->Key) == 0) { + if (AsciiStrCmp(Key, Record->Key) == 0) { break; } } @@ -400,7 +341,7 @@ SetRecord ( Status = EFI_OUT_OF_RESOURCES; goto FreeAndReturn; } - KeyBuf = (CHAR8 *)AllocateZeroPool (strlen(Key) + 1); + KeyBuf = (CHAR8 *)AllocateZeroPool (AsciiStrLen(Key) + 1); if (KeyBuf == NULL) { FreePool(Record); Status = EFI_OUT_OF_RESOURCES; @@ -413,7 +354,7 @@ SetRecord ( Status = EFI_OUT_OF_RESOURCES; goto FreeAndReturn; } - strcpy(KeyBuf, Key); + AsciiStrCpy(KeyBuf, Key); CopyMem(ValueBuf, RecordValue, RecordSize); Record->Key = KeyBuf; Record->Size = RecordSize; @@ -476,7 +417,7 @@ GetRecord ( // the records in the list are same as the ones in file // for (Record = RecordListHead; Record != NULL; Record = Record->Next) { - if (strcmp(Record->Key, Key) == 0) { + if (AsciiStrCmp(Record->Key, Key) == 0) { break; } } @@ -526,12 +467,12 @@ DelRecord ( if (RecordListHead == NULL) { return EFI_NOT_FOUND; } else { - if (strcmp(Key, RecordListHead->Key) == 0) { + if (AsciiStrCmp(Key, RecordListHead->Key) == 0) { Record = RecordListHead; RecordListHead = RecordListHead->Next; } else { for (Record = RecordListHead; Record->Next != NULL; Record = Record->Next) { - if (strcmp(Key, Record->Next->Key) == 0) { + if (AsciiStrCmp(Key, Record->Next->Key) == 0) { break; } } @@ -872,11 +813,11 @@ SetContextRecord ( } Unicode2Ascii(AsciiKey, Key); - if (strlen(AsciiKey) + Size + 1 > MAX_RECORD_LEN) { + if (AsciiStrLen(AsciiKey) + Size + 1 > MAX_RECORD_LEN) { return EFI_INVALID_PARAMETER; } - if (strchr(AsciiKey, '=') != NULL) { + if (AsciiStrStr(AsciiKey, "=") != NULL) { EFI_ENTS_DEBUG((EFI_ENTS_D_ERROR, L"The KEY of record can not contain =")); return EFI_INVALID_PARAMETER; } diff --git a/TestFrameworkPkg/Library/EasLib/EntsDpath.c b/TestFrameworkPkg/Library/EasLib/EntsDpath.c index 1b44d5b..6a8abae 100644 --- a/TestFrameworkPkg/Library/EasLib/EntsDpath.c +++ b/TestFrameworkPkg/Library/EasLib/EntsDpath.c @@ -777,38 +777,38 @@ struct { UINT8 SubType; VOID (*Function) (ENTS_POOL_PRINT *, VOID *); } DevPathTable[] = { - HARDWARE_DEVICE_PATH, HW_PCI_DP, _DevPathPci, - HARDWARE_DEVICE_PATH, HW_PCCARD_DP, _DevPathPccard, - HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, _DevPathMemMap, - HARDWARE_DEVICE_PATH, HW_VENDOR_DP, _DevPathVendor, - HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, _DevPathController, - ACPI_DEVICE_PATH, ACPI_DP, _DevPathAcpi, - ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, _DevPathExtendedAcpi, - ACPI_DEVICE_PATH, ACPI_ADR_DP, _DevPathAdrAcpi, - MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, _DevPathAtapi, - MESSAGING_DEVICE_PATH, MSG_SCSI_DP, _DevPathScsi, - MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, _DevPathFibre, - MESSAGING_DEVICE_PATH, MSG_1394_DP, _DevPath1394, - MESSAGING_DEVICE_PATH, MSG_USB_DP, _DevPathUsb, - MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, _DevPathUsbClass, - MESSAGING_DEVICE_PATH, MSG_I2O_DP, _DevPathI2O, - MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, _DevPathMacAddr, - MESSAGING_DEVICE_PATH, MSG_IPv4_DP, _DevPathIPv4, - MESSAGING_DEVICE_PATH, MSG_IPv6_DP, _DevPathIPv6, - MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, _DevPathInfiniBand, - MESSAGING_DEVICE_PATH, MSG_UART_DP, _DevPathUart, - MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, _DevPathVendor, - MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, _DevPathHardDrive, - MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, _DevPathCDROM, - MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, _DevPathVendor, - MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, _DevPathFilePath, - MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, _DevPathMediaProtocol, + { HARDWARE_DEVICE_PATH, HW_PCI_DP, _DevPathPci}, + { HARDWARE_DEVICE_PATH, HW_PCCARD_DP, _DevPathPccard}, + { HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, _DevPathMemMap}, + { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, _DevPathVendor}, + { HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, _DevPathController}, + { ACPI_DEVICE_PATH, ACPI_DP, _DevPathAcpi}, + { ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, _DevPathExtendedAcpi}, + { ACPI_DEVICE_PATH, ACPI_ADR_DP, _DevPathAdrAcpi}, + { MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, _DevPathAtapi}, + { MESSAGING_DEVICE_PATH, MSG_SCSI_DP, _DevPathScsi}, + { MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, _DevPathFibre}, + { MESSAGING_DEVICE_PATH, MSG_1394_DP, _DevPath1394}, + { MESSAGING_DEVICE_PATH, MSG_USB_DP, _DevPathUsb}, + { MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, _DevPathUsbClass}, + { MESSAGING_DEVICE_PATH, MSG_I2O_DP, _DevPathI2O}, + { MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, _DevPathMacAddr}, + { MESSAGING_DEVICE_PATH, MSG_IPv4_DP, _DevPathIPv4}, + { MESSAGING_DEVICE_PATH, MSG_IPv6_DP, _DevPathIPv6}, + { MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, _DevPathInfiniBand}, + { MESSAGING_DEVICE_PATH, MSG_UART_DP, _DevPathUart}, + { MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, _DevPathVendor}, + { MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, _DevPathHardDrive}, + { MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, _DevPathCDROM}, + { MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, _DevPathVendor}, + { MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, _DevPathFilePath}, + { MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, _DevPathMediaProtocol}, #if (EFI_SPECIFICATION_VERSION < 0x00020000) - MEDIA_DEVICE_PATH, MEDIA_FV_FILEPATH_DP, _DevPathFvFilePath, + { MEDIA_DEVICE_PATH, MEDIA_FV_FILEPATH_DP, _DevPathFvFilePath}, #endif - BBS_DEVICE_PATH, BBS_BBS_DP, _DevPathBssBss, - END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, _DevPathEndInstance, - 0, 0, NULL + { BBS_DEVICE_PATH, BBS_BBS_DP, _DevPathBssBss}, + { END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, _DevPathEndInstance}, + { 0, 0, NULL} }; UINTN diff --git a/TestFrameworkPkg/Library/EasLib/EntsGuid.c b/TestFrameworkPkg/Library/EasLib/EntsGuid.c index 3e02e69..0bd8bc3 100644 --- a/TestFrameworkPkg/Library/EasLib/EntsGuid.c +++ b/TestFrameworkPkg/Library/EasLib/EntsGuid.c @@ -17,27 +17,27 @@ #define SHELL_INTERFACE_PROTOCOL \ { \ - 0x47c7b223, 0xc42a, 0x11d2, 0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \ + 0x47c7b223, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \ } #define ENVIRONMENT_VARIABLE_ID \ { \ - 0x47c7b224, 0xc42a, 0x11d2, 0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \ + 0x47c7b224, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \ } #define DEVICE_PATH_MAPPING_ID \ { \ - 0x47c7b225, 0xc42a, 0x11d2, 0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \ + 0x47c7b225, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \ } #define PROTOCOL_ID_ID \ { \ - 0x47c7b226, 0xc42a, 0x11d2, 0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \ + 0x47c7b226, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \ } #define ALIAS_ID \ { \ - 0x47c7b227, 0xc42a, 0x11d2, 0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \ + 0x47c7b227, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \ } static EFI_GUID ShellInterfaceProtocol = SHELL_INTERFACE_PROTOCOL; @@ -51,72 +51,43 @@ struct { CHAR16 *GuidName; } EntsKnownGuids[] = { - &tNullGuid, - L"G0", - &tEfiGlobalVariable, - L"Efi", - - >EfiDevicePathProtocolGuid, - L"dpath", - >EfiLoadedImageProtocolGuid, - L"image", - >EfiSimpleTextInProtocolGuid, - L"txtin", - >EfiSimpleTextOutProtocolGuid, - L"txtout", - >EfiBlockIoProtocolGuid, - L"blkio", - >EfiDiskIoProtocolGuid, - L"diskio", - >EfiSimpleFileSystemProtocolGuid, - L"fs", - >EfiLoadFileProtocolGuid, - L"load", - >EfiDeviceIoProtocolGuid, - L"DevIo", - - &tGenericFileInfo, - L"GenFileInfo", - >EfiFileSystemInfoGuid, - L"FileSysInfo", - - >EfiUnicodeCollationProtocolGuid, - L"UnicodeCollation", - >EfiSerialIoProtocolGuid, - L"serialio", - >EfiSimpleNetworkProtocolGuid, - L"net", - >EfiNetworkInterfaceIdentifierProtocolGuid, - L"nii", - >EfiPxeBaseCodeProtocolGuid, - L"pxebc", - >EfiPxeCallbackProtocolGuid, - L"pxecb", - - &tPcAnsiProtocol, - L"PcAnsi", - &tVt100Protocol, - L"Vt100", - >EfiUnknownDeviceGuid, - L"Unknown Device", - - >EfiPartTypeSystemPartitionGuid, - L"ESP", - >EfiPartTypeLegacyMbrGuid, - L"GPT MBR", - - &ShellInterfaceProtocol, - L"ShellInt", - &SEnvId, - L"SEnv", - &SProtId, - L"ShellProtId", - &SMapId, - L"ShellDevPathMap", - &SAliasId, - L"ShellAlias", - - NULL + { &tNullGuid, L"G0"}, + { &tEfiGlobalVariable, L"Efi"}, + + { >EfiDevicePathProtocolGuid, L"dpath"}, + { >EfiLoadedImageProtocolGuid, L"image"}, + { >EfiSimpleTextInProtocolGuid, L"txtin"}, + { >EfiSimpleTextOutProtocolGuid, L"txtout"}, + { >EfiBlockIoProtocolGuid, L"blkio"}, + { >EfiDiskIoProtocolGuid, L"diskio"}, + { >EfiSimpleFileSystemProtocolGuid, L"fs"}, + { >EfiLoadFileProtocolGuid, L"load"}, + { >EfiDeviceIoProtocolGuid, L"DevIo"}, + + { &tGenericFileInfo, L"GenFileInfo"}, + { >EfiFileSystemInfoGuid, L"FileSysInfo"}, + + { >EfiUnicodeCollationProtocolGuid, L"UnicodeCollation"}, + { >EfiSerialIoProtocolGuid, L"serialio"}, + { >EfiSimpleNetworkProtocolGuid, L"net"}, + { >EfiNetworkInterfaceIdentifierProtocolGuid, L"nii"}, + { >EfiPxeBaseCodeProtocolGuid, L"pxebc"}, + { >EfiPxeCallbackProtocolGuid, L"pxecb"}, + + { &tPcAnsiProtocol, L"PcAnsi"}, + { &tVt100Protocol, L"Vt100"}, + { >EfiUnknownDeviceGuid, L"Unknown Device"}, + + { >EfiPartTypeSystemPartitionGuid, L"ESP"}, + { >EfiPartTypeLegacyMbrGuid, L"GPT MBR"}, + + { &ShellInterfaceProtocol, L"ShellInt"}, + { &SEnvId, L"SEnv"}, + { &SProtId, L"ShellProtId"}, + { &SMapId, L"ShellDevPathMap"}, + { &SAliasId, L"ShellAlias"}, + + { NULL, NULL} }; VOID diff --git a/TestFrameworkPkg/Library/EasLib/EntsLib.c b/TestFrameworkPkg/Library/EasLib/EntsLib.c index 38300c2..97603c9 100644 --- a/TestFrameworkPkg/Library/EasLib/EntsLib.c +++ b/TestFrameworkPkg/Library/EasLib/EntsLib.c @@ -29,26 +29,13 @@ EFI_RUNTIME_SERVICES *gntRT = NULL; // EFI_MEMORY_TYPE EntsPoolAllocationType = EfiBootServicesData; -// -// Unicode collation functions that are in use -// -EFI_UNICODE_COLLATION_PROTOCOL EntsLibStubUnicodeInterface = { - EntsLibStubStriCmp, - EntsLibStubMetaiMatch, - EntsLibStubStrLwrUpr, - EntsLibStubStrLwrUpr, - NULL, // FatToStr - NULL, // StrToFat - NULL // SupportedLanguages -}; - -EFI_UNICODE_COLLATION_PROTOCOL *EntsUnicodeInterface = &EntsLibStubUnicodeInterface; +EFI_UNICODE_COLLATION_PROTOCOL *EntsUnicodeInterface = NULL; // // EFI IDs // EFI_GUID tEfiGlobalVariable = EFI_GLOBAL_VARIABLE; -EFI_GUID tNullGuid = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +EFI_GUID tNullGuid = { 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0 }}; // // Protocol IDs @@ -153,6 +140,10 @@ Returns: if (EFI_ERROR(Status)) { return Status; } + Status = gntBS->LocateProtocol(&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&EntsUnicodeInterface); + if (EFI_ERROR(Status)) { + return Status; + } } return EFI_SUCCESS; diff --git a/TestFrameworkPkg/Library/EasLib/EntsLib.inf b/TestFrameworkPkg/Library/EasLib/EntsLib.inf index acdc0ad..d9f00ff 100644 --- a/TestFrameworkPkg/Library/EasLib/EntsLib.inf +++ b/TestFrameworkPkg/Library/EasLib/EntsLib.inf @@ -83,3 +83,4 @@ gEfiManagedNetworkProtocolGuid gEfiManagedNetworkServiceBindingProtocolGuid gEfiSimpleNetworkProtocolGuid + gEfiUnicodeCollation2ProtocolGuid diff --git a/TestFrameworkPkg/Library/EasLib/EntsStr.c b/TestFrameworkPkg/Library/EasLib/EntsStr.c index 1ba83a7..ed2e268 100644 --- a/TestFrameworkPkg/Library/EasLib/EntsStr.c +++ b/TestFrameworkPkg/Library/EasLib/EntsStr.c @@ -240,25 +240,6 @@ EntsStrDuplicate ( } INTN -EntsLibStubStriCmp ( - IN EFI_UNICODE_COLLATION_PROTOCOL *This, - IN CHAR16 *s1, - IN CHAR16 *s2 - ) -{ - return StrCmp (s1, s2); -} - -VOID -EntsLibStubStrLwrUpr ( - IN EFI_UNICODE_COLLATION_PROTOCOL *This, - IN CHAR16 *Str - ) -{ - return; -} - -INTN EFIAPI StriCmp ( IN CHAR16 *s1, @@ -268,146 +249,6 @@ StriCmp ( return EntsUnicodeInterface->StriColl (EntsUnicodeInterface, s1, s2); } -STATIC -BOOLEAN -MetaMatch ( - IN CHAR16 *String, - IN CHAR16 *Pattern - ) -{ - CHAR16 c; - - CHAR16 p; - - CHAR16 l; - - for (;;) { - p = *Pattern; - Pattern += 1; - - switch (p) { - case 0: - // - // End of pattern. If end of string, TRUE match - // - return (BOOLEAN) (*String ? FALSE : TRUE); - - case '*': - // - // Match zero or more chars - // - while (*String) { - if (MetaMatch (String, Pattern)) { - return TRUE; - } - - String += 1; - } - - return MetaMatch (String, Pattern); - - case '?': - // - // Match any one char - // - if (!*String) { - return FALSE; - } - - String += 1; - break; - - case '[': - // - // Match char set - // - c = *String; - if (!c) { - return FALSE; - // - // syntax problem - // - } - - l = 0; - p = *Pattern++; - while (p) { - if (p == ']') { - return FALSE; - } - - if (p == '-') { - // - // if range of chars, - // - p = *Pattern; - // - // get high range - // - if (p == 0 || p == ']') { - return FALSE; - // - // syntax problem - // - } - - if (c >= l && c <= p) { - // - // if in range, - // - break; - // - // it's a match - // - } - } - - l = p; - if (c == p) { - // - // if char matches - // - break; - // - // move on - // - } - - p = *Pattern++; - } - // - // skip to end of match char set - // - while (p && p != ']') { - p = *Pattern; - Pattern += 1; - } - - String += 1; - break; - - default: - c = *String; - if (c != p) { - return FALSE; - } - - String += 1; - break; - } - } -} - -BOOLEAN -EntsLibStubMetaiMatch ( - IN EFI_UNICODE_COLLATION_PROTOCOL *This, - IN CHAR16 *String, - IN CHAR16 *Pattern - ) -{ - return MetaMatch (String, Pattern); -} - UINTN Atoi ( CHAR16 *str @@ -532,23 +373,6 @@ Returns: return EFI_SUCCESS; } -CHAR16 * -EntsStrChr ( - IN CHAR16 *Str, - IN CHAR16 c - ) -{ - ASSERT (Str != NULL); - - for (; *Str != c; ++Str) { - if (*Str == '\0') { - return NULL; - } - } - - return (CHAR16 *) Str; -} - UINTN EntsStrStr ( IN CHAR16 *Str, @@ -654,69 +478,6 @@ strtok_line ( } CHAR16 * -strtok_arg ( - CHAR16 *s, - const CHAR16 *ct - ) -/*++ - -Routine Description: - - Find the next token in a string - Tokens are separated by separators defined in "ct" - If enclosed in double quotations, other separators are invalid. Then token is - the content in the quotations. - ---*/ -{ - CHAR16 *sbegin; - - CHAR16 *send; - INT32 l; - - sbegin = s ? s : ___strtok_arg; - if (!sbegin) { - return NULL; - } - - sbegin += strspn (sbegin, ct); - - // - // extract string enclosed in double quotation marks - // - if ((*sbegin == '"') || (*sbegin == 'L' && *(sbegin + 1) == '"')) { - l = (*sbegin == 'L') ? 2 : 1; - sbegin += l; - if (!sbegin) { - return NULL; - } - - send = strpbrk (sbegin, L"\""); - if (send && (*send != '\0')) { - *send++ = '\0'; - } - - ___strtok_arg = send; - return sbegin - l; - } - // - // extract string separated per ct - // - if (*sbegin == '\0') { - ___strtok_arg = NULL; - return NULL; - } - - send = strpbrk (sbegin, ct); - if (send && (*send != '\0')) { - *send++ = '\0'; - } - - ___strtok_arg = send; - return sbegin; -} - -CHAR16 * strtok_field ( CHAR16 *s, const CHAR16 *ct @@ -819,44 +580,6 @@ Routine Description: return NULL; } -EFI_STATUS -EntsStrToValue ( - IN CHAR16 *Buffer, - OUT UINTN *Value - ) -/*++ - -Routine Description: - - Convert a string to a value. - -Arguments: - - Buffer - String buffer. - Value - Pointer to receive the converted value. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_SUCCESS - Operation succeeded. - ---*/ -{ - if ((Buffer == NULL) || (Value == NULL)) { - return EFI_INVALID_PARAMETER; - } - // - // Convert a string to a value - // - if (Buffer[0] == L'-') { - *Value = (UINTN) (0 - Atoi (Buffer + 1)); - } else { - *Value = Atoi (Buffer); - } - - return EFI_SUCCESS; -} - INTN EntsStrToUINTN ( IN CHAR16 *Str, @@ -922,229 +645,6 @@ EntsHexStrToUINTN ( return Index; } -EFI_STATUS -EntsHexValueToStr ( - IN UINTN Value, - OUT CHAR16 *Buffer - ) -/*++ - -Routine Description: - - Convert a hexadecimal value to a string. - -Arguments: - - Value - Value to be converted. - Buffer - Pointer to string receive buffer. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_SUCCESS - Operation succeeded. - ---*/ -{ - if (Buffer == NULL) { - return EFI_INVALID_PARAMETER; - } - // - // Convert a value to a string - // - EntsSPrint (Buffer, 0, L"0x%x", Value); - - return EFI_SUCCESS; -} - -EFI_STATUS -EntsStrToHexValue ( - IN CHAR16 *Buffer, - OUT UINTN *Value - ) -/*++ - -Routine Description: - - Convert a string to a hexadecimal value. - -Arguments: - - Buffer - String buffer to be converted. - Value - Receive value pointer. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_SUCCESS - Operation succeeded. - ---*/ -{ - CHAR16 c; - - if ((Buffer == NULL) || (Value == NULL)) { - return EFI_INVALID_PARAMETER; - } - // - // skip preceeding white space - // - while (*Buffer && *Buffer == ' ') { - Buffer += 1; - } - // - // skip preceeding zeros - // - while (*Buffer && *Buffer == '0') { - Buffer += 1; - } - // - // skip preceeding white space - // - if (*Buffer && (*Buffer == 'x' || *Buffer == 'X')) { - Buffer += 1; - } - - *Value = 0; - c = *(Buffer++); - while (c) { - if (c >= 'a' && c <= 'f') { - c -= 'a' - 'A'; - } - - if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) { - *Value = *Value << 4 | c - (c >= 'A' ? 'A' - 10 : '0'); - } else { - break; - } - - c = *(Buffer++); - } - - return EFI_SUCCESS; -} - -EFI_STATUS -EntsBooleanToStr ( - IN BOOLEAN Value, - OUT CHAR16 *Buffer - ) -/*++ - -Routine Description: - - Convert a boolean to a string. - -Arguments: - - Value - Boolean value. - Buffer - Receive string buffer. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_SUCCESS - Operation succeeded. - ---*/ -{ - if (Buffer == NULL) { - return EFI_INVALID_PARAMETER; - } - // - // Convert a boolean to a string - // - if (Value) { - StrCpy (Buffer, L"True"); - } else { - StrCpy (Buffer, L"False"); - } - - return EFI_SUCCESS; -} - -EFI_STATUS -EntsStrToBoolean ( - IN CHAR16 *Buffer, - OUT BOOLEAN *Value - ) -/*++ - -Routine Description: - - Convert a string to a boolean. - -Arguments: - - Buffer - String buffer to be converted. - Value - Receive value pointer. - -Returns: - - EFI_INVALID_PARAMETER - Parameter invalid. - EFI_UNSUPPORTED - String not supported. - EFI_SUCCESS - Operation succeeded. - ---*/ -{ - if ((Buffer == NULL) || (Value == NULL)) { - return EFI_INVALID_PARAMETER; - } - - if (StriCmp (Buffer, L"True") == 0) { - *Value = TRUE; - } else if (StriCmp (Buffer, L"False") == 0) { - *Value = FALSE; - } else { - return EFI_UNSUPPORTED; - } - - return EFI_SUCCESS; -} - -BOOLEAN -EntStrBeginWith ( - IN CHAR16 *Str, - IN CHAR16 *SubStr - ) -/*++ - -Routine Description: - - Test if the string is begin with the sub string. - -Arguments: - - Str - The pointer to the string being tested - SubStr - The pointer to the sub string - -Returns: - - TRUE - The Str is begin with SubStr. - FALSE - The Str not begin with SubStr. - ---*/ -{ - CHAR16 *Temp; - - if ((Str == NULL) || (SubStr == NULL) || (StrLen (Str) < StrLen (SubStr))) { - return FALSE; - } - // - // Remove the pre-space characters - // - Temp = SubStr; - - while (*Temp == L' ') { - Temp = Temp + 1; - } - // - // Compare - // - if (StrnCmp (Str, Temp, StrLen (Temp)) == 0) { - return TRUE; - } else { - return FALSE; - } -} - BOOLEAN EntsStrEndWith ( IN CHAR16 *Str, @@ -1222,48 +722,6 @@ Returns: return EFI_SUCCESS; } -UINTN -HexStringToValue ( - IN CHAR16 *String, - IN UINTN Length - ) -/*++ - -Routine Description: - - Convert a hex string to a value. - -Arguments: - - String - Hex string buffer. - Length - Hex string length. - -Returns: - - Converted value. - ---*/ -{ - UINTN Index; - UINTN Value; - - Value = 0; - - for (Index = 0; Index < Length; Index++) { - if ((String[Index] >= L'0') && (String[Index] <= L'9')) { - Value = (Value << 4) + (String[Index] - L'0'); - } else if ((String[Index] >= L'A') && (String[Index] <= L'F')) { - Value = (Value << 4) + (String[Index] - L'A' + 10); - } else if ((String[Index] >= L'a') && (String[Index] <= L'f')) { - Value = (Value << 4) + (String[Index] - L'a' + 10); - } else { - return 0; - } - } - - return Value; -} - INTN a2i ( IN CHAR16 Ch @@ -1284,154 +742,6 @@ a2i ( return -1; } -CHAR16 -i2A ( - UINTN x - ) -{ - if (x >= 0 && x <= 9) { - return (CHAR16) (x + '0'); - } - - if (x >= 10 && x <= 15) { - return (CHAR16) (x - 10 + 'A'); - } - - return 0; -} - -CHAR16 -i2a ( - UINTN x - ) -{ - if (x >= 0 && x <= 9) { - return (CHAR16) (x + '0'); - } - - if (x >= 10 && x <= 15) { - return (CHAR16) (x - 10 + 'a'); - } - - return 0; -} - -EFI_STATUS -EntsStrToIp ( - IN CHAR16 *Str, - IN OUT EFI_IP_ADDRESS *IpAddr - ) -{ - UINT8 i; - INTN templen; - CHAR16 *s; - UINTN temp; - - templen = 0; - s = Str; - temp = 0; - - SetMem (IpAddr, sizeof (EFI_IP_ADDRESS), 0); - for (i = 0; i < 4; i++) { - templen = EntsStrToUINTN (s, &temp); - if ((templen < 0) || (temp > 255)) { - return EFI_INVALID_PARAMETER; - } - - IpAddr->v4.Addr[i] = (UINT8) temp; - if (i == 3) { - break; - } - - if (s[templen] != L'.') { - return EFI_INVALID_PARAMETER; - } - - s = &s[templen + 1]; - } - - return EFI_SUCCESS; -} - -EFI_STATUS -EntsIpToStr ( - IN EFI_IP_ADDRESS *IpAddr, - IN UINTN StrSize, - OUT CHAR16 *Str - ) -{ - EntsSPrint ( - Str, - StrSize, - L"%d.%d.%d.%d", - IpAddr->v4.Addr[0], - IpAddr->v4.Addr[1], - IpAddr->v4.Addr[2], - IpAddr->v4.Addr[3] - ); - - return EFI_SUCCESS; -} - -EFI_STATUS -EntsStrToMac ( - IN CHAR16 *Str, - IN OUT EFI_MAC_ADDRESS *MacAddr - ) -{ - UINT8 i; - INTN templen; - CHAR16 *s; - UINTN temp; - - templen = 0; - s = Str; - temp = 0; - - SetMem (MacAddr, sizeof (EFI_MAC_ADDRESS), 0); - for (i = 0; i < 6; i++) { - templen = EntsHexStrToUINTN (s, &temp); - if ((templen < 0) || (temp > 255)) { - return EFI_INVALID_PARAMETER; - } - - MacAddr->Addr[i] = (UINT8) temp; - if (i == 5) { - break; - } - - if (s[templen] != L':') { - return EFI_INVALID_PARAMETER; - } - - s = &s[templen + 1]; - } - - return EFI_SUCCESS; -} - -EFI_STATUS -EntsMacToStr ( - IN OUT EFI_MAC_ADDRESS *MacAddr, - IN UINTN StrSize, - OUT CHAR16 *Str - ) -{ - EntsSPrint ( - Str, - StrSize, - L"%02x:%02x:%02x:%02x:%02x:%02x", - MacAddr->Addr[0], - MacAddr->Addr[1], - MacAddr->Addr[2], - MacAddr->Addr[3], - MacAddr->Addr[4], - MacAddr->Addr[5] - ); - - return EFI_SUCCESS; -} - EFI_STATUS EntsTimeToStr ( IN EFI_TIME *Time, diff --git a/TestFrameworkPkg/Library/EasLib/EntsSupport.c b/TestFrameworkPkg/Library/EasLib/EntsSupport.c index 6cacd3b..efd2c87 100644 --- a/TestFrameworkPkg/Library/EasLib/EntsSupport.c +++ b/TestFrameworkPkg/Library/EasLib/EntsSupport.c @@ -49,21 +49,20 @@ UINTN NICDevicePathLen = 0; CHAR16 NICDevicePathStr[MAX_DEVICE_PATH_STR_LEN] = {0, }; #define SCT_AGENT_NIC_DEVICE_PATH L"Sct Agent NIC Device Path" -EFI_GUID gSctVendorGuid = {0x72092b90, 0x17da, 0x47d1, 0x95, 0xce, 0x88, 0xf0, 0x12, 0xe8, 0x50, 0x8d}; +EFI_GUID gSctVendorGuid = {0x72092b90, 0x17da, 0x47d1, {0x95, 0xce, 0x88, 0xf0, 0x12, 0xe8, 0x50, 0x8d}}; #define MAX_PACKET_LENGTH 1492 STATIC EFI_MANAGED_NETWORK_TRANSMIT_DATA EntsMnpTxDataTemplate = { &NetAssertionConfigData.ServerMac, // DestinationAddress &NetAssertionConfigData.MacAddr, // SourceAddress - 0x0800, // ProtocolType + 0x0800, // ProtocolType 0, // DataLength 0, // HeaderLength 1, // FragmentCount - { - 0, - NULL - } // FragmentTable + { // FragmentTable + {0, NULL} + } }; #define ENTS_SERVER_MAC_ADDRESS_NAME L"ServerMac" diff --git a/TestFrameworkPkg/Library/EasLib/EntsTime.c b/TestFrameworkPkg/Library/EasLib/EntsTime.c index 2565443..c93e51c 100644 --- a/TestFrameworkPkg/Library/EasLib/EntsTime.c +++ b/TestFrameworkPkg/Library/EasLib/EntsTime.c @@ -18,7 +18,7 @@ // // Global variables and definitions // -#define IS_LEAP(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) +#define IS_LEAP(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) static const UINTN MonthLengths[2][12] = { { diff --git a/TestFrameworkPkg/Library/EfiTestLib/EfiTestLib.c b/TestFrameworkPkg/Library/EfiTestLib/EfiTestLib.c index ac9912b..20d2dec 100644 --- a/TestFrameworkPkg/Library/EfiTestLib/EfiTestLib.c +++ b/TestFrameworkPkg/Library/EfiTestLib/EfiTestLib.c @@ -87,6 +87,7 @@ CompareGuid ( ); BOOLEAN +EFIAPI CheckBBTestCanRunAndRecordAssertion ( IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, IN CHAR16 *AssertionString, @@ -870,6 +871,7 @@ CompareGuid ( #if (EFI_SPECIFICATION_VERSION >= 0x00020000) BOOLEAN +EFIAPI CheckBBTestCanRunAndRecordAssertion ( IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, IN CHAR16 *AssertionString, @@ -895,6 +897,7 @@ CheckBBTestCanRunAndRecordAssertion ( #else BOOLEAN +EFIAPI CheckBBTestCanRunAndRecordAssertion ( IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, IN CHAR16 *AssertionString, @@ -908,6 +911,7 @@ CheckBBTestCanRunAndRecordAssertion ( #endif EFI_STATUS +EFIAPI EfiTestLibGetSystemConfigurationTable ( IN EFI_GUID *TableGuid, IN OUT VOID **Table diff --git a/TestFrameworkPkg/MonitorServices/IP4NetworkMonitor/IP4NetworkMonitor.c b/TestFrameworkPkg/MonitorServices/IP4NetworkMonitor/IP4NetworkMonitor.c index a4775a2..1e64787 100644 --- a/TestFrameworkPkg/MonitorServices/IP4NetworkMonitor/IP4NetworkMonitor.c +++ b/TestFrameworkPkg/MonitorServices/IP4NetworkMonitor/IP4NetworkMonitor.c @@ -65,15 +65,15 @@ STATIC LINK_LAYER_STATUS LinkStatus = WaitForPacket; #define DESTINATION_ADDRESS \ { \ - 255, 255, 255, 255 \ + {255, 255, 255, 255} \ } #define STATION_ADDRESS \ { \ - 0, 0, 0, 0 \ + {0, 0, 0, 0} \ } #define SUBNET_MASK \ { \ - 0, 0, 0, 0 \ + {0, 0, 0, 0} \ } EFI_IP4_CONFIG_DATA mIp4ConfigDataTemplate = { @@ -104,8 +104,7 @@ EFI_IP4_TRANSMIT_DATA mIp4TxDataTemplate = { 0, // TotalDataLength 1, // FragmentCount { - 0, - NULL + {0, NULL} } // FragmentTable }; @@ -121,8 +120,7 @@ EFI_IP4_RECEIVE_DATA mIp4RxDataTemplate = { 0, // DataLength 1, // FragmentCount { - 0, - NULL + {0, NULL} } // FragmentTable }; @@ -141,12 +139,14 @@ StartInitIp4 ( ); VOID +EFIAPI NotifyFunctionSend ( EFI_EVENT Event, VOID *Context ); VOID +EFIAPI NotifyFunctionListen ( EFI_EVENT Event, VOID *Context @@ -173,6 +173,7 @@ SetResendTimer ( ); VOID +EFIAPI ReSendTimer ( IN EFI_EVENT Event, IN VOID *Context @@ -263,6 +264,7 @@ Error: } EFI_STATUS +EFIAPI IP4NetworkMonitorUnload ( IN EFI_HANDLE ImageHandle ) @@ -303,6 +305,7 @@ Returns: // External functions implementations // EFI_STATUS +EFIAPI InitIP4Network ( IN EFI_ENTS_MONITOR_PROTOCOL *This ) @@ -411,6 +414,7 @@ Returns: } EFI_STATUS +EFIAPI ResetIP4Network ( IN EFI_ENTS_MONITOR_PROTOCOL *This ) @@ -565,6 +569,7 @@ Returns: } EFI_STATUS +EFIAPI IP4NetworkSaveContext( EFI_ENTS_MONITOR_PROTOCOL *This ) @@ -588,6 +593,7 @@ IP4NetworkSaveContext( } EFI_STATUS +EFIAPI IP4NetworkRestoreContext( IN EFI_ENTS_MONITOR_PROTOCOL *This ) @@ -614,6 +620,7 @@ IP4NetworkRestoreContext( } EFI_STATUS +EFIAPI IP4NetworkListener ( IN EFI_ENTS_MONITOR_PROTOCOL *This, IN OUT UINTN *Size, @@ -673,6 +680,7 @@ Returns: } EFI_STATUS +EFIAPI IP4NetworkSender ( IN EFI_ENTS_MONITOR_PROTOCOL *This, IN CHAR16 *Buffer @@ -890,6 +898,7 @@ Returns: } VOID +EFIAPI NotifyFunctionSend ( EFI_EVENT Event, VOID *Context @@ -915,6 +924,7 @@ Returns: } VOID +EFIAPI NotifyFunctionListen ( EFI_EVENT Event, VOID *Context @@ -1099,6 +1109,7 @@ Returns: } VOID +EFIAPI ReSendTimer ( IN EFI_EVENT Event, IN VOID *Context diff --git a/TestFrameworkPkg/MonitorServices/IP4NetworkMonitor/IP4NetworkMonitor.h b/TestFrameworkPkg/MonitorServices/IP4NetworkMonitor/IP4NetworkMonitor.h index 5885a8d..256d2b2 100644 --- a/TestFrameworkPkg/MonitorServices/IP4NetworkMonitor/IP4NetworkMonitor.h +++ b/TestFrameworkPkg/MonitorServices/IP4NetworkMonitor/IP4NetworkMonitor.h @@ -20,7 +20,7 @@ #define ENTS_VENDOR_GUID \ { \ - 0x868b4f16, 0xc83a, 0x4205, 0xa9, 0x3c, 0x3f, 0x51, 0xcf, 0x7f, 0x61, 0xc0 \ + 0x868b4f16, 0xc83a, 0x4205, {0xa9, 0x3c, 0x3f, 0x51, 0xcf, 0x7f, 0x61, 0xc0} \ } #define ENTS_SERVER_IPV4_ADDRESS_NAME L"ServerIp" @@ -56,6 +56,7 @@ typedef enum { } LINK_LAYER_STATUS; EFI_STATUS +EFIAPI IP4NetworkSaveContext( EFI_ENTS_MONITOR_PROTOCOL *This ) @@ -79,6 +80,7 @@ Returns: ; EFI_STATUS +EFIAPI IP4NetworkRestoreContext( IN EFI_ENTS_MONITOR_PROTOCOL *This ) @@ -105,6 +107,7 @@ Returns: // External functions declarations // EFI_STATUS +EFIAPI IP4NetworkListener ( IN EFI_ENTS_MONITOR_PROTOCOL *This, IN OUT UINTN *Size, @@ -131,6 +134,7 @@ Returns: ; EFI_STATUS +EFIAPI IP4NetworkSender ( IN EFI_ENTS_MONITOR_PROTOCOL *This, IN CHAR16 *Buffer @@ -157,6 +161,7 @@ Returns: ; EFI_STATUS +EFIAPI InitIP4Network ( IN EFI_ENTS_MONITOR_PROTOCOL *This ) @@ -179,6 +184,7 @@ Returns: ; EFI_STATUS +EFIAPI ResetIP4Network ( IN EFI_ENTS_MONITOR_PROTOCOL *This ) diff --git a/TestFrameworkPkg/MonitorServices/ManagedNetworkMonitor/ManagedNetworkMonitor.c b/TestFrameworkPkg/MonitorServices/ManagedNetworkMonitor/ManagedNetworkMonitor.c index 8d2a8c2..a8407fc 100644 --- a/TestFrameworkPkg/MonitorServices/ManagedNetworkMonitor/ManagedNetworkMonitor.c +++ b/TestFrameworkPkg/MonitorServices/ManagedNetworkMonitor/ManagedNetworkMonitor.c @@ -68,8 +68,8 @@ STATIC UINT32 mCurrentOpCode; STATIC UINT32 mCurrentSeqId; STATIC UINT32 mCurrentPacketLength; -EFI_MAC_ADDRESS mDestinationAddress = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -EFI_MAC_ADDRESS mSourceAddress = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +EFI_MAC_ADDRESS mDestinationAddress = { {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; +EFI_MAC_ADDRESS mSourceAddress = { {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; EFI_MANAGED_NETWORK_CONFIG_DATA mMnpConfigDataTemplate = { // @@ -95,8 +95,7 @@ EFI_MANAGED_NETWORK_TRANSMIT_DATA mMnpTxDataTemplate = { 0, // HeaderLength 1, // FragmentCount { - 0, - NULL + {0,NULL} } // FragmentTable }; @@ -142,12 +141,14 @@ MnpSendPacketOut ( ); VOID +EFIAPI NotifyFunctionSend ( EFI_EVENT Event, VOID *Context ); VOID +EFIAPI NotifyFunctionListen ( EFI_EVENT Event, VOID *Context @@ -180,12 +181,14 @@ SetResendTimer ( ); VOID +EFIAPI ReSendTimer ( IN EFI_EVENT Event, IN VOID *Context ); EFI_STATUS +EFIAPI ManagedNetworkMonitorUnload ( IN EFI_HANDLE ImageHandle ); @@ -858,7 +861,8 @@ Returns: // if (BufferSize <= MAX_PACKET_LENGTH) { IsOver = TRUE; - CLR_FLAG_MF (FragFlag.LLFlag); +// CLR_FLAG_MF (FragFlag.LLFlag); + FragFlag.Flag.MF = 0; PacketLength = (UINT32) BufferSize; FragFlag.Flag.Offset = HTONS ((UINT16)PacketStartPoint); } else { @@ -866,7 +870,8 @@ Returns: // Need more fragement // IsOver = FALSE; - SET_FLAG_MF (FragFlag.LLFlag); +// SET_FLAG_MF (FragFlag.LLFlag); + FragFlag.Flag.MF = 1; PacketLength = MAX_PACKET_LENGTH; FragFlag.Flag.Offset = HTONS ((UINT16)PacketStartPoint); BufferSize -= MAX_PACKET_LENGTH; @@ -1121,6 +1126,7 @@ ManagedNetworkRefresh( } VOID +EFIAPI NotifyFunctionListen ( EFI_EVENT Event, VOID *Context @@ -1184,7 +1190,8 @@ Returns: SequenceId = NTOHL (FragFlag.Flag.SeqId); PacketStartPoint = NTOHS ((UINT16)(FragFlag.Flag.Offset)); PacketLength = RxData->DataLength - sizeof (EAS_MNP_FRAG_FLAG); - IsOver = HAS_FLAG_MF (FragFlag.LLFlag) ? FALSE : TRUE; +// IsOver = HAS_FLAG_MF (FragFlag.LLFlag) ? FALSE : TRUE; + IsOver = FragFlag.Flag.MF ? FALSE : TRUE; OpCode = FragFlag.Flag.OpCode; // @@ -1399,6 +1406,7 @@ RESTART_RECEIVE: } VOID +EFIAPI ReSendTimer ( IN EFI_EVENT Event, IN VOID *Context diff --git a/TestFrameworkPkg/MonitorServices/ManagedNetworkMonitor/ManagedNetworkMonitor.h b/TestFrameworkPkg/MonitorServices/ManagedNetworkMonitor/ManagedNetworkMonitor.h index f7db299..f9ac4ad 100644 --- a/TestFrameworkPkg/MonitorServices/ManagedNetworkMonitor/ManagedNetworkMonitor.h +++ b/TestFrameworkPkg/MonitorServices/ManagedNetworkMonitor/ManagedNetworkMonitor.h @@ -75,6 +75,7 @@ typedef enum { #define MAX_PACKET_LENGTH 1492 EFI_STATUS +EFIAPI ManagedNetworkSaveContext ( IN EFI_ENTS_MONITOR_PROTOCOL *This ) @@ -98,6 +99,7 @@ Returns: ; EFI_STATUS +EFIAPI ManagedNetworkRestoreContext( IN EFI_ENTS_MONITOR_PROTOCOL *This ) @@ -124,6 +126,7 @@ Returns: // External functions declarations // EFI_STATUS +EFIAPI ManagedNetworkListener ( IN EFI_ENTS_MONITOR_PROTOCOL *This, IN OUT UINTN *Size, @@ -150,6 +153,7 @@ Returns: ; EFI_STATUS +EFIAPI ManagedNetworkSender ( IN EFI_ENTS_MONITOR_PROTOCOL *This, IN CHAR16 *Buffer @@ -175,6 +179,7 @@ Returns: ; EFI_STATUS +EFIAPI InitManagedNetwork ( IN EFI_ENTS_MONITOR_PROTOCOL *This ) /*++ @@ -196,6 +201,7 @@ Returns: ; EFI_STATUS +EFIAPI ResetManagedNetwork ( IN EFI_ENTS_MONITOR_PROTOCOL *This ) /*++ diff --git a/TestFrameworkPkg/Sct/ENTS/EasDispatcher/Rivl/RivlType.c b/TestFrameworkPkg/Sct/ENTS/EasDispatcher/Rivl/RivlType.c index 2d0bb28..0e8f05e 100644 --- a/TestFrameworkPkg/Sct/ENTS/EasDispatcher/Rivl/RivlType.c +++ b/TestFrameworkPkg/Sct/ENTS/EasDispatcher/Rivl/RivlType.c @@ -80,7 +80,10 @@ RIVL_INTERNAL_TYPE gRivlInternalTypeArray[] = { L"POINTER", sizeof (VOID *) }, - 0 + { + L"", + 0 + } }; // diff --git a/TestFrameworkPkg/Sct/Execute/ExecuteSupport.c b/TestFrameworkPkg/Sct/Execute/ExecuteSupport.c index 8036050..ecd4112 100644 --- a/TestFrameworkPkg/Sct/Execute/ExecuteSupport.c +++ b/TestFrameworkPkg/Sct/Execute/ExecuteSupport.c @@ -928,6 +928,7 @@ GatherConfigHandles ( } BOOLEAN +EFIAPI IhvInterfaceFilter ( IN VOID *ClientInterface, IN EFI_HANDLE SupportHandle, diff --git a/TestFrameworkPkg/Sct/Execute/ExecuteSupport.h b/TestFrameworkPkg/Sct/Execute/ExecuteSupport.h index 680eb2b..a98bac2 100644 --- a/TestFrameworkPkg/Sct/Execute/ExecuteSupport.h +++ b/TestFrameworkPkg/Sct/Execute/ExecuteSupport.h @@ -80,6 +80,7 @@ BOOLEAN ); BOOLEAN +EFIAPI IhvInterfaceFilter ( IN VOID *ClientInterface, IN EFI_HANDLE SupportHandle, diff --git a/TestFrameworkPkg/Sct/Include/SctCore.h b/TestFrameworkPkg/Sct/Include/SctCore.h index 36c2361..861cc0b 100644 --- a/TestFrameworkPkg/Sct/Include/SctCore.h +++ b/TestFrameworkPkg/Sct/Include/SctCore.h @@ -20,6 +20,7 @@ // EFI_STATUS +EFIAPI InitializeSct ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable diff --git a/TestFrameworkPkg/Sct/Include/SctDef.h b/TestFrameworkPkg/Sct/Include/SctDef.h index d0c4226..2d04ca9 100644 --- a/TestFrameworkPkg/Sct/Include/SctDef.h +++ b/TestFrameworkPkg/Sct/Include/SctDef.h @@ -65,7 +65,7 @@ // System hang assertion // #define EFI_SYSTEM_HANG_ASSERTION_GUID \ - { 0xde687a18, 0x0bbd, 0x4396, 0x85, 0x09, 0x49, 0x8f, 0xf2, 0x32, 0x34, 0xf1 } + { 0xde687a18, 0x0bbd, 0x4396, {0x85, 0x09, 0x49, 0x8f, 0xf2, 0x32, 0x34, 0xf1 }} // // Global variables diff --git a/TestFrameworkPkg/Sct/Misc/SctMisc.c b/TestFrameworkPkg/Sct/Misc/SctMisc.c index 1108f63..73f63f5 100644 --- a/TestFrameworkPkg/Sct/Misc/SctMisc.c +++ b/TestFrameworkPkg/Sct/Misc/SctMisc.c @@ -1400,7 +1400,7 @@ Routine Description: StrCpy (Buffer, L"Exhaustive"); break; default: - EFI_UNSUPPORTED; + return EFI_UNSUPPORTED; } return EFI_SUCCESS; diff --git a/TestFrameworkPkg/Sct/UI/BuildMenu.c b/TestFrameworkPkg/Sct/UI/BuildMenu.c index 5d77dd5..dfa3d6c 100644 --- a/TestFrameworkPkg/Sct/UI/BuildMenu.c +++ b/TestFrameworkPkg/Sct/UI/BuildMenu.c @@ -40,6 +40,7 @@ CreateStandardMenuPage ( ); EFI_STATUS +EFIAPI DestroyMenuPage ( IN EFI_MENU_PAGE *Page ); @@ -266,6 +267,7 @@ Returns: EFI_STATUS +EFIAPI DestroyMenuPage ( IN EFI_MENU_PAGE *Page ) diff --git a/TestFrameworkPkg/Sct/UI/BuildMenu.h b/TestFrameworkPkg/Sct/UI/BuildMenu.h index 01ccdad..a2f4b80 100644 --- a/TestFrameworkPkg/Sct/UI/BuildMenu.h +++ b/TestFrameworkPkg/Sct/UI/BuildMenu.h @@ -20,7 +20,7 @@ // #include "Sct.h" -#include "Ui.h" +#include "UI.h" // // Definitions @@ -50,6 +50,7 @@ CreateStandardMenuPage ( ); EFI_STATUS +EFIAPI DestroyMenuPage ( IN EFI_MENU_PAGE *Page ); @@ -169,6 +170,7 @@ DisplayMainMenu ( // EFI_STATUS +EFIAPI DisplayConfigMenu ( IN EFI_MENU_PAGE *ParentPage ); @@ -178,6 +180,7 @@ DisplayConfigMenu ( // EFI_STATUS +EFIAPI DisplayCaseMgmtMenu ( IN EFI_MENU_PAGE *ParentPage ); @@ -187,6 +190,7 @@ DisplayCaseMgmtMenu ( // EFI_STATUS +EFIAPI DisplayProtocolMenu ( IN EFI_MENU_PAGE *ParentPage ); @@ -196,6 +200,7 @@ DisplayProtocolMenu ( // EFI_STATUS +EFIAPI DisplayDriverMenu ( IN EFI_MENU_PAGE *ParentPage ); @@ -205,11 +210,13 @@ DisplayDriverMenu ( // EFI_STATUS +EFIAPI DisplayFileNameMenu ( IN EFI_MENU_PAGE *ParentPage ); EFI_STATUS +EFIAPI DisplaySequenceMenu ( IN EFI_MENU_PAGE *ParentPage ); @@ -228,6 +235,7 @@ DisplayCaseMenu ( //prototypes (from ResultMgmtMenu.c) // EFI_STATUS +EFIAPI DisplayResultMgmtMenu ( IN EFI_MENU_PAGE *ParentPage ); @@ -235,6 +243,7 @@ DisplayResultMgmtMenu ( //protypes (from UtilityMenu.c) // EFI_STATUS +EFIAPI DisplayUtilityMenu ( IN EFI_MENU_PAGE *ParentPage ); diff --git a/TestFrameworkPkg/Sct/UI/ConfigMenu.c b/TestFrameworkPkg/Sct/UI/ConfigMenu.c index 8aebf4e..dac0788 100644 --- a/TestFrameworkPkg/Sct/UI/ConfigMenu.c +++ b/TestFrameworkPkg/Sct/UI/ConfigMenu.c @@ -12,7 +12,7 @@ **/ -#include "SCT.h" +#include "Sct.h" #include "BuildMenu.h" // @@ -37,21 +37,25 @@ BOOLEAN ItemValueChanged = FALSE; // EFI_STATUS +EFIAPI DisplayConfigMenu ( IN EFI_MENU_PAGE *ParentPage ); EFI_STATUS +EFIAPI ConfigMenuEscFunc ( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI ConfigMenuSetDefaultFunc ( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI ConfigMenuDescPrintFunc ( IN EFI_MENU_ITEM *MenuItem, IN VOID *Context, @@ -64,6 +68,7 @@ ConfigMenuDescPrintFunc ( // EFI_STATUS +EFIAPI DisplayConfigMenu ( IN EFI_MENU_PAGE *ParentPage ) @@ -511,6 +516,7 @@ Returns: } EFI_STATUS +EFIAPI ConfigMenuSetDefaultFunc ( IN EFI_MENU_PAGE *MenuPage ) @@ -758,6 +764,7 @@ Returns: } EFI_STATUS +EFIAPI ConfigMenuEscFunc ( IN EFI_MENU_PAGE *Page ) @@ -898,6 +905,7 @@ Returns: } EFI_STATUS +EFIAPI ConfigMenuDescPrintFunc ( IN EFI_MENU_ITEM *MenuItem, IN VOID *Context, diff --git a/TestFrameworkPkg/Sct/UI/Dialog.h b/TestFrameworkPkg/Sct/UI/Dialog.h index d662602..90755b9 100644 --- a/TestFrameworkPkg/Sct/UI/Dialog.h +++ b/TestFrameworkPkg/Sct/UI/Dialog.h @@ -24,7 +24,7 @@ #include #include -#include "Ui.h" +#include "UI.h" #include diff --git a/TestFrameworkPkg/Sct/UI/DisplayUi.c b/TestFrameworkPkg/Sct/UI/DisplayUi.c index b04426c..13ae1b6 100644 --- a/TestFrameworkPkg/Sct/UI/DisplayUi.c +++ b/TestFrameworkPkg/Sct/UI/DisplayUi.c @@ -45,21 +45,25 @@ SetScrollBarPos ( ); EFI_STATUS +EFIAPI MenuBodyRefresh ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI MenuFooterRefresh ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI MenuBodyItemsRefresh ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI MenuItemRefresh ( IN EFI_MENU_PAGE *MenuPage, IN EFI_MENU_ITEM *Item, @@ -67,6 +71,7 @@ MenuItemRefresh ( ); EFI_STATUS +EFIAPI MenuPageRefresh ( IN EFI_MENU_PAGE *MenuPage ); @@ -278,6 +283,7 @@ Returns: } EFI_STATUS +EFIAPI MenuHeaderRefresh ( IN EFI_MENU_PAGE *MenuPage ) @@ -379,6 +385,7 @@ Returns: } EFI_STATUS +EFIAPI MenuBodyRefresh ( IN EFI_MENU_PAGE *MenuPage ) @@ -728,6 +735,7 @@ Returns: } EFI_STATUS +EFIAPI MenuFooterRefresh ( IN EFI_MENU_PAGE *MenuPage ) @@ -868,6 +876,7 @@ Returns: } EFI_STATUS +EFIAPI MenuBodyItemsRefresh ( IN EFI_MENU_PAGE *MenuPage ) @@ -1061,6 +1070,7 @@ Returns: } EFI_STATUS +EFIAPI MenuItemRefresh ( IN EFI_MENU_PAGE *MenuPage, IN EFI_MENU_ITEM *Item, @@ -1562,6 +1572,7 @@ Returns: } EFI_STATUS +EFIAPI MenuItemStatusRefresh ( IN EFI_MENU_PAGE *MenuPage, IN EFI_MENU_ITEM *Item, @@ -1752,6 +1763,7 @@ Returns: } EFI_STATUS +EFIAPI MenuPageRefresh ( IN EFI_MENU_PAGE *MenuPage ) diff --git a/TestFrameworkPkg/Sct/UI/FileDialog.h b/TestFrameworkPkg/Sct/UI/FileDialog.h index bfc2bf2..4801fc0 100644 --- a/TestFrameworkPkg/Sct/UI/FileDialog.h +++ b/TestFrameworkPkg/Sct/UI/FileDialog.h @@ -24,7 +24,7 @@ #include #include -#include "Ui.h" +#include "UI.h" #include // diff --git a/TestFrameworkPkg/Sct/UI/KeyFunction.c b/TestFrameworkPkg/Sct/UI/KeyFunction.c index 34e683f..e585489 100644 --- a/TestFrameworkPkg/Sct/UI/KeyFunction.c +++ b/TestFrameworkPkg/Sct/UI/KeyFunction.c @@ -30,44 +30,52 @@ extern BOOLEAN gMenuExit; //protypes (external) // EFI_STATUS +EFIAPI DoDefault ( IN EFI_MENU_PAGE *MenuPage, IN EFI_INPUT_KEY *InKey ); EFI_STATUS +EFIAPI UpFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI DownFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI DoEdit ( IN EFI_MENU_PAGE *MenuPage, IN OUT EFI_INPUT_KEY *InKey ); EFI_STATUS +EFIAPI DoIterEdit ( IN EFI_MENU_PAGE *MenuPage, IN OUT EFI_INPUT_KEY *InKey ); EFI_STATUS +EFIAPI SpaceFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI LeftArrowFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI RightArrowFunc ( IN EFI_MENU_PAGE *MenuPage ); @@ -110,6 +118,7 @@ CompareNumberString ( // EFI_STATUS +EFIAPI DoDefault ( IN EFI_MENU_PAGE *MenuPage, IN EFI_INPUT_KEY *InKey @@ -141,6 +150,7 @@ Returns: } EFI_STATUS +EFIAPI UpFunc ( IN EFI_MENU_PAGE *MenuPage ) @@ -237,6 +247,7 @@ Returns: } EFI_STATUS +EFIAPI DownFunc ( IN EFI_MENU_PAGE *MenuPage ) @@ -359,6 +370,7 @@ Returns: } EFI_STATUS +EFIAPI PageUpFunc ( IN EFI_MENU_PAGE *MenuPage ) @@ -469,6 +481,7 @@ Returns: } EFI_STATUS +EFIAPI PageDownFunc ( IN EFI_MENU_PAGE *MenuPage ) @@ -603,6 +616,7 @@ Returns: EFI_STATUS +EFIAPI DoEdit ( IN EFI_MENU_PAGE *MenuPage, IN OUT EFI_INPUT_KEY *InKey @@ -1425,6 +1439,7 @@ Returns: } EFI_STATUS +EFIAPI SpaceFunc( IN EFI_MENU_PAGE *MenuPage ) @@ -1542,6 +1557,7 @@ Returns: } EFI_STATUS +EFIAPI LeftArrowFunc( IN EFI_MENU_PAGE *MenuPage ) @@ -1635,6 +1651,7 @@ Returns: } EFI_STATUS +EFIAPI RightArrowFunc( IN EFI_MENU_PAGE *MenuPage ) @@ -2152,6 +2169,7 @@ Returns: } EFI_STATUS +EFIAPI DoIterEdit ( IN EFI_MENU_PAGE *MenuPage, IN OUT EFI_INPUT_KEY *InKey diff --git a/TestFrameworkPkg/Sct/UI/LogFileDialog.c b/TestFrameworkPkg/Sct/UI/LogFileDialog.c index 9b16ad8..e10fa73 100644 --- a/TestFrameworkPkg/Sct/UI/LogFileDialog.c +++ b/TestFrameworkPkg/Sct/UI/LogFileDialog.c @@ -2370,7 +2370,7 @@ Returns: if (*Ptr == '\\' && *(Ptr+1) == '.' && *(Ptr+2) == '.' && *(Ptr+3) != 0) { // - // Convert \Name\..\ to \ + // Convert "\Name\..\" to "\" // DO NOT convert the .. if it is at the end of the string. This will // break the .. behavior in changing directories. // @@ -2380,7 +2380,7 @@ Returns: } else if (*Ptr == '\\' && *(Ptr+1) == '.' && *(Ptr + 2) == '\\') { // - // Convert a \.\ to a \ + // Convert a "\.\" to a "\" // StrCpy (TempStr, Ptr + 2); StrCpy (Ptr, TempStr); diff --git a/TestFrameworkPkg/Sct/UI/LogFileDialog.h b/TestFrameworkPkg/Sct/UI/LogFileDialog.h index 1db7f09..10b21ac 100644 --- a/TestFrameworkPkg/Sct/UI/LogFileDialog.h +++ b/TestFrameworkPkg/Sct/UI/LogFileDialog.h @@ -24,7 +24,7 @@ #include #include -#include "Ui.h" +#include "UI.h" #include // diff --git a/TestFrameworkPkg/Sct/UI/MainMenu.c b/TestFrameworkPkg/Sct/UI/MainMenu.c index c44b406..cc79f8b 100644 --- a/TestFrameworkPkg/Sct/UI/MainMenu.c +++ b/TestFrameworkPkg/Sct/UI/MainMenu.c @@ -54,46 +54,55 @@ DisplayMainMenu ( // VOID +EFIAPI DisplayDeviceConfig ( IN EFI_MENU_PAGE *Page ); VOID +EFIAPI DisplayReportGenerator( IN EFI_MENU_PAGE *Page ); VOID +EFIAPI DisplayLog( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI MainMenuEnterFunc ( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI MainMenuEscFunc ( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI MainMenuLoadSeqFunc ( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI MainMenuSaveSeqFunc ( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI MainMenuF9Func( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI MainMenuClearFunc ( IN EFI_MENU_PAGE *Page ); @@ -416,6 +425,7 @@ Returns: } EFI_STATUS +EFIAPI MainMenuEnterFunc ( IN EFI_MENU_PAGE *Page ) @@ -472,6 +482,7 @@ Reutrns EFI_STATUS +EFIAPI MainMenuEscFunc ( IN EFI_MENU_PAGE *Page ) @@ -506,6 +517,7 @@ Returns: } VOID +EFIAPI DisplayDeviceConfig ( IN EFI_MENU_PAGE *Page ) @@ -548,6 +560,7 @@ DisplayDeviceConfig ( } VOID +EFIAPI DisplayReportGenerator( IN EFI_MENU_PAGE *Page ) @@ -661,6 +674,7 @@ DisplayReportGenerator( VOID +EFIAPI DisplayLog ( IN EFI_MENU_PAGE *Page ) @@ -767,6 +781,7 @@ DisplayLog ( } EFI_STATUS +EFIAPI MainMenuLoadSeqFunc ( IN EFI_MENU_PAGE *Page ) @@ -853,6 +868,7 @@ MainMenuLoadSeqFunc ( EFI_STATUS +EFIAPI MainMenuSaveSeqFunc ( IN EFI_MENU_PAGE *Page ) @@ -944,6 +960,7 @@ MainMenuSaveSeqFunc ( } EFI_STATUS +EFIAPI MainMenuF9Func( IN EFI_MENU_PAGE *Page ) @@ -1004,6 +1021,7 @@ Returns: } EFI_STATUS +EFIAPI MainMenuClearFunc ( IN EFI_MENU_PAGE *Page ) diff --git a/TestFrameworkPkg/Sct/UI/TestNodeMenu.c b/TestFrameworkPkg/Sct/UI/TestNodeMenu.c index 0cdf597..72ac50e 100644 --- a/TestFrameworkPkg/Sct/UI/TestNodeMenu.c +++ b/TestFrameworkPkg/Sct/UI/TestNodeMenu.c @@ -40,26 +40,31 @@ DisplayTestNodeMenu ( // Prototypes (internal) // EFI_STATUS +EFIAPI TestNodeMenuEnterFunc ( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI TestNodeMenuEscFunc ( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI TestNodeMenuSpaceFunc( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI TestNodeMenuF9Func( IN EFI_MENU_PAGE *Page ); EFI_STATUS +EFIAPI TestNodeMenuF8Func( IN EFI_MENU_PAGE *Page ); @@ -87,6 +92,7 @@ UnSelectTestNode ( ); EFI_STATUS +EFIAPI TestNodeMenuDescPrintFunc ( IN EFI_MENU_ITEM *MenuItem, IN VOID *Context, @@ -388,6 +394,7 @@ Returns: } EFI_STATUS +EFIAPI TestNodeMenuEnterFunc ( IN EFI_MENU_PAGE *Page ) @@ -449,6 +456,7 @@ Returns: } EFI_STATUS +EFIAPI TestNodeMenuEscFunc ( IN EFI_MENU_PAGE *Page ) @@ -586,6 +594,7 @@ Returns: EFI_STATUS +EFIAPI TestNodeMenuSpaceFunc( IN EFI_MENU_PAGE *Page ) @@ -661,6 +670,7 @@ Returns: } EFI_STATUS +EFIAPI TestNodeMenuF9Func( IN EFI_MENU_PAGE *Page ) @@ -721,6 +731,7 @@ Returns: } EFI_STATUS +EFIAPI TestNodeMenuF8Func( IN EFI_MENU_PAGE *Page ) @@ -929,6 +940,7 @@ Arguments: } EFI_STATUS +EFIAPI TestNodeMenuDescPrintFunc ( IN EFI_MENU_ITEM *MenuItem, IN VOID *Context, diff --git a/TestFrameworkPkg/Sct/UI/TestNodeMenu.h b/TestFrameworkPkg/Sct/UI/TestNodeMenu.h index 8f86bfb..84348c1 100644 --- a/TestFrameworkPkg/Sct/UI/TestNodeMenu.h +++ b/TestFrameworkPkg/Sct/UI/TestNodeMenu.h @@ -20,7 +20,7 @@ // #include "Sct.h" -#include "Ui.h" +#include "UI.h" #include "BuildMenu.h" #include "Dialog.h" diff --git a/TestFrameworkPkg/Sct/UI/UI.h b/TestFrameworkPkg/Sct/UI/UI.h index dbd2d41..6304c78 100644 --- a/TestFrameworkPkg/Sct/UI/UI.h +++ b/TestFrameworkPkg/Sct/UI/UI.h @@ -242,6 +242,7 @@ Returns: EFI_STATUS +EFIAPI MenuHeaderRefresh ( IN EFI_MENU_PAGE *MenuPage ) @@ -264,6 +265,7 @@ Returns: ; EFI_STATUS +EFIAPI MenuBodyRefresh ( IN EFI_MENU_PAGE *MenuPage ) @@ -290,6 +292,7 @@ Returns: // EFI_STATUS +EFIAPI MenuBodyItemsRefresh ( IN EFI_MENU_PAGE *MenuPage ) @@ -312,6 +315,7 @@ Returns: ; EFI_STATUS +EFIAPI MenuItemRefresh ( IN EFI_MENU_PAGE *MenuPage, IN EFI_MENU_ITEM *Item, @@ -338,6 +342,7 @@ Returns: ; EFI_STATUS +EFIAPI MenuItemStatusRefresh( IN EFI_MENU_PAGE *MenuPage, IN EFI_MENU_ITEM *Item, @@ -363,6 +368,7 @@ Returns: ; EFI_STATUS +EFIAPI MenuFooterRefresh ( IN EFI_MENU_PAGE *MenuPage ) @@ -385,6 +391,7 @@ Returns: ; EFI_STATUS +EFIAPI MenuPageRefresh ( IN EFI_MENU_PAGE *MenuPage ) @@ -463,12 +470,14 @@ DisplayMessage ( ); EFI_STATUS +EFIAPI DoEdit ( IN EFI_MENU_PAGE *MenuPage, IN EFI_INPUT_KEY *InKey ); EFI_STATUS +EFIAPI DoIterEdit ( IN EFI_MENU_PAGE *MenuPage, IN EFI_INPUT_KEY *InKey @@ -479,36 +488,43 @@ DoIterEdit ( // EFI_STATUS +EFIAPI UpFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI DownFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI PageUpFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI PageDownFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI SpaceFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI LeftArrowFunc ( IN EFI_MENU_PAGE *MenuPage ); EFI_STATUS +EFIAPI RightArrowFunc ( IN EFI_MENU_PAGE *MenuPage ); diff --git a/TestFrameworkPkg/Support/TestProfile/TestProfile.c b/TestFrameworkPkg/Support/TestProfile/TestProfile.c index ca405d3..9d74af3 100644 --- a/TestFrameworkPkg/Support/TestProfile/TestProfile.c +++ b/TestFrameworkPkg/Support/TestProfile/TestProfile.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -93,326 +94,52 @@ CHAR16 *gAtslDescription = L"EFI Test Profile Library"; // // Internal functions // -#define toupper(c) (((c <= 'z') && (c >= 'a')) ? (c + 'A' - 'a') : c) -#define tolower(c) (((c <= 'Z') && (c >= 'A')) ? (c - 'A' + 'a') : c) - -VOID * -TestProfile_memset( - VOID *b, - INTN c, - UINTN len - ) -{ - volatile CHAR8 *p; - UINTN i; - - p = b; - for (i = 0; i < len; i++) { - p[i] = (CHAR8)c; - } - return ((VOID *)p); -} - -VOID* -malloc ( - UINTN size - ) -{ - VOID *pMem; - - if (gBS->AllocatePool (EfiBootServicesData, size, &pMem) != EFI_SUCCESS) { - return NULL; - } - return pMem; -} - -VOID * -calloc( - UINTN NMemb, - UINTN MembSize - ) -{ - UINTN NewSize; - VOID *NewMem; - - NewSize = NMemb * MembSize; - NewMem = malloc (NewSize); - if (NewMem) { - TestProfile_memset (NewMem, 0, NewSize); - } - - return NewMem; -} - -VOID -free ( - VOID *addr - ) -{ - gBS->FreePool (addr); -} - -INTN -memcmp( - VOID *s1, - VOID *s2, - UINTN n - ) -{ - CHAR8 *p1, *p2; - - p1 = s1; - p2 = s2; - if (n != 0) { - do { - if (*p1++ != *p2++) - return (*--p1 - *--p2); - } while (--n != 0); - } - return (0); -} - -VOID * -memcpy( - VOID *dst, - VOID *src, - UINTN len - ) -{ - CHAR8 *d, *s; - - d = dst; - s = src; - while (len--) { - *(d++) = *(s++); - } - return dst; -} - -CHAR8 * -strchr( - CHAR8 *p, - INTN ch - ) -{ - for (; ; ++p) { - if (*p == ch) - return((CHAR8 *)p); - if (!*p) - return((CHAR8 *)NULL); - } - /* NOTREACHED */ -} - -INTN -strcmp( - CHAR8 *s1, - CHAR8 *s2 - ) -{ - while (*s1 == *s2++) { - if (*s1++ == 0) - return 0; - } - return (*s1 - *s2 - 1); -} - -INTN -stricmp( - CHAR8 *s1, - CHAR8 *s2 - ) -{ - while (toupper(*s1) == toupper(*s2)) { - s2++; - if (*s1++ == 0) - return (0); - } - return (*s1 - *s2); -} - -CHAR8 * -strcpy( - CHAR8 *to, - CHAR8 *from - ) -{ - CHAR8 *save; - - save = to; - for (; (*to = *from) != 0 ; ++from, ++to) - ; - return(save); -} - -CHAR8 * -strncpy( - CHAR8 *dst, - CHAR8 *src, - UINTN n - ) -{ - volatile CHAR8 *d; - CHAR8 *s; - - d = dst; - s = src; - if (n != 0) { - do { - if ((*d++ = *s++) == 0) { - /* NUL pad the remaining n-1 bytes */ - while (--n != 0) - *d++ = 0; - break; - } - } while (--n != 0); - } - return (dst); -} - -UINTN -strlen( - CHAR8 *str - ) -{ - CHAR8 *s; - - for (s = str; *s; ++s) - ; - return (UINTN)(s - str); -} - CHAR8 * -strdup( - CHAR8 *str +AsciiDuplicateString ( + CHAR8 *str ) { - CHAR8 *copy; - - if (str != NULL) { - copy = malloc(strlen(str) + 1); - if (copy != NULL) - return strcpy(copy, str); - } - return NULL; -} - -CHAR8 * -strcat( - CHAR8 *s, - CHAR8 *append -) -{ - CHAR8 *save; - - save = s; - for (; *s; ++s) - ; - while ( (*s++ = *append++) != 0) - ; - return(save); -} - -UINTN -wcslen( - CHAR16 *str - ) -{ - CHAR16 *s; - - for (s = str; *s; ++s) - ; - return (UINTN)(s - str); -} - -CHAR16 * -wcscpy( - CHAR16 *to, - CHAR16 *from - ) -{ - CHAR16 *save; - - save = to; - for (; (*to = *from) != 0; ++from, ++to) - ; - return(save); + return (str == NULL) ? NULL : AllocateCopyPool (AsciiStrSize (str), str); } CHAR16 * -wcsdup ( +UnicodeDuplicateString ( CHAR16 *str ) { - CHAR16 *copy; - - if (str != NULL) { - copy = calloc(wcslen(str) + 1, sizeof(CHAR16)); - if (copy != NULL) - return wcscpy(copy, str); - } - return NULL; + return (str == NULL) ? NULL : AllocateCopyPool (StrSize (str), str); } -CHAR16 * -wcschr( - CHAR16 *p, - INTN ch - ) -{ - for (;; ++p) { - if (*p == ch) - return((CHAR16 *)p); - if (!*p) - return((CHAR16 *)NULL); - } - /* NOTREACHED */ -} - -UINTN -wcstombs( +INTN +TestProfile_wcstombs( CHAR8 *s, CHAR16 *pwcs, UINTN n ) { - UINTN cnt; - - cnt = 0; - if (!pwcs || !s) - return (UINTN)-1; + EFI_STATUS Status; - while (n-- > 0) { - *s = (CHAR8) (*pwcs++ & 0x00ff); - if (*s++ == 0) { - break; - } - ++cnt; + Status = UnicodeStrToAsciiStrS(pwcs, s, n); + if (EFI_ERROR (Status)) { + return -1; } - return (cnt); + return AsciiStrnLenS (s, n); } -UINTN -mbstowcs( +INTN +TestProfile_mbstowcs( CHAR16 *pwcs, CHAR8 *s, UINTN n ) { - UINTN cnt; - - cnt = 0; - if (!pwcs || !s) - return (UINTN)-1; + EFI_STATUS Status; - while (n-- > 0) { - *pwcs = (CHAR16)(*s++ & 0x00ff); - if (*pwcs++ == 0) { - break; - } - ++cnt; + Status = AsciiStrToUnicodeStrS(s, pwcs, n); + if (EFI_ERROR (Status)) { + return -1; } - return (cnt); + return StrnLenS (pwcs, n); } VOID @@ -435,15 +162,15 @@ Routine Description: ptrCur = IniFile->Head; while (ptrCur != NULL) { - free (ptrCur->ptrSection); - free (ptrCur->ptrEntry); - free (ptrCur->ptrValue); + FreePool (ptrCur->ptrSection); + FreePool (ptrCur->ptrEntry); + FreePool (ptrCur->ptrValue); ptrCur = ptrCur->ptrNext; } while (IniFile->Head != NULL) { ptrTmp = IniFile->Head->ptrNext; - free (IniFile->Head); + FreePool (IniFile->Head); IniFile->Head = ptrTmp; } IniFile->Tail = NULL; @@ -451,13 +178,13 @@ Routine Description: ptrCommentCur = IniFile->CommentLineHead; while (ptrCommentCur != NULL) { - free (ptrCommentCur->ptrComment); + FreePool (ptrCommentCur->ptrComment); ptrCommentCur = ptrCommentCur->ptrNext; } while (IniFile->CommentLineHead != NULL) { ptrCommentTmp = IniFile->CommentLineHead->ptrNext; - free (IniFile->CommentLineHead); + FreePool (IniFile->CommentLineHead); IniFile->CommentLineHead = ptrCommentTmp; } } @@ -484,7 +211,7 @@ Routine Description: // // skip '\n' & '\r' at end of comment line // - Length = (UINT32) strlen (ptrStr); + Length = (UINT32) AsciiStrLen (ptrStr); for (Index = Length; Index > 0; Index --) { if (ptrStr[Index - 1] != '\n' && ptrStr[Index - 1] != '\r') { break; @@ -492,11 +219,11 @@ Routine Description: } ptrStr[Index] = '\0'; - ptrCommentLineNew = (COMMENTLINE *) malloc (sizeof(COMMENTLINE)); - ptrCommentLineNew->ptrComment = (CHAR8 *) calloc (strlen(ptrStr) + 1, sizeof(CHAR8)); + ptrCommentLineNew = (COMMENTLINE *) AllocatePool (sizeof(COMMENTLINE)); + ptrCommentLineNew->ptrComment = (CHAR8 *) AllocateZeroPool (AsciiStrLen(ptrStr) + 1); ptrCommentLineNew->commentNo = *commentNo; - strcpy (ptrCommentLineNew->ptrComment, ptrStr); + AsciiStrCpy (ptrCommentLineNew->ptrComment, ptrStr); if (IniFile->CommentLineHead == NULL) { IniFile->CommentLineHead = ptrCommentLineNew; @@ -534,7 +261,7 @@ Routine Description: // // skip '\n' & ' ' & '\r' at end of string // - Length = (UINT32) strlen (tmp); + Length = (UINT32) AsciiStrLen (tmp); for (Index = Length; Index > 0; Index --) { if (tmp[Index - 1] != '\n' && tmp[Index - 1] != ' ' && tmp[Index - 1] != '\r') { break; @@ -542,7 +269,7 @@ Routine Description: } tmp[Index] = '\0'; - strcpy (ptrStr, tmp); + AsciiStrCpy (ptrStr, tmp); return ptrStr; } @@ -590,34 +317,34 @@ Routine Description: CHAR8 *p, *q; INI *ptrItem; - p = strchr (ptrStr, '['); - q = strchr (ptrStr, ']'); + p = AsciiStrStr (ptrStr, "["); + q = AsciiStrStr (ptrStr, "]"); *q = '\0' ; _alltrim (++p); - if (strlen (p) <= MAX_STRING_LEN) { + if (AsciiStrLen (p) <= MAX_STRING_LEN) { if (*p == '\0') { - strcpy (ptrSection, "UNKNOWN"); + AsciiStrCpy (ptrSection, "UNKNOWN"); } else { - strcpy (ptrSection, p); + AsciiStrCpy (ptrSection, p); } } else { - strncpy (ptrSection, p, MAX_STRING_LEN); + AsciiStrnCpy (ptrSection, p, MAX_STRING_LEN); ptrSection[MAX_STRING_LEN] = '\0'; } - ptrItem = (INI *)malloc (sizeof(INI)); + ptrItem = (INI *)AllocatePool (sizeof(INI)); - ptrItem->ptrSection = (CHAR8 *) calloc (strlen(ptrSection) + 1, sizeof(CHAR8)); - ptrItem->ptrEntry = (CHAR8 *) calloc (1, sizeof(CHAR8)); - ptrItem->ptrValue = (CHAR8 *) calloc (1, sizeof(CHAR8)); + ptrItem->ptrSection = (CHAR8 *) AllocateZeroPool (AsciiStrLen(ptrSection) + 1); + ptrItem->ptrEntry = (CHAR8 *) AllocateZeroPool (1); + ptrItem->ptrValue = (CHAR8 *) AllocateZeroPool (1); ptrItem->commentNo = *commentNo; - strcpy (ptrItem->ptrSection, ptrSection); - strcpy (ptrItem->ptrEntry, ""); - strcpy (ptrItem->ptrValue, ""); + AsciiStrCpy (ptrItem->ptrSection, ptrSection); + AsciiStrCpy (ptrItem->ptrEntry, ""); + AsciiStrCpy (ptrItem->ptrValue, ""); (*commentNo) ++; @@ -641,36 +368,36 @@ Routine Description: CHAR8 *p, *p2; UINTN Len; - p = strchr (ptrStr, '='); + p = AsciiStrStr (ptrStr, "="); *p = '\0'; _alltrim (ptrStr); - if (strlen (ptrStr) <= MAX_STRING_LEN) { + if (AsciiStrLen (ptrStr) <= MAX_STRING_LEN) { if (*ptrStr == '\0') { - strcpy (ptrEntry, "UNKNOWN"); + AsciiStrCpy (ptrEntry, "UNKNOWN"); } else { - strcpy (ptrEntry, ptrStr); + AsciiStrCpy (ptrEntry, ptrStr); } } else { - strncpy (ptrEntry, ptrStr, MAX_STRING_LEN); + AsciiStrnCpy (ptrEntry, ptrStr, MAX_STRING_LEN); ptrEntry[MAX_STRING_LEN] = '\0'; } _alltrim (++ p); - p2 = strchr (p, '#'); + p2 = AsciiStrStr (p, "#"); if (p2 != NULL) { *p2 = '\0'; _alltrim (p); } - Len = strlen (p); + Len = AsciiStrLen (p); - if (strlen (p) <= MAX_STRING_LEN) { - strcpy (ptrValue, p); + if (AsciiStrLen (p) <= MAX_STRING_LEN) { + AsciiStrCpy (ptrValue, p); } else { - strncpy (ptrValue, p, MAX_STRING_LEN); + AsciiStrnCpy (ptrValue, p, MAX_STRING_LEN); ptrValue[MAX_STRING_LEN] = '\0'; } } @@ -695,28 +422,28 @@ Routine Description: CHAR8 ptrValue[MAX_STRING_LEN + 1]; INI *ptrItem; - strcpy (ptrLine, _alltrim (ptrLine)); + AsciiStrCpy (ptrLine, _alltrim (ptrLine)); if (*ptrLine == '#') { // it's a comment line _getcomment (IniFile, ptrLine, commentNo); - } else if ((*ptrLine == '[') && (strchr (ptrLine, ']') != NULL)) { + } else if ((*ptrLine == '[') && (AsciiStrStr (ptrLine, "]") != NULL)) { // it's a section head _getsection (IniFile, ptrLine, ptrSection, commentNo); *isSectionGot = TRUE; - } else if (strchr (ptrLine, '=') != NULL) { + } else if (AsciiStrStr (ptrLine, "=") != NULL) { _getentry (ptrLine, ptrEntry, ptrValue); if (*isSectionGot == TRUE) { - ptrItem = (INI *)malloc (sizeof(INI)); - ptrItem->ptrSection = (CHAR8 *) calloc (strlen(ptrSection) + 1, sizeof(CHAR8)); - ptrItem->ptrEntry = (CHAR8 *) calloc (strlen(ptrEntry) + 1, sizeof(CHAR8)); - ptrItem->ptrValue = (CHAR8 *) calloc (strlen(ptrValue) + 1, sizeof(CHAR8)); + ptrItem = (INI *)AllocatePool (sizeof(INI)); + ptrItem->ptrSection = (CHAR8 *) AllocateZeroPool (AsciiStrLen(ptrSection) + 1); + ptrItem->ptrEntry = (CHAR8 *) AllocateZeroPool (AsciiStrLen(ptrEntry) + 1); + ptrItem->ptrValue = (CHAR8 *) AllocateZeroPool (AsciiStrLen(ptrValue) + 1); ptrItem->commentNo = *commentNo; - strcpy (ptrItem->ptrSection, ptrSection); - strcpy (ptrItem->ptrEntry, ptrEntry); - strcpy (ptrItem->ptrValue, ptrValue); + AsciiStrCpy (ptrItem->ptrSection, ptrSection); + AsciiStrCpy (ptrItem->ptrEntry, ptrEntry); + AsciiStrCpy (ptrItem->ptrValue, ptrValue); (*commentNo) ++; @@ -770,7 +497,7 @@ Routine Description: CurOrder = 0; ptrCur = Head; while (ptrCur != NULL) { - if (stricmp (Section, ptrCur->ptrSection) == 0) { + if (AsciiStriCmp (Section, ptrCur->ptrSection) == 0) { if (CurOrder == Order) { break; } @@ -796,18 +523,18 @@ Routine Description: --*/ { if (ptrItem->ptrSection != NULL) { - free (ptrItem->ptrSection); + FreePool (ptrItem->ptrSection); ptrItem->ptrSection = NULL; } if (ptrItem->ptrEntry != NULL) { - free (ptrItem->ptrEntry); + FreePool (ptrItem->ptrEntry); ptrItem->ptrEntry = NULL; } if (ptrItem->ptrValue != NULL) { - free (ptrItem->ptrValue); + FreePool (ptrItem->ptrValue); ptrItem->ptrValue = NULL; } - free (ptrItem); + FreePool (ptrItem); } VOID @@ -825,8 +552,8 @@ _rmComment ( while (ptrCmtCur != NULL) { if (ptrCmtCur->commentNo == ptrItem->commentNo) { ptrCmtNext = ptrCmtCur->ptrNext; - free (ptrCmtCur->ptrComment); - free (ptrCmtCur); + FreePool (ptrCmtCur->ptrComment); + FreePool (ptrCmtCur); if (ptrCmtPrev == NULL) { *CmtHead = ptrCmtNext; } else { @@ -919,27 +646,27 @@ Returns: return EFI_INVALID_PARAMETER; } - wcscpy (String, L""); + StrCpy (String, L""); - if (wcslen (Section) > MAX_STRING_LEN || wcslen(Entry) > MAX_STRING_LEN) { + if (StrLen (Section) > MAX_STRING_LEN || StrLen(Entry) > MAX_STRING_LEN) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrEntry, Entry, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrEntry, Entry, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - strcpy (tmpSection, ptrSection); + AsciiStrCpy (tmpSection, ptrSection); _alltrim (tmpSection); - strcpy (tmpEntry, ptrEntry); + AsciiStrCpy (tmpEntry, ptrEntry); _alltrim (tmpEntry); - if (strlen (tmpSection) == 0 || strlen (tmpEntry) == 0) { + if (AsciiStrLen (tmpSection) == 0 || AsciiStrLen (tmpEntry) == 0) { return EFI_INVALID_PARAMETER; } @@ -956,17 +683,17 @@ Returns: // // the same, so find the field // - if ((stricmp (tmpSection, ptrCur->ptrSection) == 0) && - (stricmp (tmpEntry, ptrCur->ptrEntry) == 0)) { - if (strlen (ptrCur->ptrValue) < *maxLength) { - strcpy (ptrString, ptrCur->ptrValue); - mbstowcs (String, ptrString, strlen(ptrString) + 1); + if ((AsciiStriCmp (tmpSection, ptrCur->ptrSection) == 0) && + (AsciiStriCmp (tmpEntry, ptrCur->ptrEntry) == 0)) { + if (AsciiStrLen (ptrCur->ptrValue) < *maxLength) { + AsciiStrCpy (ptrString, ptrCur->ptrValue); + TestProfile_mbstowcs (String, ptrString, AsciiStrLen(ptrString) + 1); return EFI_SUCCESS; } else { - strncpy (ptrString, ptrCur->ptrValue, *maxLength - 1); + AsciiStrnCpy (ptrString, ptrCur->ptrValue, *maxLength - 1); ptrString[*maxLength-1] = '\0'; - mbstowcs (String, ptrString, strlen(ptrString) + 1); - *maxLength = (UINT32) (strlen (ptrCur->ptrValue) + 1); + TestProfile_mbstowcs (String, ptrString, AsciiStrLen(ptrString) + 1); + *maxLength = (UINT32) (AsciiStrLen (ptrCur->ptrValue) + 1); return EFI_BUFFER_TOO_SMALL; } } @@ -1030,35 +757,35 @@ Returns: return EFI_INVALID_PARAMETER; } - if (wcslen (Section) > MAX_STRING_LEN || - wcslen (Entry) > MAX_STRING_LEN || - wcslen (String) > MAX_STRING_LEN) { + if (StrLen (Section) > MAX_STRING_LEN || + StrLen (Entry) > MAX_STRING_LEN || + StrLen (String) > MAX_STRING_LEN) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrEntry, Entry, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrEntry, Entry, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - strcpy (tmpSection, ptrSection); + AsciiStrCpy (tmpSection, ptrSection); _alltrim (tmpSection); - strcpy (tmpEntry, ptrEntry); + AsciiStrCpy (tmpEntry, ptrEntry); _alltrim (tmpEntry); - if (strlen (tmpSection) == 0 || strlen (tmpEntry) == 0) { + if (AsciiStrLen (tmpSection) == 0 || AsciiStrLen (tmpEntry) == 0) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrString, String, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrString, String, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - strcpy (tmpString, ptrString); + AsciiStrCpy (tmpString, ptrString); _alltrim (tmpString); // @@ -1067,14 +794,14 @@ Returns: ptrCur = Private->Head; ptrPrev = NULL; while (ptrCur != NULL) { - if (stricmp (tmpSection, ptrCur->ptrSection) == 0) { - if (stricmp (tmpEntry, ptrCur->ptrEntry) == 0) { - if (stricmp (tmpString, ptrCur->ptrValue) != 0) { - tmpPtr = strdup (tmpString); + if (AsciiStriCmp (tmpSection, ptrCur->ptrSection) == 0) { + if (AsciiStriCmp (tmpEntry, ptrCur->ptrEntry) == 0) { + if (AsciiStriCmp (tmpString, ptrCur->ptrValue) != 0) { + tmpPtr = AsciiDuplicateString (tmpString); if (tmpPtr == NULL) { return EFI_OUT_OF_RESOURCES; } - free (ptrCur->ptrValue); + FreePool (ptrCur->ptrValue); ptrCur->ptrValue = tmpPtr; Private->Modified = TRUE; } @@ -1088,22 +815,21 @@ Returns: // // if not, should add a new item // - ptrNew = (INI *) malloc (sizeof(INI)); - TestProfile_memset (ptrNew, 0, sizeof(INI)); + ptrNew = (INI *) AllocateZeroPool (sizeof(INI)); if (ptrNew == NULL) { return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrSection = strdup (tmpSection); + ptrNew->ptrSection = AsciiDuplicateString (tmpSection); if (ptrNew->ptrSection == NULL) { _freeItem (ptrNew); return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrEntry = strdup (tmpEntry); + ptrNew->ptrEntry = AsciiDuplicateString (tmpEntry); if (ptrNew->ptrEntry == NULL) { _freeItem (ptrNew); return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrValue = strdup (tmpString); + ptrNew->ptrValue = AsciiDuplicateString (tmpString); if (ptrNew->ptrValue == NULL) { _freeItem (ptrNew) ; return EFI_OUT_OF_RESOURCES; @@ -1128,24 +854,23 @@ Returns: // ptrCur = ptrNew; - ptrNew = (INI *) malloc (sizeof(INI)); - TestProfile_memset (ptrNew, 0, sizeof(INI)); + ptrNew = (INI *) AllocateZeroPool (sizeof(INI)); if (ptrNew == NULL) { return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrSection = strdup (tmpSection); + ptrNew->ptrSection = AsciiDuplicateString (tmpSection); if (ptrNew->ptrSection == NULL) { _freeItem (ptrNew); _freeItem (ptrCur); return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrEntry = strdup (""); + ptrNew->ptrEntry = AsciiDuplicateString (""); if (ptrNew->ptrEntry == NULL) { _freeItem (ptrNew); _freeItem (ptrCur); return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrValue = strdup (""); + ptrNew->ptrValue = AsciiDuplicateString (""); if (ptrNew->ptrValue == NULL) { _freeItem (ptrNew); _freeItem (ptrCur); @@ -1205,16 +930,16 @@ Returns: return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - strcpy (tmpSection, ptrSection); + AsciiStrCpy (tmpSection, ptrSection); _alltrim (tmpSection); ptrCur = Private->Head; ptrPrev = NULL; while (ptrCur != NULL) { - if (stricmp (tmpSection, ptrCur->ptrSection) == 0) { + if (AsciiStriCmp (tmpSection, ptrCur->ptrSection) == 0) { Private->Modified = TRUE; _rmComment (&(Private->CommentLineHead), ptrCur); ptrNext = ptrCur->ptrNext; @@ -1296,27 +1021,27 @@ Returns: return EFI_INVALID_PARAMETER; } - wcscpy (String, L""); + StrCpy (String, L""); - if (wcslen (Section) > MAX_STRING_LEN || wcslen (Entry) > MAX_STRING_LEN) { + if (StrLen (Section) > MAX_STRING_LEN || StrLen (Entry) > MAX_STRING_LEN) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrEntry, Entry, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrEntry, Entry, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - strcpy (tmpSection, ptrSection); + AsciiStrCpy (tmpSection, ptrSection); _alltrim (tmpSection); - strcpy (tmpEntry, ptrEntry); + AsciiStrCpy (tmpEntry, ptrEntry); _alltrim (tmpEntry); - if (strlen (tmpSection) == 0 || strlen (tmpEntry) == 0) { + if (AsciiStrLen (tmpSection) == 0 || AsciiStrLen (tmpEntry) == 0) { return EFI_INVALID_PARAMETER; } @@ -1341,17 +1066,17 @@ Returns: // break; } - if ((stricmp (tmpSection, ptrCur->ptrSection) == 0) && - (stricmp (tmpEntry, ptrCur->ptrEntry) == 0)) { - if (strlen (ptrCur->ptrValue) < *maxLength) { - strcpy (ptrString, ptrCur->ptrValue); - mbstowcs (String, ptrString, strlen(ptrString) + 1); + if ((AsciiStriCmp (tmpSection, ptrCur->ptrSection) == 0) && + (AsciiStriCmp (tmpEntry, ptrCur->ptrEntry) == 0)) { + if (AsciiStrLen (ptrCur->ptrValue) < *maxLength) { + AsciiStrCpy (ptrString, ptrCur->ptrValue); + TestProfile_mbstowcs (String, ptrString, AsciiStrLen(ptrString) + 1); return EFI_SUCCESS; } else { - strncpy (ptrString, ptrCur->ptrValue, *maxLength - 1); + AsciiStrnCpy (ptrString, ptrCur->ptrValue, *maxLength - 1); ptrString[*maxLength-1] = '\0'; - mbstowcs (String, ptrString, strlen(ptrString) + 1 ); - *maxLength = (UINT32) (strlen (ptrCur->ptrValue) + 1); + TestProfile_mbstowcs (String, ptrString, AsciiStrLen(ptrString) + 1 ); + *maxLength = (UINT32) (AsciiStrLen (ptrCur->ptrValue) + 1); return EFI_BUFFER_TOO_SMALL; } } @@ -1417,35 +1142,35 @@ Returns: return EFI_INVALID_PARAMETER; } - if (wcslen (Section) > MAX_STRING_LEN || - wcslen (Entry) > MAX_STRING_LEN || - wcslen (String) > MAX_STRING_LEN) { + if (StrLen (Section) > MAX_STRING_LEN || + StrLen (Entry) > MAX_STRING_LEN || + StrLen (String) > MAX_STRING_LEN) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrEntry, Entry, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrEntry, Entry, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - strcpy (tmpSection, ptrSection); + AsciiStrCpy (tmpSection, ptrSection); _alltrim (tmpSection); - strcpy (tmpEntry, ptrEntry); + AsciiStrCpy (tmpEntry, ptrEntry); _alltrim (tmpEntry); - if (strlen (tmpSection) == 0 || strlen (tmpEntry) == 0) { + if (AsciiStrLen (tmpSection) == 0 || AsciiStrLen (tmpEntry) == 0) { return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrString, String, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrString, String, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - strcpy (tmpString, ptrString); + AsciiStrCpy (tmpString, ptrString); _alltrim (tmpString); // @@ -1463,14 +1188,14 @@ Returns: // break; } - if ((stricmp (tmpSection, ptrCur->ptrSection ) == 0) && - (stricmp (tmpEntry, ptrCur->ptrEntry ) == 0)) { - if (stricmp( tmpString, ptrCur->ptrValue) != 0) { - tmpPtr = strdup (tmpString); + if ((AsciiStriCmp (tmpSection, ptrCur->ptrSection ) == 0) && + (AsciiStriCmp (tmpEntry, ptrCur->ptrEntry ) == 0)) { + if (AsciiStriCmp( tmpString, ptrCur->ptrValue) != 0) { + tmpPtr = AsciiDuplicateString (tmpString); if (tmpPtr == NULL) { return EFI_OUT_OF_RESOURCES; } - free (ptrCur->ptrValue); + FreePool (ptrCur->ptrValue); ptrCur->ptrValue = tmpPtr; Private->Modified = TRUE; } @@ -1483,22 +1208,21 @@ Returns: // // if not, should add a new item // - ptrNew = (INI *) malloc(sizeof(INI)); - TestProfile_memset (ptrNew, 0, sizeof(INI)); + ptrNew = (INI *) AllocateZeroPool (sizeof(INI)); if (ptrNew == NULL) { return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrSection = strdup (tmpSection); + ptrNew->ptrSection = AsciiDuplicateString (tmpSection); if (ptrNew->ptrSection == NULL) { _freeItem (ptrNew); return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrEntry = strdup (tmpEntry); + ptrNew->ptrEntry = AsciiDuplicateString (tmpEntry); if (ptrNew->ptrEntry == NULL) { _freeItem (ptrNew); return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrValue = strdup (tmpString); + ptrNew->ptrValue = AsciiDuplicateString (tmpString); if (ptrNew->ptrValue == NULL) { _freeItem (ptrNew); return EFI_OUT_OF_RESOURCES; @@ -1523,24 +1247,23 @@ Returns: // ptrCur = ptrNew; - ptrNew = (INI *)malloc (sizeof(INI)); - TestProfile_memset (ptrNew, 0, sizeof(INI)); + ptrNew = (INI *) AllocateZeroPool (sizeof(INI)); if (ptrNew == NULL) { return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrSection = strdup (tmpSection); + ptrNew->ptrSection = AsciiDuplicateString (tmpSection); if ( ptrNew->ptrSection == NULL ) { _freeItem (ptrNew); _freeItem (ptrCur); return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrEntry = strdup (""); + ptrNew->ptrEntry = AsciiDuplicateString (""); if ( ptrNew->ptrEntry == NULL ) { _freeItem (ptrNew); _freeItem (ptrCur); return EFI_OUT_OF_RESOURCES; } - ptrNew->ptrValue = strdup (""); + ptrNew->ptrValue = AsciiDuplicateString (""); if ( ptrNew->ptrValue == NULL ) { _freeItem (ptrNew); _freeItem (ptrCur); @@ -1603,10 +1326,10 @@ Returns: return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - strcpy (tmpSection, ptrSection); + AsciiStrCpy (tmpSection, ptrSection); _alltrim (tmpSection); ptrSect = _searchSection (Private->Head, Order, tmpSection); @@ -1692,17 +1415,17 @@ Returns: return EFI_INVALID_PARAMETER; } - if (wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { + if (TestProfile_wcstombs (ptrSection, Section, MAX_STRING_LEN + 1) == -1) { return EFI_INVALID_PARAMETER; } - strcpy (tmpSection, ptrSection); + AsciiStrCpy (tmpSection, ptrSection); _alltrim (tmpSection); *OrderNum = 0; ptrCur = Private->Head; while (ptrCur != NULL) { - if (stricmp (tmpSection, ptrCur->ptrSection) == 0) { + if (AsciiStriCmp (tmpSection, ptrCur->ptrSection) == 0) { ++ (*OrderNum); } @@ -1835,7 +1558,7 @@ Returns: } ptrCur = Private->Head ; - strcpy (ptrCurSection, ""); + AsciiStrCpy (ptrCurSection, ""); first = TRUE; // @@ -1865,10 +1588,10 @@ Returns: if (first) { first = FALSE; } else { - strcpy (Buffer, "\r\n"); - BufSize = strlen (Buffer); + AsciiStrCpy (Buffer, "\r\n"); + BufSize = AsciiStrLen (Buffer); if (Private->isUnicode) { - mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); + TestProfile_mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); BufSize *= 2; Status = Handle->Write (Handle, &BufSize, Line); } else { @@ -1889,11 +1612,11 @@ Returns: while (ptrCmtCur != NULL) { if (ptrCmtCur->commentNo == ptrCur->commentNo) { commentNo = ptrCmtCur->commentNo; - strcpy (Buffer, ptrCmtCur->ptrComment); - strcat (Buffer, "\r\n"); - BufSize = strlen (Buffer); + AsciiStrCpy (Buffer, ptrCmtCur->ptrComment); + AsciiStrCat (Buffer, "\r\n"); + BufSize = AsciiStrLen (Buffer); if (Private->isUnicode) { - mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); + TestProfile_mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); BufSize *= 2; Status = Handle->Write (Handle, &BufSize, Line); } else { @@ -1912,13 +1635,13 @@ Returns: // // new section, write the section head // - strcpy (ptrCurSection, ptrCur->ptrSection); - strcpy (Buffer, "["); - strcat (Buffer, ptrCurSection); - strcat (Buffer, "]\r\n"); - BufSize = strlen (Buffer); + AsciiStrCpy (ptrCurSection, ptrCur->ptrSection); + AsciiStrCpy (Buffer, "["); + AsciiStrCat (Buffer, ptrCurSection); + AsciiStrCat (Buffer, "]\r\n"); + BufSize = AsciiStrLen (Buffer); if (Private->isUnicode) { - mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); + TestProfile_mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); BufSize *= 2; Status = Handle->Write (Handle, &BufSize, Line); } else { @@ -1933,13 +1656,13 @@ Returns: // // write the entry and value line // - strcpy (Buffer, ptrCur->ptrEntry); - strcat (Buffer, "="); - strcat (Buffer, ptrCur->ptrValue); - strcat (Buffer, "\r\n"); - BufSize = strlen (Buffer); + AsciiStrCpy (Buffer, ptrCur->ptrEntry); + AsciiStrCat (Buffer, "="); + AsciiStrCat (Buffer, ptrCur->ptrValue); + AsciiStrCat (Buffer, "\r\n"); + BufSize = AsciiStrLen (Buffer); if (Private->isUnicode) { - mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); + TestProfile_mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); BufSize *= 2; Status = Handle->Write (Handle, &BufSize, Line); } else { @@ -1962,11 +1685,11 @@ Returns: commentNo ++; while (ptrCmtCur != NULL) { if (ptrCmtCur->commentNo >= commentNo) { - strcpy (Buffer, ptrCmtCur->ptrComment); - strcat (Buffer, "\r\n"); - BufSize = strlen (Buffer); + AsciiStrCpy (Buffer, ptrCmtCur->ptrComment); + AsciiStrCat (Buffer, "\r\n"); + BufSize = AsciiStrLen (Buffer); if (Private->isUnicode) { - mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); + TestProfile_mbstowcs ((CHAR16 *)Line, Buffer, BufSize + 1); BufSize *= 2; Status = Handle->Write (Handle, &BufSize, Line); } else { @@ -2041,15 +1764,15 @@ Routine Description: IniFile->Handle.GetOrderNum = NULL; IniFile->Handle.Flush = NULL; if (IniFile->FileName != NULL) { - free (IniFile->FileName); + FreePool (IniFile->FileName); IniFile->FileName = NULL; } if (IniFile->DevPath != NULL) { - free (IniFile->DevPath); + FreePool (IniFile->DevPath); IniFile->DevPath = NULL; } _freePointer(IniFile); - free (IniFile); + FreePool (IniFile); } EFI_STATUS @@ -2104,20 +1827,20 @@ Returns: return EFI_INVALID_PARAMETER; } - if (wcslen (FileName) > MAX_STRING_LEN) { + if (StrLen (FileName) > MAX_STRING_LEN) { return EFI_INVALID_PARAMETER; } // // New and initialize a ini file // - NewIniFile = malloc (sizeof(EFI_INI_FILE_PRIVATE_DATA)); + NewIniFile = AllocatePool (sizeof(EFI_INI_FILE_PRIVATE_DATA)); if (NewIniFile == NULL) { return EFI_OUT_OF_RESOURCES; } _initFile (NewIniFile); - NewIniFile->FileName = wcsdup (FileName); + NewIniFile->FileName = UnicodeDuplicateString (FileName); if ( NewIniFile->FileName == NULL ) { _freeIniFile (NewIniFile); return EFI_OUT_OF_RESOURCES; @@ -2324,20 +2047,20 @@ Returns: return EFI_INVALID_PARAMETER; } - if (wcslen (FileName) > MAX_STRING_LEN) { + if (StrLen (FileName) > MAX_STRING_LEN) { return EFI_INVALID_PARAMETER; } // // New and initialize a ini file // - NewIniFile = malloc (sizeof(EFI_INI_FILE_PRIVATE_DATA)); + NewIniFile = AllocatePool (sizeof(EFI_INI_FILE_PRIVATE_DATA)); if (NewIniFile == NULL) { return EFI_OUT_OF_RESOURCES; } _initFile (NewIniFile); - NewIniFile->FileName = wcsdup (FileName); + NewIniFile->FileName = UnicodeDuplicateString (FileName); if ( NewIniFile->FileName == NULL ) { _freeIniFile (NewIniFile); return EFI_OUT_OF_RESOURCES; @@ -2735,6 +2458,7 @@ Returns: } EFI_STATUS +EFIAPI TslInitUnload ( IN EFI_HANDLE ImageHandle ) diff --git a/TestFrameworkPkg/Support/TestProfile/TestProfile.inf b/TestFrameworkPkg/Support/TestProfile/TestProfile.inf index c8fc148..bb6c3f8 100644 --- a/TestFrameworkPkg/Support/TestProfile/TestProfile.inf +++ b/TestFrameworkPkg/Support/TestProfile/TestProfile.inf @@ -34,6 +34,7 @@ UefiBootServicesTableLib BaseLib BaseMemoryLib + MemoryAllocationLib DevicePathLib DebugLib -- 2.6.3.windows.1