Registry Integration


Windows uses a database called the Registry to maintain system information about users, hardware, and installed software.

NOTE

Registry use and the <cfregistry> tag are supported only on the Windows platform.


The Registry stores information through a hierarchy of keys and values:

  • Keys can contain values or other keys.

  • A key and any keys or values below it are known as a Registry branch.

  • Values are split into two components: the value name and the value data.

CAUTION

The Registry contains system-critical information. Editing the Registry incorrectly may severely damage your system. At the very least, you should back up the Registry data on the server before tinkering. For obvious reasons, you can restrict developer access to <cfregistry> through ColdFusion Administrator.


You can use <cfregistry> to query the Registry; it returns a standard query object of keys and values. Use the action attribute with get to retrieve one entry or with getall, as shown here, to retrieve multiple keys and values from the Registry:

 <!--- Grabbing data from the Registry ---> <cfregistry action="GetAll"             branch="HKEY_LOCAL_MACHINE\Software\Macromedia"             type="Any"             name="reg"> <table border="1"> <tr>  <th>Entry</th>  <th>Type</th>  <th>Value</th> </tr> <cfoutput query="reg"> <tr>  <td>#Entry#</td>  <td>#Type#</td>  <td>#Value#</td> </tr> </cfoutput> </table> 

TIP

In the <cfregistry> result set, if #Type# is a key, then #Value# is an empty string. When you specify TYPE="Any", GetAll returns any binary Registry values. However, the binary value's #Type# variable contains unsupported, and #Value# is blank.


The <cfregistry> tag allows you to add, edit, and delete Registry values. You can use the set action to add or update Registry keys and value data. <cfregistry> simply creates the key or value if it does not already exist. You need to specify attributes for branch, the entry to set, the value's type of data, and the value data itself. You can also use <cfregistry> with the delete action to delete Registry keys and values.



Macromedia ColdFusion MX 7 Certified Developer Study Guide
Macromedia ColdFusion MX 7 Certified Developer Study Guide
ISBN: 0321330110
EAN: 2147483647
Year: 2004
Pages: 389
Authors: Ben Forta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net