提取CAB文件,FDIIsCabinet不断返回false

时间:2019-04-24 15:16:22

标签: c++ cab

我正在使用这种简单的方法

bool bk = cabber.OpenExtractCAB( "C:\\xx\\xx\\INSTALL.CAB",  "C:\\xx\xx\\");

以这种方式实现

BOOL OpenExtractCAB( char * cCABFullPath, char * cDestinationFolder )
{
    FDICABINETINFO  fdici;
    int             hf;
    char            *p;

    // Set up some important globals
    g_hfdi = NULL;
    g_pFDIProgress = NULL;

    g_hfdi = FDICreate(
        fdi_mem_alloc,
        fdi_mem_free,
        fdi_file_open,
        fdi_file_read,
        fdi_file_write,
        fdi_file_close,
        fdi_file_seek,
        cpu80386,
        &g_fdi_erf
    );

    if (g_hfdi == NULL)
    {

        return FALSE;
    }

    /*
     * Is this file really a cabinet?
     */
    hf = fdi_file_open(
        cCABFullPath,
        _O_BINARY | _O_RDONLY | _O_SEQUENTIAL,
        0
    );

    if (hf == -1)
    {
        return FALSE;
    }

    if (FALSE == FDIIsCabinet(
            g_hfdi,
            hf,
            &fdici))
    {
        /*
         * No, it's not a cabinet!
         */
        _close(hf);   
        return FALSE;
    }

我没有发布该函数的其余部分,但这就是它停止的地方,而且我不明白为什么检查我的文件是否为CAB的FDI函数为什么总是返回false。一个CAB文件。 通过调试它hf = 0,但我不知道如何调试其余部分,看看实际上出了什么问题

0 个答案:

没有答案
相关问题