⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kaeziparchiveregister.cpp

📁 zip解压源码.
💻 CPP
字号:
//////////////////////////////////////////////////////////////////////////////////////
//
//  FileName    :   KAEZipArchiveRegister.h
//  Creater     :   Liu Haifeng
//  Date        :   2000-07-27 16:51:20
//  Comment     :   Use to register KAEZipArchive Component to KSCOM
//
//////////////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "KAEZipArchive.h"
#include "KAEZipArchiveRegister.h"



static HANDLE g_hKAEZipArchiveComponent = NULL;

#ifdef _KAV_COMPONENT_REG_FACTORY_

#include "KAEZipArchiveFactory.h"


static int g_nRegFactory = 0;


KSCOMRESULT KAEZipArchiveRegFactory()    
{
    if (g_nRegFactory > 0)
    {
        g_nRegFactory++;

        return KSCOM_S_OK;
    }

    KSCOMRESULT krResult = KSCOM_E_FAIL;
    KSCOMRESULT krRetCode = KSCOM_E_FAIL;
    KAEZipArchiveFactory *pcNameFactory = NULL;

    pcNameFactory = new KAEZipArchiveFactory();
    if (!pcNameFactory)
        goto Exit0;

    krRetCode = KSCoRegisterClassObject(CLSID_KAEZipArchive, IID_IClassFactory, pcNameFactory, &g_hKAEZipArchiveComponent);
    if (FAILED(krRetCode))
    {
        krResult = krRetCode;
        goto Exit0;
    }

    g_nRegFactory++;

    krResult = KSCOM_S_OK;

Exit0:

    if (pcNameFactory)
    {
        pcNameFactory->Release();
        pcNameFactory = NULL;
    }

    return krResult;
}

KSCOMRESULT KAEZipArchiveUnRegFactory()
{
    if (g_nRegFactory <= 0)
        return KSCOM_E_FAIL;

    g_nRegFactory--;
    if (g_nRegFactory > 0)
        return KSCOM_S_OK;

    KSCOMRESULT krResult = KSCOM_S_OK;

    if (g_hKAEZipArchiveComponent)
    {
        krResult = KSCoUnRegisterClassObject(g_hKAEZipArchiveComponent);
        g_hKAEZipArchiveComponent = NULL;
    }

    return krResult;
}

#elif _KAV_COMPONENT_REG_FILE_


static int g_nRegFile = 0;

KSCOMRESULT KAEZipArchiveRegFile()
{
    if (g_nRegFile > 0)
    {
        g_nRegFile++;

        return KSCOM_S_OK;
    }
    
    KSCOMRESULT krResult = KSCOM_E_FAIL;
    KSCOMRESULT krRetCode = KSCOM_E_FAIL;

    krRetCode = KSCoRegisterComponent(
        CLSID_KAEZipArchive, 
        IID_IClassFactory, 
        REGISTER_COMPONENT_FILENAME,
        0,
        KAEZIPARCHIVE_FILENAME,
        &g_hKAEZipArchiveComponent
    );
    if (FAILED(krRetCode))
    {
        krResult = krRetCode;
        goto Exit0;
    }

    g_nRegFile++;

    krResult = KSCOM_S_OK;

Exit0:

    return krResult;
}


KSCOMRESULT KAEZipArchiveUnRegFile()
{
    if (g_nRegFile <= 0)
        return KSCOM_E_FAIL;

    g_nRegFile--;
    if (g_nRegFile > 0)
        return KSCOM_S_OK;

    KSCOMRESULT krResult = KSCOM_S_OK;

    if (g_hKAEZipArchiveComponent)
    {
        krResult = KSCoUnRegisterComponent(g_hKAEZipArchiveComponent);
        g_hKAEZipArchiveComponent = NULL;
    }

    return krResult;
}



#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -