}\r
}\r
\r
+/**\r
+ Check whether exist device path info in the ConfigHdr string.\r
+\r
+ @param String UEFI configuration string\r
+\r
+ @retval TRUE Device Path exist.\r
+ @retval FALSE Not exist device path info.\r
+\r
+**/\r
+BOOLEAN\r
+IsDevicePathExist (\r
+ IN EFI_STRING String\r
+ )\r
+{\r
+ UINTN Length;\r
+ EFI_STRING PathHdr;\r
+\r
+ for (; (*String != 0 && StrnCmp (String, L"PATH=", StrLen (L"PATH=")) != 0); String++);\r
+ if (*String == 0) {\r
+ return FALSE;\r
+ }\r
+\r
+ String += StrLen (L"PATH=");\r
+ if (*String == 0) {\r
+ return FALSE;\r
+ }\r
+ PathHdr = String;\r
+\r
+ for (Length = 0; *String != 0 && *String != L'&'; String++, Length++);\r
+ if (((Length + 1) / 2) < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {\r
+ return FALSE;\r
+ }\r
+\r
+ return TRUE;\r
+}\r
+\r
/**\r
Allocate a FORMSET_STORAGE data structure and insert to FormSet Storage List.\r
\r
InitializeConfigHdr (FormSet, BrowserStorage);\r
\r
BrowserStorage->Initialized = FALSE;\r
+ } else {\r
+ if ((StorageType == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) && \r
+ (FormSet->DriverHandle != NULL) && \r
+ (!IsDevicePathExist (BrowserStorage->ConfigHdr))) {\r
+ //\r
+ // If this storage not has device path info but new formset has,\r
+ // update the device path info.\r
+ //\r
+ FreePool (BrowserStorage->ConfigHdr);\r
+ InitializeConfigHdr (FormSet, BrowserStorage);\r
+ }\r
}\r
\r
Storage->BrowserStorage = BrowserStorage;\r