Windows PE
Keywords: WinPe Windows PE WindowsPE Windows\PE Windows/PE Windows-PE WinPE BartPE 16 32 64 bit
Windows Preinstallation Environment is a minimal Win32 operating system with limited services, built on the Windows kernel.
WinPE Limitations:
- To reduce its size, Windows PE includes only a subset of the available Win32 APIs. I/O (disk and network) and core Win32
APIs are included, therefore some WinBatch functions may not execute properly.
- Windows PE x64 does not include Windows on Windows 64 (WOW64) subsystems. Therefore Winbatch cannot be installed to WinPE. Rather you must run compiled 64-bit exes
on Windows PE x64.
WinPE Notes:
WinBatch Notes:
- WinPE 2.0 seems to require WinBatch 2007A or newer.
- WinPE 3.0 seems to require WinBatch 2009C or newer.
- WinBatch (32-bit) will currently only run on 32 bit versions of WinPE. And 64-bit compiled WinBatch exes will only run on 64 bit versions of WinPE
REFERENCE:
Question:
Can the 32-bit version of WinBatch be run on the 64-bit version of Windows PE?
Answer:
Sorry no. Because Windows on Windows (WOW) is not supported, 16-bit applications won’t run in 32-bit versions of Windows PE, and 32-bit applications won’t run in 64-bit versions of Windows PE. You will need to compile your script using the 64-bit version of WinBatch.
You will need Winbatch 2011B or newer which supports 64-bit.
Question:
How can I determine which system dlls my compiled WinBatch exe requires in order to run?
Answer:
There is a tool called ‘Dependency Walker’ that could maybe provide further information about any dll issues on WinPE. For starters, go to
http://www.dependencywalker.com. Download the free software. Try including it in your WinPE build. Only necessary files are:
\DW\depends.dll
\DW\depends.exe
Once booted into WinPE run the following from the command line to test Dependency Walker:
"x:\Windows\System32\DW\depends.exe" /?
Once you have confirmed you can launch the Dependency Walker tool, lets try running your simple compiled script thru it. The command to profile the script would look something like this:
"x:\Windows\System32\DW\depends.exe" /pb /od:"dp_output.dwi" "x:\Windows\System32\WinBatch\smallWB.exe"
Notes:
/pb = Profiling option: Automatically begin profiling after the module has been loaded - This option requires that you specify a module to open. If an output option (/od, /ot, /of, or /oc) is specified, Dependency Walker will wait until the profiling fully completes before saving the results.
/od:{path} = Output file in Dependency Walker Image (DWI) format - This option requires that you specify a module or Dependency Walker Image (DWI) file to open. Once the module has been processed, the results will be written to the specified file in the Dependency Walker Image (DWI) format.
You could then inspect the resulting dp_output.dwi file inside Dependency Walker. Pay close attention to the system dlls that were unable to load.
WinPE 3.0 Notes
WinPE 3.0 seems to require WinBatch 2009C or newer. Make sure to install any of the Windows Shell components. WinBatch script depend on much of the functionality of the Windows Shell.
From WinBatch
- The compiled exe file (small version), WIL DLL (WBD__44i.dll) and any added WIL extender dlls.
From Windows ( determined using Dependency Walker)
- msvfw32.dll ( only required for WinBatch 2012A and older. For 2012B and newer it is only required if you want to display bitmaps in WinBatch Dialogs. )
- shdocvw.dll
- rstrtmgr.dll
- netplwiz.dll
- ndfapi.dll
- mmdevapi.dll
- efsadu.dll
- devmgr.dll
- cscapi.dll
- clbcatq.dll
- certenroll.dll
- apphelp.dll
User Shared Details about WinPE 3.0
Here are the things I did using WinBatch 2012C (not all of which were necessarily required; some things may have been unnecessary but as I now have a working WinPE 3.0 .iso image that I can burn onto 2GB USB thumb drives):
- I took a 32-bit Windows 7 system, to use as my base platform, downloaded (from Microsoft, at http://www.microsoft.com/en-us/download/details.aspx?id=5753) the Windows 7 AIK (Automated Installation Kit), burned the AIK .iso file to a DVD, and then installed the AIK from the DVD I had just created.
- I went to the Start Menu -> Programs -> Windows AIK, right-clicked on Windows PE Tools Command Prompt and clicked Run as Administrator from the context menu.
- From that command prompt (you must use this tools command prompt because it changes a number of settings, including the PATH environment variable) I did the following:
copype.cmd x86 c:\winpe_x86
- When that finished, I then ran the following command (from the same command prompt):
imagex /mountrw c:\winpe_x86\winpe.wim 1 c:\winpe_x86\mount (Note: Most anti-virus packages interfere with your ability to mount the WinPE image, so you must first disable your anti-virus prior to attempting to use the imagex command)
- Once the image was successfully mounted, I copied all the .ttf versions of the font files you mentioned (except Marlett, which comes with WinPE by default) from a the C:\Windows\Fonts directory to the C:\Winpe_x86\mount\Windows\Fonts directory and to the C:\Winpe_x86\mount\Windows\System32 directory. Those .ttf fonts were all variations of Arial, Courier, and Times New Roman.
- Then I copied the following Microsoft Windows 7 .dll files from the C:\Windows\System32 directory to the C:\Winpe_x86\mount\Windows\System32 directory:
msvfw32.dll ( only required for WinBatch 2012A and older. For 2012B and newer it is only required if you want to display bitmaps in WinBatch Dialogs. )
compobj.dll
shdocvw.dll
rstrtmgr.dll
netplwiz.dll
ndfapi.dll
mmdevapi.dll
efsadu.dll
devmgr.dll
cscapi.dll
clbcatq.dll
certenroll.dll
apphelp.dll
ieframe.dll
oledlg.dll
puiapi.dll
vaultcli.dll
wdi.dll
- Then I copied all of the Winbatch (including Winbatch extenders) .dll files from their location to the C:\Winpe_x86\mount\Windows\System32 directory.
- Then I compiled my Winbatch .wbt script file into a compiled Winbatch .exe executable file, in the following way: Small .EXE for networked computers. I checkmarked the “Signing” checkbox but for the elevation setting I set that to “No UAC Info.”
I should have been able to just leave the checkbox unchecked and it should have had the same affect……but I could not get my program to run (under WinPE) when compiled this way.
I had to checkmark the checkbox and then set the elevation setting to “No UAC Info.”
- Then I ran the SignCode.wbt script to sign my compiled executable program (I’ve modified this script slightly to make signing my compiled programs a little easier).
- I then copied my compiled Winbatch program to the C:\Winpe_x86\mount\Windows\System32 directory.
- Then from a Windows PE Tools Command Prompt, run the following command:
dism /image:C:\winpe_x86\mount\ /Set-ScratchSpace:512
- I then ran the following command from the Windows PE Tools Command Prompt:
imagex /unmount c:\winpe_x86\mount /commit (Note: Make certain that you do not have a command prompt window open and are not in the c:\winpe_x86\mount (or below, such as c:\winpe_x86\mount\Windows) directory or that you have the Windows Explorer open and are in the c:\winpe_x86\mount (or below) directory, as this will cause the unmount to fail. You must not be in the c:\winpe_x86\mount directory structure when you run the unmount command or the unmount command will fail)
- At this point, you should now have a good WinPE 3.0 boot image file. The next step is to execute the following command from a Windows PE Tools Command Prompt (use a Windows PE Tools Command Prompt to ensure that your command prompt window has the proper privileges):
copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim
- Then obtain a 2GB USB thumb drive (a 1GB would also probably still be large enough but 2GB thumb drives are so cheap, why bother) and plug it into the computer.
- Run an ordinary command prompt window by doing a Run as Administrator, so that the command prompt runs with elevated privileges.
- From that command prompt, do the following:
diskpart
list disk
From the disk list, determine which numbered disk is your USB thumb drive (for this example, we will assume that it is disk 1) and do:
select disk 1
clean
create partition primary
select partition 1
active
format quick fs=fat32
assign (make a note of the drive letter that gets assigned to the USB drive; for this example, we’ll assume drive letter F:)
exit
- Then from a Windows PE Tools Command Prompt, run the following command (this example uses the F: drive as the target drive designation, based on the assumption from the previous step):
xcopy c:\winpe_x86\iso\*.* /s /e /f f:
It this point, you should have a bootable USB thumb drive that boots WinPE 3.0 which has a copy of your program on it and your program should run under WinPE (just make sure that your program runs successfully on a regular Windows 7 (or XP) computer
before you try running it under WinPE).
WinPE 1.0 / 2.0 Notes
Question:
WinPE 2.0 components required to be on a Windows PE CD-ROM so that WinBatch can run:
In addition to the usual grouping of files on the CD-ROM, we have found that for WinBatch to run properly you need
From WinBatch
- The compiled exe file (small version), WIL DLL (WBD__44i.dll) and any added WIL extender dlls.
From Windows
- One additonal Dll (from Windows) msvfw32.dll
- The four fonts : Arial, Courier, Marlett and Times Roman
- There are rumors that the compobj.dll may also be needed.
Article ID: W15548
File Created: 2014:08:06:14:07:44
Last Updated: 2014:08:06:14:07:44