解读 DeltaDecompressFileFile

179 篇文章 0 订阅
86 篇文章 0 订阅

解读 DeltaDecompressFile

 

这是一个导出函数。

实际上只有四个参数:

第一个参数为基准文件,可以为空,这时就是自压缩文件,即DCN 格式;

第二个参数为标志,说明压缩文件的文件头长度,比如,DCD 格式为 12

第三个参数为压缩文件;

第四个参数为输出文件,可以和第三个参数指定的文件相同,这样,就直接覆盖原来的压缩文件了。

 

//----- (1023E030) --------------------------------------------------------
int __userpurge Windows::Rtl::DeltaDecompressFile (

Windows::Rtl *this,

structWindows::Rtl::IRtlFile *a2,

unsigned __int32 a3,

structWindows::Rtl::IRtlFile *a4,

structWindows::Rtl::IRtlFile *a5)
{

  v5 =`anonymous namespace'::ValidateDeltaBufferCompressorInitialized();
  v16 =0;
  v15 =0;
  v17 =0;
  v19 =0;
  v18 =0;
  v20 =0;
  if (this
    &&
(v6 =*(int(__thiscall **)(Windows::Rtl *,_DWORD, unsigned __int32 *,_DWORD))(*(_DWORD *)this +24),
        __guard_check_icall_fptr(*(_DWORD *)(*(_DWORD *)this +24)),
        v5 =v6(this, 0,&v15, 0),
        v5 <0)
    ||(v7 =*(int(__thiscall **)(unsigned __int32, _DWORD, unsigned__int32 *, _DWORD))(*(_DWORD *)a3 + 24),
        __guard_check_icall_fptr(*(_DWORD *)(*(_DWORD *)a3 + 24)),
        v5 =v7(a3, 0, &v18, 0),
        v5 <0) )
  {
LABEL_8:
    Windows::Rtl::AutoBlob<Windows::Auto<_LBLOB>>::Close((int)&v18);
    Windows::Rtl::AutoBlob<Windows::Auto<_LBLOB>>::Close((int)&v15);
    return v5;
  }
  v13 =0;
  v12 =0;
  v14 =0;
  v5 =Windows::Rtl::DeltaDecompressBuffer(
         (Windows::Rtl*)3,
         (unsigned__int32)&v15,
         a2,
         (unsigned__int32)&v18,
         (struct_LBLOB *)&v12,
         v11);
  v8 =(Windows::Rtl::AutoDeltaBlob *)&v12;
  if (v5 < 0
    ||(v9 =*(int(__thiscall **)(struct Windows::Rtl::IRtlFile *, _DWORD, int *))(*(_DWORD *)a4 + 28),
        __guard_check_icall_fptr(*(_DWORD *)(*(_DWORD *)a4 + 28)),
        v5 =v9(a4, 0, &v12),
        v8 =(Windows::Rtl::AutoDeltaBlob *)&v12,
        v5 <0) )
  {
    Windows::Rtl::AutoDeltaBlob::Close(v8);
    goto LABEL_8;
  }
  Windows::Rtl::AutoDeltaBlob::Close((Windows::Rtl::AutoDeltaBlob *)&v12);
  Windows::Rtl::AutoBlob<Windows::Auto<_LBLOB>>::Close((int)&v18);
  Windows::Rtl::AutoBlob<Windows::Auto<_LBLOB>>::Close((int)&v15);
  return 0;
}

 

DeltaDecompressFileFile

 

使用 DeltaDecompressFileFile函数可以解压缩 DCD 格式的压缩文件。

 

HRESULTDeltaDecompressFileFile( LPWSTRDeltaFileName, LPWSTRBaseFileName)

{

    // 如果是增量压缩,那么第一个文件就是基准文件,第二个文件就是增量压缩文件,标志为 12

    // 如果是自压缩,那么,第一个文件就为空,第二个文件为自压缩文件,标志为 4

    InitFunPtrs_Wcp();

 

    HRESULTresult = 0;

    IRtlFile *pIFileDelta = NULL;

    IRtlFile *pIFileBase = NULL;

    GetInterfaceAndObject(DeltaFileName, &pIFileDelta, NULL, GENERIC_WRITE);

    if (BaseFileName == NULL)

    {

        result = DeltaDecompressFile(NULL, DCHLENGTH::DCN, pIFileDelta, pIFileDelta);

    }

    else

    {

        GetInterfaceAndObject(BaseFileName, &pIFileBase, NULL, GENERIC_READ);

        result = DeltaDecompressFile(pIFileBase, DCHLENGTH::DCD, pIFileDelta, pIFileDelta);

    }

 

    if (pIFileDelta)

    {

        pIFileDelta->Release();

    }

    if (pIFileBase)

    {

        pIFileBase->Release();

    }

 

    returnresult;

}

 

定义一个枚举,表示压缩文件头的长度:

enumDCHLENGTH

{

    DCD = 12,

    DCN = 4,

    DCH = 12,

    DCM = 4,

    DCS = 12

};

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值