Changeset 28194 in vbox
- Timestamp:
- Apr 12, 2010 9:58:53 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r28110 r28194 3754 3754 tr("Cannot delete settings of a registered machine")); 3755 3755 3756 ULONG uLogHistoryCount = 3; 3757 ComPtr<ISystemProperties> systemProperties; 3758 mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 3759 if (!systemProperties.isNull()) 3760 systemProperties->COMGETTER(LogHistoryCount)(&uLogHistoryCount); 3761 3756 3762 /* delete the settings only when the file actually exists */ 3757 3763 if (mData->pMachineConfigFile->fileExists()) … … 3776 3782 * Console::powerUpThread()). Also, delete the VBox.png[.N] 3777 3783 * files that may have been created by the GUI. */ 3778 Utf8Str log = Utf8StrFmt("%s/VBox.log", logFolder.raw()); 3784 Utf8Str log = Utf8StrFmt("%s%cVBox.log", 3785 logFolder.raw(), RTPATH_DELIMITER); 3779 3786 RTFileDelete(log.c_str()); 3780 log = Utf8StrFmt("%s/VBox.png", logFolder.raw()); 3787 log = Utf8StrFmt("%s%cVBox.png", 3788 logFolder.raw(), RTPATH_DELIMITER); 3781 3789 RTFileDelete(log.c_str()); 3782 for (int i = 3; i >=0; i--)3790 for (int i = uLogHistoryCount; i > 0; i--) 3783 3791 { 3784 log = Utf8StrFmt("%s/VBox.log.%d", logFolder.raw(), i); 3792 log = Utf8StrFmt("%s%cVBox.log.%d", 3793 logFolder.raw(), RTPATH_DELIMITER, i); 3785 3794 RTFileDelete(log.c_str()); 3786 log = Utf8StrFmt("%s/VBox.png.%d", logFolder.raw(), i); 3795 log = Utf8StrFmt("%s%cVBox.png.%d", 3796 logFolder.raw(), RTPATH_DELIMITER, i); 3787 3797 RTFileDelete(log.c_str()); 3788 3798 } … … 4724 4734 CheckComArgNotNull(aWidth); 4725 4735 CheckComArgNotNull(aHeight); 4726 CheckComArg Expr(aData, !ComSafeArrayOutIsNull(aData));4736 CheckComArgOutSafeArrayPointerValid(aData); 4727 4737 4728 4738 AutoCaller autoCaller(this); … … 4817 4827 CheckComArgNotNull(aWidth); 4818 4828 CheckComArgNotNull(aHeight); 4819 CheckComArg Expr(aData, !ComSafeArrayOutIsNull(aData));4829 CheckComArgOutSafeArrayPointerValid(aData); 4820 4830 4821 4831 AutoCaller autoCaller(this); … … 4953 4963 } 4954 4964 4955 STDMETHODIMP Machine::ReadLog(ULONG /*aIdx*/, ULONG64 /*aOffset*/, ULONG64 /*aSize*/, ComSafeArrayOut(BYTE, aData)) 4956 { 4957 CheckComArgExpr(aData, !ComSafeArrayOutIsNull(aData)); 4958 4959 #ifdef VBOX_WITH_XPCOM 4960 NOREF(aDataSize); 4961 #endif 4962 4963 ReturnComNotImplemented(); 4965 STDMETHODIMP Machine::ReadLog(ULONG aIdx, ULONG64 aOffset, ULONG64 aSize, ComSafeArrayOut(BYTE, aData)) 4966 { 4967 LogFlowThisFunc(("\n")); 4968 CheckComArgOutSafeArrayPointerValid(aData); 4969 4970 AutoCaller autoCaller(this); 4971 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4972 4973 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 4974 4975 HRESULT rc = S_OK; 4976 Utf8Str logFolder; 4977 getLogFolder(logFolder); 4978 Assert(logFolder.length()); 4979 ULONG uLogHistoryCount = 3; 4980 ComPtr<ISystemProperties> systemProperties; 4981 mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 4982 if (!systemProperties.isNull()) 4983 systemProperties->COMGETTER(LogHistoryCount)(&uLogHistoryCount); 4984 Utf8Str log; 4985 if (aIdx == 0) 4986 log = Utf8StrFmt("%s%cVBox.log", 4987 logFolder.raw(), RTPATH_DELIMITER); 4988 else 4989 log = Utf8StrFmt("%s%cVBox.log.%d", 4990 logFolder.raw(), RTPATH_DELIMITER, aIdx); 4991 4992 size_t cbData = (size_t)RT_MIN(aSize, 2048); 4993 com::SafeArray<BYTE> logData(cbData); 4994 4995 RTFILE LogFile; 4996 int vrc = RTFileOpen(&LogFile, log.raw(), 4997 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE); 4998 if (RT_SUCCESS(vrc)) 4999 { 5000 vrc = RTFileReadAt(LogFile, aOffset, logData.raw(), cbData, &cbData); 5001 if (RT_SUCCESS(vrc)) 5002 logData.resize(cbData); 5003 else 5004 rc = setError(VBOX_E_IPRT_ERROR, 5005 tr("Could not read log file '%s' (%Rrc)"), 5006 log.raw(), vrc); 5007 } 5008 else 5009 rc = setError(VBOX_E_IPRT_ERROR, 5010 tr("Could not open log file '%s' (%Rrc)"), 5011 log.raw(), vrc); 5012 5013 if (FAILED(rc)) 5014 logData.resize(0); 5015 logData.detachTo(ComSafeArrayOutArg(aData)); 5016 5017 return rc; 4964 5018 } 4965 5019
Note:
See TracChangeset
for help on using the changeset viewer.