Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 32 of file wlregistry.c.
Referenced by WinLdrInitSystemHive().
{ ULONG FileId; CHAR FullHiveName[256]; LONG Status; FILEINFORMATION FileInfo; ULONG HiveFileSize; ULONG_PTR HiveDataPhysical; PVOID HiveDataVirtual; ULONG BytesRead; LPCWSTR FsService; /* Concatenate path and filename to get the full name */ strcpy(FullHiveName, DirectoryPath); strcat(FullHiveName, HiveName); //Print(L"Loading %s...\n", FullHiveName); Status = ArcOpen(FullHiveName, OpenReadOnly, &FileId); if (Status != ESUCCESS) { UiMessageBox("Opening hive file failed!"); return FALSE; } /* Get the file length */ Status = ArcGetFileInformation(FileId, &FileInfo); if (Status != ESUCCESS) { ArcClose(FileId); UiMessageBox("Hive file has 0 size!"); return FALSE; } HiveFileSize = FileInfo.EndingAddress.LowPart; /* Round up the size to page boundary and alloc memory */ HiveDataPhysical = (ULONG_PTR)MmAllocateMemoryWithType( MM_SIZE_TO_PAGES(HiveFileSize + MM_PAGE_SIZE - 1) << MM_PAGE_SHIFT, LoaderRegistryData); if (HiveDataPhysical == 0) { ArcClose(FileId); UiMessageBox("Unable to alloc memory for a hive!"); return FALSE; } /* Convert address to virtual */ HiveDataVirtual = PaToVa((PVOID)HiveDataPhysical); /* Fill LoaderBlock's entries */ LoaderBlock->RegistryLength = HiveFileSize; LoaderBlock->RegistryBase = HiveDataVirtual; /* Finally read from file to the memory */ Status = ArcRead(FileId, (PVOID)HiveDataPhysical, HiveFileSize, &BytesRead); if (Status != ESUCCESS) { ArcClose(FileId); UiMessageBox("Unable to read from hive file!"); return FALSE; } // Add boot filesystem driver to the list FsService = FsGetServiceName(FileId); if (FsService) { TRACE(" Adding filesystem service %S\n", FsService); Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\", NULL, (LPWSTR)FsService); if (!Status) TRACE(" Failed to add filesystem service\n"); } else { TRACE(" No required filesystem service\n"); } ArcClose(FileId); return TRUE; }