WimImage plug-in

From NSIS Wiki
Jump to navigationJump to search
Author: JasonFriday13 (talk, contrib)


Links

Plugin package:
WimImage_plugin.zip (44 KB)

Forum thread

Description

This plugin is designed to remove the current 2GB limit in NSIS by creating and extracting images contained in .wim files that are separate to the installer. Thanks to the Wim API being unicode only, this plugin is unicode only. This plugin requires Admin privileges to run correctly (blame the API for that one too). Also requires Windows 7 or later. 32 bit and 64 bit plugins are included.

Just extract the contents to your nsis directory (usually 'C:\Program Files\NSIS').

Sample Usage

Image creation script:

Name "Example .wim Creation Script"
OutFile "ExampleWimCreate.exe"
 
;Required to use WimImage.dll
Unicode True
RequestExecutionLevel Admin
 
Page Components
Page InstFiles
 
ShowInstDetails Show
 
Section "WimImage::AddDir"
  DetailPrint "WimImage::AddDir, making .wim file"
  ;Use the defaults for this call (no compress, no verify, default temp dir.
  WimImage::AddDir /O "$EXEDIR\wimtest.wim" /S "$SMPROGRAMS"
  Pop $0
  DetailPrint "AddDir returned=|$0|"
  DetailPrint ""
SectionEnd
 
Section "WimImage::AppendDir"
  DetailPrint "WimImage::AppendDir, making base .wim file"
  ;Use /C 1 (XPRESS compression) with /V (file verification).
  WimImage::AddDir /O "$EXEDIR\wimtest.wim" /S "$SMPROGRAMS" /C 1 /V
  Pop $0
  DetailPrint "AddDir returned=|$0|"
  DetailPrint ""
 
  DetailPrint "WimImage::AppendDir, appending .wim file"
  ;Create a pluginsdir temporary directory.
  CreateDirectory "$PLUGINSDIR\temp"
  ;Use the temp dir with LZX compression and file verification.
  WimImage::AppendDir /O "$EXEDIR\wimtest.wim" /S "$DESKTOP" /T "$PLUGINSDIR\temp" /C 2 /V
  Pop $0
  DetailPrint "AppendDir returned=|$0|"
  DetailPrint ""
SectionEnd

Image extraction script (installer):

Name "Example .wim Extract Script"
OutFile "ExampleWimExtract.exe"
 
;Required to use WimImage.dll
Unicode True
RequestExecutionLevel Admin
 
Page Components
Page InstFiles
 
ShowInstDetails Show
 
Section "WimImage::Extract"
  DetailPrint "WimImage::Extract, Extract .wim file"
  ;Create a pluginsdir temporary directory.
  CreateDirectory "$PLUGINSDIR\temp"
  SetOutPath "$EXEDIR\Folder1"
  ;Use the temp dir with file verification.
  WimImage::Extract /O "$EXEDIR\Folder1" /S "$EXEDIR\wimtest.wim" /T "$PLUGINSDIR\temp" /V
  Pop $0
  DetailPrint "Extract returned=|$0|"
  DetailPrint ""
 
  DetailPrint "WimImage::Extract, Extract .wim file"
  SetOutPath "$EXEDIR\Folder2"
  ;Use the default temp dir with /I 2, /RS and /V file verification.
  WimImage::Extract /O "$EXEDIR\Folder2" /S "$EXEDIR\wimtest.wim" /I 2 /RS /V
  Pop $0
  DetailPrint "Extract returned=|$0|"
SectionEnd