Share

7-Zip

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

7z.dll Implementation Problems

  1. 2008-11-19 00:13:51 UTC
    I plan to use 7zip file creation in a new program. I studied client7z and understood it after some time. But I can't get into the whole 7zip code to understand all.
    My question is how I set all the settings for an archive like compression mode.
  2. 2008-11-19 09:44:24 UTC
    CPP\7zip\Archive\IArchive.h
    ISetProperties
  3. 2008-11-25 01:07:47 UTC
    Thank you for this information. I now got more into it but the whole implementation is really hard for someone who is new to 7zip development + com interfaces.

    I don't want to open another topic for a problem also if it isn't really the same context.
    I have some problems to compile or better link my project or better the 7zip part with mingw. There were some messages of missing IID_IUnknown. With googling I found out that this can be fixed by linking luuid library. That works good but now I have one problem left. Undefined reference to IID_IOutStream. I tried to get deeper into the problem. The confused thing was that all matches for it seemed to be in files that wasn't used (only inside of the DLL I load). Also commenting all matches out didn't fix it.
    I think I must miss anything but anyway, did someone had similar problems?
  4. 2008-11-25 04:56:56 UTC
    If you use MSVC 6.0, update platform SDK to:
    Windows Server 2003 PSDK (February 2003)

  5. 2008-11-25 11:58:17 UTC
    No I use Mingw (g++) MSVC seems to work good but I tested this only with your Client7z. It's not possible for me to compile this project with MSVC too.
    But how could a missing reference to IID_IOutStream belong to any library or something like this?
  6. 2008-11-25 16:47:28 UTC
    The problem is because of MY_UNKNOWN_IMP1(IOutStream) in my implementation of an out stream. If I write for testing IUnknown it links well.
    The error seems to everytime happen in a mingw file. But the file changed mingw/include/c++/3.4.5/bits/basic_string.h or alloc.h or ... It makes no sense to me and I have no idea how to fix it :/
  7. 2008-11-26 05:39:35 UTC
    I can't help with mingw.
  8. 2008-11-26 12:53:46 UTC
    Yeah too bad. I hoped someone had similar experiences. The problem ist Iam not sure that I did everything right. The define flued is really heavy. Also I try to include only as much of your code besides the dll as really necessary. If I would use your streams for example that would lead to the use of many many more.

    How could it happen that IID_IOutStream is unreferenced. I now found the define where it was created but because of what could the linking error happen? Any help maybe?
  9. 2008-11-27 09:51:17 UTC
    Check some things in files

    MyGuidDef.h
    MyInitGuid.h

    #ifdef DEFINE_GUID
    #undef DEFINE_GUID
    #endif

    #ifdef INITGUID
    #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
    MY_EXTERN_C const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
    #else
    #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
    MY_EXTERN_C const GUID name
    #endif



    Try to change some lines.
  10. 2008-11-27 12:45:18 UTC
    Yes thanks, I tried VERY MUCH and now have a more or less simple solution. Now it it works but I didn't test any working of the code yet.
    I defined all interfaces I needed in my main code file. Thats the only place it worked.

    DEFINE_GUID(CLSID_CFormat7z,
    0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
    DEFINE_GUID(IID_IOutStream, 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
    DEFINE_GUID(IID_IInStream, 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
    DEFINE_GUID(IID_IStreamGetSize, 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
  11. 2008-11-28 05:51:08 UTC
    You must define all interfaces just in one cpp file.
    You must include
    "MyInitGuid.h" (that defines INITGUID)
    and then include all .h files with interfaces.
  12. 2008-12-10 22:21:51 UTC
    Thank you VERY MUCH. I missed this post and did some other think in the past. The errors really were because of the missing include of "MyInitGuid.h" in the both FileStream implementations. My "fix" wasn't really one. I hope now my compression try works :)
  13. 2008-12-17 13:42:24 UTC
    Hi Igor,
    progress is good at the moment I now got a simple file/archive browser with only open some files and only trust on the extension what really isn't what it should be ;).
    Did I get it right that I have to detect the right archive type myself and give it to the dll? Where is this code in your source I really investigated some time but it seems like I didn't get a structure in the sources. And how is it working with a rar sfx archive for example?
    Thank you in advance
  14. 2008-12-17 19:27:12 UTC
    Check
    LoadCodecs.cpp
    LoadCodecs.h
    OpenArchive.cpp
    OpenArchive.h
  15. 2008-12-17 20:38:16 UTC
    Yeah that looks more what I searched for :) Never been in this folder before nor been there by stepping through code functions.
    Anyway. I will have a look how the codecs can help me and do the detection on my own.
  16. 2009-01-14 00:18:26 UTC
    I have a small question:
    Is the 7zip dll only using GetHandlerPropertyFunc2 so that I can ignore 1 if I don't want to support external libraries (old ones)?
  17. 2009-01-14 03:14:52 UTC
    Please read the message above. I have successfully integrated all formats and have found one minor bug. The order by the content of an archive isn't sorted after anything so I create the folders if needed. But I only assign a icon and some attributes if I get the dir item.
    In a doc file it appears that I don't get these dir items. I have a right tree but no icons and wrong attributes. I can fix it more or less easy but wanted to let you know about this glitch.
  18. 2009-01-14 06:36:10 UTC
    I don't understand that question.
  19. 2009-01-14 12:46:51 UTC
    There are:
    GetHandlerPropertyFunc2 getProp2 = (GetHandlerPropertyFunc2)l7zip.resolve("GetHandlerProperty2");

    and

    GetHandlerPropertyFunc getProp = (GetHandlerPropertyFunc)l7zip.resolve("GetHandlerProperty");

    The question is if I can ignore getProp and only use getProp2. getProp was only used in old libraries and in the first versions of the interface?
  20. 2009-01-14 15:56:18 UTC
    Yes, use GetHandlerProperty2.
  21. 2009-01-23 13:40:50 UTC
    Hi Igor,
    I want to let you know about a second issue I found while creating my program. I don't think you are really interested in, but it could still be a problem for a user.
    I have a zip archive created in fast mode. In the archive are some 7z files. You first test the IInArchive with the extension. I don't do it at this point so the 7z format was detected.
    If I rename the file to any other extension 7z (but why should I do this), bin or eng or whatever also 7-zip false detects the archive.
  22. 2009-01-23 13:51:48 UTC
    I want provide you a small idea that could also overall improve the speed of your code. I had it after writing the last message.
    Please write if you see any side effect in doing this:
    Instead of open every archive with const uint64 kMaxCheckStartPosition = 1 < 22 creating two constants:
    const quint64 executableArciveDetectionLength = 1 << 22;
    const quint64 archiveDetectionLength = 20;
    and use the first only for any executable. Or do you have a better idea for the size of archiveDetectionLength? Sould it bet higher?
  23. 2009-01-23 14:53:36 UTC
    Maybe you are right. But 1 << 22 must be fast too.
  24. 2009-01-23 14:59:26 UTC
    Yes but it's mainly because 1 << 22 causes false detections on normal archives. It works like a stream library inside of files... ;).
    That it will be little bit faster is a nice addition. But you are right. The open function runs very fast for me.
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.