解读 DeltaDecompressFileFile

    xiaoxiao2021-03-25  85

    解读 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

    };

     

    转载请注明原文地址: https://ju.6miu.com/read-35777.html

    最新回复(0)