rikyoz / bit7z

A C++ static library offering a clean and simple interface to the 7-zip shared libraries.
https://rikyoz.github.io/bit7z
Mozilla Public License 2.0
623 stars 113 forks source link

[Bug]: mErrorCode=CLASS_E_CLASSNOTAVAILABLE ClassFactory cannot supply requested class #89

Closed jf3096 closed 2 years ago

jf3096 commented 2 years ago

bit7z version

3.1.x

7-zip version

v21.07

7-zip DLL used

7za.dll

MSVC version

2017

Architecture

x86_64

Which version of Windows are you using?

Windows 10

Bug description

unable extract. error: {mErrorCode=CLASS_E_CLASSNOTAVAILABLE ClassFactory cannot supply requested class }

void extractVolumeExample()
{
    try
    {
        Bit7zLibrary lib{ L"C:/Users/admin/source/repos/bit7z-demo/libs/bit7z/lib/7za.dll" };
        BitExtractor extractor{ lib, BitFormat::Split };
        extractor.extract(L"D:/test/volumes/out/.001", L"D:/test/volumes/out/_");
        std::cout << "Done";
    }
    catch (const BitException& ex) {
        std::cout << "error";
        //do something with ex.what()...
    }
}

Steps to reproduce

No response

Expected behavior

No response

Relevant compilation output

No response

Code of Conduct

rikyoz commented 2 years ago

Hi!

7-zip DLL used

7za.dll

unable extract. error: {mErrorCode=CLASS_E_CLASSNOTAVAILABLE ClassFactory cannot supply requested class }

BitExtractor extractor{ lib, BitFormat::Split };

I think the problem is in the DLL you are using: the 7za.dll doesn't support the BitFormat::Split format; it supports only the 7z format (e.g., BitFormat::SevenZip). For extracting split archives, you should use the 7z.dll, which supports all formats. You can find a table with the supported features of each 7-zip DLL here: https://github.com/rikyoz/bit7z/wiki/7z-DLLs.

jf3096 commented 2 years ago

Thank you very much for quick reply. But I cannot find 7z.dll in https://www.7-zip.org/. Could you please guide me to a site where I can download 7z.dll?

rikyoz commented 2 years ago

Thank you very much for quick reply. But I cannot find 7z.dll in https://www.7-zip.org/. Could you please guide me to a site where I can download 7z.dll?

One way I know to obtain the already compiled 7z.dll file is to download the usual 7-zip installer, and extract it: image Alternatively, if you already installed 7-zip, you might find the DLL in its installation folder under C:\Program Files\7-zip.

jf3096 commented 2 years ago

thank you! it works

rikyoz commented 2 years ago

thank you! it works

You're welcome! :)