VOID UiShowMessageBoxesInSection(PCSTR SectionName) { ULONG Idx; CHAR SettingName[80]; CHAR SettingValue[80]; PCHAR MessageBoxText; ULONG MessageBoxTextSize; ULONG_PTR SectionId; if (!IniOpenSection(SectionName, &SectionId)) { return; } // // Find all the message box settings and run them // for (Idx=0; Idx<IniGetNumSectionItems(SectionId); Idx++) { IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), SettingValue, sizeof(SettingValue)); if (_stricmp(SettingName, "MessageBox") == 0) { // Get the real length of the MessageBox text MessageBoxTextSize = IniGetSectionSettingValueSize(SectionId, Idx); //if (MessageBoxTextSize > 0) { // Allocate enough memory to hold the text MessageBoxText = MmHeapAlloc(MessageBoxTextSize); if (MessageBoxText) { // Get the MessageBox text IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), MessageBoxText, MessageBoxTextSize); // Fix it up UiEscapeString(MessageBoxText); // Display it UiMessageBox(MessageBoxText); // Free the memory MmHeapFree(MessageBoxText); } } } } }
VOID DriveMapMapDrivesInSection(PCSTR SectionName) { CHAR SettingName[80]; CHAR SettingValue[80]; CHAR Drive1[80]; CHAR Drive2[80]; ULONG_PTR SectionId; ULONG SectionItemCount; ULONG Index; ULONG Index2; DRIVE_MAP_LIST DriveMapList; RtlZeroMemory(&DriveMapList, sizeof(DRIVE_MAP_LIST)); if (!IniOpenSection(SectionName, &SectionId)) { return; } // Get the number of items in this section SectionItemCount = IniGetNumSectionItems(SectionId); // Loop through each one and check if its a DriveMap= setting for (Index=0; Index<SectionItemCount; Index++) { // Get the next setting from the .ini file section if (IniReadSettingByNumber(SectionId, Index, SettingName, sizeof(SettingName), SettingValue, sizeof(SettingValue))) { if (_stricmp(SettingName, "DriveMap") == 0) { // Make sure we haven't exceeded the drive map max count if (DriveMapList.DriveMapCount >= 4) { UiMessageBox("Max DriveMap count exceeded in section [%s]:\n\n%s=%s", SectionName, SettingName, SettingValue); continue; } RtlZeroMemory(Drive1, 80); RtlZeroMemory(Drive2, 80); strcpy(Drive1, SettingValue); // Parse the setting value and separate a string "hd0,hd1" // into two strings "hd0" and "hd1" for (Index2=0; Index2<strlen(Drive1); Index2++) { // Check if this character is the separater character (comma - ',') if (Drive1[Index2] == ',') { Drive1[Index2] = '\0'; strcpy(Drive2, &Drive1[Index2+1]); break; } } // Make sure we got good values before we add them to the map if (!DriveMapIsValidDriveString(Drive1) || !DriveMapIsValidDriveString(Drive2)) { UiMessageBox("Error in DriveMap setting in section [%s]:\n\n%s=%s", SectionName, SettingName, SettingValue); continue; } // Add them to the map DriveMapList.DriveMap[(DriveMapList.DriveMapCount * 2)] = DriveMapGetBiosDriveNumber(Drive1); DriveMapList.DriveMap[(DriveMapList.DriveMapCount * 2)+1] = DriveMapGetBiosDriveNumber(Drive2); DriveMapList.DriveMapCount++; TRACE("Mapping BIOS drive 0x%x to drive 0x%x\n", DriveMapGetBiosDriveNumber(Drive1), DriveMapGetBiosDriveNumber(Drive2)); } } } if (DriveMapList.DriveMapCount) { TRACE("Installing Int13 drive map for %d drives.\n", DriveMapList.DriveMapCount); DriveMapInstallInt13Handler(&DriveMapList); } else { TRACE("Removing any previously installed Int13 drive map.\n"); DriveMapRemoveInt13Handler(); } }