Registry plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(PFx: Added usage from readme)
Line 38: Line 38:
*Converts string to hex values
*Converts string to hex values
*Converts hex values to string
*Converts hex values to string
== Usage ==
=== Open for search ===
<highlight-nsis>
${registry::Open} "[fullpath]" "[Options]" $var
</highlight-nsis>
=== Find first and next (call one or more times) ===
<highlight-nsis>
${registry::Find} "[handle]" $var1 $var2 $var3 $var4
</highlight-nsis>
=== Close search (free memory) ===
<highlight-nsis>
${registry::Close} "[handle]"
</highlight-nsis>
=== KeyExists (check is registry key exists) ===
<highlight-nsis>
${registry::KeyExists} "[fullpath]" $var
$var == 0  # key exists
$var == -1  # key doesn't exist
</highlight-nsis>
=== Registry Read ===
<highlight-nsis>
${registry::Read} "[fullpath]" "[value]" $var1 $var2
</highlight-nsis>
=== Registry Write ===
<highlight-nsis>
${registry::Write} "[fullpath]" "[value]" "[string]" "[TYPE]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Registry Extra Read ===
<highlight-nsis>
${registry::ReadExtra} "[fullpath]" "[value]" "[number]" $var1 $var2
</highlight-nsis>
=== Registry Extra Write ===
<highlight-nsis>
${registry::WriteExtra} "[fullpath]" "[value]" "[string]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Create Registry Key ===
<highlight-nsis>
${registry::CreateKey} "[fullpath]" $var
$var == 1  # [fullpath] already exists
$var == 0  # [fullpath] successfully created
$var == -1  # error
</highlight-nsis>
=== Delete Registry Value (same as DeleteRegValue) ===
<highlight-nsis>
${registry::DeleteValue} "[fullpath]" "[value]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Delete Registry Key (same as DeleteRegKey) ===
<highlight-nsis>
${registry::DeleteKey} "[fullpath]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Delete Empty Registry Key (if no values and subkeys in it) ===
<highlight-nsis>
${registry::DeleteKeyEmpty} "[fullpath]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Copy Registry Value ===
<highlight-nsis>
${registry::CopyValue} "[fullpath_source]" "[value_source]" "[fullpath_target]" "[value_target]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Move Registry Value ===
<highlight-nsis>
${registry::MoveValue} "[fullpath_source]" "[value_source]" "[fullpath_target]" "[value_target]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Copy Registry Key ===
<highlight-nsis>
${registry::CopyKey} "[fullpath_source]" "[fullpath_target]\[new_key_name]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Move Registry Key ===
<highlight-nsis>
${registry::MoveKey} "[fullpath_source]" "[fullpath_target]\[new_key_name]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Registry Export (save to the file in REGEDIT4 format) ===
<highlight-nsis>
${registry::SaveKey} "[fullpath]" "[file]" "[Options]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
=== Registry Import (restore from the file) ===
<highlight-nsis>
${registry::RestoreKey} "[file]" $var
$var == 0  # success
$var == -1  # error
</highlight-nsis>
Note:
${registry::RestoreKey} simply exec regedit:  regedit /s "[file]"
=== StrToHex (converts string to hex values) ===
<highlight-nsis>
${registry::StrToHex} "[string]" $var
</highlight-nsis>
"[string]"  - String to convert
$var  - Hex string
=== HexToStr (converts hex values to string) ===
<highlight-nsis>
${registry::HexToStr} "[hex_string]" $var
</highlight-nsis>
"[string]"  - Hex string to convert
$var  - String
=== Unload plugin ===
<highlight-nsis>
${registry::Unload}
</highlight-nsis>


[[Category:Plugins]]
[[Category:Plugins]]

Revision as of 21:55, 19 February 2009

Author: Instructor (talk, contrib)


Links

Download v3.5:
Registry.zip (154 KB)

Discussion:
Forum thread

Description

This is NSIS plug-in for registry. Archive also contains PPC-Registry plugin for Pocket PC.


Features:

  • Powerful registry search:
    • fast algorithm
    • principle of turn in stack (first in -> last out)
    •   i.e. search from first registry key to last
    • search for key, value and/or string in any root
    • search with name and/or type
    • search with banner support
    • search with subkeys or not
  • Check if registry key exists
  • Read value of any type and size
  • Write value of any type and size
  • Create key
  • Delete value (same as DeleteRegValue)
  • Delete key (same as DeleteRegKey)
  • Delete empty key (if no values and subkeys in it)
  • Copy value
  • Move value
  • Copy key
  • Move key
  • Export key contents to the file in REGEDIT4 format
  • Import key contents from the file to the registry (Note: this does not work on Windows Vista)
  • Converts string to hex values
  • Converts hex values to string

Usage

Open for search

${registry::Open} "[fullpath]" "[Options]" $var

Find first and next (call one or more times)

${registry::Find} "[handle]" $var1 $var2 $var3 $var4

Close search (free memory)

${registry::Close} "[handle]"

KeyExists (check is registry key exists)

${registry::KeyExists} "[fullpath]" $var
 
$var == 0   # key exists
$var == -1  # key doesn't exist

Registry Read

${registry::Read} "[fullpath]" "[value]" $var1 $var2

Registry Write

${registry::Write} "[fullpath]" "[value]" "[string]" "[TYPE]" $var
 
$var == 0   # success
$var == -1  # error


Registry Extra Read

${registry::ReadExtra} "[fullpath]" "[value]" "[number]" $var1 $var2

Registry Extra Write

${registry::WriteExtra} "[fullpath]" "[value]" "[string]" $var
 
$var == 0   # success
$var == -1  # error

Create Registry Key

${registry::CreateKey} "[fullpath]" $var
$var == 1   # [fullpath] already exists
$var == 0   # [fullpath] successfully created
$var == -1  # error


Delete Registry Value (same as DeleteRegValue)

${registry::DeleteValue} "[fullpath]" "[value]" $var
 
$var == 0   # success
$var == -1  # error


Delete Registry Key (same as DeleteRegKey)

${registry::DeleteKey} "[fullpath]" $var
 
$var == 0   # success
$var == -1  # error


Delete Empty Registry Key (if no values and subkeys in it)

${registry::DeleteKeyEmpty} "[fullpath]" $var
 
$var == 0   # success
$var == -1  # error


Copy Registry Value

${registry::CopyValue} "[fullpath_source]" "[value_source]" "[fullpath_target]" "[value_target]" $var
 
$var == 0   # success
$var == -1  # error


Move Registry Value

${registry::MoveValue} "[fullpath_source]" "[value_source]" "[fullpath_target]" "[value_target]" $var
 
$var == 0   # success
$var == -1  # error


Copy Registry Key

${registry::CopyKey} "[fullpath_source]" "[fullpath_target]\[new_key_name]" $var
 
$var == 0   # success
$var == -1  # error


Move Registry Key

${registry::MoveKey} "[fullpath_source]" "[fullpath_target]\[new_key_name]" $var
 
$var == 0   # success
$var == -1  # error

Registry Export (save to the file in REGEDIT4 format)

${registry::SaveKey} "[fullpath]" "[file]" "[Options]" $var
 
 
$var == 0   # success
$var == -1  # error


Registry Import (restore from the file)

${registry::RestoreKey} "[file]" $var
 
$var == 0   # success
$var == -1  # error

Note: ${registry::RestoreKey} simply exec regedit: regedit /s "[file]"


StrToHex (converts string to hex values)

${registry::StrToHex} "[string]" $var

"[string]" - String to convert

$var - Hex string


HexToStr (converts hex values to string)

${registry::HexToStr} "[hex_string]" $var

"[string]" - Hex string to convert

$var - String


Unload plugin

${registry::Unload}