//\r
// Retrive uncommitted data from Form Browser\r
//\r
- CurrentFakeNVMap = (BMM_FAKE_NV_DATA *) HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA));\r
- DisMap = (UINT8 *) CurrentFakeNVMap;\r
- for (Index = 0; Index < sizeof (BMM_FAKE_NV_DATA); Index ++) {\r
- if (DisMap [Index] != 0) {\r
- break;\r
- }\r
- }\r
- \r
- if (Index == sizeof (BMM_FAKE_NV_DATA)) {\r
- FreePool (CurrentFakeNVMap);\r
- CurrentFakeNVMap = &Private->BmmFakeNvData;\r
- }\r
+ CurrentFakeNVMap = &Private->BmmFakeNvData;\r
+ HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap);\r
\r
//\r
// need to be subtituded.\r
//\r
Status = HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL);\r
\r
- //\r
- // Update local settting.\r
- //\r
- if (CurrentFakeNVMap != &Private->BmmFakeNvData) {\r
- CopyMem (&Private->BmmFakeNvData, CurrentFakeNVMap, sizeof (BMM_FAKE_NV_DATA));\r
- FreePool (CurrentFakeNVMap);\r
- }\r
-\r
return Status;\r
}\r
\r
//\r
// Retrieve uncommitted data from Form Browser\r
//\r
- NvRamMap = (FILE_EXPLORER_NV_DATA *) HiiGetBrowserData (&mFileExplorerGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA));\r
- if (NvRamMap == NULL) {\r
- return EFI_NOT_FOUND;\r
- }\r
- CopyMem (&Private->FeFakeNvData, NvRamMap, sizeof (FILE_EXPLORER_NV_DATA));\r
- FreePool (NvRamMap);\r
NvRamMap = &Private->FeFakeNvData;\r
+ HiiGetBrowserData (&mFileExplorerGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA), (UINT8 *) NvRamMap);\r
\r
if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) {\r
//\r
\r
/**\r
Retrieves uncommited data from the Form Browser and converts it to a binary\r
- buffer. The returned buffer is allocated using AllocatePool(). The caller\r
- is responsible for freeing the returned buffer using FreePool().\r
+ buffer.\r
\r
@param[in] VariableName Pointer to a Null-terminated Unicode string. This \r
is an optional parameter that may be NULL.\r
@param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional \r
parameter that may be NULL.\r
@param[in] BufferSize Length in bytes of buffer to hold retrived data. \r
+ @param[out] Block Buffer of data to be updated.\r
\r
- @retval NULL The uncommitted data could not be retrieved.\r
- @retval Other A pointer to a buffer containing the uncommitted data.\r
+ @retval FALSE The uncommitted data could not be retrieved.\r
+ @retval TRUE The uncommitted data was retrieved.\r
\r
**/\r
-UINT8 *\r
+BOOLEAN\r
EFIAPI\r
HiiGetBrowserData (\r
IN CONST EFI_GUID *VariableGuid, OPTIONAL\r
IN CONST CHAR16 *VariableName, OPTIONAL\r
- IN UINTN BlockSize\r
+ IN UINTN BlockSize,\r
+ OUT UINT8 *Block\r
);\r
\r
/**\r
return ConfigResp;\r
}\r
\r
-/**\r
- Uses the ConfigToBlock() service of the Config Routing Protocol to \r
- convert <ConfigResp> to a block. The block is allocated using\r
- AllocatePool(). The caller is responsible for freeing the block\r
- using FreePool().\r
-\r
- If ConfigResp is NULL, then ASSERT().\r
-\r
- @param[in] ConfigResp Pointer to a Null-terminated Unicode string.\r
- @param[in] BufferSize Length in bytes of buffer to hold retrived data. \r
-\r
- @retval NULL The block could not be generated..\r
- @retval Other Pointer to the allocated block.\r
-\r
-**/\r
-UINT8 *\r
-EFIAPI\r
-InternalHiiConfigToBlock (\r
- IN EFI_STRING ConfigResp,\r
- IN UINTN BlockSize\r
- )\r
-{\r
- EFI_STATUS Status;\r
- CHAR16 *Progress;\r
- UINT8 *Block;\r
-\r
- ASSERT (ConfigResp != NULL);\r
-\r
- //\r
- // Allocate a buffer to hold the <ConfigResp> conversion\r
- //\r
- Block = AllocateZeroPool (BlockSize);\r
- if (Block == NULL) {\r
- return NULL;\r
- }\r
-\r
- //\r
- // Convert <ConfigResp> to a buffer\r
- //\r
- Status = gHiiConfigRouting->ConfigToBlock (\r
- gHiiConfigRouting,\r
- ConfigResp,\r
- Block,\r
- &BlockSize,\r
- &Progress\r
- );\r
- if (EFI_ERROR (Status)) {\r
- FreePool (Block);\r
- return NULL;\r
- }\r
-\r
- //\r
- // Return converted buffer\r
- //\r
- return Block;\r
-}\r
-\r
/**\r
Uses the BrowserCallback() service of the Form Browser Protocol to retrieve \r
or set uncommitted data. If sata i being retrieved, then the buffer is \r
\r
/**\r
Retrieves uncommited data from the Form Browser and converts it to a binary\r
- buffer. The returned buffer is allocated using AllocatePool(). The caller\r
- is responsible for freeing the returned buffer using FreePool().\r
+ buffer.\r
\r
- @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional \r
- parameter that may be NULL.\r
@param[in] VariableName Pointer to a Null-terminated Unicode string. This \r
is an optional parameter that may be NULL.\r
+ @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional \r
+ parameter that may be NULL.\r
@param[in] BufferSize Length in bytes of buffer to hold retrived data. \r
+ @param[out] Block Buffer of data to be updated.\r
\r
- @retval NULL The uncommitted data could not be retrieved.\r
- @retval Other A pointer to a buffer containing the uncommitted data.\r
+ @retval FALSE The uncommitted data could not be retrieved.\r
+ @retval TRUE The uncommitted data was retrieved.\r
\r
**/\r
-UINT8 *\r
+BOOLEAN\r
EFIAPI\r
HiiGetBrowserData (\r
IN CONST EFI_GUID *VariableGuid, OPTIONAL\r
IN CONST CHAR16 *VariableName, OPTIONAL\r
- IN UINTN BlockSize\r
+ IN UINTN BlockSize,\r
+ OUT UINT8 *Block\r
)\r
{\r
EFI_STRING ResultsData;\r
UINTN Size;\r
EFI_STRING ConfigResp;\r
- UINT8 *Block;\r
+ EFI_STATUS Status;\r
+ CHAR16 *Progress;\r
\r
//\r
// Retrieve the results data from the Browser Callback\r
//\r
ResultsData = InternalHiiBrowserCallback (VariableGuid, VariableName, NULL);\r
if (ResultsData == NULL) {\r
- return NULL;\r
+ return FALSE;\r
}\r
\r
//\r
//\r
FreePool (ResultsData);\r
if (ConfigResp == NULL) {\r
- return NULL;\r
+ return FALSE;\r
}\r
\r
//\r
// Convert <ConfigResp> to a buffer\r
//\r
- Block = InternalHiiConfigToBlock (ConfigResp, BlockSize);\r
+ Status = gHiiConfigRouting->ConfigToBlock (\r
+ gHiiConfigRouting,\r
+ ConfigResp,\r
+ Block,\r
+ &BlockSize,\r
+ &Progress\r
+ );\r
+ //\r
+ // Free the allocated buffer\r
+ //\r
FreePool (ConfigResp);\r
\r
- return Block;\r
+ if (EFI_ERROR (Status)) {\r
+ return FALSE;\r
+ }\r
+\r
+ return TRUE;\r
}\r
\r
/**\r
//\r
// Retrive uncommitted data from Browser\r
//\r
- Configuration = (DRIVER_SAMPLE_CONFIGURATION *) HiiGetBrowserData (&mFormSetGuid, VariableName, sizeof (DRIVER_SAMPLE_CONFIGURATION));\r
- if (Configuration != NULL) {\r
+ Configuration = AllocateZeroPool (sizeof (DRIVER_SAMPLE_CONFIGURATION));\r
+ ASSERT (Configuration != NULL);\r
+ if (HiiGetBrowserData (&mFormSetGuid, VariableName, sizeof (DRIVER_SAMPLE_CONFIGURATION), (UINT8 *) Configuration)) {\r
//\r
// Update password's clear text in the screen\r
//\r
(UINT8 *) Configuration,\r
NULL\r
);\r
- \r
- FreePool (Configuration);\r
}\r
\r
+ //\r
+ // Free Configuration Buffer\r
+ //\r
+ FreePool (Configuration);\r
+\r
\r
//\r
// Set password\r
[Protocols]\r
gEfiHiiStringProtocolGuid ## CONSUMES\r
gEfiHiiConfigRoutingProtocolGuid ## CONSUMES\r
- gEfiHiiConfigAccessProtocolGuid ## CONSUMES\r
+ gEfiHiiConfigAccessProtocolGuid ## PRODUCES\r
gEfiFormBrowser2ProtocolGuid ## CONSUMES\r
gEfiHiiDatabaseProtocolGuid ## CONSUMES\r
\r
//\r
// Retrive uncommitted data from Browser\r
//\r
- IfrNvData = (ISCSI_CONFIG_IFR_NVDATA *) HiiGetBrowserData (&mVendorGuid, mVendorStorageName, sizeof (ISCSI_CONFIG_IFR_NVDATA));\r
- if (IfrNvData == NULL) {\r
+ IfrNvData = AllocateZeroPool (sizeof (ISCSI_CONFIG_IFR_NVDATA));\r
+ ASSERT (IfrNvData != NULL);\r
+ if (!HiiGetBrowserData (&mVendorGuid, mVendorStorageName, sizeof (ISCSI_CONFIG_IFR_NVDATA), (UINT8 *) IfrNvData)) {\r
+ FreePool (IfrNvData);\r
return EFI_NOT_FOUND;\r
}\r
\r
PLAT_OVER_MNGR_DATA *FakeNvData;\r
\r
Private = EFI_CALLBACK_INFO_FROM_THIS (This);\r
- FakeNvData = (PLAT_OVER_MNGR_DATA *) HiiGetBrowserData (&mPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA));\r
- if (FakeNvData == NULL) {\r
+ FakeNvData = &Private->FakeNvData;\r
+ if (HiiGetBrowserData (&mPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData)) {\r
return EFI_NOT_FOUND;\r
}\r
\r
CommintChanges (Private, KeyValue, FakeNvData);\r
}\r
\r
- if (FakeNvData != NULL) {\r
- FreePool (FakeNvData);\r
- }\r
-\r
return EFI_SUCCESS;\r
}\r
\r
PLAT_OVER_MNGR_DATA *FakeNvData;\r
\r
Private = EFI_CALLBACK_INFO_FROM_THIS (This);\r
- FakeNvData = (PLAT_OVER_MNGR_DATA *) HiiGetBrowserData (&mPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA));\r
- if (FakeNvData == NULL) {\r
+ FakeNvData = &Private->FakeNvData;\r
+ if (HiiGetBrowserData (&mPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData)) {\r
return EFI_NOT_FOUND;\r
}\r
\r
// Pass changed uncommitted data back to Form Browser\r
//\r
HiiSetBrowserData (&mPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData, NULL);\r
- \r
- //\r
- // Update local configuration buffer.\r
- //\r
- CopyMem (&Private->FakeNvData, FakeNvData, sizeof (PLAT_OVER_MNGR_DATA));\r
- if (FakeNvData != NULL) {\r
- FreePool (FakeNvData);\r
- }\r
\r
return EFI_SUCCESS;\r
}\r