1. Introduction.
This Tutorial is intended to help you to create PE Builder Plugins. I don't consider it as an Stand-alone tutorial, but as an adition to Bart PE Builder Help file. So, I will not explain things that are already explained by Bart. Read his Help first.
2. What you need.
- An Fresh Windows XP instalation, or an instalation on wich you have never instaled the program for wich you want to make an plugin.
- An Software wich could make an snapshoot of your sistem, before and after installing the program for wich you want to make an plugin. Personnaly, I use the free OnDemand WinINSTALL LE 2003, so I will use it for this Tutorial.
- An Tool to convert .reg files in .inf files, such as PEReg.
- Notepad ( Wordpad for bigger files ).
- The program for wich you want to make the Plugin.
- Of course, Bart's PE Builder, latest version.
3. Starting.
Download and install WinINSTALL LE 2003. Read carefully the Help. This software is designed to create MSI packages. We, will use the wizard to make an snapshoot before installing the program for wich you want to make the plugin, as in the image:
Now follow the Wizard instructions. I will not exemplifier here how it works. Just read carefully the program help. At the end of the "before" snapshoot, it will ask you the path to the program you want to install, then it will run the installer. When ended, run the installed program and check the settings ( the configuration ) you want to use for it.
If the program has as an option to save the settings in the registry or in an .ini file, you should choose the Registry. Now close the program and start again WinINSTALL LE 2003. Run the Wizard an second time and it will ask you to perform the "After" snapshoot or to "Abort". Perform the "After" snapshoot.
At the end, you can exit WinINSTALL. In the folder you have selected at the beginning, you will find the resulting files and folders ( the differences between the two images - practically the changes makes by the installation of the new program ).
As an example, for OpenOffice it will look like this:
We are interested only to see wich files are copied and in wich folders, and also the registry entries.
The .msi and .nai files could be deleted.
Note: The WINDOWS folder could missing if the program don't copies files here. Also, the "Documents and Settings" folder could appear ( you can delete him ) if the program copies some files in. Also, take care because sometimes, some files could be "hidden", or there could be some interferences with other programs wich runs at the install moment, such antivirus, who will copy also some log or dat files.
Because is more easy, I make an "files" folder in the plugin directory where I copy the program files, and the .inf file will instruct PE Builder to copy all the content. instead to give instruction for copy each file one after an other. There is no need to copy also uninstall files.
For the files wich are installed in other folders than the program one, such as "system32" or "fonts", it may be usewfull to create an command line to grab and copy them in an separate plugin folder. For example, in my OpenOffice Plugin, I've made an command line to grab the OpenOfice fonts and put them in an "fonts" folder:
@echo off
md Fonts
copy %SystemRoot%\Fonts\opens___.ttf Fonts\
copy %SystemRoot%\Fonts\VeraBd.ttf Fonts\
copy %SystemRoot%\Fonts\VeraBI.ttf Fonts\
copy %SystemRoot%\Fonts\VeraIt.ttf Fonts\
copy %SystemRoot%\Fonts\VeraMoBd.ttf Fonts\
copy %SystemRoot%\Fonts\VeraMoBI.ttf Fonts\
copy %SystemRoot%\Fonts\VeraMoIt.ttf Fonts\
copy %SystemRoot%\Fonts\VeraMono.ttf Fonts\
copy %SystemRoot%\Fonts\VeraSe.ttf Fonts\
copy %SystemRoot%\Fonts\VeraSeBd.ttf Fonts\
What it means ?
The
"@echo" - on or off - display information or execute command. If "@echo" is on ( @echo ), the information written after him on same line will be displayed in the Command window. If "@echo" is off ( @echo off ), the information written after him will be executed.
The
"md Fonts" command will create an Folder called "Fonts" (
make
directory ).
The
"copy %SystemRoot%\Fonts\opens___.ttf Fonts\" will copy the font file
opens___.ttf from the Windows Fonts (
%SystemRoot%\Fonts ) to the new created "Fonts" folder.
It's quite simple, considering the relative path instead the program path. Because this is needed also for the .inf files, you should consider this:
C:\ is usually
%SystemDrive% - The partition where resides your operating sistem.
C:\Windows\ is
%SystemRoot% - The "Windows" folder.
Note: Command lines are very importans, as you can use them to create "autorun" files wich could start services or programs, create folders in Ramdrive and copy files from CD to Ramdrive. For more examples, check the .cmd files in the Bart PE Builder Plugins folder.
4. Creating the .inf file.
Now, you can convert the .reg file in .inf file using PEReg.
The resulting file will be use to create the PE Builder .inf file.
Use Bart "pluginhelp" included in the PE Builder/doc/ to see how to create the headers for the .inf file, and to make the list of the files to be copied ( using the created folders ). You must check also
WinPe Folders Numbering For .inf Files. Also change the program path using relative path. Example:
0x1, "Classes\.rar\ShellNew", "FileName", "@ProgFiles\WinRAR\rarnew.dat"
Must be changed in:
0x1, "Classes\.rar\ShellNew", "FileName", "%SystemDrive%\Programs\WinRAR\rarnew.dat"
Note that sometimes "@ProgFiles" is replaced by "C:\Program Files". You should make the same change.
You may found also "@WinVol" mentioned in some lines. This is usually "C:\" or the partition where resides your operating sistem, and you may replace it with "%SystemDrive%".
In most cases that's it. But for some complicated programs, such as OpenOffice, or if you need file associations, you must make also some changes to the .inf file.
First, open again the .inf file and check to see if there are any lines entries wich begins with "0x3". PE Builder will recognize this entries only if there are binary entries. So, you should Delete ALL the lines entries wich begins with "0x3" and have not binary entries, or you will receive errors when creating the Build.
You may found in the .inf file also some entries containing "MRU" ( Most Recent Used ) data, such "LastVisitedMRU" or "OpenSaveMRU". You can delete those lines.
For file associations you must make also some changes. Example:
0x1, "Classes\WinRAR.ZIP\shell\open\command", "", "\"@ProgFiles\WinRAR\WinRAR.exe\" \"%1\""
Must be changed in:
0x2, "Classes\WinRAR.ZIP\shell\open\command",,"""%SystemDrive%\Programs\WinRAR\WinRAR.exe"" ""%1"""
Also some lines could contains switches ( -n, -o, -p, -pt ). This is the case with OpenOffice. You may find something like this:
0x1, "Classes\soffice.StarDrawDocument.5\shell\new\command", "", "\"%SystemDrive%\Programs\OpenOffice\program\soffice.exe\" -n \"%1\""
0x1, "Classes\soffice.StarDrawDocument.5\shell\open\command", "", "\"%SystemDrive%\Programs\OpenOffice\program\soffice.exe\" -o \"%1\""
0x1, "Classes\soffice.StarDrawDocument.5\shell\print\command", "", "\"%SystemDrive%\Programs\OpenOffice\program\soffice.exe\" -p \"%1\""
0x1, "Classes\soffice.StarDrawDocument.5\shell\printto\command", "", "\"%SystemDrive%\Programs\OpenOffice\program\soffice.exe\" -pt \"%2\" \"%1\""
You muste change to:
0x2, "Classes\soffice.StarCalcDocument.5\shell\new\command","",
"""%SystemDrive%\Programs\OpenOffice\program\soffice.exe"" /n ""%1"""
0x2, "Classes\soffice.StarCalcDocument.5\shell\open\command","",
"""%SystemDrive%\Programs\OpenOffice\program\soffice.exe"" /o ""%1"""
0x2, "Classes\soffice.StarCalcDocument.5\shell\print\command","",
"""%SystemDrive%\Programs\OpenOffice\program\soffice.exe"" /p ""%1"""
0x2, "Classes\soffice.StarCalcDocument.5\shell\printto\command","",
"""%SystemDrive%\Programs\OpenOffice\program\soffice.exe"" /p /t ""%2"" ""%1"""
5. Using Sherpya's XPE.
If you want to use the Windows XP shell, you should consider to use Sherpya's XPE Plugin. It's enough to add the following to your .inf file to have an shortcut in the Start Menu/Programs:
[Software.AddReg]
0x2,"Sherpya\XPEinit\Programs","OpenOffice","%SystemDrive%\Programs\OpenOffice\program\soffice.exe"
Of course, you must use the path for your plugin, this is just an example. Consider also to read the XPE plugin help.
6. Dll's Registration.
Some programs, or explorer plugins, must need to register some dll's in order to work. There are 2 way to do this. One by using an .cmd file, as explained in PEBuilder, and an other to use RunOnceEx. An advantage, is that using XPE, some dll requires to be registered AFTER the explorer starts, and RunOnceEx could do this. An example for the Google Toolbar:
[Software.AddReg]
0x1,"Microsoft\Windows\CurrentVersion\RunOnceEx\505","019","GoogleToolbar1.dll|DllRegisterServer"
Note:
; post dll registration - just before explorer starts
; 501-600 Always post registration
; 601+ Only Standalone (if you use xpe from nu2menu startup group, this will not be executed)
Take care to not use values wich are used by other plugins !
Note: All the dll's you want to register must be placed in /system32/ directory, or the RunOnceEx will not find them !
In this case you must change some entries in the .inf file. This is also the case of the Google Toolbar. Initially it is installed in the "Program Files". So, the entries in the .inf file have the following path:
0x1, "Classes\CLSID\{2318C2B1-4965-11d4-9B18-009027A5CD4F}\InprocServer32", "", "c:\program files\google\googletoolbar1.dll"
Because of the dll registration, we need to put the file in the /sistem32/ folder and change the path in the .inf:
0x1, "Classes\CLSID\{2318C2B1-4965-11d4-9B18-009027A5CD4F}\InprocServer32", "", "%SystemRoot%\System32\googletoolbar1.dll"
7. Conclusion.
This is just an brief Tutorial to make complex Plugins. It's not needed to use it with simple plugins, like an unique executable wich use an .ini file for saving settings. Personally, I've used this manner to make Plugins only for OpenOffice and WinRAR. All the rest were made manually. Also it's possible to meet problems wich are not explained there. All sugestions are welcome. I will be glad if you can mail me what you have discovered, to add in this Tutorial.
As an advice, before post an Plugin on the Net, try it as much as possible. It could work for you, but not for the others...
8. Usewfull Links.
- CD Forum - The biggest CD Forum for Rescue Bootable CD's. Bart's PE Builder included.
- PE Builder - Bart's PE Builder home page.
- Sherpya - XPE Plugin, AutoramResizer, Java, Mozilla Firebird...
- Paraglider - You will need his plugins...
- Reatogo - Plugin Repository, also offer some Automation Tools...
- XPE.Collewijn.Info - How to make your Bootable XPE CD using Bart's PE Builder.
- PluginBuilder - May be you will find this usewfull...
Version 1.0