Menu

RegistryFunctions

Anonymous

Registry related functions

wbc.readRegistry

  • Description: Returns a registry value.
  • Threading: Foreground/immediate
  • Function: wbc.readRegistry(hive, path, name)
  • Arguments:
    • hive: Hive to read from. Can be "HKLM" (HKEY_LOCAL_MACHINE), "HKCU" (HKEY_CURRENT_USER), or "HKUS" (KEY_USERS)
    • path: Path to the registry key containing the desired value. Backslashes should be escaped.
    • name: Name of the value to be read. If null, the default value is read.
  • Returns:
    • The value contained in the key. REG_DWORD, REG_EXPAND_SZ, and REG_SZ are returned as strings. REG_MULTI_SZ as an array of strings. REG_BINARY as an array of bytes.
    • ERROR/INVALID
  • Notes: None

wbc.writeRegistry

  • Description: Writes a value to the registry.
  • Threading: Foreground/immediate
  • Function: wbc.writeRegistry(hive, path, name, value, type)
  • Arguments:
    • hive: Hive to write to. Can be "HKLM" (HKEY_LOCAL_MACHINE), "HKCU" (HKEY_CURRENT_USER), or "HKUS" (KEY_USERS)
    • path: Path to the registry key to write to. Backslashes should be escaped.
    • name: Name of the value to be written. If null, the default value is read.
    • value: Value to be written.
    • type: String representation of the type to be written:
      • Optional. If not specified, the type will be determined by the value's variable type:
      • Boolean value: Written as a REG_SZ: ("true" or "false).
      • String value: Written as a REG_SZ
      • Integer value: Written as a REG_DWORD
      • Byte array: Written as a REG_BINARY
      • any other type is invalid.
    • If type is specified, it can be one of the following:
    • 'string': Written as REG_SZ
    • 'dword': Written as REG_DWORD
    • 'binary': Written as an array of bytes.
    • If a type is specified and null is passed as the value, defaults will be written as follows:
    • 'string': an empty string ("")
    • 'dword': zero.
    • 'binary': A single byte with a value of zero.
  • Returns:
    • OK/ERROR/INVALID
  • Notes: None

wbc.removeRegistryValue

  • Description: Deletes a specific value from the registry.
  • Threading: Foreground/immediate
  • Function: wbc.removeRegistryValue:(hive, path, name)
  • Arguments:
    • hive: Hive being deleted from. Can be "HKLM" (HKEY_LOCAL_MACHINE), "HKCU" (HKEY_CURRENT_USER), or "HKUS" (HKEY_USERS)
    • path: path of the key being deleted from. Backslashes must be escaped.
    • name: Name of the value being deleted.
  • Returns:
    • OK/ERROR/INVALID
  • Notes: None

wbc.registryKeyExists

  • Description: Checks for the existence of a registry key.
  • Threading: Foreground/immediate
  • Function: wbc.registryKeyExists(hive, path)
  • Arguments:
    • hive: Hive being checked. Can be "HKLM" (HKEY_LOCAL_MACHINE), "HKCU" (HKEY_CURRENT_USER), or "HKUS" (HKEY_USERS)
    • path: path of the key being checked. Backslashes must be escaped.
  • Returns:
    • true or false.
    • INVALID/ERROR
  • Notes: None

wbc.getSubkeys

  • Description: Returns a list of subkeys, if found, under the specified key.
  • Threading: Foreground/blocking
  • Function: wbc.getSubkeys(hive, path)
  • Arguments:
    • hive: Hive being checked. Can be "HKLM" (HKEY_LOCAL_MACHINE), "HKCU" (HKEY_CURRENT_USER), or "HKUS" (HKEY_USERS)
    • path: path of the key being checked. Backslashes must be escaped.
  • Returns:
    • INVALID/ERROR
    • An array of strings representing the names of the subkeys.
  • Notes:
    • Full paths of the subkeys are not returned, only the names.

wbc.removeRegistryKey

  • Description: Delete the specified registry key.
  • Threading: Foreground/blocking
  • Function: wbc.removeRegistryKey: function(hive, path)
  • Arguments:
    • hive: Hive being checked. Can be "HKLM" (HKEY_LOCAL_MACHINE), "HKCU" (HKEY_CURRENT_USER), or "HKUS" (HKEY_USERS)
    • path: path of the key being checked. Backslashes must be escaped.
  • Returns:
    • OK/ERROR/INVALID
  • Notes:
    • All values and subkeys are deleted without warning, assuming sufficient permissions are available.

wbc.observeRegistryChange

  • Description: Monitors a specified registry key for changes.
  • Threading: Foreground/immediate, with background listener thread.
  • Function: wbc.observeRegistryChange:(hive, path, doWatchSubtree, callback)
  • Arguments:
    • hive: Hive being monitored. Can be "HKLM" (HKEY_LOCAL_MACHINE) or "HKCU" (HKEY_CURRENT_USER)
    • path: path of the key being monitored. Backslashes must be escaped.
    • doWatchSubtree: if true, all subkeys are monitored. If false only the specified key is monitored.
  • Returns:
    • INVALID/ERROR
    • changeID: A reference value to use to stop monitoring this key.
  • Notes:
    • The callback is invoked if any of the following changes occur:
      • a subkey is added or deleted.
      • changes to the attributes of the key, such as the security descriptor information.
      • changes to a value of the key. This can include adding or deleting a value, or changing an existing value.
    • changes to the security descriptor of the key.
    • The current version of wbc.js allows for only one callback at a time:
    • If a second call to registerDirectoryChange is made with a callback, both folders will be monitored but only the last callback will be used.
    • If callback is set to null on the second call to registerDirectoryChange, the first callback will not be overwritten.
    • The callback evt object contains the following properties:
    • If a registry event occurs, the callback is called with an object having the following properties:
      • func: the internal function name ('uisdk_RegisterRegChange')
      • changeID: the change callback identifier.
      • isCurrentUser: 'true' if the HKCU is watched, and 'false' otherwise.
      • registryHive: the registry hive being watched ("HKEY_LOCAL_MACHINE" or "HKEY_CURRENT_USER")
      • regKey: the registry key (path) being monitored.
      • isWatchSubtree: isWatchSubtree value that was passed internally to uisdk_RegisterRegChange.
      • notifyFilter: notifyFilter value that was passed internally to uisdk_RegisterRegChange.

wbc.stopObservingRegistry

  • Description: Stops observing a registry change previously monitored with observeRegistryChange
  • Threading: Foreground/immediate
  • Function: wbc.stopObservingRegistry(changeID)
  • Arguments:
    • changeID: The value returned by observeRegistryChange
  • Returns:
    • OK/ERROR/INVALID
  • Notes:
    • The callback specified in observeRegistryChange is not deleted. It can be reused by passing null as the second argument to future calls to observeRegistryChange, or overwritten by passing a new value.

wbc.setWow32RegRedirect

  • Description: Controls whether registry read/write operations act on the 32 or 64 bit portions of the registry.
  • Threading: Foreground/immediate
  • Function: wbc.setWow32RegRedirect(isReversed)
  • Arguments:
    • isReversed: if true, the 32 bit version of the UI SDK will operate on the 64bit portion of the registry, and the 64bit version of the UI SDK will operate on the 32 bit portion of the registry. If false, the correct registry section is operated upon as would normally be expected.
  • Returns:
    • OK
  • Notes:
    • Has no effect on 32 bit systems.
    • Remember that it reverses the behavior. To deterministically act on 32 or 64 bit portions of the registry, it is necessary to first determine the current OS architecture, via getWindowsInfo()

Related

Wiki: Home