// --------------------------------------------------------------------------- // CMMCScBkupStateArchiveOpJavaData::BackupMidletL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateArchiveOpJavaData::BackupMidletL() { CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); const TInt count = dataOwners.Count(); // while ( ++iIndexValueCurrent < count ) { CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); // if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypeJavaData ) == EFalse ) { #ifdef __MMCSCBKUPLOGGING_ENABLED__ HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( owner.Owner().Identifier() ); __LOG1("CMMCScBkupStateArchiveOpJavaData::BackupMidletL() - trying to get midlet for hash: %S", hash ); CleanupStack::PopAndDestroy( hash ); #endif iBackupTransferObjectMidlet->RequestL( owner, iStatus, Driver().DrvParamsBase().DriveAndOperations() ); SetActive(); iCurrentJavaState = EJavaStateMidlet; break; // while loop } } }
// --------------------------------------------------------------------------- // CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() { CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); // We only need to request the midlet's passive data if it has a non-zero // size. if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) { if ( owner.OperationalSize( EMMCScBkupOwnerDataTypePassiveData ) > 0 ) { #ifdef __MMCSCBKUPLOGGING_ENABLED__ HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( owner.Owner().Identifier() ); __LOG1("CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() - trying to get midlet data for hash: %S", hash ); CleanupStack::PopAndDestroy( hash ); #endif iBackupTransferObjectMidletData->RequestL( owner, iStatus, Driver().DrvParamsBase().DriveAndOperations() ); SetActive(); } else { CompleteSelf(); } } else { CompleteSelf(); } iCurrentJavaState = EJavaStateMidletData; }
// --------------------------------------------------------------------------- // CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() // // // --------------------------------------------------------------------------- TUint CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ) { TUint size = 0; // const TBool systemBURSupported = MMCScBkupSBEUtils::HasSystemDataL( aOwner ); const TBool systemDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeSystemData ); __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - systemBURSupported: %d, systemDataTransferAllowedForDrive: %d", systemBURSupported, systemDataTransferAllowedForDrive ); if ( systemBURSupported && systemDataTransferAllowedForDrive ) { __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - sid: 0x%08x claims SYSTEM Data...", iOwner->SecureId().iId); // Again we have to create a temporary in order to actually retrieve the info... CSBPackageId* packageGeneric = static_cast<CSBPackageId*>( MMCScBkupSBEUtils::CopyLC( aIdentifier ) ); const TUid packageId = packageGeneric->PackageIdL(); // const TPackageDataType type = Driver().DrvParamsBase().PackageTransferType(); CSBPackageTransferType* transferType = CSBPackageTransferType::NewL( packageId, aDrive, type ); CleanupStack::PushL( transferType ); size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType ); __LOG3("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - packageId: 0x%08x, sid: 0x%08x, package size: %8d", packageId.iUid, iOwner->SecureId().iId, size); CleanupStack::PopAndDestroy( transferType ); // iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeSystemData, aDrive, size ); CleanupStack::PopAndDestroy( packageGeneric ); } return size; }
// --------------------------------------------------------------------------- // CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() { CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); const TInt count = index.Count(); __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - START - %d data owners...", count ); // if ( iIndexValueCurrent < count ) { __LOG2("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - getting java data index record [%03d/%03d]", iIndexValueCurrent, count); const CMMCScBkupIndexJavaDataEntry& entry = index.At( iIndexValueCurrent ); if ( entry.HasMidletDataInfo() ) { // Get the associated data owner CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - trying to get data owner info for hash: %S", &entry.Hash() ); CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Hash() ); if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) { // Request all the java data (on all supported drives) for this // particular data owner __LOG3("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - trying to restore JAVA MIDLET DATA for hash: %S [offset: %8d, length: %8d]", &entry.Hash(), entry.MidletDataInfo().Offset(), entry.MidletDataInfo().Length() ); // Build restore entry list (will only contain one entry - the // reader API forces an array interface on us, so let's do ou best // to please it...) const TMMCScBkupArchiveDriveAndVector driveAndVector( entry.Drive(), entry.MidletDataInfo() ); iRestoreEntries.Reset(); iRestoreEntries.AppendL( driveAndVector ); // Start the asynchronous restore op... iRestoreTransferObjectMidletData->RequestL( owner, iStatus, iRestoreEntries ); SetActive(); } else { CompleteSelf(); } } else { CompleteSelf(); } } else { CompleteSelf(); } iCurrentJavaState = EJavaStateMidletData; }
// --------------------------------------------------------------------------- // CMMCScBkupReadDataTransferRequestBase::ReadChunkL() // // // --------------------------------------------------------------------------- void CMMCScBkupReadDataTransferRequestBase::ReadChunkL( TDes8& aSink, TInt aLength ) { const TInt endOffset = CurrentReadInfo().EndOffset(); __LOG4("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - START - aLength: %d, endOffset: %d, iCurrentOffset: %d, sinkLength: %d", aLength, endOffset, iCurrentOffset, aSink.Length()); // if ( iCurrentOffset >= 0 && iCurrentOffset <= endOffset ) { if ( aLength > 0 ) { MMMCScBkupArchiveDataInterface& archiveDataInterface = Driver().DrvADI(); // We read based upon the current offset and the specified length TPtr8 sink( iTemporaryTransferSink->Des() ); const TMMCScBkupArchiveVector readRequest( iCurrentOffset, aLength ); const TMMCScBkupArchiveVector& readResult = archiveDataInterface.ADIReadL( sink, readRequest ); __LOG2("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - read result - offset: %d, length: %d", readResult.Offset(), readResult.Length()); // Update offset iCurrentOffset += readResult.Length(); aSink.Append( sink ); __LOG2("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - new offset (iCurrentOffset): %d, sink Length: %d", iCurrentOffset, aSink.Length()); #ifdef DEBUGGING_DATA_TRANSFER TRAP_IGNORE( DumpTransferDataL( archiveDataInterface.ADIFsSession(), sink) ); #endif if ( iCurrentOffset > CurrentReadInfo().EndOffset() ) { __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - Fatal Error - read went beyond archive entry boundary!"); ASSERT( EFalse ); User::Leave( KErrCorrupt ); } else { __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - read was okay - updating stats & reporting progress..."); // We managed to read the data okay, so let's update our stats DataTransferred( readResult.Length() ); // ... and also update progress Driver().DrvProgressHandler().MMCScBkupHandleProgress( readResult.Length() ); } } } else { __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - Fatal Error - current offset out of bounds!"); ASSERT( EFalse ); User::Leave( KErrCorrupt ); } __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - END"); }
/// <summary> /// Create the thread. /// </summary> /// <param name="threadProc">Thread enty point</param> /// <param name="arg">Thread argument.</param> /// <param name="flags">Thread creation flags</param> /// <returns>New thread object</returns> Thread ProcessThreads::CreateNew( ptr_t threadProc, ptr_t arg, enum CreateThreadFlags flags /*= NoThreadFlags*/ ) { HANDLE hThd = NULL; if (!NT_SUCCESS( _core.native()->CreateRemoteThreadT( hThd, threadProc, arg, flags, THREAD_ALL_ACCESS ) )) { // Ensure full thread access if (NT_SUCCESS( _core.native()->CreateRemoteThreadT( hThd, threadProc, arg, flags, THREAD_QUERY_LIMITED_INFORMATION ) )) { if (Driver().loaded()) Driver().PromoteHandle( GetCurrentProcessId(), hThd, THREAD_ALL_ACCESS ); } } return Thread( hThd, &_core ); }
// --------------------------------------------------------------------------- // CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() // // // --------------------------------------------------------------------------- TBool CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup( TInt aError ) { (void) aError; __LOG1("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - **** - error: %d", aError ); TBool continueProcessing = ETrue; // Cancel requester. Its probably already inactive, but just in case... PerformAsynchronousCancellation(); // Reset state and move to next item. Treat the current (badly behaving) item // as completed/processed. CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); if ( iCurrentDataOwnerIndex < dataOwners.Count() ) { CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iCurrentDataOwnerIndex ); (void) owner; __LOGFILE2("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - **** - error: %d, SID: 0x%08x - SIZE OF DATA skipped for DO", aError, owner.SecureId().iId ); // Ensures that asynchronous state step is called again.. CompleteSelf(); } else { continueProcessing = EFalse; } // __LOG1("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - END - continueProcessing: %d", continueProcessing ); return continueProcessing; }
/// <summary> /// Free memory /// </summary> /// <param name="size">Size of memory chunk to free. If 0 - whole block is freed</param> NTSTATUS MemBlock::Free( size_t size /*= 0*/ ) { if (_ptr != 0) { size = Align( size, 0x1000 ); NTSTATUS status = _physical ? Driver().FreeMem( _memory->core().pid(), _ptr, size, MEM_RELEASE ) : _memory->Free( _ptr, size, size == 0 ? MEM_RELEASE : MEM_DECOMMIT ); if (!NT_SUCCESS( status )) return LastNtStatus(); if(size == 0) { _ptr = 0; _size = 0; _protection = 0; } else { _ptr += size; _size -= size; } } return STATUS_SUCCESS; }
void Line::set_num_of_vehicles( int n_vehicles ) { if (n_vehicles<0) { n_vehicles = 0; } int count = n_vehicles-num_of_vehicles(); if (count > 0) { while (count-- > 0) { add_driver( *GenerateDriver( &Driver(Vehicle()), my_road_,index())); } reorder(); } else { while (count++ < 0) { drivers_->pop_back(); } reorder(); } }
void KinZfitter::KinRefitZ() { double l1,l2,lph1,lph2; double l3,l4,lph3,lph4; l1 = 1.0; l2 = 1.0; lph1 = 1.0; lph2 = 1.0; l3 = 1.0; l4 = 1.0; lph3 = 1.0; lph4 = 1.0; bool fourEfourMu = IsFourEFourMu(idsZ1_, idsZ2_); mass4lRECO_ = GetM4l(); //cout << mass4lRECO << endl; if (mass4lRECO_ <= cutoff_) {//fit Z1 SetFitInput(fitInput1, p4sZ1_, pTerrsZ1_, p4sZ1ph_, pTerrsZ1ph_); Driver(fitInput1, fitOutput1); SetFitOutput(fitInput1, fitOutput1, l1, l2, lph1, lph2, pTerrsZ1REFIT_, pTerrsZ1phREFIT_, covMatrixZ1_); pTerrsZ2REFIT_.push_back(pTerrsZ2_[0]); pTerrsZ2REFIT_.push_back(pTerrsZ2_[1]); } else {//fit two Zs if (fourEfourMu) {//4e,4mu, do reshuffle RepairZ1Z2(p4sZ1_, pTerrsZ1_, p4sZ1ph_, pTerrsZ1ph_, p4sZ2_, pTerrsZ2_, p4sZ2ph_, pTerrsZ2ph_, idsZ1_, idsZ2_); } SetFitInput(fitInput1, p4sZ1_, pTerrsZ1_, p4sZ1ph_, pTerrsZ1ph_); Driver(fitInput1, fitOutput1); SetFitOutput(fitInput1, fitOutput1, l1, l2, lph1, lph2, pTerrsZ1REFIT_, pTerrsZ1phREFIT_, covMatrixZ1_); SetFitInput(fitInput2, p4sZ2_, pTerrsZ2_, p4sZ2ph_, pTerrsZ2ph_); Driver(fitInput2, fitOutput2); SetFitOutput(fitInput2, fitOutput2, l3, l4, lph3, lph4, pTerrsZ2REFIT_, pTerrsZ2phREFIT_, covMatrixZ2_); } if(debug_) cout<<"l1 "<<l1<<"; l2 "<<l2<<" lph1 "<<lph1<<" lph2 "<<lph2<<endl; if(debug_) cout<<"l3 "<<l3<<"; l4 "<<l4<<" lph3 "<<lph3<<" lph4 "<<lph4<<endl; SetZResult(l1, l2, lph1, lph2, l3, l4, lph3, lph4); if(debug_) cout<<"Z refit done"<<endl; }
/// <summary> /// Copies image into target process /// </summary> /// <param name="pImage">Image data</param> /// <returns>true on success</returns> bool MMap::CopyImage(ImageContext* pImage) { NTSTATUS status = STATUS_SUCCESS; BLACBONE_TRACE(L"ManualMap: Performing image copy"); // offset to first section equals to header size size_t dwHeaderSize = pImage->peImage.HeadersSize(); // Copy header if(pImage->flags & HideVAD) status = Driver().WriteMem(_process.Id(), pImage->imgMem.Ptr(), dwHeaderSize, pImage->peImage.FileBase()); else status = pImage->imgMem.Write(0, dwHeaderSize, pImage->peImage.FileBase()); if(!NT_SUCCESS(status)) { BLACBONE_TRACE(L"ManualMap: Failed to copy image headers. Status = 0x%x", status); return false; } // Set header protection if(!(pImage->flags & HideVAD) && pImage->imgMem.Protect(PAGE_READONLY, 0, dwHeaderSize) != STATUS_SUCCESS) { BLACBONE_TRACE(L"ManualMap: Failed to set header memory protection. Status = 0x%x", LastNtStatus()); return false; } auto& sections = pImage->peImage.Sections(); // Copy sections for(auto& section : sections) { // Skip discardable sections if(section.Characteristics & (IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_EXECUTE)) { if(section.SizeOfRawData == 0) continue; uint8_t* pSource = reinterpret_cast<uint8_t*>(pImage->peImage.ResolveRVAToVA(section.VirtualAddress)); // Copy section data if(pImage->flags & HideVAD) { status = Driver().WriteMem( _process.Id(), pImage->imgMem.Ptr() + section.VirtualAddress, section.SizeOfRawData, pSource ); } else { status = pImage->imgMem.Write(section.VirtualAddress, section.SizeOfRawData, pSource); } if(!NT_SUCCESS(status)) { BLACBONE_TRACE( L"ManualMap: Failed to copy image section at offset 0x%x. Status = 0x%x", section.VirtualAddress, status ); return false; } } } return true; }
void vncServer::SetHookings() { if (sethook && m_desktop) { m_desktop->SethookMechanism(Hook(),Driver()); } sethook=false; }
/// <summary> /// Change memory protection /// </summary> /// <param name="protection">New protection flags</param> /// <param name="offset">Memory offset in block</param> /// <param name="size">Block size</param> /// <param name="pOld">Old protection flags</param> /// <returns>Status</returns> NTSTATUS MemBlock::Protect( DWORD protection, uintptr_t offset /*= 0*/, size_t size /*= 0*/, DWORD* pOld /*= nullptr */ ) { auto prot = CastProtection( protection, _memory->core().DEP() ); if (size == 0) size = _size; return _physical ? Driver().ProtectMem( _memory->core().pid(), _ptr + offset, size, prot ) : _memory->Protect( _ptr + offset, size, prot, pOld ); }
// --------------------------------------------------------------------------- // CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSpecificSizeL() // // // --------------------------------------------------------------------------- TUint CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSpecificSizeL( const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aDataType ) { CSBJavaTransferType* transferType = CSBJavaTransferType::NewL( aHash, aDrive, aDataType ); CleanupStack::PushL( transferType ); const TUint size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType ); CleanupStack::PopAndDestroy( transferType ); return size; }
// --------------------------------------------------------------------------- // CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSpecificSizeL() // // // --------------------------------------------------------------------------- TUint CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSpecificSizeL( TSecureId aSecureID, TDriveNumber aDrive, TTransferDataType aDataType ) { CSBSIDTransferType* transferType = CSBSIDTransferType::NewL( aSecureID, aDrive, aDataType ); CleanupStack::PushL( transferType ); const TUint size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType ); CleanupStack::PopAndDestroy( transferType ); return size; }
// --------------------------------------------------------------------------- // CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL( TBool /*aPartial*/ ) { __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() - START" ); __DEBUG_TESTING_SKIP_RESTORE_JAV_DATA; iRestoreTransferObjectMidlet = CMMCScBkupReadDataTransferRequest< TJavaTransferType >::NewL( Driver(), EMMCScBkupOwnerDataTypeJavaData, EJavaMIDlet ); iRestoreTransferObjectMidletData = CMMCScBkupReadDataTransferRequest< TJavaTransferType >::NewL( Driver(), EMMCScBkupOwnerDataTypePassiveData, EJavaMIDletData ); CompleteSelf(); __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() - END" ); }
task main() { while(true) { getJoystickSettings(joystick); Driver(); arm_tilt(); arm_extension(); ramp(); } }
bool MMap::RelocateImage(ImageContext* pImage) { BLACBONE_TRACE(L"ManualMap: Relocating image '%ls'", pImage->FilePath.c_str()); // Reloc delta size_t Delta = pImage->imgMem.Ptr<size_t>() - static_cast<size_t>(pImage->peImage.ImageBase()); // No need to relocate if(Delta == 0) { BLACBONE_TRACE(L"ManualMap: No need for relocation"); LastNtStatus(STATUS_SUCCESS); return true; } auto start = pImage->peImage.DirectoryAddress(IMAGE_DIRECTORY_ENTRY_BASERELOC); auto end = start + pImage->peImage.DirectorySize(IMAGE_DIRECTORY_ENTRY_BASERELOC); RelocData* fixrec = reinterpret_cast<RelocData*>(start); if(fixrec == nullptr) { // TODO: return proper error code BLACBONE_TRACE(L"ManualMap: Can't relocate image, no relocation data"); LastNtStatus(STATUS_IMAGE_NOT_AT_BASE); return false; } while((size_t)fixrec < end && fixrec->BlockSize) { DWORD count = (fixrec->BlockSize - 8) >> 1; // records count for(DWORD i = 0; i < count; ++i) { WORD fixtype = (fixrec->Item[i].Type); // fixup type WORD fixoffset = (fixrec->Item[i].Offset) % 4096; // offset in 4K block // no fixup required if(fixtype == IMAGE_REL_BASED_ABSOLUTE) continue; // add delta if(fixtype == IMAGE_REL_BASED_HIGHLOW || fixtype == IMAGE_REL_BASED_DIR64) { size_t fixRVA = fixoffset + fixrec->PageRVA; size_t val = *reinterpret_cast<size_t*>(pImage->peImage.ResolveRVAToVA(fixoffset + fixrec->PageRVA)) + Delta; auto status = STATUS_SUCCESS; if(pImage->flags & HideVAD) status = Driver().WriteMem(_process.Id(), pImage->imgMem.Ptr() + fixRVA, sizeof(val), &val); else status = pImage->imgMem.Write(fixRVA, val); // Apply relocation if(!NT_SUCCESS(status)) { BLACBONE_TRACE(L"ManualMap: Failed to apply relocation at offset 0x%x. Status = 0x%x", fixRVA, status); return false; } } else { // TODO: support for all remaining relocations BLACBONE_TRACE(L"ManualMap: Abnormal relocation type %d. Aborting", fixtype); LastNtStatus(STATUS_INVALID_IMAGE_FORMAT); return false; } } // next reloc entry fixrec = reinterpret_cast<RelocData*>(reinterpret_cast<size_t>(fixrec) + fixrec->BlockSize); } return true; }
/// <summary> /// Change memory protection /// </summary> /// <param name="protection">New protection flags</param> /// <param name="offset">Memory offset in block</param> /// <param name="size">Block size</param> /// <param name="pOld">Old protection flags</param> /// <returns>Status</returns> NTSTATUS MemBlock::Protect( DWORD protection, uintptr_t offset /*= 0*/, size_t size /*= 0*/, DWORD* pOld /*= nullptr */ ) { if (!_pImpl) return STATUS_MEMORY_NOT_ALLOCATED; auto prot = CastProtection( protection, _pImpl->_memory->core().DEP() ); if (size == 0) size = _pImpl->_size; return _pImpl->_physical ? Driver().ProtectMem( _pImpl->_memory->core().pid(), _pImpl->_ptr + offset, size, prot ) : _pImpl->_memory->Protect( _pImpl->_ptr + offset, size, prot, pOld ); }
// --------------------------------------------------------------------------- // CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() // // // --------------------------------------------------------------------------- TBool CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() { MMMCScBkupDriver& driver = Driver(); const TInt startingOffset = CurrentOffset(); const TInt finalOffset = CurrentReadInfo().EndOffset(); // Calculate how much data is remaining const TInt amountOfDataStillToBeRead = finalOffset - startingOffset; __LOG4("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - START - startingOffset: 0x%08x, finalOffset: 0x%08x, amountToBeRead: %8d, iFinishedSupplyingData: %d", startingOffset, finalOffset, amountOfDataStillToBeRead, iFinishedSupplyingData); // Get a handle to the received data - but only if we don't already // have a handle to it! Calling this method resets whatever is already // in the transfer chunk - hence we must only call it once (at the beginning // of a multi-chunked transfer) if ( iTransferChunkPointer == NULL ) { iTransferChunkPointer = &driver.DrvSecureBackupClient().TransferDataAddressL(); } // How much space is available? const TInt spaceAvailable = iTransferChunkPointer->MaxLength() - iTransferChunkPointer->Length(); const TInt amountToRead = Min( spaceAvailable, Min( iReadChunkSize, amountOfDataStillToBeRead ) ); __LOG2("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - xfer space available: %8d, amountToRead: %8d", spaceAvailable, amountToRead); // Do the read ReadChunkL( *iTransferChunkPointer, amountToRead ); // Was this the last time we needed to perform a read? const TBool lastReadFromArchive = ( CurrentOffset() == finalOffset ); __LOG1("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - read data okay - lastReadFromArchive: %d", lastReadFromArchive); // Check to see if the data sink chunk is full. If so then we need to let // the SBE process what we've prepared so far, then we'll fill it with more // data. iFinishedSupplyingData = lastReadFromArchive; TBool moreToBeRead = !lastReadFromArchive; if ( !iFinishedSupplyingData && iTransferChunkPointer->Length() == iTransferChunkPointer->MaxLength() ) { // Also cope with the boundary condition that the sink is full // but we've also just given it the last byte anyway. In which case, // we don't need to request a repeat transfer. This is actually // all the data in one go. moreToBeRead = EFalse; } // __LOG1("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - END - more to read: %d", moreToBeRead); return moreToBeRead; }
// --------------------------------------------------------------------------- // CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL( TBool /*aPartial*/ ) { __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL() - START" ); __DEBUG_TESTING_SKIP_BACKUP_JAV_DATA; iBackupTransferObjectMidlet = CMMCScBkupWriteDataTransferRequest< TJavaTransferType >::NewL( Driver(), *this, EMMCScBkupOwnerDataTypeJavaData, EJavaTransferDerivedType, EJavaMIDlet ); iBackupTransferObjectMidletData = CMMCScBkupWriteDataTransferRequest< TJavaTransferType >::NewL( Driver(), *this, EMMCScBkupOwnerDataTypePassiveData, EJavaTransferDerivedType, EJavaMIDletData ); CompleteSelf(); }
static bool pluginInitialize(Plugin &plugin) { if(Server::create()->start(plugin.getPath(), OS_MYSQL_DATA) == false) return false; if(DatabasesSystem::instance()->addDriver(shared_ptr<IDatabaseDriver>(OS_NEW Driver(plugin.getPath()))) == false) return false; shared_ptr<ThirdPartyLibrary> mysqlLibrary = ThirdPartyLibrariesReporter::instance()->addLibrary(); OS_ASSERT(mysqlLibrary != nullptr); mysqlLibrary->setName("Mysql"); mysqlLibrary->setUrl("http://www.mysql.com"); mysqlLibrary->setLicense("GPL"); return true; }
// --------------------------------------------------------------------------- // CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() // // // --------------------------------------------------------------------------- void CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() { __ASSERT_ALWAYS(iTransferChunkPointer != NULL, User::Invariant()); const CSBGenericDataType& generic = DataOwner().Owner().Identifier(); // Prepare the transfer type with a virtual function call... CSBGenericTransferType* transferType = PrepareTransferTypeL( generic, CurrentDrive(), DataOwner().Version()); delete iTransferType; iTransferType = transferType; #ifdef __MMCSCBKUPLOGGING_ENABLED__ TInt lengthOfDataReadyForTransfer = 0; if ( iTransferChunkPointer != NULL ) { lengthOfDataReadyForTransfer = iTransferChunkPointer->Length(); } if ( iTransferType->DerivedTypeL() == EJavaTransferDerivedType ) { HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( DataOwner().Owner().Identifier() ); __LOG5("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - supplying %d bytes of data for has: %S, drive: %c, iTransferChunkPointer addr: 0x%08x, iTransferChunkPointer length: %d", lengthOfDataReadyForTransfer, hash, 'A' + CurrentDrive(), iTransferChunkPointer->Ptr(), iTransferChunkPointer->Length() ); CleanupStack::PopAndDestroy( hash ); } else { const TSecureId sid = DataOwner().SecureId(); __LOG5("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - supplying %d bytes of data for sid: 0x%08x, drive: %c, iTransferChunkPointer addr: 0x%08x, iTransferChunkPointer length: %d", lengthOfDataReadyForTransfer, sid.iId, 'A' + CurrentDrive(), iTransferChunkPointer->Ptr(), iTransferChunkPointer->Length() ); } #endif // Driver().DrvSecureBackupClient().SupplyDataL( *iTransferType, iFinishedSupplyingData, iStatus ); SetActive(); // Reset ResetDataTransferCounter(); iTransferChunkPointer = NULL; // Address is retrieved from global chunk in DoProcessChunkOfDataL __LOG("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - data transmitted, waiting for request completion..."); // When the SBE informs us that it has read the data, we'll need to send it the next // chunk. SetState( EProcessData ); }
// --------------------------------------------------------------------------- // CMMCScBkupStateOpAware::PerformLastRightsL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateOpAware::PerformLastRightsL() { const TMMCScBkupOperationType type = Driver().DrvOperation(); switch(type) { case EMMCScBkupOperationTypeFullBackup: case EMMCScBkupOperationTypePartialBackup: PerformLastRightsBackupL( type == EMMCScBkupOperationTypePartialBackup ); break; case EMMCScBkupOperationTypeFullRestore: case EMMCScBkupOperationTypePartialRestore: PerformLastRightsRestoreL( type == EMMCScBkupOperationTypePartialRestore ); break; default: ASSERT( EFalse ); break; } }
// --------------------------------------------------------------------------- // CMMCScBkupStateOpAware::PerformAsynchronousCancellation() // // // --------------------------------------------------------------------------- void CMMCScBkupStateOpAware::PerformAsynchronousCancellation() { const TMMCScBkupOperationType type = Driver().DrvOperation(); switch(type) { case EMMCScBkupOperationTypeFullBackup: case EMMCScBkupOperationTypePartialBackup: PerformAsynchronousCancellationBackup( type == EMMCScBkupOperationTypePartialBackup ); break; case EMMCScBkupOperationTypeFullRestore: case EMMCScBkupOperationTypePartialRestore: PerformAsynchronousCancellationRestore( type == EMMCScBkupOperationTypePartialRestore ); break; default: ASSERT( EFalse ); break; } }
// --------------------------------------------------------------------------- // CMMCScBkupStateNotifyAllSnapshotsSupplied::NextStateId() // // // --------------------------------------------------------------------------- TMMCScBkupStateId CMMCScBkupStateNotifyAllSnapshotsSupplied::NextStateId() const { TMMCScBkupStateId nextState = KMMCScBkupStateIdRequestSizeOfBackupData; // const TMMCScBkupOperationType type = Driver().DrvOperation(); switch(type) { case EMMCScBkupOperationTypeFullBackup: nextState = KMMCScBkupStateIdRequestSizeOfBackupData; break; case EMMCScBkupOperationTypeFullRestore: nextState = KMMCScBkupStateIdArchiveOpSystemData; break; default: ASSERT( EFalse ); break; } // return nextState; }
// --------------------------------------------------------------------------- // CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() // // // --------------------------------------------------------------------------- TBool CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) { (void) aError; __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() - error: %d", aError ); // Reset state and move to next item. Treat the current (badly behaving) item // as completed/processed. CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); if ( iIndexValueCurrent < dataOwners.Count() ) { CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeJavaData, ETrue ); iCurrentJavaState = EJavaStateIdle; __LOGFILE2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, SID: 0x%08x - JAVA data skipped for DO", aError, owner.SecureId().iId ); } CompleteSelf(); return ETrue; }
// --------------------------------------------------------------------------- // CMMCScBkupStateValidateDiskSpace::NextStateId() // // // --------------------------------------------------------------------------- TMMCScBkupStateId CMMCScBkupStateValidateDiskSpace::NextStateId() const { TMMCScBkupStateId nextState = KMMCScBkupStateIdOperationComplete; // const TMMCScBkupOperationType type = Driver().DrvOperation(); switch(type) { case EMMCScBkupOperationTypeFullBackup: nextState = KMMCScBkupStateIdArchiveOpPublicDataFiles; break; case EMMCScBkupOperationTypeFullRestore: nextState = KMMCScBkupStateIdSetPhoneMode; break; default: ASSERT( EFalse ); break; } // return nextState; }
// --------------------------------------------------------------------------- // CMMCScBkupStateValidateDiskSpace::PerformAsynchronousStateStepL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateValidateDiskSpace::PerformAsynchronousStateStepL() { const TMMCScBkupOperationType type = Driver().DrvOperation(); switch(type) { case EMMCScBkupOperationTypeFullBackup: { ValidateFreeSpaceBeforeBackupL(); break; } case EMMCScBkupOperationTypeFullRestore: { ValidateFreeSpaceBeforeRestoreL(); break; } default: User::Leave(KErrNotSupported); break; } }
// --------------------------------------------------------------------------- // CMMCScBkupStateOpAware::NextStateId() // // // --------------------------------------------------------------------------- TMMCScBkupStateId CMMCScBkupStateOpAware::NextStateId() const { TMMCScBkupStateId state = KMMCScBkupStateIdOperationComplete; // const TMMCScBkupOperationType type = Driver().DrvOperation(); switch(type) { case EMMCScBkupOperationTypeFullBackup: case EMMCScBkupOperationTypePartialBackup: state = NextStateBackupId( type == EMMCScBkupOperationTypePartialBackup ); break; case EMMCScBkupOperationTypeFullRestore: case EMMCScBkupOperationTypePartialRestore: state = NextStateRestoreId( type == EMMCScBkupOperationTypePartialRestore ); break; default: ASSERT( EFalse ); break; } // return state; }