Monday, July 13, 2015

_vbaRedim vbaRedim

__cdecl SAFEARRAY*
    __vbaRedim(arg0__Flags_HAVEVARTYPE,arg4__SizeOfVbLong_4,arg8__ppSAFEARRAY_40D060,argC__VARTYPE_vbLong,arg10__cDims_1,
    arg14__Dim0High,arg18__Dim0Low,...DimNHigh,DimNLow,...)
{
    sub_660DAEFA(
        arg0__Flags_HAVEVARTYPE,
        arg4__SizeOfVbLong_4,
        argC__VARTYPE_vbLong,
        arg10__cDims_1,
        &LowHighBounds,
        arg8__ppSAFEARRAY_40D060);
   
    return *arg8__ppSAFEARRAY_40D060;
}

void __stdcall
sub_660DAEFA(arg0__Flags_HAVEVARTYPE, arg4__SizeOfVbLong_4, arg8__VARTYPE_vbLong, argC__cDims_1, arg10__LowHighBounds, arg14_ppSAFEARRAY)
{
    //loc_660DAFEA
    SafeArrayAllocDescriptorEx(arg8__VARTYPE_vbLong,argC__cDims_1,arg14_ppSAFEARRAY);
    pSAFEARRAY->fFeatures = arg0__Flags_HAVEVARTYPE;
    pSAFEARRAY->cbElement = arg4__SizeOfVbLong_4;
   
    arg4__SizeOfVbLong_4=0;
    arg8__VARTYPE_vbLong  = &pSAFEARRAY->lLbound;//The lower bound of the dimension.
   
    for(iDim=0;iDim<cDims;++iDim)
    {
        pSAFEARRAY->rgsabound[iDim].cElements = arg10__LowHighBounds[iDim].High - arg10__LowHighBounds[iDim].Low + 1;
        pSAFEARRAY->rgsabound[iDim].lLbound = arg10__LowHighBounds[iDim].Low;
    }
   
    pSAFEARRAY->pvData = SafeArrayAllocData(pSAFEARRAY);
}

HRESULT SafeArrayAllocDescriptorEx(arg0__VARTYPE_vbLong,arg4__cDims_1,arg8_ppSAFEARRAY)
{
    val = (VAL*)new BYTE[0x10+sizeof(SAFEARRAY)+sizeof(SAFEARRAYBOUND)*arg4__cDims_1];
    SAFEARRAY* pSAFEARRAY = val + 1;
   
    memset(val,0);
   
    val->Type = arg0__VARTYPE_vbLong;//
   
    pSAFEARRAY->cDims = arg4__cDims_1;
    pSAFEARRAY->fFeatures = FADF_HAVEVARTYPE;
    
     
    *arg8_ppSAFEARRAY = pSAFEARRAY;
    return 0;
}

No comments:

Post a Comment