Changeset 23418 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 29, 2009 4:18:20 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 52986
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r23407 r23418 830 830 for (size_t j = 0; j < atts.size(); ++ j) 831 831 { 832 BOOL fHostDrive = FALSE; 833 832 834 ComPtr<IMedium> medium; 833 835 hrc = atts [j]->COMGETTER(Medium)(medium.asOutParam()); H(); 834 if (medium.isNull())835 continue;836 837 836 LONG lDev; 838 837 hrc = atts[j]->COMGETTER(Device)(&lDev); H(); … … 855 854 } 856 855 857 BOOL fHostDrive = false; 858 hrc = medium->COMGETTER(HostDrive)(&fHostDrive); H(); 856 if (!medium.isNull()) 857 { 858 hrc = medium->COMGETTER(HostDrive)(&fHostDrive); H(); 859 } 860 859 861 if (fHostDrive) 860 862 { 863 Assert(!medium.isNull()); 861 864 if (lType == DeviceType_DVD) 862 865 { … … 902 905 } 903 906 904 rc = CFGMR3InsertNode(pLunL0, "AttachedDriver", &pLunL1); RC_CHECK(); 905 rc = CFGMR3InsertString(pLunL1, "Driver", "VD"); RC_CHECK(); 906 rc = CFGMR3InsertNode(pLunL1, "Config", &pCfg); RC_CHECK(); 907 908 hrc = medium->COMGETTER(Location)(&str); H(); 909 rc = CFGMR3InsertStringW(pCfg, "Path", str); RC_CHECK(); 910 STR_FREE(); 911 912 hrc = medium->COMGETTER(Format)(&str); H(); 913 rc = CFGMR3InsertStringW(pCfg, "Format", str); RC_CHECK(); 914 STR_FREE(); 915 916 /* DVDs are always readonly */ 917 if (lType == DeviceType_DVD) 907 if (!medium.isNull()) 918 908 { 919 rc = CFGMR3InsertInteger(pCfg, "ReadOnly", 1); RC_CHECK(); 920 } 921 922 /* Pass all custom parameters. */ 923 bool fHostIP = true; 924 SafeArray<BSTR> names; 925 SafeArray<BSTR> values; 926 hrc = medium->GetProperties(NULL, 927 ComSafeArrayAsOutParam(names), 928 ComSafeArrayAsOutParam(values)); H(); 929 930 if (names.size() != 0) 931 { 932 PCFGMNODE pVDC; 933 rc = CFGMR3InsertNode(pCfg, "VDConfig", &pVDC); RC_CHECK(); 934 for (size_t ii = 0; ii < names.size(); ++ii) 909 rc = CFGMR3InsertNode(pLunL0, "AttachedDriver", &pLunL1); RC_CHECK(); 910 rc = CFGMR3InsertString(pLunL1, "Driver", "VD"); RC_CHECK(); 911 rc = CFGMR3InsertNode(pLunL1, "Config", &pCfg); RC_CHECK(); 912 913 hrc = medium->COMGETTER(Location)(&str); H(); 914 rc = CFGMR3InsertStringW(pCfg, "Path", str); RC_CHECK(); 915 STR_FREE(); 916 917 hrc = medium->COMGETTER(Format)(&str); H(); 918 rc = CFGMR3InsertStringW(pCfg, "Format", str); RC_CHECK(); 919 STR_FREE(); 920 921 /* DVDs are always readonly */ 922 if (lType == DeviceType_DVD) 935 923 { 936 if (values[ii] && *values[ii]) 937 { 938 Utf8Str name = names[ii]; 939 Utf8Str value = values[ii]; 940 rc = CFGMR3InsertString(pVDC, name.c_str(), value.c_str()); 941 if ( name.compare("HostIPStack") == 0 942 && value.compare("0") == 0) 943 fHostIP = false; 944 } 924 rc = CFGMR3InsertInteger(pCfg, "ReadOnly", 1); RC_CHECK(); 945 925 } 946 }947 948 /* Create an inversed tree of parents. */949 ComPtr<IMedium> parentMedium = medium;950 for (PCFGMNODE pParent = pCfg;;)951 {952 hrc = parentMedium->COMGETTER(Parent)(medium.asOutParam()); H();953 if (medium.isNull())954 break;955 956 PCFGMNODE pCur;957 rc = CFGMR3InsertNode(pParent, "Parent", &pCur); RC_CHECK();958 hrc = medium->COMGETTER(Location)(&str); H();959 rc = CFGMR3InsertStringW(pCur, "Path", str); RC_CHECK();960 STR_FREE();961 962 hrc = medium->COMGETTER(Format)(&str); H();963 rc = CFGMR3InsertStringW(pCur, "Format", str); RC_CHECK();964 STR_FREE();965 926 966 927 /* Pass all custom parameters. */ 928 bool fHostIP = true; 967 929 SafeArray<BSTR> names; 968 930 SafeArray<BSTR> values; 969 931 hrc = medium->GetProperties(NULL, 970 932 ComSafeArrayAsOutParam(names), 971 ComSafeArrayAsOutParam(values)); H();933 ComSafeArrayAsOutParam(values)); H(); 972 934 973 935 if (names.size() != 0) 974 936 { 975 937 PCFGMNODE pVDC; 976 rc = CFGMR3InsertNode(pC ur, "VDConfig", &pVDC);RC_CHECK();938 rc = CFGMR3InsertNode(pCfg, "VDConfig", &pVDC); RC_CHECK(); 977 939 for (size_t ii = 0; ii < names.size(); ++ii) 978 940 { 979 if (values[ii] )941 if (values[ii] && *values[ii]) 980 942 { 981 943 Utf8Str name = names[ii]; … … 989 951 } 990 952 991 /* C ustom code: put marker to not use host IP stack to driver992 * configuration node. Simplifies life of DrvVD a bit. */993 if (!fHostIP)953 /* Create an inversed tree of parents. */ 954 ComPtr<IMedium> parentMedium = medium; 955 for (PCFGMNODE pParent = pCfg;;) 994 956 { 995 rc = CFGMR3InsertInteger(pCfg, "HostIPStack", 0); RC_CHECK(); 957 hrc = parentMedium->COMGETTER(Parent)(medium.asOutParam()); H(); 958 if (medium.isNull()) 959 break; 960 961 PCFGMNODE pCur; 962 rc = CFGMR3InsertNode(pParent, "Parent", &pCur); RC_CHECK(); 963 hrc = medium->COMGETTER(Location)(&str); H(); 964 rc = CFGMR3InsertStringW(pCur, "Path", str); RC_CHECK(); 965 STR_FREE(); 966 967 hrc = medium->COMGETTER(Format)(&str); H(); 968 rc = CFGMR3InsertStringW(pCur, "Format", str); RC_CHECK(); 969 STR_FREE(); 970 971 /* Pass all custom parameters. */ 972 SafeArray<BSTR> names; 973 SafeArray<BSTR> values; 974 hrc = medium->GetProperties(NULL, 975 ComSafeArrayAsOutParam(names), 976 ComSafeArrayAsOutParam(values)); H(); 977 978 if (names.size() != 0) 979 { 980 PCFGMNODE pVDC; 981 rc = CFGMR3InsertNode(pCur, "VDConfig", &pVDC); RC_CHECK(); 982 for (size_t ii = 0; ii < names.size(); ++ii) 983 { 984 if (values[ii]) 985 { 986 Utf8Str name = names[ii]; 987 Utf8Str value = values[ii]; 988 rc = CFGMR3InsertString(pVDC, name.c_str(), value.c_str()); 989 if ( name.compare("HostIPStack") == 0 990 && value.compare("0") == 0) 991 fHostIP = false; 992 } 993 } 994 } 995 996 /* Custom code: put marker to not use host IP stack to driver 997 * configuration node. Simplifies life of DrvVD a bit. */ 998 if (!fHostIP) 999 { 1000 rc = CFGMR3InsertInteger(pCfg, "HostIPStack", 0); RC_CHECK(); 1001 } 1002 1003 /* next */ 1004 pParent = pCur; 1005 parentMedium = medium; 996 1006 } 997 998 /* next */999 pParent = pCur;1000 parentMedium = medium;1001 1007 } 1002 1008 }
Note:
See TracChangeset
for help on using the changeset viewer.