WimCaptEx

WimCaptEx is part of the nativeEx_Win7 project.

In the script !ManageWims.script, WimCaptEx handles processing of *.wim files without having a WAIK installed.

The script delivers WimCaptEx_x86.exe or WimCaptEx_64.exe (depending on your host OS) as WimCaptEx.exe to the %Tools% directory.
Then it extracts and installs from the Win7 source CD:
Syntax:
  1. Mount a *.wim
    WimCaptEx -A:M -W:<complete path to the *.wim> -D:<directory where to mount> -I:<image index>

  2. "Intelligent" mount a *.wim (see below)
    WimCaptEx -A:I -W:<complete path to the *.wim> -D:<directory where to mount> -I:<image index>

  3. Remount a *.wim
    WimCaptEx -A:R -D:<remountable directory>

  4. Unmount the mounted directory saving changes
    WimCaptEx -A:U -D:<mounted directory> -W:<complete path to the *.wim> -I:<image index>

  5. Unmount the mounted directory discarding changes
    WimCaptEx -A:UD -D:<mounted directory> -W:<complete path to the *.wim> -I:<image index>

  6. Capture a directory into a *.wim
    WimCaptEx -A:C  -D:<directory to capture> -W:<complete path to target *.wim> -C:<compression>
    <compression>:
    This function always creates a new *.wim, deleting an eventually existing one, and writes to image index 1.
    The image is declarted as 'boot' image.

  7. Apply (unpack) a *.wim into a directory
    WimCaptEx -A:A -W:<complete path to the *.wim> -D:<directory where to mount> -I:<image index>

  8. Get the status as exitcode of WimCaptEx (See below)
    WimCaptEx -A:S -W:<complete path to the *.wim> -D:<directory where mounted> -I:<image index>

  9. Show progress:
    All command lines can have an optional switch -P
    That shows periods written into the console window.
    Remark: When mounting, for some time (depending on the size of the *.wim upto 1 minute) no periods appear. That is caused by windows internal functionality that for this time the callback function is not called. That is no bug of WimCaptEx and cannot be handled.

  10. Create directories:
    All command lines can have an optional switch -Q
    Directories are created silently, if they do not exist and are needed for capturing into a *.wim or mounting or applying an image into the directory.
Intelligent mount:
WimCaptEx performs a mount depending on current conditions:
When the WIM / image is already mounted, do nothing.
When the WIM / image is remountable, do a remount.
When the mount directory already is the mount of a different WIM / image, unmount the current image, then mount the new one.
If none of the previous conditions matched, do a fresh mount.


Status code:
The exitcode of WimCaptEx started with the -A:S action switch is one or a combination of the following flags:
WIM_MOUNT_FLAG_MOUNTED            = $00000001;
WIM_MOUNT_FLAG_MOUNTING           = $00000002;
WIM_MOUNT_FLAG_REMOUNTABLE        = $00000004;
WIM_MOUNT_FLAG_INVALID            = $00000008;
WIM_MOUNT_FLAG_NO_WIM             = $00000010;
WIM_MOUNT_FLAG_NO_MOUNTDIR        = $00000020;
WIM_MOUNT_FLAG_MOUNTDIR_REPLACED  = $00000040;
WIM_MOUNT_FLAG_READWRITE          = $00000100;


Error handling:

If an error occurred, the exit code of WimCapEx is different from zero:

 0: OK
 1: Error registering callback function
 2: Error creating WIM file
 3: Error capturing image
 4: Error setting boot image index
 5: Error retreiving temp path
 6: Error mounting image
 7: Error unmounting image
 8: Wimgapi.dll, wimserv.exe and / or wimmount.sys not found
 9: Path already mounted
10: Error applying image
11: Error loading image
12: Error retreiving status
13: Error freeing orphaned image

If the console window is visible, the error is shown there, including the description of the internal Windows error.
When the -P option is set, the console window remains open until you hit the 'Enter' key.


Manual installation of necessary files:
(check path names!)


 2009-NOV-22, psc