Changeset 58459 in vbox for trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiLib.c
- Timestamp:
- Oct 28, 2015 8:17:18 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
-
Property svn:mergeinfo
set to (toggle deleted branches)
/vendor/edk2/current 103735-103757
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiLib.c
r48674 r58459 6 6 and print messages on the console output and standard error devices. 7 7 8 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>8 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> 9 9 This program and the accompanying materials 10 10 are licensed and made available under the terms and conditions of the BSD License … … 1213 1213 } 1214 1214 1215 /** 1215 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES 1216 1217 /** 1218 [ATTENTION] This function will be deprecated for security reason. 1219 1216 1220 Returns a pointer to an allocated buffer that contains the contents of a 1217 1221 variable retrieved through the UEFI Runtime Service GetVariable(). The … … 1274 1278 } 1275 1279 1276 1277 /** 1280 /** 1281 [ATTENTION] This function will be deprecated for security reason. 1282 1278 1283 Returns a pointer to an allocated buffer that contains the contents of a 1279 1284 variable retrieved through the UEFI Runtime Service GetVariable(). This … … 1299 1304 return GetVariable (Name, &gEfiGlobalVariableGuid); 1300 1305 } 1301 1306 #endif 1307 1308 /** 1309 Returns the status whether get the variable success. The function retrieves 1310 variable through the UEFI Runtime Service GetVariable(). The 1311 returned buffer is allocated using AllocatePool(). The caller is responsible 1312 for freeing this buffer with FreePool(). 1313 1314 If Name is NULL, then ASSERT(). 1315 If Guid is NULL, then ASSERT(). 1316 If Value is NULL, then ASSERT(). 1317 1318 @param[in] Name The pointer to a Null-terminated Unicode string. 1319 @param[in] Guid The pointer to an EFI_GUID structure 1320 @param[out] Value The buffer point saved the variable info. 1321 @param[out] Size The buffer size of the variable. 1322 1323 @return EFI_OUT_OF_RESOURCES Allocate buffer failed. 1324 @return EFI_SUCCESS Find the specified variable. 1325 @return Others Errors Return errors from call to gRT->GetVariable. 1326 1327 **/ 1328 EFI_STATUS 1329 EFIAPI 1330 GetVariable2 ( 1331 IN CONST CHAR16 *Name, 1332 IN CONST EFI_GUID *Guid, 1333 OUT VOID **Value, 1334 OUT UINTN *Size OPTIONAL 1335 ) 1336 { 1337 EFI_STATUS Status; 1338 UINTN BufferSize; 1339 1340 ASSERT (Name != NULL && Guid != NULL && Value != NULL); 1341 1342 // 1343 // Try to get the variable size. 1344 // 1345 BufferSize = 0; 1346 *Value = NULL; 1347 if (Size != NULL) { 1348 *Size = 0; 1349 } 1350 1351 Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value); 1352 if (Status != EFI_BUFFER_TOO_SMALL) { 1353 return Status; 1354 } 1355 1356 // 1357 // Allocate buffer to get the variable. 1358 // 1359 *Value = AllocatePool (BufferSize); 1360 ASSERT (*Value != NULL); 1361 if (*Value == NULL) { 1362 return EFI_OUT_OF_RESOURCES; 1363 } 1364 1365 // 1366 // Get the variable data. 1367 // 1368 Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value); 1369 if (EFI_ERROR (Status)) { 1370 FreePool(*Value); 1371 *Value = NULL; 1372 } 1373 1374 if (Size != NULL) { 1375 *Size = BufferSize; 1376 } 1377 1378 return Status; 1379 } 1380 1381 /** 1382 Returns a pointer to an allocated buffer that contains the contents of a 1383 variable retrieved through the UEFI Runtime Service GetVariable(). This 1384 function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. 1385 The returned buffer is allocated using AllocatePool(). The caller is 1386 responsible for freeing this buffer with FreePool(). 1387 1388 If Name is NULL, then ASSERT(). 1389 If Value is NULL, then ASSERT(). 1390 1391 @param[in] Name The pointer to a Null-terminated Unicode string. 1392 @param[out] Value The buffer point saved the variable info. 1393 @param[out] Size The buffer size of the variable. 1394 1395 @return EFI_OUT_OF_RESOURCES Allocate buffer failed. 1396 @return EFI_SUCCESS Find the specified variable. 1397 @return Others Errors Return errors from call to gRT->GetVariable. 1398 1399 **/ 1400 EFI_STATUS 1401 EFIAPI 1402 GetEfiGlobalVariable2 ( 1403 IN CONST CHAR16 *Name, 1404 OUT VOID **Value, 1405 OUT UINTN *Size OPTIONAL 1406 ) 1407 { 1408 return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size); 1409 } 1302 1410 1303 1411 /**
Note:
See TracChangeset
for help on using the changeset viewer.