Modifying Component Resources in XPECMD

Since the release of Feature Pack 2007, we've gotten a few questions about how to modify component resources and properties in XPECMD. There is already some documentation available in the XPeHelp.chm that describes how to work with properties (such as the username property of a User Account instance). Working with component Resources is just as important in many cases, and you can work with them in almost the same way you work with Properties.

Properties and Resources are both collections of data objects that a Component or Instance object owns. As such, you just use VBScript syntax to access them, like you would any other collection. For example, let's say you want to manually disable the FBA/DLL COM Registration resource in Enhanced Write Filter (doing this would prevent EWF from creating its specialized volume in a DISK or RAM configuration). Here's how you do it:


 xpecmd> new cfg config<br>Starting configuration activation at: 11/30/2006 10:32:42 AM...<br>Info      100: Initializing new configuration<br>Info      102: Adding base system component to configuration<br>Info      101: Initializing new component: "Base Component [Version 5.1.2600, R2010]"<br>CFDB: 0.75 secs, 14 reqs. LAB: 0.31 secs, 12 reqs, 8% hits, 2 entries<br>Activation complete, elapsed time: 0.84 seconds<br>No errors or warnings<br>xpecmd> new myInst = 'inst:enhanced write fitler'<br>xpecmd> add cfg myInst<br>xpecmd> show myInst.Resources<br>Resources: [23 items]<br>-----  ------------<br>Index: Value<br>-----  ------------<br>    2: FBRegDLL(819):"%11%\ewfdll.dll","ConfigureEwf"<br>    5: File(819):"%11%","ewfdll.dll"<br>    6: File(819):"%11%","ewfinit.dll"<br>   15: File(819):"%12%","ewf.sys"<br>    1: File(819):"%17%","ewf.inf"<br>   16: File(819):"%24%","HORM.DAT" (DISABLED)<br>   23: RawDep(819):"File","ADVAPI32.dll"<br>   18: RawDep(819):"File","certclas.inf"<br>  ...

In this example, the FBA DLL/COM Registration is the "FBRegDLL(819)" entry at the top of the list, and its index in the Resources list is 2. You can disable this resource with the following command:


 xpecmd> myInst.Resources(2).Disabled = TRUE

Now if you SHOW the resources of myInst again, you'll see the word "(DISABLED)" next to the FBRegDLL entry.

By the way: The FP2007 version of EWF includes built-in support for RAM (Reg) mode, which automatically takes care of disabling the FBA DLL/COM Registration resource for you when you build your runtime. I used this component as an example because people who have used RAM (Reg) mode in SP2 and below are already familiar with going through this process in Target Designer.

Keep in mind that individual resources in a component Instance are not always listed in the same order each time they're loaded into memory. For instance, when I saved the configuration I created in my steps above, then reloaded it, the FBRegDLL entry had moved to index 14. Because of the way Resources are defined, you can't refer to an individual Resource by DisplayName like you can with Properties. As a result, there isn't really any good way to automate this process right now. We will continue to look into ways to improve these processes in the future, however.

- Matt