28ULONG OldInt13HandlerAddress = 0;
29ULONG DriveMapHandlerAddress = 0;
30ULONG DriveMapHandlerSegOff = 0;
39 if ((
strlen(DriveString) < 3) ||
40 ((DriveString[0] !=
'f') && (DriveString[0] !=
'F') &&
41 (DriveString[0] !=
'h') && (DriveString[0] !=
'H')) ||
42 ((DriveString[1] !=
'd') && (DriveString[1] !=
'D')))
51 if (DriveString[
Index] <
'0' || DriveString[
Index] >
'9')
58 if ((
atoi(&DriveString[2]) < 0) || (
atoi(&DriveString[2]) > 0xff))
68 UCHAR BiosDriveNumber = 0;
87 BiosDriveNumber |= 0x80;
90 return BiosDriveNumber;
96DriveMapMapDrivesInSection(
100 CHAR SettingValue[80];
103 ULONG SectionItemCount;
106 DRIVE_MAP_LIST DriveMapList;
122 if (
_stricmp(SettingName,
"DriveMap") == 0)
125 if (DriveMapList.DriveMapCount >= 4)
127 UiMessageBox(
"Max DriveMap count exceeded in section [%s]:\n\n%s=%s", ((
PINI_SECTION)SectionId)->SectionName, SettingName, SettingValue);
134 strcpy(Drive1, SettingValue);
138 for (Index2=0; Index2<
strlen(Drive1); Index2++)
141 if (Drive1[Index2] ==
',')
143 Drive1[Index2] =
'\0';
144 strcpy(Drive2, &Drive1[Index2+1]);
152 UiMessageBox(
"Error in DriveMap setting in section [%s]:\n\n%s=%s", ((
PINI_SECTION)SectionId)->SectionName, SettingName, SettingValue);
159 DriveMapList.DriveMapCount++;
166 if (DriveMapList.DriveMapCount)
168 TRACE(
"Installing Int13 drive map for %d drives.\n", DriveMapList.DriveMapCount);
169 DriveMapInstallInt13Handler(&DriveMapList);
173 TRACE(
"Removing any previously installed Int13 drive map.\n");
174 DriveMapRemoveInt13Handler();
178VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
183#if defined(SARCH_PC98)
188 if (!DriveMapInstalled)
191 OldInt13HandlerAddress = RealModeIVT[0x13];
194 (*BiosLowMemorySize)--;
197 DriveMapHandlerAddress = (
ULONG)(*BiosLowMemorySize) << 10;
200 DriveMapHandlerSegOff = (DriveMapHandlerAddress << 12) & 0xffff0000;
204 RtlCopyMemory(&DriveMapInt13HandlerMapList, DriveMap,
sizeof(DRIVE_MAP_LIST));
207 DriveMapOldInt13HandlerAddress = OldInt13HandlerAddress;
211 &DriveMapInt13HandlerStart,
212 ((
PUCHAR)&DriveMapInt13HandlerEnd - (
PUCHAR)&DriveMapInt13HandlerStart));
215 RealModeIVT[0x13] = DriveMapHandlerSegOff;
218 DriveMapInstalled =
TRUE;
221VOID DriveMapRemoveInt13Handler(
VOID)
226#if defined(SARCH_PC98)
231 if (DriveMapInstalled)
234 RealModeIVT[0x13] = OldInt13HandlerAddress;
237 (*BiosLowMemorySize)++;
240 DriveMapInstalled =
FALSE;
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
ACPI_SIZE strlen(const char *String)
#define DriveMapGetBiosDriveNumber(DeviceName)
VOID CacheInvalidateCacheData(VOID)
#define DBG_DEFAULT_CHANNEL(ch)
VOID UiMessageBox(_In_ PCSTR Format,...)
BOOLEAN DriveMapIsValidDriveString(PCSTR DriveString)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
ULONG IniGetNumSectionItems(ULONG_PTR SectionId)
BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName