コード例 #1
0
ファイル: seclib.cpp プロジェクト: cdaffara/symbiandump-os1
GLDEF_C TInt GetSecurityInfo(const char* aFileName, SBinarySecurityInfo& aInfo)
	{
	// Check we have a filename
	if (!aFileName)
		{
		return KErrNotFound;
		}

	// Zero the capabilities
	memset(aInfo.iCapabilities, 0, KCapabilitySetMaxSize);

	// We don't want to update the image's capabilities
	CapabilitySet = EFalse;

	// Try opening the file as an E32Image
	E32ImageFile f;
	TInt r = f.Open(aFileName);

	if (r==KErrCorrupt || r==KErrNotSupported || r==1)
		{
#ifndef __LINUX__
		// Try emulator format
		aInfo.iE32Image = EFalse;

		HANDLE file = CreateFileA(aFileName, 
		                          GENERIC_READ|GENERIC_WRITE, 
								  FILE_SHARE_READ|FILE_SHARE_WRITE, 
								  NULL, 
								  OPEN_EXISTING, 
								  0, 
								  NULL);
		if (file == INVALID_HANDLE_VALUE)
			{
			return GetLastError();
			}

		r = SetCap(file);
#endif
		}
	else
		{
		// Extract caps from E32Image
		aInfo.iE32Image = ETrue;

		r = SetCap(f.iOrigHdr);
		}

	if (r == KErrNone)
		{
		aInfo.iSecureId = SecureId.iId;
		aInfo.iVendorId = VendorId.iId;
		*(SCapabilitySet*)(aInfo.iCapabilities) = Capability;
		}

	return r;
	}
コード例 #2
0
ファイル: main.cpp プロジェクト: kuailexs/symbiandump-os1
TInt DoIt()
	{
	TInt r;

	r=Source.Open(Fs,SourceName.FullName(),EFileRead);
	if(r!=KErrNone)
		return r;

	r = Destination.Replace(Fs,DestinationName.FullName(),EFileWrite);
	if(r!=KErrNone)
		return r;

	TUint8* buffer;
	const TInt KBufferSize = 0x10000;

	buffer = (TUint8*)User::Alloc(KBufferSize);
	if(!buffer)
		return KErrNoMemory;

	TPtr8 p(buffer,KBufferSize,KBufferSize);
	TInt n = 0;
	while (r==KErrNone)
		{
		r = Source.Read(p);
		if(r!=KErrNone || p.Size()==0)
			break;
		if (n==0)
			{
			// first block contains header
			if ((TUint)p.Size() < sizeof(E32ImageHeader))
				{
				r = KErrCorrupt;
				break;
				}
			E32ImageHeader* h = (E32ImageHeader*)buffer;
			r = SetCap(h);
			}
		if (r==KErrNone)
			r = Destination.Write(p);
		++n;
		}

	delete buffer;

	Source.Close();
	Destination.Close();

	return r;
	}
コード例 #3
0
ファイル: main.cpp プロジェクト: kuailexs/symbiandump-os1
TInt DoIt()
	{
	TInt  r;

	TBuf<MAX_PATH> sName;
	r = MapEmulatedFileName(sName, SourceName.NameAndExt());
	if(r!=KErrNone)
		return r;

	TBuf<MAX_PATH> dName;
	r = MapEmulatedFileName(dName, DestinationName.FullName());
	if(r!=KErrNone)
		return r;

	if(!Emulator::CopyFile((LPCTSTR)sName.PtrZ(),(LPCTSTR)dName.PtrZ(),FALSE))
		return KErrGeneral;

	HANDLE hFile=Emulator::CreateFile((LPCTSTR)dName.PtrZ(),GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);
	if (hFile==INVALID_HANDLE_VALUE)
		return KErrArgument;

	return SetCap(hFile);
	}
コード例 #4
0
MBOOL
Pass2NodeImpl::
enquePass2(MBOOL const doCallback)
{
    //workaround for start/stop recording
    Mutex::Autolock lock(mRecordingLock);

    NG_TRACE_CALL();
    QParams enqueParams;
    vector<p2data> vP2data;
    MUINT32 trace_begin = muEnqFrameCnt;

    if( !getPass2Buffer(vP2data) )
    {
        // no dst buffers
        return MTRUE;
    }

    if( vP2data.size() == 0 )
    {
        MY_LOGE("no src/dst buf");
        return MFALSE;
    }

    enqueParams.mvIn.reserve( vP2data.size() );
    //enqueParams.mvOut.reserve(dstCount);

    MUINT32 index = 0;
    vector<p2data>::const_iterator pData = vP2data.begin();
    while( pData != vP2data.end() )
    {
        MUINT32 magicNum;
        MVOID*  pPrivateData;
        MUINT32 privateDataSize;
        MCropRect p2InCrop;
        MSize srcSize;
        MINT64 timestamp;

        // input
        Input src;
        //
        src.mPortID = mapToPortID(pData->src.data);
        src.mPortID.group = index;
        src.mBuffer = pData->src.buf;
        //
        if( pData->doCrop )
        {
            mpIspSyncCtrlHw->getPass2Info(
                    src.mBuffer,
                    pData->dstSize,
                    magicNum,
                    pPrivateData,
                    privateDataSize,
                    p2InCrop);
        }
        else
        {
            MBOOL isRrzo;
            mpIspSyncCtrlHw->queryImgBufInfo(
                    src.mBuffer,
                    magicNum,
                    isRrzo,
                    pPrivateData,
                    privateDataSize);
            p2InCrop.p_integral = MPoint(0, 0);
            p2InCrop.p_fractional = MPoint(0, 0);
            p2InCrop.s = src.mBuffer->getImgSize();
        }
        //
        if( !isPreviewPath() )
            magicNum = SetCap(magicNum);
        //
        enqueParams.mvPrivaData.push_back(pPrivateData);
        enqueParams.mvMagicNo.push_back(magicNum);
        enqueParams.mvIn.push_back(src);
        //
        srcSize = src.mBuffer->getImgSize();
        timestamp = src.mBuffer->getTimestamp();
        //
        MY_LOGD("i %d data %d, buf 0x%x, va 0x%x, # 0x%X, type %d cnt %d", 
                index,
                pData->src.data,
                src.mBuffer,
                src.mBuffer->getBufVA(0),
                magicNum,
                mPass2Type,
                muEnqFrameCnt);
        //output
        //
        MCrpRsInfo crop1;
        crop1.mGroupID    = 1;
        crop1.mCropRect.s = srcSize;
        crop1.mResizeDst  = srcSize;
        //
        MCrpRsInfo crop2;
        crop2.mGroupID    = 2;
        crop2.mCropRect   = p2InCrop;
        //crop2.mResizeDst = MSize(0,0);
        // output
        MUINT32 i = 0;
        for( vector<ImgRequest>::const_iterator pOutReq = pData->vDstReq.begin();
                pOutReq != pData->vDstReq.end(); pOutReq++, i++ )
        {
            const MUINT32 dstDataType = pData->vDstData[i];
            Output dst;
            IImageBuffer* pDstBuf = const_cast<IImageBuffer*>(pOutReq->mBuffer);
            //
            MY_LOGD("data %d, buf 0x%x, va 0x%x, tans %d usg %d", 
                    dstDataType,
                    pDstBuf, 
                    pDstBuf->getBufVA(0),
                    pOutReq->mTransform,
                    pOutReq->mUsage);
            //
            dst.mPortID             = mapToPortID(dstDataType);
            dst.mPortID.group       = index;
            dst.mPortID.capbility   = (NSIoPipe::EPortCapbility)(pOutReq->mUsage);
            //
            dst.mBuffer     = pDstBuf;
            dst.mTransform  = pOutReq->mTransform;
            //
            dst.mBuffer->setTimestamp(timestamp);
            //
            enqueParams.mvOut.push_back(dst);
            //
            if(mapToPortID(dstDataType) == IMG2O)
            {
                crop1.mCropRect = p2InCrop;
                crop1.mResizeDst = dst.mBuffer->getImgSize();
                MY_LOGD("IMG2O:B(%p),S(%dx%d),C(%d,%d,%dx%d)",
                        dst.mBuffer,
                        crop1.mResizeDst.w,
                        crop1.mResizeDst.h,
                        crop1.mCropRect.p_integral.x,
                        crop1.mCropRect.p_integral.y,
                        crop1.mCropRect.s.w,
                        crop1.mCropRect.s.h);
            }
        }
        //
        enqueParams.mvCropRsInfo.push_back( crop1 ); 
        enqueParams.mvCropRsInfo.push_back( crop2 ); 
        //
        // next src/dst pair
        pData++;
        muEnqFrameCnt++;
        index++;
    }
    //
    configFeature();

    //
#if PASS2_CALLBACL_ENABLE
    if( doCallback )
    {
        enqueParams.mpfnCallback = pass2CbFunc;
        enqueParams.mpCookie = this;
    }
    else
#endif
    {
        enqueParams.mpfnCallback = NULL;
        enqueParams.mpCookie = NULL;
    }
    //
    if( !mpIspSyncCtrlHw->lockHw(IspSyncControlHw::HW_PASS2) )
    {
        MY_LOGE("isp sync lock pass2 failed");
        return MFALSE;
    }
    //
    NG_TRACE_FMT_BEGIN("enqP2:%d", trace_begin);
    if( !mpPostProcPipe->enque(enqueParams) )
    {
        NG_TRACE_FMT_END();
        MY_LOGE("enque pass2 failed");
        AEE_ASSERT("ISP pass2 enque fail");
        return MFALSE;
    }
    NG_TRACE_FMT_END();
    return MTRUE;
}