BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN LPCSTR DirectoryPath) { CHAR SearchPath[1024]; CHAR AnsiName[256], OemName[256], LangName[256]; BOOLEAN Status; // Scan registry and prepare boot drivers list WinLdrScanRegistry(LoaderBlock, DirectoryPath); // Get names of NLS files Status = WinLdrGetNLSNames(AnsiName, OemName, LangName); if (!Status) { UiMessageBox("Getting NLS names from registry failed!"); return FALSE; } TRACE("NLS data %s %s %s\n", AnsiName, OemName, LangName); // Load NLS data strcpy(SearchPath, DirectoryPath); strcat(SearchPath, "SYSTEM32\\"); Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName); TRACE("NLS data loaded with status %d\n", Status); /* TODO: Load OEM HAL font */ return TRUE; }
static VOID SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR SearchPath) { INFCONTEXT InfContext; BOOLEAN Status; LPCSTR AnsiName, OemName, LangName; /* Get ANSI codepage file */ if (!InfFindFirstLine(InfHandle, "NLS", "AnsiCodepage", &InfContext)) { ERR("Failed to find 'NLS/AnsiCodepage'\n"); return; } if (!InfGetDataField(&InfContext, 1, &AnsiName)) { ERR("Failed to get load options\n"); return; } /* Get OEM codepage file */ if (!InfFindFirstLine(InfHandle, "NLS", "OemCodepage", &InfContext)) { ERR("Failed to find 'NLS/AnsiCodepage'\n"); return; } if (!InfGetDataField(&InfContext, 1, &OemName)) { ERR("Failed to get load options\n"); return; } if (!InfFindFirstLine(InfHandle, "NLS", "UnicodeCasetable", &InfContext)) { ERR("Failed to find 'NLS/AnsiCodepage'\n"); return; } if (!InfGetDataField(&InfContext, 1, &LangName)) { ERR("Failed to get load options\n"); return; } Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName); TRACE("NLS data loaded with status %d\n", Status); }