Changeset 93584 in vbox for trunk/src/VBox
- Timestamp:
- Feb 3, 2022 2:49:19 PM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r93561 r93584 4899 4899 one of the indices of <link to="IUnattended::detectedImageIndices"/>. 4900 4900 4901 Changing this after ISO detection may cause 4902 <link to="IUnattended::detectedOSTypeId"/>, <link to="IUnattended::detectedOSVersion"/>, 4903 <link to="IUnattended::detectedOSFlavor"/>, <link to="IUnattended::detectedOSLanguages"/>, 4904 and <link to="IUnattended::detectedOSHints"/> to be updated with values 4905 specific to the selected image. 4906 4901 4907 Used only with Windows installation CD/DVD: 4902 4908 https://technet.microsoft.com/en-us/library/cc766022%28v=ws.10%29.aspx … … 5037 5043 Prepare for running the unattended process of installation. 5038 5044 5039 This will instantiate the installer based on the guest type associated 5040 with the machine (see <link to="IMachine::OSTypeId"/>). It will also 5041 perform <link to="IUnattended::detectIsoOS"/> if not yet called on the 5042 current <link to="IUnattended::isoPath"/> value. 5045 This will perform <link to="IUnattended::detectIsoOS"/> if not yet called on the 5046 current <link to="IUnattended::isoPath"/> value. It may then may cause 5047 <link to="IUnattended::detectedOSTypeId"/>, <link to="IUnattended::detectedOSVersion"/>, 5048 <link to="IUnattended::detectedOSFlavor"/>, <link to="IUnattended::detectedOSLanguages"/>, 5049 and <link to="IUnattended::detectedOSHints"/> to be updated with values 5050 specific to the image selected by <link to="IUnattended::imageIndex"/> if the ISO 5051 contains images. 5052 5053 This method will then instantiate the installer based on the detected guest type 5054 (see <link to="IUnattended::detectedOSTypeId"/>). 5043 5055 </desc> 5044 5056 </method> -
trunk/src/VBox/Main/include/UnattendedImpl.h
r93581 r93584 287 287 */ 288 288 bool i_isGuestOSArchX64(Utf8Str const &rStrGuestOsTypeId); 289 290 /** 291 * Updates the detected attributes when the image index or image list changes. 292 * 293 * @returns true if we've got all necessary stuff for a successful detection. 294 */ 295 bool i_updateDetectedAttributeForImage(WIMImage const &rImage); 296 289 297 }; 290 298 -
trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
r93581 r93584 551 551 { 552 552 rImage.mArch = s_aArches[uArch].pszArch; 553 rImage.mOSType = (VBOXOSTYPE)(s_aArches[uArch].enmArch | (rImage.mOSType & VBOXOSTYPE_ ArchitectureMask));553 rImage.mOSType = (VBOXOSTYPE)(s_aArches[uArch].enmArch | (rImage.mOSType & VBOXOSTYPE_OsTypeMask)); 554 554 } 555 555 else … … 765 765 // sources/lang.ini - ditto. 766 766 767 /* 768 * The install.wim file contains an XML document describing the install 769 * images it contains. This includes all the info we need for a successful 770 * detection. 771 */ 767 772 RTVFSFILE hVfsFile; 768 /** @todo look at the install.wim file too, extracting the XML (easy) and769 * figure out the available image numbers and such. The format is770 * documented. It would also provide really accurate Windows771 * version information without the need to guess. The current772 * content of mStrDetectedOSVersion is mostly useful for human773 * consumption. ~~Long term it should be possible to have version774 * conditionals (expr style, please) in the templates, which775 * would make them a lot easier to write and more flexible at the776 * same time. - done already~~777 *778 * Here is how to list images inside an install.wim file from powershell:779 * https://docs.microsoft.com/en-us/powershell/module/dism/get-windowsimage?view=windowsserver2022-ps780 *781 * Unfortunately, powershell is not available by default on non-windows hosts, so we782 * have to do it ourselves of course, but this can help when coding & testing.783 */784 785 773 int vrc = RTVfsFileOpen(hVfsIso, "sources/install.wim", RTFILE_O_READ | RTFILE_O_DENY_NONE | RTFILE_O_OPEN, &hVfsFile); 786 774 if (RT_SUCCESS(vrc)) … … 839 827 try 840 828 { 829 mDetectedImages.clear(); /* debugging convenience */ 841 830 parseWimXMLData(pElmRoot, mDetectedImages); 842 831 } … … 844 833 { 845 834 vrc = VERR_NO_MEMORY; 835 } 836 837 /* 838 * If we found images, update the detected info attributes. 839 */ 840 if (RT_SUCCESS(vrc) && mDetectedImages.size() > 0) 841 { 842 size_t i; 843 for (i = 0; i < mDetectedImages.size(); i++) 844 if (mDetectedImages[i].mImageIndex == midxImage) 845 break; 846 if (i >= mDetectedImages.size()) 847 i = 0; /* use the first one if midxImage wasn't found */ 848 if (i_updateDetectedAttributeForImage(mDetectedImages[i])) 849 { 850 LogRel2(("Unattended: happy with mDetectedImages[%u]\n", i)); 851 *penmOsType = mDetectedImages[i].mOSType; 852 return S_OK; 853 } 846 854 } 847 855 } … … 2171 2179 if (midxImage == mDetectedImages[i].mImageIndex) 2172 2180 { 2181 i_updateDetectedAttributeForImage(mDetectedImages[i]); 2173 2182 fImageFound = true; 2174 /** @todo Replace / amend the detected version? */2175 2183 break; 2176 2184 } … … 3341 3349 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3342 3350 AssertReturn(mpInstaller == NULL, setErrorBoth(E_FAIL, VERR_WRONG_ORDER, tr("Cannot change after prepare() has been called"))); 3351 3352 /* Validate the selection if detection was done already: */ 3353 if (mDetectedImages.size() > 0) 3354 { 3355 for (size_t i = 0; i < mDetectedImages.size(); i++) 3356 if (mDetectedImages[i].mImageIndex == index) 3357 { 3358 midxImage = index; 3359 i_updateDetectedAttributeForImage(mDetectedImages[i]); 3360 return S_OK; 3361 } 3362 LogRel(("Unattended: Setting invalid index=%u\n", index)); /** @todo fail? */ 3363 } 3364 3343 3365 midxImage = index; 3344 3366 return S_OK; … … 3736 3758 return false; 3737 3759 } 3760 3761 3762 bool Unattended::i_updateDetectedAttributeForImage(WIMImage const &rImage) 3763 { 3764 bool fRet = true; 3765 3766 /* 3767 * If the image doesn't have a valid value, we don't change it. 3768 * This is obviously a little bit bogus, but what can we do... 3769 */ 3770 const char *pszOSTypeId = Global::OSTypeId(rImage.mOSType); 3771 if (pszOSTypeId && strcmp(pszOSTypeId, "Other") != 0) 3772 mStrDetectedOSTypeId = pszOSTypeId; 3773 else 3774 fRet = false; 3775 3776 if (rImage.mVersion.isNotEmpty()) 3777 mStrDetectedOSVersion = rImage.mVersion; 3778 else 3779 fRet = false; 3780 3781 if (rImage.mLanguages.size() > 0) 3782 mDetectedOSLanguages = rImage.mLanguages; 3783 else 3784 fRet = false; 3785 3786 return fRet; 3787 } 3788
Note:
See TracChangeset
for help on using the changeset viewer.