Changeset 96861 in vbox
- Timestamp:
- Sep 26, 2022 10:52:54 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/vfs.h
r96407 r96861 203 203 * 204 204 * @returns IPRT status code. 205 * @param hVfs VFS handle. 206 * @param pszLabel Where to store the lable. 207 * @param cbLabel Size of the buffer @a pszLable points at. 208 * @param pcbActual Where to return the label length, including the 209 * terminator. In case of VERR_BUFFER_OVERFLOW returns, 210 * this will be set to the required buffer size. Optional. 211 */ 212 RTDECL(int) RTVfsQueryLabel(RTVFS hVfs, char *pszLabel, size_t cbLabel, size_t *pcbActual); 205 * @param hVfs VFS handle. 206 * @param fAlternative For use with ISO files to retrieve the primary lable 207 * rather than the joliet / UDF one that the mount 208 * options would indicate. For other file systems, as 209 * well for ISO not mounted in joliet / UDF mode, the 210 * flag is ignored. 211 * @param pszLabel Where to store the lable. 212 * @param cbLabel Size of the buffer @a pszLable points at. 213 * @param pcbActual Where to return the label length, including the 214 * terminator. In case of VERR_BUFFER_OVERFLOW 215 * returns, this will be set to the required buffer 216 * size. Optional. 217 */ 218 RTDECL(int) RTVfsQueryLabel(RTVFS hVfs, bool fAlternative, char *pszLabel, size_t cbLabel, size_t *pcbActual); 213 219 214 220 -
trunk/include/iprt/vfslowlevel.h
r96407 r96861 182 182 * Returns a UTF-8 string. */ 183 183 RTVFSQIEX_VOL_LABEL, 184 /** Alternative volume label, the primary one for ISOs, otherwise treated same 185 * as RTVFSQIEX_VOL_LABEL. */ 186 RTVFSQIEX_VOL_LABEL_ALT, 184 187 /** Volume serial number. 185 188 * Returns a uint32_t, uint64_t or RTUUID. */ -
trunk/src/VBox/Main/include/UnattendedImpl.h
r96407 r96861 266 266 HRESULT i_innerDetectIsoOSWindows(RTVFS hVfsIso, DETECTBUFFER *puBuf); 267 267 HRESULT i_innerDetectIsoOSLinux(RTVFS hVfsIso, DETECTBUFFER *puBuf); 268 HRESULT i_innerDetectIsoOSLinuxFedora(RTVFS hVfsIso, DETECTBUFFER *puBuf, char *pszVolId); 268 269 HRESULT i_innerDetectIsoOSOs2(RTVFS hVfsIso, DETECTBUFFER *puBuf); 269 270 HRESULT i_innerDetectIsoOSFreeBsd(RTVFS hVfsIso, DETECTBUFFER *puBuf); -
trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
r96721 r96861 46 46 #include <iprt/ctype.h> 47 47 #include <iprt/file.h> 48 #ifndef RT_OS_WINDOWS 49 # include <iprt/formats/mz.h> 50 # include <iprt/formats/pecoff.h> 51 #endif 48 52 #include <iprt/formats/wim.h> 49 53 #include <iprt/fsvfs.h> … … 960 964 if ( RTStrNICmp(pBuf->sz, RT_STR_TUPLE("vista")) == 0 961 965 || RTStrNICmp(pBuf->sz, RT_STR_TUPLE("winmain_beta")) == 0) 962 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_WinVista);966 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_WinVista); 963 967 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("lh_sp2rtm")) == 0) 964 968 { 965 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_WinVista);969 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_WinVista); 966 970 pszVersion = "sp2"; 967 971 } 968 972 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("longhorn_rtm")) == 0) 969 973 { 970 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_WinVista);974 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_WinVista); 971 975 pszVersion = "sp1"; 972 976 } 973 977 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("win7")) == 0) 974 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win7);978 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win7); 975 979 else if ( RTStrNICmp(pBuf->sz, RT_STR_TUPLE("winblue")) == 0 976 980 || RTStrNICmp(pBuf->sz, RT_STR_TUPLE("winmain_blue")) == 0 977 981 || RTStrNICmp(pBuf->sz, RT_STR_TUPLE("win81")) == 0 /* not seen, but just in case its out there */ ) 978 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win81);982 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win81); 979 983 else if ( RTStrNICmp(pBuf->sz, RT_STR_TUPLE("win8")) == 0 980 984 || RTStrNICmp(pBuf->sz, RT_STR_TUPLE("winmain_win8")) == 0 ) 981 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win8);985 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win8); 982 986 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("th1")) == 0) 983 987 { 984 988 pszVersion = "1507"; // aka. GA, retroactively 1507 985 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);989 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 986 990 } 987 991 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("th2")) == 0) 988 992 { 989 993 pszVersion = "1511"; // aka. threshold 2 990 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);994 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 991 995 } 992 996 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("rs1_release")) == 0) 993 997 { 994 998 pszVersion = "1607"; // aka. anniversay update; rs=redstone 995 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);999 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 996 1000 } 997 1001 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("rs2_release")) == 0) 998 1002 { 999 1003 pszVersion = "1703"; // aka. creators update 1000 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1004 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1001 1005 } 1002 1006 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("rs3_release")) == 0) 1003 1007 { 1004 1008 pszVersion = "1709"; // aka. fall creators update 1005 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1009 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1006 1010 } 1007 1011 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("rs4_release")) == 0) 1008 1012 { 1009 1013 pszVersion = "1803"; 1010 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1014 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1011 1015 } 1012 1016 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("rs5_release")) == 0) 1013 1017 { 1014 1018 pszVersion = "1809"; 1015 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1019 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1016 1020 } 1017 1021 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("19h1_release")) == 0) 1018 1022 { 1019 1023 pszVersion = "1903"; 1020 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1024 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1021 1025 } 1022 1026 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("19h2_release")) == 0) 1023 1027 { 1024 1028 pszVersion = "1909"; // ?? 1025 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1029 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1026 1030 } 1027 1031 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("20h1_release")) == 0) 1028 1032 { 1029 1033 pszVersion = "2003"; // ?? 1030 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1034 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1031 1035 } 1032 1036 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("vb_release")) == 0) 1033 1037 { 1034 1038 pszVersion = "2004"; // ?? vb=Vibranium 1035 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1039 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1036 1040 } 1037 1041 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("20h2_release")) == 0) 1038 1042 { 1039 1043 pszVersion = "2009"; // ?? 1040 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1044 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1041 1045 } 1042 1046 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("21h1_release")) == 0) 1043 1047 { 1044 1048 pszVersion = "2103"; // ?? 1045 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1049 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1046 1050 } 1047 1051 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("21h2_release")) == 0) 1048 1052 { 1049 1053 pszVersion = "2109"; // ?? 1050 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win10);1054 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win10); 1051 1055 } 1052 1056 else if (RTStrNICmp(pBuf->sz, RT_STR_TUPLE("co_release")) == 0) … … 1095 1099 { 1096 1100 fClarifyProd = true; 1097 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win2k3);1101 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win2k3); 1098 1102 if (RTStrVersionCompare(psz, "5.2.3790.3959") >= 0) 1099 1103 pszVersion = "sp2"; … … 1103 1107 else if (RTStrVersionCompare(psz, "5.1.0") >= 0) /* XP */ 1104 1108 { 1105 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_WinXP);1109 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_WinXP); 1106 1110 if (RTStrVersionCompare(psz, "5.1.2600.5512") >= 0) 1107 1111 pszVersion = "sp3"; … … 1113 1117 else if (RTStrVersionCompare(psz, "5.0.0") >= 0) 1114 1118 { 1115 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win2k);1119 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win2k); 1116 1120 if (RTStrVersionCompare(psz, "5.0.2195.6717") >= 0) 1117 1121 pszVersion = "sp4"; … … 1161 1165 vrc = RTIniFileQueryValue(hIniFile, "Product Specification", "Product", pBuf->sz, sizeof(*pBuf), NULL); 1162 1166 if (RT_SUCCESS(vrc) && RTStrNICmp(pBuf->sz, RT_STR_TUPLE("Windows XP")) == 0) 1163 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_WinXP);1167 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_WinXP); 1164 1168 else if (RT_SUCCESS(vrc) && RTStrNICmp(pBuf->sz, RT_STR_TUPLE("Windows Server 2003")) == 0) 1165 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win2k3);1169 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win2k3); 1166 1170 else 1167 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Win2k);1171 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Win2k); 1168 1172 1169 1173 if (RT_SUCCESS(vrc) && (strstr(pBuf->sz, "Server") || strstr(pBuf->sz, "server"))) … … 1291 1295 1292 1296 /** 1297 * Architecture strings for Linux and the like. 1298 */ 1299 static struct { const char *pszArch; uint32_t cchArch; VBOXOSTYPE fArch; } const g_aLinuxArches[] = 1300 { 1301 { RT_STR_TUPLE("amd64"), VBOXOSTYPE_x64 }, 1302 { RT_STR_TUPLE("x86_64"), VBOXOSTYPE_x64 }, 1303 { RT_STR_TUPLE("x86-64"), VBOXOSTYPE_x64 }, /* just in case */ 1304 { RT_STR_TUPLE("x64"), VBOXOSTYPE_x64 }, /* ditto */ 1305 1306 { RT_STR_TUPLE("x86"), VBOXOSTYPE_x86 }, 1307 { RT_STR_TUPLE("i386"), VBOXOSTYPE_x86 }, 1308 { RT_STR_TUPLE("i486"), VBOXOSTYPE_x86 }, 1309 { RT_STR_TUPLE("i586"), VBOXOSTYPE_x86 }, 1310 { RT_STR_TUPLE("i686"), VBOXOSTYPE_x86 }, 1311 { RT_STR_TUPLE("i786"), VBOXOSTYPE_x86 }, 1312 { RT_STR_TUPLE("i886"), VBOXOSTYPE_x86 }, 1313 { RT_STR_TUPLE("i986"), VBOXOSTYPE_x86 }, 1314 }; 1315 1316 /** 1293 1317 * Detects linux architecture. 1294 1318 * … … 1300 1324 static bool detectLinuxArch(const char *pszArch, VBOXOSTYPE *penmOsType, VBOXOSTYPE enmBaseOsType) 1301 1325 { 1302 if ( RTStrNICmp(pszArch, RT_STR_TUPLE("amd64")) == 0 1303 || RTStrNICmp(pszArch, RT_STR_TUPLE("x86_64")) == 0 1304 || RTStrNICmp(pszArch, RT_STR_TUPLE("x86-64")) == 0 /* just in case */ 1305 || RTStrNICmp(pszArch, RT_STR_TUPLE("x64")) == 0 /* ditto */ ) 1306 { 1307 *penmOsType = (VBOXOSTYPE)(enmBaseOsType | VBOXOSTYPE_x64); 1308 return true; 1309 } 1310 1311 if ( RTStrNICmp(pszArch, RT_STR_TUPLE("x86")) == 0 1312 || RTStrNICmp(pszArch, RT_STR_TUPLE("i386")) == 0 1313 || RTStrNICmp(pszArch, RT_STR_TUPLE("i486")) == 0 1314 || RTStrNICmp(pszArch, RT_STR_TUPLE("i586")) == 0 1315 || RTStrNICmp(pszArch, RT_STR_TUPLE("i686")) == 0 1316 || RTStrNICmp(pszArch, RT_STR_TUPLE("i786")) == 0 1317 || RTStrNICmp(pszArch, RT_STR_TUPLE("i886")) == 0 1318 || RTStrNICmp(pszArch, RT_STR_TUPLE("i986")) == 0) 1319 { 1320 *penmOsType = enmBaseOsType; 1321 return true; 1322 } 1323 1326 for (size_t i = 0; i < RT_ELEMENTS(g_aLinuxArches); i++) 1327 if (RTStrNICmp(pszArch, g_aLinuxArches[i].pszArch, g_aLinuxArches[i].cchArch) == 0) 1328 { 1329 *penmOsType = (VBOXOSTYPE)(enmBaseOsType | g_aLinuxArches[i].fArch); 1330 return true; 1331 } 1324 1332 /** @todo check for 'noarch' since source CDs have been seen to use that. */ 1325 1333 return false; … … 1333 1341 * @param penmOsType Where to return the arch and type on success. 1334 1342 * @param enmBaseOsType The base (x86) OS type to return. 1343 * @param ppszHit Where to return the pointer to the architecture 1344 * specifier. Optional. 1345 * @param ppszNext Where to return the pointer to the char 1346 * following the architecuture specifier. Optional. 1335 1347 */ 1336 static bool detectLinuxArchII(const char *pszArch, VBOXOSTYPE *penmOsType, VBOXOSTYPE enmBaseOsType) 1337 { 1338 if ( RTStrIStr(pszArch, "amd64") != NULL 1339 || RTStrIStr(pszArch, "x86_64") != NULL 1340 || RTStrIStr(pszArch, "x86-64") != NULL /* just in case */ 1341 || RTStrIStr(pszArch, "x64") != NULL /* ditto */ ) 1342 { 1343 *penmOsType = (VBOXOSTYPE)(enmBaseOsType | VBOXOSTYPE_x64); 1344 return true; 1345 } 1346 1347 if ( RTStrIStr(pszArch, "x86") != NULL 1348 || RTStrIStr(pszArch, "i386") != NULL 1349 || RTStrIStr(pszArch, "i486") != NULL 1350 || RTStrIStr(pszArch, "i586") != NULL 1351 || RTStrIStr(pszArch, "i686") != NULL 1352 || RTStrIStr(pszArch, "i786") != NULL 1353 || RTStrIStr(pszArch, "i886") != NULL 1354 || RTStrIStr(pszArch, "i986") != NULL) 1355 { 1356 *penmOsType = enmBaseOsType; 1357 return true; 1348 static bool detectLinuxArchII(const char *pszArch, VBOXOSTYPE *penmOsType, VBOXOSTYPE enmBaseOsType, 1349 char **ppszHit = NULL, char **ppszNext = NULL) 1350 { 1351 for (size_t i = 0; i < RT_ELEMENTS(g_aLinuxArches); i++) 1352 { 1353 const char *pszHit = RTStrIStr(pszArch, g_aLinuxArches[i].pszArch); 1354 if (pszHit != NULL) 1355 { 1356 if (ppszHit) 1357 *ppszHit = (char *)pszHit; 1358 if (ppszNext) 1359 *ppszNext = (char *)pszHit + g_aLinuxArches[i].cchArch; 1360 *penmOsType = (VBOXOSTYPE)(enmBaseOsType | g_aLinuxArches[i].fArch); 1361 return true; 1362 } 1358 1363 } 1359 1364 return false; … … 1372 1377 && !RT_C_IS_ALNUM(pszOsAndVersion[3])) 1373 1378 { 1374 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_RedHat);1379 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_RedHat); 1375 1380 pszOsAndVersion = RTStrStripL(pszOsAndVersion + 3); 1376 1381 } … … 1381 1386 && !RT_C_IS_ALNUM(pszOsAndVersion[8])) 1382 1387 { 1383 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_OpenSUSE);1388 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_OpenSUSE); 1384 1389 pszOsAndVersion = RTStrStripL(pszOsAndVersion + 8); 1385 1390 } … … 1387 1392 && !RT_C_IS_ALNUM(pszOsAndVersion[6])) 1388 1393 { 1389 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Oracle);1394 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Oracle); 1390 1395 pszOsAndVersion = RTStrStripL(pszOsAndVersion + 6); 1391 1396 } … … 1393 1398 && !RT_C_IS_ALNUM(pszOsAndVersion[6])) 1394 1399 { 1395 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_RedHat);1400 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_RedHat); 1396 1401 pszOsAndVersion = RTStrStripL(pszOsAndVersion + 6); 1397 1402 } … … 1399 1404 && !RT_C_IS_ALNUM(pszOsAndVersion[6])) 1400 1405 { 1401 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_FedoraCore);1406 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_FedoraCore); 1402 1407 pszOsAndVersion = RTStrStripL(pszOsAndVersion + 6); 1403 1408 } … … 1405 1410 && !RT_C_IS_ALNUM(pszOsAndVersion[6])) 1406 1411 { 1407 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Ubuntu);1412 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Ubuntu); 1408 1413 pszOsAndVersion = RTStrStripL(pszOsAndVersion + 6); 1409 1414 } … … 1411 1416 && !RT_C_IS_ALNUM(pszOsAndVersion[10])) 1412 1417 { 1413 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Ubuntu);1418 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Ubuntu); 1414 1419 pszOsAndVersion = RTStrStripL(pszOsAndVersion + 10); 1415 1420 } … … 1419 1424 && !RT_C_IS_ALNUM(pszOsAndVersion[7])) 1420 1425 { 1421 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Ubuntu);1426 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Ubuntu); 1422 1427 pszOsAndVersion = RTStrStripL(pszOsAndVersion + 7); 1423 1428 } … … 1425 1430 && !RT_C_IS_ALNUM(pszOsAndVersion[6])) 1426 1431 { 1427 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Debian);1432 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Debian); 1428 1433 pszOsAndVersion = RTStrStripL(pszOsAndVersion + 6); 1429 1434 } … … 1453 1458 if ( RTStrIStr(pszOsAndVersion, "RedHat") != NULL 1454 1459 || RTStrIStr(pszOsAndVersion, "Red Hat") != NULL) 1455 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_x64) | VBOXOSTYPE_RedHat);1460 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_RedHat); 1456 1461 else if (RTStrIStr(pszOsAndVersion, "Oracle") != NULL) 1457 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Oracle);1462 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Oracle); 1458 1463 else if (RTStrIStr(pszOsAndVersion, "CentOS") != NULL) 1459 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_RedHat);1464 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_RedHat); 1460 1465 else if (RTStrIStr(pszOsAndVersion, "Fedora") != NULL) 1461 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_FedoraCore);1466 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_FedoraCore); 1462 1467 else if (RTStrIStr(pszOsAndVersion, "Ubuntu") != NULL) 1463 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Ubuntu);1468 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Ubuntu); 1464 1469 else if (RTStrIStr(pszOsAndVersion, "Mint") != NULL) 1465 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Ubuntu);1470 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Ubuntu); 1466 1471 else if (RTStrIStr(pszOsAndVersion, "Debian")) 1467 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_Debian);1472 *penmOsType = (VBOXOSTYPE)((*penmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_Debian); 1468 1473 else 1469 1474 fRet = false; … … 1492 1497 * 1493 1498 * @returns true if detected, false if not. 1494 * @param pszDiskName Name of the disk as it is read from .disk/info or README.diskdefines file. 1495 * @param cchVersionPosition String position where first numerical character is found. We use substring upto this position as OS flavor 1499 * @param pszDiskName Name of the disk as it is read from .disk/info or 1500 * README.diskdefines file. 1501 * @param poffVersion String position where first numerical character is 1502 * found. We use substring upto this position as OS flavor 1496 1503 */ 1497 static bool detectLinuxDistroFlavor(const char *pszDiskName, size_t *cchVersionPosition) 1498 { 1499 if (!pszDiskName || !cchVersionPosition) 1504 static bool detectLinuxDistroFlavor(const char *pszDiskName, size_t *poffVersion) 1505 { 1506 Assert(poffVersion); 1507 if (!pszDiskName) 1500 1508 return false; 1501 while (*pszDiskName != '\0' && !RT_C_IS_DIGIT(*pszDiskName)) 1509 char ch; 1510 while ((ch = *pszDiskName) != '\0' && !RT_C_IS_DIGIT(ch)) 1502 1511 { 1503 1512 ++pszDiskName; 1504 ++(*cchVersionPosition);1513 *poffVersion += 1; 1505 1514 } 1506 1515 return true; … … 1559 1568 { 1560 1569 LogRel(("Unattended: .treeinfo: Unknown: name/family='%s', assuming Red Hat\n", pBuf->sz)); 1561 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ x64) | VBOXOSTYPE_RedHat);1570 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_RedHat); 1562 1571 } 1563 1572 } … … 1844 1853 1845 1854 /* 1846 * All of the debian based distro versions I checked have a single line ./disk/info file. 1847 * Only info I could find related to .disk folder is: https://lists.debian.org/debian-cd/2004/01/msg00069.html 1855 * All of the debian based distro versions I checked have a single line ./disk/info 1856 * file. Only info I could find related to .disk folder is: 1857 * https://lists.debian.org/debian-cd/2004/01/msg00069.html 1858 * 1848 1859 * Some example content from several install ISOs is as follows: 1849 * Ubuntu 4.10 "Warty Warthog" - Preview amd64 Binary-1 (20041020)1850 * Linux Mint 20.3 "Una" - Release amd64 202201041851 * Debian GNU/Linux 11.2.0 "Bullseye" - Official amd64 NETINST 20211218-11:121852 * Debian GNU/Linux 9.13.0 "Stretch" - Official amd64 DVD Binary-1 20200718-11:071853 * Xubuntu 20.04.2.0 LTS "Focal Fossa" - Release amd64 (20210209.1)1854 * Ubuntu 17.10 "Artful Aardvark" - Release amd64 (20180105.1)1855 * Ubuntu 16.04.6 LTS "Xenial Xerus" - Release i386 (20190227.1)1856 * Debian GNU/Linux 8.11.1 "Jessie" - Official amd64 CD Binary-1 20190211-02:101857 * Kali GNU/Linux 2021.3a "Kali-last-snapshot" - Official amd64 BD Binary-1 with firmware 20211015-16:551858 * Official Debian GNU/Linux Live 10.10.0 cinnamon 2021-06-19T12:131860 * Ubuntu 4.10 "Warty Warthog" - Preview amd64 Binary-1 (20041020) 1861 * Linux Mint 20.3 "Una" - Release amd64 20220104 1862 * Debian GNU/Linux 11.2.0 "Bullseye" - Official amd64 NETINST 20211218-11:12 1863 * Debian GNU/Linux 9.13.0 "Stretch" - Official amd64 DVD Binary-1 20200718-11:07 1864 * Xubuntu 20.04.2.0 LTS "Focal Fossa" - Release amd64 (20210209.1) 1865 * Ubuntu 17.10 "Artful Aardvark" - Release amd64 (20180105.1) 1866 * Ubuntu 16.04.6 LTS "Xenial Xerus" - Release i386 (20190227.1) 1867 * Debian GNU/Linux 8.11.1 "Jessie" - Official amd64 CD Binary-1 20190211-02:10 1868 * Kali GNU/Linux 2021.3a "Kali-last-snapshot" - Official amd64 BD Binary-1 with firmware 20211015-16:55 1869 * Official Debian GNU/Linux Live 10.10.0 cinnamon 2021-06-19T12:13 1859 1870 */ 1860 1871 vrc = RTVfsFileOpen(hVfsIso, ".disk/info", RTFILE_O_READ | RTFILE_O_DENY_NONE | RTFILE_O_OPEN, &hVfsFile); … … 1888 1899 { 1889 1900 char szVolumeId[128]; 1890 size_t cchVolumeId; 1891 vrc = RTVfsQueryLabel(hVfsIso, szVolumeId, 128, &cchVolumeId); 1901 vrc = RTVfsQueryLabel(hVfsIso, false /*fAlternative*/, szVolumeId, sizeof(szVolumeId), NULL); 1892 1902 if (RT_SUCCESS(vrc)) 1893 1903 { … … 1930 1940 } 1931 1941 1942 /* 1943 * Fedora live iso should be recognizable from the primary volume ID (the 1944 * joliet one is usually truncated). We set fAlternative = true here to 1945 * get the primary volume ID. 1946 */ 1947 char szVolumeId[128]; 1948 vrc = RTVfsQueryLabel(hVfsIso, true /*fAlternative*/, szVolumeId, sizeof(szVolumeId), NULL); 1949 if (RT_SUCCESS(vrc) && RTStrStartsWith(szVolumeId, "Fedora-")) 1950 return i_innerDetectIsoOSLinuxFedora(hVfsIso, pBuf, &szVolumeId[sizeof("Fedora-") - 1]); 1932 1951 return S_FALSE; 1952 } 1953 1954 1955 /** 1956 * Continues working a Fedora ISO image after the caller found a "Fedora-*" 1957 * volume ID. 1958 * 1959 * Sample Volume IDs: 1960 * - Fedora-WS-Live-34-1-2 (joliet: Fedora-WS-Live-3) 1961 * - Fedora-S-dvd-x86_64-34 (joliet: Fedora-S-dvd-x86) 1962 * - Fedora-WS-dvd-i386-25 (joliet: Fedora-WS-dvd-i3) 1963 */ 1964 HRESULT Unattended::i_innerDetectIsoOSLinuxFedora(RTVFS hVfsIso, DETECTBUFFER *pBuf, char *pszVolId) 1965 { 1966 char * const pszFlavor = pszVolId; 1967 char * psz = pszVolId; 1968 1969 /* The volume id may or may not include an arch, component. 1970 We ASSUME that it includes a numeric part with the version, or at least 1971 part of it. */ 1972 char *pszVersion = NULL; 1973 char *pszArch = NULL; 1974 if (detectLinuxArchII(psz, &mEnmOsType, VBOXOSTYPE_FedoraCore, &pszArch, &pszVersion)) 1975 *pszArch = '\0'; 1976 else 1977 { 1978 mEnmOsType = (VBOXOSTYPE)(VBOXOSTYPE_FedoraCore | VBOXOSTYPE_UnknownArch); 1979 1980 char ch; 1981 while ((ch = *psz) != '\0' && (!RT_C_IS_DIGIT(ch) || !RT_C_IS_PUNCT(psz[-1]))) 1982 psz++; 1983 if (ch != '\0') 1984 pszVersion = psz; 1985 } 1986 1987 /* 1988 * Replace '-' with '.' in the version part and use it as the version. 1989 */ 1990 if (pszVersion) 1991 { 1992 psz = pszVersion; 1993 while ((psz = strchr(psz, '-')) != NULL) 1994 *psz++ = '.'; 1995 try { mStrDetectedOSVersion = RTStrStrip(pszVersion); } 1996 catch (std::bad_alloc &) { return E_OUTOFMEMORY; } 1997 1998 *pszVersion = '\0'; /* don't include in flavor */ 1999 } 2000 2001 /* 2002 * Split up the pre-arch/version bits into words and use them as the flavor. 2003 */ 2004 psz = pszFlavor; 2005 while ((psz = strchr(psz, '-')) != NULL) 2006 *psz++ = ' '; 2007 try { mStrDetectedOSFlavor = RTStrStrip(pszFlavor); } 2008 catch (std::bad_alloc &) { return E_OUTOFMEMORY; } 2009 2010 /* 2011 * If we don't have an architecture, we look at the vmlinuz file as the x86 2012 * and AMD64 versions starts with a MZ+PE header giving the architecture. 2013 */ 2014 if ((mEnmOsType & VBOXOSTYPE_ArchitectureMask) == VBOXOSTYPE_UnknownArch) 2015 { 2016 static const char * const s_apszVmLinuz[] = { "images/pxeboot/vmlinuz", "isolinux/vmlinuz" }; 2017 for (size_t i = 0; i < RT_ELEMENTS(s_apszVmLinuz); i++) 2018 { 2019 RTVFSFILE hVfsFileLinuz = NIL_RTVFSFILE; 2020 int vrc = RTVfsFileOpen(hVfsIso, s_apszVmLinuz[i], RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE, 2021 &hVfsFileLinuz); 2022 if (RT_SUCCESS(vrc)) 2023 { 2024 /* DOS signature: */ 2025 PIMAGE_DOS_HEADER pDosHdr = (PIMAGE_DOS_HEADER)&pBuf->ab[0]; 2026 AssertCompile(sizeof(*pBuf) > sizeof(*pDosHdr)); 2027 vrc = RTVfsFileReadAt(hVfsFileLinuz, 0, pDosHdr, sizeof(*pDosHdr), NULL); 2028 if (RT_SUCCESS(vrc) && pDosHdr->e_magic == IMAGE_DOS_SIGNATURE) 2029 { 2030 /* NT signature - only need magic + file header, so use the 64 version for better debugging: */ 2031 PIMAGE_NT_HEADERS64 pNtHdrs = (PIMAGE_NT_HEADERS64)&pBuf->ab[0]; 2032 vrc = RTVfsFileReadAt(hVfsFileLinuz, pDosHdr->e_lfanew, pNtHdrs, sizeof(*pNtHdrs), NULL); 2033 AssertCompile(sizeof(*pBuf) > sizeof(*pNtHdrs)); 2034 if (RT_SUCCESS(vrc) && pNtHdrs->Signature == IMAGE_NT_SIGNATURE) 2035 { 2036 if (pNtHdrs->FileHeader.Machine == IMAGE_FILE_MACHINE_I386) 2037 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & ~VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_x86); 2038 else if (pNtHdrs->FileHeader.Machine == IMAGE_FILE_MACHINE_AMD64) 2039 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & ~VBOXOSTYPE_ArchitectureMask) | VBOXOSTYPE_x64); 2040 else 2041 AssertFailed(); 2042 } 2043 } 2044 2045 RTVfsFileRelease(hVfsFileLinuz); 2046 if ((mEnmOsType & VBOXOSTYPE_ArchitectureMask) != VBOXOSTYPE_UnknownArch) 2047 break; 2048 } 2049 } 2050 } 2051 2052 /* 2053 * If that failed, look for other files that gives away the arch. 2054 */ 2055 if ((mEnmOsType & VBOXOSTYPE_ArchitectureMask) == VBOXOSTYPE_UnknownArch) 2056 { 2057 static struct { const char *pszFile; VBOXOSTYPE fArch; } const s_aArchSpecificFiles[] = 2058 { 2059 { "EFI/BOOT/grubaa64.efi", VBOXOSTYPE_arm64 }, 2060 { "EFI/BOOT/BOOTAA64.EFI", VBOXOSTYPE_arm64 }, 2061 }; 2062 PRTFSOBJINFO pObjInfo = (PRTFSOBJINFO)&pBuf->ab[0]; 2063 AssertCompile(sizeof(*pBuf) > sizeof(*pObjInfo)); 2064 for (size_t i = 0; i < RT_ELEMENTS(s_aArchSpecificFiles); i++) 2065 { 2066 int vrc = RTVfsQueryPathInfo(hVfsIso, s_aArchSpecificFiles[i].pszFile, pObjInfo, 2067 RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK); 2068 if (RT_SUCCESS(vrc) && RTFS_IS_FILE(pObjInfo->Attr.fMode)) 2069 { 2070 mEnmOsType = (VBOXOSTYPE)((mEnmOsType & ~VBOXOSTYPE_ArchitectureMask) | s_aArchSpecificFiles[i].fArch); 2071 break; 2072 } 2073 } 2074 } 2075 2076 /* 2077 * If we like, we could parse grub.conf to look for fullly spelled out 2078 * flavor, though the menu items typically only contains the major version 2079 * number, so little else to add, really. 2080 */ 2081 2082 return (mEnmOsType & VBOXOSTYPE_ArchitectureMask) != VBOXOSTYPE_UnknownArch ? S_OK : S_FALSE; 1933 2083 } 1934 2084 … … 2260 2410 char szVolumeId[128]; 2261 2411 size_t cchVolumeId; 2262 vrc = RTVfsQueryLabel(hVfsIso, szVolumeId, 128, &cchVolumeId);2412 vrc = RTVfsQueryLabel(hVfsIso, false /*fAlternative*/, szVolumeId, 128, &cchVolumeId); 2263 2413 if (RT_SUCCESS(vrc)) 2264 2414 { … … 3836 3986 return S_OK; 3837 3987 3988 /* Fredora ISOs cannot be installed at present. */ 3989 if (enmOsTypeMasked == VBOXOSTYPE_FedoraCore) 3990 return S_OK; 3991 3838 3992 /* 3839 3993 * Assume the rest works. -
trunk/src/VBox/Runtime/common/fs/isovfs.cpp
r96407 r96861 5060 5060 { 5061 5061 case RTVFSQIEX_VOL_LABEL: 5062 { 5063 if (pThis->enmType == RTFSISOVOLTYPE_UDF) 5062 case RTVFSQIEX_VOL_LABEL_ALT: 5063 { 5064 if (pThis->enmType == RTFSISOVOLTYPE_UDF 5065 && ( enmInfo == RTVFSQIEX_VOL_LABEL 5066 || pThis->offPrimaryVolDesc == 0)) 5064 5067 return rtFsIsoVol_ReturnUdfDString(pThis->Udf.VolInfo.achLogicalVolumeID, 5065 5068 sizeof(pThis->Udf.VolInfo.achLogicalVolumeID), pvInfo, cbInfo, pcbRet); 5069 5070 bool const fPrimary = enmInfo == RTVFSQIEX_VOL_LABEL_ALT 5071 || pThis->enmType == RTFSISOVOLTYPE_ISO9960; 5072 5066 5073 int rc = RTVfsFileReadAt(pThis->hVfsBacking, 5067 pThis->enmType == RTFSISOVOLTYPE_ISO9960 5068 ? pThis->offPrimaryVolDesc : pThis->offSecondaryVolDesc, 5074 fPrimary ? pThis->offPrimaryVolDesc : pThis->offSecondaryVolDesc, 5069 5075 uBuf.ab, RT_MAX(RT_MIN(pThis->cbSector, sizeof(uBuf)), sizeof(uBuf.PriVolDesc)), NULL); 5070 5076 AssertRCReturn(rc, rc); 5071 switch (enmInfo) 5072 { 5073 case RTVFSQIEX_VOL_LABEL: 5074 if (pThis->enmType == RTFSISOVOLTYPE_ISO9960) 5075 return rtFsIsoVol_ReturnIso9660DString(uBuf.PriVolDesc.achVolumeId, sizeof(uBuf.PriVolDesc.achVolumeId), 5076 pvInfo, cbInfo, pcbRet); 5077 return rtFsIsoVol_ReturnIso9660D1String(uBuf.SupVolDesc.achVolumeId, sizeof(uBuf.SupVolDesc.achVolumeId), 5078 pvInfo, cbInfo, pcbRet); 5079 default: 5080 AssertFailedReturn(VERR_INTERNAL_ERROR); 5081 } 5082 break; 5077 5078 if (fPrimary) 5079 return rtFsIsoVol_ReturnIso9660DString(uBuf.PriVolDesc.achVolumeId, sizeof(uBuf.PriVolDesc.achVolumeId), 5080 pvInfo, cbInfo, pcbRet); 5081 return rtFsIsoVol_ReturnIso9660D1String(uBuf.SupVolDesc.achVolumeId, sizeof(uBuf.SupVolDesc.achVolumeId), 5082 pvInfo, cbInfo, pcbRet); 5083 5083 } 5084 5084 -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r96407 r96861 2319 2319 2320 2320 2321 RTDECL(int) RTVfsQueryLabel(RTVFS hVfs, char *pszLabel, size_t cbLabel, size_t *pcbActual)2321 RTDECL(int) RTVfsQueryLabel(RTVFS hVfs, bool fAlternative, char *pszLabel, size_t cbLabel, size_t *pcbActual) 2322 2322 { 2323 2323 RTVFSINTERNAL *pThis = hVfs; … … 2336 2336 2337 2337 RTVfsLockAcquireRead(pThis->Base.hLock); 2338 rc = pThis->pOps->Obj.pfnQueryInfoEx(pThis->Base.pvThis, RTVFSQIEX_VOL_LABEL, pszLabel, cbLabel, pcbActual); 2338 rc = pThis->pOps->Obj.pfnQueryInfoEx(pThis->Base.pvThis, !fAlternative ? RTVFSQIEX_VOL_LABEL : RTVFSQIEX_VOL_LABEL_ALT, 2339 pszLabel, cbLabel, pcbActual); 2339 2340 RTVfsLockReleaseRead(pThis->Base.hLock); 2340 2341 }
Note:
See TracChangeset
for help on using the changeset viewer.