@@ -1161,6 +1161,72 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
11611161 (* BusNumber )++ ;
11621162}
11631163
1164+ static
1165+ PCSTR
1166+ GetPc9821SystemIdentifier (
1167+ _In_ UCHAR Id )
1168+ {
1169+ switch (Id )
1170+ {
1171+ case 0x27 : return "Lt2" ;
1172+ case 0x30 : return "Cx3" ;
1173+ case 0x40 : return "Ct16" ;
1174+ case 0x59 : return "V166" ;
1175+ case 0x5F : return "Nr166" ;
1176+ case 0x73 : return "Ra333" ;
1177+ default : return NULL ;
1178+ }
1179+ }
1180+
1181+ static
1182+ VOID
1183+ CreateSystemKey (
1184+ _Inout_ PCONFIGURATION_COMPONENT_DATA * SystemKey )
1185+ {
1186+ const ULONG IdentifierSize = 256 ;
1187+ PCHAR Identifier ;
1188+
1189+ /* The kernel expects the PC-98 identifier string to begin with 'NEC PC-98' */
1190+ #define PC98_DEFAULT_ID "NEC PC-98"
1191+
1192+ Identifier = FrLdrHeapAlloc (IdentifierSize , TAG_HW_RESOURCE_LIST );
1193+ if (!Identifier )
1194+ return ;
1195+
1196+ /* Check if this machine is NEC PC-9821 */
1197+ if (* (PUSHORT )MEM_EXTENDED_NORMAL == 0x2198 )
1198+ {
1199+ UCHAR Id = * ((PUCHAR )MEM_EXTENDED_NORMAL + 0x3F );
1200+ PCSTR IdString ;
1201+
1202+ IdString = GetPc9821SystemIdentifier (Id );
1203+ if (!IdString )
1204+ {
1205+ /* Unknown values should be visible in sysdm control panel for bug reports */
1206+ ERR ("Unknown PC-9821 model %02X\n" , Id );
1207+ RtlStringCbPrintfA (Identifier ,
1208+ IdentifierSize ,
1209+ PC98_DEFAULT_ID "21 Unknown model %02X" ,
1210+ Id );
1211+ }
1212+ else
1213+ {
1214+ RtlStringCbPrintfA (Identifier ,
1215+ IdentifierSize ,
1216+ PC98_DEFAULT_ID "21 %s" ,
1217+ IdString );
1218+ }
1219+ }
1220+ else
1221+ {
1222+ RtlStringCbCopyA (Identifier , IdentifierSize , PC98_DEFAULT_ID );
1223+ }
1224+ TRACE ("System identifier '%s'\n" , Identifier );
1225+
1226+ FldrCreateSystemKey (SystemKey , Identifier );
1227+ FrLdrHeapFree (Identifier , TAG_HW_RESOURCE_LIST );
1228+ }
1229+
11641230PCONFIGURATION_COMPONENT_DATA
11651231Pc98HwDetect (
11661232 _In_opt_ PCSTR Options )
@@ -1171,7 +1237,7 @@ Pc98HwDetect(
11711237 TRACE ("DetectHardware()\n" );
11721238
11731239 /* Create the 'System' key */
1174- FldrCreateSystemKey (& SystemKey , "NEC PC-98" );
1240+ CreateSystemKey (& SystemKey );
11751241
11761242 GetHarddiskConfigurationData = Pc98GetHarddiskConfigurationData ;
11771243
0 commit comments