VirtualBox

source: vbox/trunk/src/VBox/Main/include/UnattendedImpl.h@ 68239

最後變更 在這個檔案從68239是 68239,由 vboxsync 提交於 8 年 前

Unattended: Added detectedOSLanguages and language attributes to deal with the windows installer's stupid UILanguage requirement. The specified language must be supported by the installation media, probably by way of lang.ini, which means we need to implement UDF support to really get this right. For now, looking for language specifier in the ISO name (ASSUMES filename unchanged since MSDN download).

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 10.2 KB
 
1/* $Id: UnattendedImpl.h 68239 2017-08-02 12:39:12Z vboxsync $ */
2/** @file
3 * Unattended class header
4 */
5
6/*
7 * Copyright (C) 2006-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_UNATTENDED
19#define ____H_UNATTENDED
20
21#include <VBox/ostypes.h>
22#include <iprt/time.h>
23#include "UnattendedWrap.h"
24
25/* Forward declarations. */
26class UnattendedInstaller;
27struct UnattendedInstallationDisk;
28struct ControllerSlot;
29
30
31/**
32 * Class implementing the IUnattended interface.
33 *
34 * This class is instantiated on the request by IMachine::getUnattended.
35 */
36class ATL_NO_VTABLE Unattended
37 : public UnattendedWrap
38{
39public:
40 DECLARE_EMPTY_CTOR_DTOR(Unattended)
41
42 HRESULT FinalConstruct();
43 void FinalRelease();
44
45 // public initializer/uninitializer for internal purposes only
46 HRESULT initUnattended(VirtualBox *aParent);
47 void uninit();
48
49 // public methods for internal purposes
50 Utf8Str const &i_getIsoPath() const;
51 Utf8Str const &i_getUser() const;
52 Utf8Str const &i_getPassword() const;
53 Utf8Str const &i_getFullUserName() const;
54 Utf8Str const &i_getProductKey() const;
55 Utf8Str const &i_getAdditionsIsoPath() const;
56 bool i_getInstallGuestAdditions() const;
57 Utf8Str const &i_getValidationKitIsoPath() const;
58 bool i_getInstallTestExecService() const;
59 Utf8Str const &i_getTimeZone() const;
60 PCRTTIMEZONEINFO i_getTimeZoneInfo() const;
61 Utf8Str const &i_getLocale() const;
62 Utf8Str const &i_getLanguage() const;
63 Utf8Str const &i_getCountry() const;
64 bool i_isMinimalInstallation() const;
65 Utf8Str const &i_getHostname() const;
66 Utf8Str const &i_getAuxiliaryBasePath() const;
67 ULONG i_getImageIndex() const;
68 Utf8Str const &i_getScriptTemplatePath() const;
69 Utf8Str const &i_getPostInstallScriptTemplatePath() const;
70 Utf8Str const &i_getPostInstallCommand() const;
71 Utf8Str const &i_getExtraInstallKernelParameters() const;
72
73 bool i_isRtcUsingUtc() const;
74 bool i_isGuestOs64Bit() const;
75 VBOXOSTYPE i_getGuestOsType() const;
76
77
78private:
79 ComPtr<VirtualBox> const mParent; /**< Strong reference to the parent object (VirtualBox/IMachine). */
80 ComPtr<Machine> mMachine; /**< Strong reference to the machine object (Machine/IMachine). */
81 Guid mMachineUuid; /**< The machine UUID. */
82 RTNATIVETHREAD mhThreadReconfigureVM; /**< Set when reconfigureVM is running. */
83 Utf8Str mStrGuestOsTypeId; /**< Guest OS type ID (set by prepare). */
84 bool mfRtcUseUtc; /**< Copy of IMachine::RTCUseUTC (locking reasons). */
85 bool mfGuestOs64Bit; /**< 64-bit (true) or 32-bit guest OS (set by prepare). */
86 VBOXOSTYPE meGuestOsType; /**< The guest OS type (set by prepare). */
87 UnattendedInstaller *mpInstaller; /**< The installer instance (set by prepare, deleted by done). */
88
89 /** @name Values of the IUnattended attributes.
90 * @{ */
91 Utf8Str mStrUser;
92 Utf8Str mStrPassword;
93 Utf8Str mStrFullUserName;
94 Utf8Str mStrProductKey;
95 Utf8Str mStrIsoPath;
96 Utf8Str mStrAdditionsIsoPath;
97 bool mfInstallGuestAdditions;
98 bool mfInstallTestExecService;
99 Utf8Str mStrValidationKitIsoPath;
100 Utf8Str mStrTimeZone;
101 PCRTTIMEZONEINFO mpTimeZoneInfo;
102 Utf8Str mStrLocale;
103 Utf8Str mStrLanguage; /**< (only relevant for windows at the moment) */
104 Utf8Str mStrCountry;
105 RTCList<RTCString, RTCString *> mPackageSelectionAdjustments;
106 Utf8Str mStrHostname;
107 Utf8Str mStrAuxiliaryBasePath;
108 bool mfIsDefaultAuxiliaryBasePath;
109 ULONG midxImage;
110 Utf8Str mStrScriptTemplatePath;
111 Utf8Str mStrPostInstallScriptTemplatePath;
112 Utf8Str mStrPostInstallCommand;
113 Utf8Str mStrExtraInstallKernelParameters;
114
115 bool mfDoneDetectIsoOS; /**< Set by detectIsoOS(), cleared by setIsoPath(). */
116 Utf8Str mStrDetectedOSTypeId;
117 Utf8Str mStrDetectedOSVersion;
118 Utf8Str mStrDetectedOSFlavor;
119 RTCList<RTCString, RTCString *> mDetectedOSLanguages; /**< (only relevant for windows at the moment) */
120 Utf8Str mStrDetectedOSHints;
121 /** @} */
122
123 // wrapped IUnattended functions:
124
125 /**
126 * Checks what mStrIsoPath points to and sets the detectedOS* properties.
127 */
128 HRESULT detectIsoOS();
129
130 /**
131 * Prepare any data, environment, etc.
132 */
133 HRESULT prepare();
134
135 /**
136 * Prepare installation ISO/floppy.
137 */
138 HRESULT constructMedia();
139
140 /**
141 * Prepare a VM to run an unattended installation
142 */
143 HRESULT reconfigureVM();
144
145 /**
146 * Done with all media construction and VM configuration and stuff.
147 */
148 HRESULT done();
149
150 // wrapped IUnattended attributes:
151 HRESULT getIsoPath(com::Utf8Str &isoPath);
152 HRESULT setIsoPath(const com::Utf8Str &isoPath);
153 HRESULT getUser(com::Utf8Str &user);
154 HRESULT setUser(const com::Utf8Str &user);
155 HRESULT getPassword(com::Utf8Str &password);
156 HRESULT setPassword(const com::Utf8Str &password);
157 HRESULT getFullUserName(com::Utf8Str &user);
158 HRESULT setFullUserName(const com::Utf8Str &user);
159 HRESULT getProductKey(com::Utf8Str &productKey);
160 HRESULT setProductKey(const com::Utf8Str &productKey);
161 HRESULT getAdditionsIsoPath(com::Utf8Str &additionsIsoPath);
162 HRESULT setAdditionsIsoPath(const com::Utf8Str &additionsIsoPath);
163 HRESULT getInstallGuestAdditions(BOOL *installGuestAdditions);
164 HRESULT setInstallGuestAdditions(BOOL installGuestAdditions);
165 HRESULT getValidationKitIsoPath(com::Utf8Str &aValidationKitIsoPath);
166 HRESULT setValidationKitIsoPath(const com::Utf8Str &aValidationKitIsoPath);
167 HRESULT getInstallTestExecService(BOOL *aInstallTestExecService);
168 HRESULT setInstallTestExecService(BOOL aInstallTestExecService);
169 HRESULT getTimeZone(com::Utf8Str &aTimezone);
170 HRESULT setTimeZone(const com::Utf8Str &aTimezone);
171 HRESULT getLocale(com::Utf8Str &aLocale);
172 HRESULT setLocale(const com::Utf8Str &aLocale);
173 HRESULT getLanguage(com::Utf8Str &aLanguage);
174 HRESULT setLanguage(const com::Utf8Str &aLanguage);
175 HRESULT getCountry(com::Utf8Str &aCountry);
176 HRESULT setCountry(const com::Utf8Str &aCountry);
177 HRESULT getProxy(com::Utf8Str &aProxy);
178 HRESULT setProxy(const com::Utf8Str &aProxy);
179 HRESULT getPackageSelectionAdjustments(com::Utf8Str &aPackageSelectionAdjustments);
180 HRESULT setPackageSelectionAdjustments(const com::Utf8Str &aPackageSelectionAdjustments);
181 HRESULT getHostname(com::Utf8Str &aHostname);
182 HRESULT setHostname(const com::Utf8Str &aHostname);
183 HRESULT getAuxiliaryBasePath(com::Utf8Str &aAuxiliaryBasePath);
184 HRESULT setAuxiliaryBasePath(const com::Utf8Str &aAuxiliaryBasePath);
185 HRESULT getImageIndex(ULONG *index);
186 HRESULT setImageIndex(ULONG index);
187 HRESULT getMachine(ComPtr<IMachine> &aMachine);
188 HRESULT setMachine(const ComPtr<IMachine> &aMachine);
189 HRESULT getScriptTemplatePath(com::Utf8Str &aScriptTemplatePath);
190 HRESULT setScriptTemplatePath(const com::Utf8Str &aScriptTemplatePath);
191 HRESULT getPostInstallScriptTemplatePath(com::Utf8Str &aPostInstallScriptTemplatePath);
192 HRESULT setPostInstallScriptTemplatePath(const com::Utf8Str &aPostInstallScriptTemplatePath);
193 HRESULT getPostInstallCommand(com::Utf8Str &aPostInstallCommand);
194 HRESULT setPostInstallCommand(const com::Utf8Str &aPostInstallCommand);
195 HRESULT getExtraInstallKernelParameters(com::Utf8Str &aExtraInstallKernelParameters);
196 HRESULT setExtraInstallKernelParameters(const com::Utf8Str &aExtraInstallKernelParameters);
197 HRESULT getDetectedOSTypeId(com::Utf8Str &aDetectedOSTypeId);
198 HRESULT getDetectedOSVersion(com::Utf8Str &aDetectedOSVersion);
199 HRESULT getDetectedOSLanguages(com::Utf8Str &aDetectedOSLanguages);
200 HRESULT getDetectedOSFlavor(com::Utf8Str &aDetectedOSFlavor);
201 HRESULT getDetectedOSHints(com::Utf8Str &aDetectedOSHints);
202 //internal functions
203
204 /**
205 * Worker for reconfigureVM.
206 * The caller makes sure to close the session whatever happens.
207 */
208 HRESULT i_innerReconfigureVM(AutoMultiWriteLock2 &rAutoLock, StorageBus_T enmRecommendedStorageBus,
209 ComPtr<IMachine> const &rPtrSessionMachine);
210 HRESULT i_reconfigureFloppy(com::SafeIfaceArray<IStorageController> &rControllers,
211 std::vector<UnattendedInstallationDisk> &rVecInstallatationDisks,
212 ComPtr<IMachine> const &rPtrSessionMachine,
213 AutoMultiWriteLock2 &rAutoLock);
214 HRESULT i_reconfigureIsos(com::SafeIfaceArray<IStorageController> &rControllers,
215 std::vector<UnattendedInstallationDisk> &rVecInstallatationDisks,
216 ComPtr<IMachine> const &rPtrSessionMachine,
217 AutoMultiWriteLock2 &rAutoLock, StorageBus_T enmRecommendedStorageBus);
218
219 /**
220 * Adds all free slots on the controller to @a rOutput.
221 */
222 HRESULT i_findOrCreateNeededFreeSlots(const Utf8Str &rStrControllerName, StorageBus_T enmStorageBus,
223 ComPtr<IMachine> const &rPtrSessionMachine, uint32_t cSlotsNeeded,
224 std::list<ControllerSlot> &rDvdSlots);
225
226 /**
227 * Attach to VM a disk
228 */
229 HRESULT i_attachImage(UnattendedInstallationDisk const *pImage, ComPtr<IMachine> const &rPtrSessionMachine,
230 AutoMultiWriteLock2 &rLock);
231
232 /*
233 * Wrapper functions
234 */
235
236 /**
237 * Check whether guest is 64bit platform or not
238 */
239 bool i_isGuestOSArchX64(Utf8Str const &rStrGuestOsTypeId);
240};
241
242#endif // !____H_UNATTENDED
243
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette