SCIF 1.1 : WAIK 3.0 Support

The Windows Automated Installation Kit (WAIK) is being revised to support Windows 7 / Windows Server 2008 R2 and will be known as WAIK 3.0. WAIK 3.0 contains the following changes from 2.x that affect the design or implementation of code within SCIF:
  • New Tool
    • DISM.exe - Deployment Image Servicing and Management tool
  • Deprecated tools – replaced by DISM and not included in WAIK 3.0:
    • PEImg.exe
    • PkgMgr.exe

In the previous version of the Framework, the PEImg.exe and ImageX.exe tools were called via command line to mount and modify boot images. With the introduction of WAIK 3.0 and the changing of these tools, a change is required in the SCIF code. Though ImageX.exe is still available in WAIK 3.0, the removal of PEImg.exe requires changes in the Integration Framework code. The primary change that will be made in the affected methods is to detect the WAIK version and then branch to the appropriate utility and command line string for each as needed.
Since DISM.exe has architecture-specific versions, some methods will be modified to allow specification of the CPU architecture to be used in the command line calling DISM.exe.

PrepWinPeImage will not have a WAIK3 equivalent since the functionality used in WAIK2 is no longer used in WAIK3. When called and the code determines WAIK3 is being used, the method will simply return to the caller with a “success” status.

ConfigMgr 2007 SP2 will require/install WAIK 3.0 in order to support Windows 7/Server 2008 R2 deployment, and a user that installs WAIK 3.0 must install ConfigMgr SP2, since ConfigMgr versions prior to SP2 do not work with WAIK 3.0. However, it is not this code’s responsibility to ensure that if WAIK 3.0 is installed that ConfigMgr SP2 is installed. The primary reason is that since most of the operations of this code happen behind the scenes, it is likely that any error generated would be inside a log file and not visible to the user. That said, since it is possible that a user could take a WinPE image containing Windows7 or Server 2008R2 and try to import it into a WAIK 2.x environment, the Windows version of WinPE in a WIM file will be checked if using WAIK 2.x, and if Windows 7 / or Server 2008 R2 is the version, it will return an error. WAIK3 is backward-compatible to Vista SP1 / WinPE 2.1 and Server 2003 R2, so it can be safely used for those images.

Aside from required changes to support WAIK 3.0, reviewing the code has shown that there are some duplicated methods and methods which should belong to other classes. In this revision, those changes will also be made. Those changes are noted in the code changes listed later in this document.

No additional feature support for DISM capabilities will be added to the SCIF 1.1 code. This release is primarily an update of features to support WAIK 3.0 changes. Any additional changes (such as support for different CPU architectures or image indexes) were implemented to aid the implementation of the WAIK 3.0 features. No additional feature changes will occur until SCIF 2.0.

There are no changes required to any of the XML or other code in InstallShield in order to support these WAIK 3.0 changes. However, additional options are available for the XML schema to take advantage of WAIK 3.0 functionality. Those are listed in the sections below.

Code Changes Made in SCIF:

Code changes specific to WAIK 3.0:

  • Modified installer schema (SampleInstallConfig.xsd) to add new enumerations for WinPE 3.0:
    • The WinPeVersions type allows specification of minimum WAIK version required for a boot image to be used for modification during the installation process.
<xs:simpleType name="WinPeVersions" >
   ...
      <xs:enumeration value="6.1.7000.0">
        <xs:annotation>
          <xs:documentation>WinPE version 3.0 (Windows 7)</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  • The WinPePackageNames type allows specification WinPE packages to be added to a boot image. The new enumerations cover packages now available in WAIK 3.0.
<xs:simpleType name="WinPePackageNames">
    <xs:restriction base="xs:string">
      ...
      <xs:enumeration value="WAIK30-winpe-legacysetup">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="WAIK30-winpe-pppoe">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="WAIK30-winpe-setup">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="WAIK30-winpe-setup-client">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="WAIK30-winpe-setup-server">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="WAIK30-winpe-wds-tools">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
</xs:simpleType>
  • Modify the PrepWinPeImage() method to “do nothing” if WAIK3 is being used. Ts is no longer used / needed by WAIK3. Any call to this with WAIK3 will always return success without doing anything.
  • Mify the following methods to use DISM command lines when WAIK 3.0 is used. Removes the static creation of the command line string and static strings used in the call to the RunCommandLine() method and instead uses string variables that are set based on the appropriate requirements of the WAIK version.
  • ImportDriversIntoWim
    • DISM.exe /image:<mount path> /Add-Driver /driver:<inf file> /index:<int> /ForceUnsigned
  • InstallPackageToWinPE
    • DISM.exe /image:<wim file> /Add-Package /PackagePath: “\<AIKDir>\Tools\PETools\<arch>\WinPE_OCs\<cabfile>”
    • Also checks to ensure WAIK3.0 package names are not being used in a prior WAIK version.
  • ChangeWinPeScratchSpace
    • DISM.exe /image:<wim file> /Set-ScratchSpace:<int>
  • Modified the following methods to allow for support of WIM architecture types other than “x86”:
    • IMPORTANT NOTE: Even though different architectures are supported, the version of tools that are run during the image creation/update process are in determined by the current host system architecture. In other words, if you are installing the integration on an x86 ConfigMgr server, it will use the x86 tools.
  • ChangeWinPeScratchSpace() – changed method signature to add archType parameter. Created a new default signature without the new parameter that calls the new signature with “x86” to provide backward compatibility.
  • ImportDriversIntoWim()– changed method signature to add archType parameter. Created a new default signature without the new parameter that calls the new signature with “x86” to provide backward compatibility.
  • Modified the XML schema to add an “Architecture” element to the boot image package properties. This allows specifying a particular architecture of an image within a WIM when creating a boot image and prevents accidental use of source WIM files of different architectures. If no architecture is specified in the XML, the code will attempt to parse the path to the source WIM file and if “x64” is in the path, “amd64” will be used. Otherwise, “x86” is used as the default.
<xs:complexType name="BootImagePackageProperties" mixed="true">
    <xs:choice maxOccurs="unbounded">
      <xs:group ref="PackagePropertiesValues" />
      <xs:element name="Architecture" type="ArchitectureTypes" maxOccurs="1"  />
...

  • XML would look like this:
<BootImagePackage Action="CreateFromExistingWim" ID="OEM_BOOT_IMAGE_X86">
<Architecture>x86</Architecture>
<ImageIndex>1</ImageIndex>
d.	Also changed the schema definition for the “x64” architecture type to “amd64” to correctly reflect the WAIK directory structure.
<xs:simpleType name="ArchitectureTypes">
    <xs:restriction base="xs:string" >
      <xs:enumeration value="x86" />
      <xs:enumeration value="ia64" />
      <xs:enumeration value="amd64" />
    </xs:restriction>
  </xs:simpleType>
  • Modified the following methods to support getting WIM information from WIM files containing multiple images, from the image index other than “1”. Changed method signature to add index parameter. Created a new method overload without the new parameter that calls the new menthod with “1” to provide backward compatibility.
    1. GetWimVersion()
    2. GetWimSystemRoot()
    3. importDriversIntoWim()
    4. MountWimFile()
    5. Modified the XML schema to add “ImageIndex” elements to the boot image package properties as well as the boot image import options. This allows specifying a particular index of an image within a WIM for both creation and copying from a source WIM (defaults to “1”):
<xs:complexType name="BootImagePackageProperties" mixed="true">
    ...
      <xs:element name="ImageIndex" type="xs:string" default="1" maxOccurs="1"/>
...
<xs:element name="ImportFromWaikOptions">
...
<xs:element name="ImageIndex" type="xs:string" default="1" maxOccurs="1"/>
  • XML would look like this:
<BootImagePackage Action="CreateFromExistingWim" ID="OEM_BOOT_IMAGE_X86">
<Architecture>x86</Architecture>
<ImageIndex>1</ImageIndex>

  • Added the following method related to WinPE Packages:
    • GetWaik3PackagePath(): takes the package name specified in the installer XML and finds the appropriate .CAB file to be added to WinPE. Checks the version of the Windows image in the WIM to prevent accidentally specifying WAIK 3.0-only packages for use with Windows versions prior to Win7 / WS2008 R2.

Moving / Consolidating WAIK-related code from OSD class to ObjectInstaller class:

These changes are to consolidate all references to these utility methods into the same class rather than have them scattered into separate classes (and some duplicated).
  1. Move OSD.GetWimInfo to ObjectInstaller.GetWimInfo
  2. Move OSD.GetWimVersion to ObjectInstaller.GetWimVersion
  3. Move OSD.GetWimSystemRoot to ObjectInstaller.GetWimSystemRoot
  4. Move OSD.ChangeWinPeScratchSpace to ObjectInstaller.ChangeWinPeScratchSpace
  5. Move OSD.PrepWinPeImage to ObjectInstaller.PrepWinPeImage
  6. Merge OSD.InstallPackageIntoWinPE into ObjectInstaller.InstallPackageIntoWinPe (currently duplicates code – OSD method was the only one used)
  7. Move OSD.UninstallPackageInfoWinPe to ObjectInstaller.UninstallWinPePackageFromWim
  8. Merge OSD.MountWimFile with ObjectInstaller.MountWimFile
  9. Merge OSD.UnmountWimFile with ObjectInstaller.UnmountWimFile
  10. Move OSD.ExportWimFile to ObjectInstaller.ExportWimFile
  11. Change all references to OSD methods to reference ObjectInstaller class
  12. Removed OSD.ImportPackageIntoWinPe (not used – only supported installing packages already imported)

Additional changes made to improve overall code

  1. Modified path string concatenation in multiple methods to use Path.Combine() to ensure valid path string (prevent accidental double-backslash in paths)
  2. All methods that call GetWaikPath() - Modified to remove additional checking for valid directory path as necessary and simply made the check within GetWaikPath. If any error occurs, a null string is returned to the calling method.
  3. Removed all redundant calls to UnMountWinFile() if an error occurred and simply put one call to UnMountWimFile() in parent methods.
  4. Added IsWaikArchStringValid() method - Ensures architecture string matches “x86”, “amd64” or “ia64”
  5. Added GetImagexPath() - Returns the path to the imagex.exe utility. Two method signatures. Default (no parameters) returns the x86 version. Specifying an architecture returns the utility for that architecture.
  6. Added GetDismPath() - Returns the path to the dism.exe utility. Two method signatures. Default (no parameters) returns the x86 version. Specifying an architecture returns the utility for that architecture.
  7. Added GetPeImgPath() - Returns the path to the peimg.exe utility. There are no alternate architecture versions.
  8. Added GetFileParentDirectory() to simplify setting the working directory in all command line execution of WinPE utilities.
  9. Combined CreateBootWimFromWaik() and CreateBootWimFromExistingWim() into CreateBootWim(). This removes a lot of duplicate code and simplifies the structure to reduce potential bugs. Using the old methods results in calling the new method with the appropriate parameters.
  10. Added GetWaikBootWim() to simplify finding the appropriate winpe.wim file within the WAIK based on architecture type.
  11. Added GetExistingBootWim() to simplify finding the appropriate boot image .wim file based on a path specified in the installer XML.
  12. Added DeleteWimFile() and modified MoveOldWimFile() to provide for removing the temp.wim files after they are no longer needed and for cleaning up old boot.wim files (will keep only one backup copy of the boot.wim instead of infinitely creating backups).


Last edited Aug 19, 2009 at 11:30 PM by rhearn, version 4

Comments

No comments yet.