| 254 | } |
| 255 | |
| 256 | EFI_STATUS ReinitSelfLib(VOID) |
| 257 | { |
| 258 | // called after reconnect drivers to re-open file handles |
| 259 | |
| 260 | EFI_STATUS Status; |
| 261 | EFI_HANDLE NewSelfHandle; |
| 262 | EFI_DEVICE_PATH_PROTOCOL* TmpDevicePath; |
| 263 | |
| 264 | // DbgHeader("ReinitSelfLib"); |
| 265 | |
| 266 | if (!SelfDevicePath) { |
| 267 | return EFI_NOT_FOUND; |
| 268 | } |
| 269 | |
| 270 | TmpDevicePath = DuplicateDevicePath(SelfDevicePath); |
| 271 | DBG("reinit: self device path=%ls\n", FileDevicePathToXStringW(TmpDevicePath).wc_str()); |
| 272 | if(TmpDevicePath == NULL) |
| 273 | return EFI_NOT_FOUND; |
| 274 | |
| 275 | NewSelfHandle = NULL; |
| 276 | Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, |
| 277 | &TmpDevicePath, |
| 278 | &NewSelfHandle); |
| 279 | CheckError(Status, L"while reopening our self handle"); |
| 280 | DBG("new SelfHandle=%llX\n", (uintptr_t)NewSelfHandle); |
| 281 | |
| 282 | SelfRootDir = EfiLibOpenRoot(NewSelfHandle); |
| 283 | if (SelfRootDir == NULL) { |
| 284 | DBG("SelfRootDir can't be reopened\n"); |
| 285 | return EFI_NOT_FOUND; |
| 286 | } |
| 287 | SelfDeviceHandle = NewSelfHandle; |
| 288 | /*Status = */SelfRootDir->Open(SelfRootDir, &ThemeX.ThemeDir, ThemePath.wc_str(), EFI_FILE_MODE_READ, 0); |
| 289 | |
| 290 | |
| 291 | /*Status = */SelfRootDir->Open(SelfRootDir, &OEMDir, OEMPath.wc_str(), EFI_FILE_MODE_READ, 0); |
| 292 | Status = SelfRootDir->Open(SelfRootDir, &SelfDir, SelfDirPath.wc_str(), EFI_FILE_MODE_READ, 0); |
| 293 | CheckFatalError(Status, L"while reopening our installation directory"); |
| 294 | return Status; |
| 295 | } |
| 296 | |
| 297 | |
| 298 | static |
no test coverage detected