- Timestamp:
- Mar 24, 2009 1:21:12 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 44892
- Location:
- trunk/src/VBox
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
r18164 r18177 1263 1263 { 1264 1264 ComPtr<IHardDisk> hardDisk; 1265 CHECK_ERROR(aVirtualBox, OpenHardDisk(filename, TRUE /* fWrite */, hardDisk.asOutParam()));1265 CHECK_ERROR(aVirtualBox, OpenHardDisk(filename, AccessMode_ReadWrite, hardDisk.asOutParam())); 1266 1266 } 1267 1267 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r18162 r18177 388 388 if (!hardDisk) 389 389 { 390 a->virtualBox->OpenHardDisk(Bstr(a->argv[0]), hardDisk.asOutParam());390 a->virtualBox->OpenHardDisk(Bstr(a->argv[0]), AccessMode_ReadWrite, hardDisk.asOutParam()); 391 391 if (!hardDisk) 392 392 return errorArgument("Hard disk image not found"); … … 521 521 if (FAILED (rc)) 522 522 { 523 CHECK_ERROR(a->virtualBox, OpenHardDisk(src, TRUE /* fWrite */, srcDisk.asOutParam()));523 CHECK_ERROR(a->virtualBox, OpenHardDisk(src, AccessMode_ReadWrite, srcDisk.asOutParam())); 524 524 if (SUCCEEDED (rc)) 525 525 { … … 943 943 if (FAILED (rc)) 944 944 { 945 CHECK_ERROR(a->virtualBox, OpenHardDisk(filepath, TRUE /* fWrite */, hardDisk.asOutParam()));945 CHECK_ERROR(a->virtualBox, OpenHardDisk(filepath, AccessMode_ReadWrite, hardDisk.asOutParam())); 946 946 if (SUCCEEDED (rc)) 947 947 { … … 1083 1083 1084 1084 ComPtr<IHardDisk> hardDisk; 1085 CHECK_ERROR(a->virtualBox, OpenHardDisk(filepath, TRUE /* fWrite */, hardDisk.asOutParam()));1085 CHECK_ERROR(a->virtualBox, OpenHardDisk(filepath, AccessMode_ReadWrite, hardDisk.asOutParam())); 1086 1086 if (SUCCEEDED(rc) && hardDisk) 1087 1087 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r18162 r18177 1054 1054 { 1055 1055 /* open the new hard disk object */ 1056 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[0]), TRUE /* fWrite */, hardDisk.asOutParam()));1056 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[0]), AccessMode_ReadWrite, hardDisk.asOutParam())); 1057 1057 } 1058 1058 } … … 1087 1087 { 1088 1088 /* open the new hard disk object */ 1089 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[1]), TRUE /* fWrite */, hardDisk.asOutParam()));1089 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[1]), AccessMode_ReadWrite, hardDisk.asOutParam())); 1090 1090 } 1091 1091 } … … 1120 1120 { 1121 1121 /* open the new hard disk object */ 1122 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[2]), TRUE /* fWrite */, hardDisk.asOutParam()));1122 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[2]), AccessMode_ReadWrite, hardDisk.asOutParam())); 1123 1123 } 1124 1124 } … … 1833 1833 { 1834 1834 /* open the new hard disk object */ 1835 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), TRUE /* fWrite */, hardDisk.asOutParam()));1835 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), AccessMode_ReadWrite, hardDisk.asOutParam())); 1836 1836 } 1837 1837 } … … 1922 1922 { 1923 1923 /* open the new hard disk object */ 1924 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), TRUE /* fWrite */, hardDisk.asOutParam()));1924 CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), AccessMode_ReadWrite, hardDisk.asOutParam())); 1925 1925 } 1926 1926 } -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r18162 r18177 1670 1670 /* we've not found the image */ 1671 1671 RTPrintf("Adding hard disk '%S'...\n", hdaFile); 1672 virtualBox->OpenHardDisk(hdaFileBstr, TRUE /* fWrite */, hardDisk.asOutParam());1672 virtualBox->OpenHardDisk(hdaFileBstr, AccessMode_ReadWrite, hardDisk.asOutParam()); 1673 1673 } 1674 1674 /* do we have the right image now? */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r18162 r18177 1545 1545 case VBoxDefs::MediaType_HardDisk: 1546 1546 { 1547 CHardDisk hd = mVBox.OpenHardDisk(aLocation, TRUE /* fWrite */);1547 CHardDisk hd = mVBox.OpenHardDisk(aLocation, KAccessMode_ReadWrite); 1548 1548 if (mVBox.isOk()) 1549 1549 { -
trunk/src/VBox/Main/ApplianceImpl.cpp
r18162 r18177 2312 2312 /* First open the existing disk image */ 2313 2313 rc = pVirtualBox->OpenHardDisk(Bstr(strSrcFilePath), 2314 FALSE, // read-only2314 AccessMode_ReadOnly, 2315 2315 srcHdVBox.asOutParam()); 2316 2316 if (FAILED(rc)) throw rc; -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r18162 r18177 1133 1133 } 1134 1134 1135 STDMETHODIMP VirtualBox::OpenHardDisk(IN_BSTR aLocation, BOOL fWrite, IHardDisk **aHardDisk) 1135 STDMETHODIMP VirtualBox::OpenHardDisk(IN_BSTR aLocation, 1136 AccessMode_T accessMode, 1137 IHardDisk **aHardDisk) 1136 1138 { 1137 1139 CheckComArgNotNull(aLocation); … … 1149 1151 rc = hardDisk->init(this, 1150 1152 aLocation, 1151 ( fWrite) ? HardDisk::OpenReadWrite : HardDisk::OpenReadOnly );1153 (accessMode == AccessMode_ReadWrite) ? HardDisk::OpenReadWrite : HardDisk::OpenReadOnly ); 1152 1154 1153 1155 if (SUCCEEDED (rc)) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r18163 r18177 360 360 361 361 <enum 362 name="AccessMode" 363 uuid="1da0007c-ddf7-4be8-bcac-d84a1558785f" 364 > 365 <desc> 366 Access mode for opening files. 367 </desc> 368 369 <const name="ReadOnly" value="1"/> 370 <const name="ReadWrite" value="2"/> 371 </enum> 372 373 <enum 362 374 name="MachineState" 363 375 uuid="73bf04d0-7c4f-4684-9abf-d65a9ad74343" … … 1874 1886 by reading hard disk data at the specified location. 1875 1887 1876 If @a write is true, the image is opened for read/write access and must 1877 have according permissions, as VirtualBox may actually write status 1878 information into the disk's metadata sections. Note that write access 1879 is required for all typical image usage in VirtualBox, since VirtualBox 1880 may need to write metadata such as a UUID into the image. The only 1881 exception is opening a source image temporarily for copying and 1888 If @a write is ReadWrite (which it should be), the image is opened for 1889 read/write access and must have according permissions, as VirtualBox 1890 may actually write status information into the disk's metadata sections. 1891 1892 Note that write access is required for all typical image usage in VirtualBox, 1893 since VirtualBox may need to write metadata such as a UUID into the image. 1894 The only exception is opening a source image temporarily for copying and 1882 1895 cloning when the image will quickly be closed again. 1883 1896 … … 1903 1916 </desc> 1904 1917 </param> 1905 <param name=" write" type="boolean" dir="in">1918 <param name="accessMode" type="AccessMode" dir="in"> 1906 1919 <desc> 1907 If true, opens for read/write access. If false, opens for read access only.1920 Determines whether to open the image in read/write or read-only mode. 1908 1921 </desc> 1909 1922 </param> -
trunk/src/VBox/Main/include/HardDiskImpl.h
r18162 r18177 78 78 79 79 enum HDDOpenMode { OpenReadWrite, OpenReadOnly }; 80 // have to use a special enum or otherwise the overloaded init() is ambiguous 80 // have to use a special enum for the overloaded init() below; 81 // can't use AccessMode_T from XIDL because that's mapped to an int 82 // and would be ambiguous 81 83 82 84 // public initializer/uninitializer for internal purposes only -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r18162 r18177 151 151 STDMETHOD(CreateHardDisk)(IN_BSTR aFormat, IN_BSTR aLocation, 152 152 IHardDisk **aHardDisk); 153 STDMETHOD(OpenHardDisk) (IN_BSTR aLocation, BOOL fWrite, IHardDisk **aHardDisk);153 STDMETHOD(OpenHardDisk) (IN_BSTR aLocation, AccessMode_T accessMode, IHardDisk **aHardDisk); 154 154 STDMETHOD(GetHardDisk) (IN_GUID aId, IHardDisk **aHardDisk); 155 155 STDMETHOD(FindHardDisk) (IN_BSTR aLocation, IHardDisk **aHardDisk); -
trunk/src/VBox/Main/testcase/tstAPI.cpp
r17737 r18177 562 562 Bstr src = L"E:\\develop\\innotek\\images\\NewHardDisk.vdi"; 563 563 printf ("Opening the existing hard disk '%ls'...\n", src.raw()); 564 CHECK_ERROR_BREAK (virtualBox, OpenHardDisk (src, hd.asOutParam()));564 CHECK_ERROR_BREAK (virtualBox, OpenHardDisk (src, AccessMode_ReadWrite, hd.asOutParam())); 565 565 printf ("Enter to continue...\n"); 566 566 getchar();
Note:
See TracChangeset
for help on using the changeset viewer.