[App] [Apr-26-09] WM6.5 Plug-in Installer

Search This thread

AppStar

Member
May 15, 2008
38
0
AppStar Titanium
Plug-in Installer

This program allows chome/titanium plug-in developers to create a cab file that will insert the plug-in's markup into the cpr files depending on the device's resolution and update the registry without overriding any of the user's existing chome/titanium configuration files or settings.

Device Requirements:
1. WM 6.5
2. .Net CF 2.0 or higher

Usage:
First things first, this is a developer only tool that has strict requirements to work properly. It requires a few files to be deployed and files like the plg files are case sensitive. ATPluginInstaller.exe and CESetupDLL.dll can be used for any free, not for profit, chome/Titanium plug-in.

Ok, now onto the fun stuff...

ATPluginInstaller.exe is the program where most of the magic happens. It does a few important things. First, it adds a plug-in name to the registry in "HKEY_LOCAL_MACHINE\Software\Microsoft\CHome:plugins" and also inserts the plug-in into the specified location in "HKEY_LOCAL_MACHINE\Software\Microsoft\CHome:ExtensibilityXML" and "DefaultXML". Then it clears all VALUES in "HKEY_LOCAL_MACHINE\Security\CHome\DefaultSettings" to prevent chome from reverting to an old layout. Finally it injects the appropriate markup for the device resolution into each of the Titanium CPR files.

For ATPluginInstaller.exe to know what plug-in and markup to use, it needs a PLG file. A PLG file is basically a pre-defined XML file that includes the name, position, and markup for the plug-in you want to install.

Begining of a sample PLG file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<plugin>
  <name>ATFavePeople</name>
  <position>2</position>
  <layouts>
    <layout screenWidth="240" screenHeight="320">
      <!-- ATFavePeople -->
      <Layer ID="ATFavePeopleExpanded" Visible="False" Width="240" Height="82" Clip="False">
        <Layer ID="Page" Clip="False">
          <!-- Icon on upper right -->
          <Image ID="Icon" Left="188" Top="-13" Width="43" Height="57" ScaleStyle="Stretch"/>
          <!-- Large picture in Center -->
          <Image ID="ContactPhoto" Left="10" Top="17" Width="43" Height="43" ScaleStyle="Fit" Clip="False">
            <Layer ID="Border2" Color="#FFFFFFFF" Left="-2" Top="-2" Width="90" Height="90" Visible="True"/>
          </Image>
(abbreviated to conserve space...)

The root node is "plugin". The three sub-nodes are "name", "position", and "layouts". All nodes must follow case to work with ATPluginInstaller.exe.

The "name" node contains the name of the plug-in you wish to install. It must match the name used in the plug-in markup.

The "position" node specifies where you want the plug-in to be displayed on chome. It is 0 based. Meaning the first spot is 0, the second spot is 1, and so on. If a number greater than the number of currently installed plug-ins is used, then the plug-in will be displayed at the bottom of chome.

The "layouts" node contains all the plug-in markup for the different device resolutions. Each resolution is defined by a "layout" sub-node with two attributes. The attributes are "screenWidth" and "screenHeight" which define what "layout" sub-node to use for each resolution. The "layout" sub-node contains the markup that will be injected into the CPR files. This markup is also case sensative and must follow the case that is used by Microsoft in the default CPR files or the sample attached PLG file.

To install a plug-in, simply call ATPluginInstaller.exe followed by the "-i" parameter and a space and then the PLG file name.
example: ATPluginInstaller.exe -i default.plg

ATPluginInstaller.exe is also uninstall friendly. Just replace "-i" with "-u".
example" ATPluginInstaller.exe -u default.plg

Well that's fine and dandy, but how the hell do I call ATPluginInstaller.exe from my CAB file? That's where a setup DLL comes into play. A setup DLL allows you to execute additional functions after a program is installed and before it is uninstalled. Working with setup DLLs are a pain in the butt because they don't support managed code, only C++. So I've attached CESetupDLL which is a setup dll that does two things:
1. It calls ATPluginInstaller.exe and installs, "-i", default.plg from the folder where the application is deployed to.
2. It calls CHomeRefresh.exe from the folder where the application is deployed to, to update Chome without performing a restart. (I didn't write CHomeRefresh and don't know who did but it works fairly well.)

CESetupDLL also works for CAB uninstall.

To include your CESetupDLL.dll in the INF file (file used to build installation CAB file) you have to add the following string to the [DefaultInstall] section:

CESetupDLL = "CESetupDLL.dll"

You can read more about setup.dlls here:
http://www.pocketpcdn.com/articles/setupdll.html
http://msdn.microsoft.com/en-us/library/aa924308.aspx

That's pretty much it! Remember to pay attention to case, and if you use my CESetupDLL.dll include ATPluginInstaller.exe, default.plg, and CHomeRefresh.exe to your program folder in your CAB.

Feel free to use ATPluginInstaller.exe and CESetupDLL.dll for any free, not for profit, chome/Titanium plug-in. Giving me some credit would be nice too. ;-)
 

Attachments

  • PluginInstaller.zip
    12.2 KB · Views: 4,742
Last edited:

showaco

Senior Member
Aug 10, 2007
1,774
2
Waco, TX
Cool, thanks for this.
Let me make sure of the default.plg file, if I want to include cpr installs for different resolutions, I just add all of them to that one file, correct? Just change the layout screenwidth,screenheight for each new cpr I need to write, for both portrait and landscape. So for vga only, I would have two layout sections, one with screenwidth=480, screenheight=640 and then another layout with screenwidth=640, screenheight=480? If a cpr doesn't exist on device, then it just skips that one and goes to next?

Just wanted to make sure I understood it correctly as I plan on updating titaniumweather this week and wanted to use this.
 

AppStar

Member
May 15, 2008
38
0
Cool, thanks for this.
Let me make sure of the default.plg file, if I want to include cpr installs for different resolutions, I just add all of them to that one file, correct? Just change the layout screenwidth,screenheight for each new cpr I need to write, for both portrait and landscape. So for vga only, I would have two layout sections, one with screenwidth=480, screenheight=640 and then another layout with screenwidth=640, screenheight=480? If a cpr doesn't exist on device, then it just skips that one and goes to next?

Just wanted to make sure I understood it correctly as I plan on updating titaniumweather this week and wanted to use this.

Yeah, that's pretty much it. All the different resolutions in one file. In your case you would just need two layout nodes for VGA, one for portrait and one for landscape.
 

showaco

Senior Member
Aug 10, 2007
1,774
2
Waco, TX
I'm working on getting next version of titaniumweather finished up and had a question/request. I noticed that your atplugin installer must be reading the defaultxml for plugin info before inserting and rewriting the default and extensibilityxml values. Is it possible to have it read the extensibilityxml for the info instead? A lot of people only update the extensibiliyxml when adding new panels since thats all that is necessary to show panels and with your current version all those panels are removed from extensibilityxml when atplugin installer runs. I can change it in chome editor to write to both locations, but still doesn't help out with someone that has made there own panels independently.

I've added option in weather to switch layouts using your atplugin app to change layouts for different style of weather icons, works very well to switch them out.
 

AppStar

Member
May 15, 2008
38
0
I just double checked and atplugininstaller reads from ExtensibilityXML first. It then injects the plugin name and updates ExtensibililtyXML and DefaultXML to the new value. I don't bother to read DefaultXML, I just override it since they both should be the same anyhow. I can change it to not override DefaultXML if users are having issues with it.

BTW, I'm glad to hear you got it working with additional layouts. I have the same feature in my latest Fave Contacts release. I was worried developers might have trouble because of case sensitivity. I use an XPath query and I'm not quite sure why the powers that be(W3C) decided XPath needs to be forced to case sensitive.
 

showaco

Senior Member
Aug 10, 2007
1,774
2
Waco, TX
I just double checked and atplugininstaller reads from ExtensibilityXML first. It then injects the plugin name and updates ExtensibililtyXML and DefaultXML to the new value. I don't bother to read DefaultXML, I just override it since they both should be the same anyhow. I can change it to not override DefaultXML if users are having issues with it.

BTW, I'm glad to hear you got it working with additional layouts. I have the same feature in my latest Fave Contacts release. I was worried developers might have trouble because of case sensitivity. I use an XPath query and I'm not quite sure why the powers that be(W3C) decided XPath needs to be forced to case sensitive.
huh, maybe just some weird issue I had going on then. After that first change up, everything after that didn't change my layout anymore. But I also updated chome editor to write to defaultxml too and reset my custom panels in after first change up, so maybe that fixed issue for me.:confused:
Yeah, got 4 or 5 different icon sets now, with different .plg files for each since most have different size icons and that was easiest way to have for future icon packs to be added without having to release new weather versions. Working on cab now, had trouble with install at first 'cause I was saving your ATPluginInstaller.exe to a subfolder under installation path, which is location I needed to work with my future addons. Got it sorted now(I think:)).
 

drkfngthdragnlrd

Retired Recognized Developer
Mar 27, 2008
2,424
271
47
Palmdale, CA
www.facebook.com
Is there a way to specify the CPR's to modify in the .plg file? I have made completely new CPR's for NeoTitanium. Instead of being Titanium_(Resolution).cpr, they are Neo_(Resolution).cpr, M2DNeo_(Resolution).cpr, & BWNeo_(Resolution).cpr. for the different themes. I did this so the user can swtich back and forth from NeoTitanium to Titanium (or the different themes) without uninstalling it.
 

AppStar

Member
May 15, 2008
38
0
Is there a way to specify the CPR's to modify in the .plg file? I have made completely new CPR's for NeoTitanium. Instead of being Titanium_(Resolution).cpr, they are Neo_(Resolution).cpr, M2DNeo_(Resolution).cpr, & BWNeo_(Resolution).cpr. for the different themes. I did this so the user can swtich back and forth from NeoTitanium to Titanium (or the different themes) without uninstalling it.

Hmmm... I was going to pull the CPR file name out of the registry, but decided against it because I didn't have any way of knowing that the PLG file was indeed targeted to that CPR anyhow. Adding a node to the PLG is a good idea. But we need to be very careful with distribution. If users got a hold of your PLGs and tried to use them with a Titanium layout they would not work.
 

Mnemonique

Senior Member
Jan 17, 2009
243
4
Cebu
Nice!

Very cool indeed.

Just the thing I'm looking for :).

Was currently busy with pre-define cpr file to append at the titanium_(resolution_here).cpr, this surely helps a lot in making that happened.

Thanks!!!!!
 
Last edited:

JukEboXAuDiO

Senior Member
Apr 9, 2008
786
1
I have a BIG question. In your ATFavePeople Cab you have a Setup.dll in the Main root of the cab but you don't talk about that. What is that Setup.dll for? I added the AtpluginInstaller, CESetupdll.dll, default.plg, and CHomeRefresh in the cab. Someone told the cab is unsuccessful when its installed and I can't quite figure out why.
 

AppStar

Member
May 15, 2008
38
0
I have a BIG question. In your ATFavePeople Cab you have a Setup.dll in the Main root of the cab but you don't talk about that. What is that Setup.dll for? I added the AtpluginInstaller, CESetupdll.dll, default.plg, and CHomeRefresh in the cab. Someone told the cab is unsuccessful when its installed and I can't quite figure out why.

I replied to your private message but i'll repost here incase others need the info.

Hmmm.. There are a couple things you need to check. Make sure the have the CESetupdll.dll configured properly in your INF file.

To include your CESetupDLL.dll in the INF file (file used to build installation CAB file) you have to add the following string to the [DefaultInstall] section:

CESetupDLL = "CESetupDLL.dll"

Also make sure your cab file is extracting all the files to the same folder.
 

AppStar

Member
May 15, 2008
38
0
Just a heads up... I'll be leaving for a business trip tomorrow and won't be back till Monday. I'll get to any questions and/or fixes when I get back. Thanks guys!
 

JukEboXAuDiO

Senior Member
Apr 9, 2008
786
1
SO what do I do about creating a setup.dll file when I don't have a program that can create .dll files.
 

drkfngthdragnlrd

Retired Recognized Developer
Mar 27, 2008
2,424
271
47
Palmdale, CA
www.facebook.com
Hmmm... I was going to pull the CPR file name out of the registry, but decided against it because I didn't have any way of knowing that the PLG file was indeed targeted to that CPR anyhow. Adding a node to the PLG is a good idea. But we need to be very careful with distribution. If users got a hold of your PLGs and tried to use them with a Titanium layout they would not work.

This is why I was wondering if there was a way to call out a specific cpr file name. That way if the cpr doesn't exist on the "machine", the plg does nothing. Also, in the future on release you'll see a lot more custom named cprs. HTC I know uses their own naming. My smart phone has like 5 different sets of cprs on it.
 

Genix9

Senior Member
Jan 12, 2009
71
0
Do you think there's a way to also include multiple plugins in the default.plg file?

I'm looking for a way to use the PluginInstaller to update existing .cpr default (Clock, Music, Photos, etc.) without messing up any additional/custom plugins people have put in.
 

twolf

Senior Member
Mar 5, 2006
2,675
8
LX
twolf.sytes.net
Finally was able to install a plugin made by this installer...
Almost all my *.cpr files were read-only, so the plugin wasnt able to save them and kept giving me the "AtpluginInstaller.exe" error.

Changed them to non read-only with Resco Explorer and all worked fine. :)
 

orlith

Senior Member
Sep 13, 2008
308
35
Paris
OPPO Find X5 Pro
Hi There.
don't know if I'm in the right topic if not I apologize.
I would like to know iif there is way to change the GUID of a "personnale" plugin. It seems that non standard plugin got the same guid, and on some case it makes trouble (I would like to put one of my personnal plugins by default when I press "hang" button).

Thanks