ExtractDLLEx plug-in

From NSIS Wiki

Author: mumpitzstuff (talk, contrib)


Extractdllex.zip (135 KB)
Zip.gif Extractdllex.zip (135 KB) (Mirror #1)

What is this?

ExtractDLLEx is a extension DLL for NSIS. It can decompress one or more files from a LZMA container file which was created with compressfile.exe before. It is especially useful in combination with NSISdl so that you don't have to download large files uncompressed.


  • Decompression (within NSIS script):
    • Push path and name of compressed file and then path and name of temporary destination file on top of the stack.
    • Call the function "extract" with CallInstDLL
    • On Success, the string "success" is on top of the stack, else an error message.
    • The decompressed files are created in the same directory like the script executable NSIS script file.
    • The second filename is only used for temporary file access!
  • Compression (outside NSIS script or using !system):
    • Call CompressFile.exe with the name of the compressed file and the uncompressed files as parameters. You can use relative paths of the actual directory. The usage of wildcards like * and ? is also supported!
    • Use always / and not \ in your paths!
    • Don't use / in front of relative paths.
    • ../ is not supported in relative paths.
    • CompressFile needs the lzma.exe file!



CompressFile.exe test.7z test.* te?t.exe test1/test2/test.txt

Decompression (NSIS script)

    Push "test.7z"
    Push "update.tmp"

    ;get the result
    Pop $0
    StrCmp $0 success SUCCESS
      MessageBox MB_OK|MB_ICONSTOP "$0"

Process Overview

1. Batch file compresses files:

CompressFile.exe test.7z test.* test/test.txt

2. The process begins:

         test.exe      test.dat    test/test.txt
                 \        |        /
                  \       |       /
                   \      |      /
                    \     |     /
  CompressFile.exe   \    |    /
                      pack.tmp (hardcoded in CompressFile)
                      update.tmp (temporary file!)
  ExtractDLLEx.dll    /   |   \
                     /    |    \
                    /     |     \
                   /      |      \
                  /       |       \
          test.exe     test.dat    test/test.txt

3. NSIS script unpacks files:

  Push "test.7z"
  Push "update.tmp"
  ;get the result
  Pop $0
  StrCmp $0 success SUCCESS
    MessageBox MB_OK|MB_ICONSTOP "$0"

Changes from Original Version

  • LZMA compression with CRC check.
  • File container support.
  • Wildcard support.
  • Relative path support.
  • Smaller DLL file size.

Known limitations

Zlib and LZMA compression are included. The included plugin supports only LZMA because of the better compression and smaller filesize.

Bug: CompressFile.exe does not support using a space in the result filename. It will report as a success, but the resulting file is only 4 bytes, and will fail to decompress later. If you want to use a space in the resulting compressed file name, simply rename the file after CompressFile.exe generated it. Decompressing files with spaces works just fine.


Modified by
Copyright 2004 by Achim Winkler (achim@lkcc.org)
Created by
Copyright 2002 by Tim Kosse (tim.kosse@gmx.de)

Legal Stuff

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.
Personal tools