Old 16th May 2014, 04:35   #1
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
WimImage Plugin: For installers bigger than 2GB

So I've spent the last 5 days or so working on this plugin. What it does is read a directory and creates an image of it inside a .wim file. What better time to write a plugin like this than the recent death of Windows XP?

I've added the basics: AddDir, AppendDir, and Extract. I'm considering adding support for split .wim files too.

Thanks to the .wim API, this plugin is Unicode only, and requires Windows Vista and up. It also requires Administrator privileges to work correctly.

To compile the source code it also requires VS2012. I haven't checked if VS2010 works, but VS2008 definitely does not work. I'm not releasing source code just yet, I'll see if any bugs pop up first.

I've included a 32 bit version and a 64 bit version, don't worry about the size as these are debug .dll's. The release versions are 12KB for 32 bit and 13KB for 64 bit. I've also included a readme file and an example script (setup for 32 bit). Just extract the files and compile the example.

Also, WimImage::Extract overwrites any files with matching filenames, and by the looks of the WIMApplyImage flags, it doesn't support "off", "try", "ifnewer", and "ifdiff".

If you have any problems, bugs, or questions, just reply in this thread.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 16th May 2014, 10:49   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,163
This is a cool idea!

Note: Server 2003 (and WinXP 64?) are not dead yet.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 16th May 2014, 11:36   #3
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
Also, the text editor in VS2012 is like spell check on steroids! Type in #include ", and it pops up a list of the include-able files and folders, type a \ and the same happens . It underlines all functions and statements that aren't defined, and when the cursor is on a statement, it highlights the other parts of the file where it's used. Also, the tooltips display the definitions of functions and statements, like TRUE gives "#define TRUE 1".

That's how I managed to write and debug about 500 lines of code in just 5 days. The SpiderBanner plugin has about 800 lines, but that took several months to write and bugfix.

Also, I wrote the code for the 32 bit version first, and apart from changing .libs, the 64 bit version compiled with no source code changes, and it worked first time with my .cvs 64 bit build of nsis too . I love VS2012 .

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 18th May 2014, 11:40   #4
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
So I've now implemented splitting of .wim files, and I can verify them with 7-zip. The problem is the coding samples and API are very vague about implementing a way to extract the data from the split .swm files.

I can extract the first .swm using the api, but after a bit of experimenting, I might have to implement my own loop that manually asks for the next file if it doesn't exist in the current dir, and manually extract each one. I still have one or two things I can try as well.

Or I just don't implement splitting in the first place. I've made a tweak to the UI code so that it's non-intrusive now (it doesn't go changing stuff on the installer window anymore), other than that the basic code is unchanged (I haven't found any more bugs yet).

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 19th May 2014, 10:43   #5
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
So I've got extracting split images working OK, but only if they all exist at the same time in the same directory. So it looks like I will have to manually copy each file off the discs to a temporary directory (using WIMCopyFile or similar) and apply the .wim from said temporary directory.

Also, I'll look at implementing a cancel routine which involves enabling the cancel button and hooking it's call to the main window, since the wim API supports cancelling operations.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 22nd May 2014, 13:18   #6
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
So the next alpha version is here. I've added support for splitting .wim files, and for copying them from one place to another (best used for optical media).

I don't think I will add support for cancel routines, the only one that makes sense is the one used in copying .wim files (if the files can't be accessed then why bother continuing with the install?).

Still no source code included yet, still looking for bugs to appear. As before, I've included a readme file, an example script, and both 32 and 64 bit debug .dll files.

Can a Mod remove my previous attachment please?

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile

Last edited by Anders; 15th September 2014 at 14:52. Reason: Requested by user
JasonFriday13 is offline   Reply With Quote
Old 22nd May 2014, 13:21   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,163
You should make a wiki page and that will also give you control over the attachments...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd May 2014, 13:32   #8
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
I will soon, I generally wait for my software to be pretty stable before posting it on the wiki.

Now it's time to do alot of testing, as I don't plan to add any more features. The next release will probably be stable enough to be put on the wiki anyway.

As usual, if any bugs pop up just reply in this thread.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 16th June 2014, 23:53   #9
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
So here it is, the first release version with source code. I got rid of VS2012 and modified the header so that the plugin will compile on VS2008, both 32bit and 64bit. I linked the trunk version (r6489) of the plugin api with this release.

I have only tested this plugin with 3.0b0, though it should work with 3.0a0 and up. I've also tested it with trunk version r6489 64 bit builds and I haven't seen any bugs yet.

Now available on the wiki: http://nsis.sourceforge.net/WimImage_plug-in.

[edit] W00T! 500 posts!

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 18th June 2014, 09:51   #10
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
Reread the documentation, and the wimgapi.dll file is only included in Windows 7 and later, so I uploaded a new version with the corrected readme file. I also corrected the wiki page.

For this reason, I'm moving away from using the windows provided API, and start using wimlib (http://wimlib.sf.net) to create .wim files. This also gives the opportunity to create a cross-platform tool for creating .wim files from the build script. Eventually the creation side will be removed from the plugin and made into a command-line tool which can be run with !system, !execute or !finalize, or a compiler plugin (if that ever happens ).

[edit] Also, the debug attachment above can be removed now as a proper release has been made.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile

Last edited by JasonFriday13; 18th June 2014 at 12:28.
JasonFriday13 is offline   Reply With Quote
Old 15th September 2014, 11:00   #11
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
I've made another update, details:

Removed msvcr*.dll dependency, strings are dynamically allocated now. Also added string length checks for folder and file paths.

Also, I've added an extra error code, so if you use the error codes in your installer, you'll have to check them against the list in the readme.

Also, I had to link the static crt runtime in order to get the 64 bit divide routine, no other functions in the crt are used. The plugin size didn't go up, so really it's a win-win.

Available at: http://nsis.sourceforge.net/WimImage_plug-in.

I will probably start working on using wimlib as the base of this plugin, and transition to a python/scons build chain. I'll probably split the creation and extraction parts up, and probably use a wrapper .exe around ImageX.exe to create the .wim files. They will be statically linked, so it would probably run on Windows XP without dramas. What a hill I have to climb!

[edit] Also, I noticed that the attachment earlier in this thread still hasn't been removed, can a mod remove it please?

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 2nd October 2014, 20:48   #12
gruntlord6
Junior Member
 
Join Date: Jul 2010
Posts: 14
This is really cool, good work!
gruntlord6 is offline   Reply With Quote
Old 3rd October 2014, 10:30   #13
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
Thanks for the feedback .

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 27th October 2014, 00:22   #14
meoit
Member
 
Join Date: Oct 2014
Location: $DESKTOP
Posts: 90
JasonFriday13 - cool man!. This Plugin is very useful for my Deploying Game.
meoit is offline   Reply With Quote
Old 27th October 2014, 07:18   #15
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
Thanks.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 13th January 2015, 16:14   #16
MaGoth
Junior Member
 
Join Date: Sep 2010
Posts: 21
Hi,
Is it possible to adapt this plugin WimImage, for version NSIS-2.46.5 Unicode?

Tnx..
MaGoth is offline   Reply With Quote
Old 14th January 2015, 08:33   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
Originally Posted by MaGoth View Post
Hi,
Is it possible to adapt this plugin WimImage, for version NSIS-2.46.5 Unicode?

Tnx..
What is wrong with the DLL in the zip file? Just copy it (x86-unicode) to your Plugins folder.

Stu
Afrow UK is offline   Reply With Quote
Old 16th January 2015, 22:52   #18
MaGoth
Junior Member
 
Join Date: Sep 2010
Posts: 21
Hi, Afrow UK
I am using WinXP, a this plug-in is designed for Win7 and above, judging from description.
MaGoth is offline   Reply With Quote
Old 16th January 2015, 23:08   #19
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,163
Quote:
Originally Posted by MaGoth View Post
I am using WinXP, a this plug-in is designed for Win7 and above, judging from description.
The WIM file format does not exist on XP, it was created for Vista IIRC but maybe the official API only exists on 7 and later?

The plugin would have to use http://sourceforge.net/projects/wimlib/ to support all versions of Windows...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th January 2015, 04:10   #20
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 881
Quote:
Originally Posted by MaGoth View Post
Hi, Afrow UK
I am using WinXP, a this plug-in is designed for Win7 and above, judging from description.
Correct. Vista didn't have the required dll shipped with the OS, but 7 does ship the required dll (wimgapi.dll). I don't know the terms of use for including wimgapi.dll in installers, but that is one way to get around it.

I main reason I wrote this plugin is because XP was declared End of Life in March/April 2014 and it's not longer supported. Windows 7 is the most used OS, recently passing 50% of all OS usage in the world.

Using wimlib has been on my todo list, but it's not a high priority, the reason is as stated above. I stopped using XP 64 bit just weeks after Win 7 was released.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump