Site Header
How to Create Your Own Simple Plugins in Bart-PE

How to Create Your Own Plugins for Bart-PE

OK. First things first. Why do you need to create a plugin?
There are literally thousands of plugins readily available for apps and utils, all you need to do is Google. If the plugin you need is not already out there, is there a reason for this? Perhaps it has been tried and simply will not work. e.g. Sysinternals RootKit Revealer.
Have a trawl through some of the PE-Builder forums to see if there is a discussion relating to the plugin you need, stating why it won’t work. If after all that you can’t find anything, then you may be the first to need a plugin for a particular application or utility.

Plugin Components

To create a simple plugin you will need the following:

  1. A folder to hold the plugin withing the %PE-Builder%\plugin folder.
  2. A folder within %PE-Builder%\plugin\my-plugin to hold the required files.
  3. A ‘my-plugin.inf’ file to tell PE-Builder what to do with the files.
  4. A ‘my-plugin.htm’ file to tell others how to use your plugin. (optional)
  5. A’my-plugin_nu2menu.xml if you want to place an entry on the nu2 menu. (optional)

Example

For this example we will create a plugin for Net Statistics, a fairly simple freeware utility for reporting the volume of traffic on your network adapters. Please remember to make a donation to any freeware authors if you intend using their software regularly.

Plugin folder

In Windows Explorer go to your %PE-Builder%\plugin folder and create a folder named net-stats Inside the net-stats folder create a folder named files.
Download Net Statistics from SourceForge.net
Extract the .exe installer from the downloaded .zip file and install on your system.
Copy the files netstats.exe, NetStats.hdb, and General Public License.rtf to your ‘%PE-Builder%\plugin\net-stats\files’ folder.
Create a new text document named net-stats.inf in your ‘%PE-Builder%\plugin\net-stats’ folder.
Create a new text document named net-stats.htm in your ‘%PE-Builder%\plugin\net-stats’ folder.
Create a new text document named net-stats_nu2menu.xml in your ‘%PE-Builder%\plugin\net-stats’ folder.

my-plugin.inf

This is quite a simple plugin, and requires no registry settings. The .inf file must be an ascii file, not unicode, and should take the format as shown below. Any text you wish to add as comments should begin with a semi-colon.

;net-stats.inf
; PE Builder v3 plug-in INF file
; Created by Bart Lagerweij - - http://www.nu2.nu/pebuilder/
;
;Put your own name in this section for people to wow over
;
; Put a description of what the plugin does in here...  

[Version]
Signature= "$Windows NT$"  

[PEBuilder]
Name="DisplayNameOfPlugin"
Enable=0 ;The default is 0, which is disabled.
Help="help.htm"

;Tell PE-Builder the name of the folder to create for your ;application
[WinntDirectories]
a="Programs\plugin-name",2  

;Tell PE-Builder the name of the folder to get the ;files from for your application [SourceDisksFiles]
files\file1=a,,1
files\file2=a,,1

;Tell PE-Builder to append your menu entries to nu2menu.xml
[Append]
nu2menu.xml, net-stats_nu2menu.xml  

;When using the Sherpya XPE shell, you may need to add some start menu shortcuts here.
[Software.Addreg]
; Shortcut(s) for Net Statistics 0x2, "Sherpya\XPEinit\Programs", "Net Statistics\Net Statistics", "%SystemDrive%\Programs\net-stats\netstats.exe||%SystemDrive%\Programs\net-stats\netstats.exe"

Folders within the Windows/Bart-PE environment all have index numbers. If you need to place a file in a particular location, you can find the folder index numbers here.

My-plugin_nu2menu.xml

You will want to add your plugin to the nu2 start menu if you don’t plan to use xpe as your shell. The menu parses an xml file and adds the entries to the nu2 menu.

<!-- Nu2Menu entry for Net Statistics -->

<NU2MENU>

<MENU ID="Programs">

<MITEM TYPE="POPUP" DISABLED="@Not(@FileExists(@GetProgramDrive()\Programs\net-stats\*.*))" MENUID="Net Statistics">Net Statistics</MITEM>

</MENU>

 

<MENU ID="Net Statistics">

<MITEM TYPE="ITEM" DISABLED="@Not(@FileExists(@GetProgramDrive()\Programs\net-stats\netstats.exe))" CMD="RUN" FUNC="@GetProgramDrive()\Programs\net-stats\netstats.exe">Net Statistics</MITEM>

</MENU>

</NU2MENU>

I don’t believe in re-inventing the wheel.
The easiest way to get the hang of these files is to open some of the ready made plugin files and see what they are doing, then edit an existing file to suit your plugin.
Don’t forget to save the edited file in your plugin folder, not the one you found it in.

my-plugin.htm

A basic plugin like this will not need too much by way of instructions , but you want people to know where to get the source files, and what to do with them. If you already know some html, then you will find this section easy enough. If you don’t already know html, then all you need to do is open the help file in notepad, and see how simple this is.

<html>
<head>
<title>Tom's Net Statistics Plugin</title>
</head>
<body>
<i>PE Builder v3 plugin</i>
<hr>
<h1>Net Statistics</h1>
<a href="http://netstats.sourceforge.net/">Net Statistics</a> is a free network monitoring tool.</a><br>
Download <a target="_blank" href="https://sourceforge.net/project/showfiles.php?group_id=94930">Net Statistics</a>.<br>
Download the <a target="_blank" href="http://www.tomspeirs.co.uk/stuff/net-stats.cab">plugin</a> <br>
<p>Copy the following files into the <tt>plugin\net-stats\files</tt> directory:<br>
netstats.exe, netstats.hdb, General Public License.rtf <br> </p> <hr>
<i>PE Builder Copyright (c) 2002-2003 Bart Lagerweij. All rights reserved.<br>
Plugin by Tom Speirs ©MMVI
<a href="http://www.tomspeirs.co.uk">http://www.tomspeirs.co.uk</a></i>,
</body>
</html>

That’s all there is to creating a simple plugin. Further details can be found here.
Download the finished plugin, and see how it looks.

Valid HTML 4.01 Transitional Valid CSS!

Any donations gratefully accepted
 
 

Creative Commons License

Original photography appearing on this site is licensed under a Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England & Wales License.

This page has had


hits since February 21st 2006
 
 
Get Firefox!
 
 
Site Born on: February 21st 2006