[9f577259] | 1 | #!/bin/bash |
---|
| 2 | #/** |
---|
| 3 | #@file Registry.lib |
---|
| 4 | #@brief Librería o clase Registry |
---|
| 5 | #@class Boot |
---|
| 6 | #@brief Funciones para gestión del registro de Windows. |
---|
| 7 | #@version 1.0.1 |
---|
| 8 | #@warning License: GNU GPLv3+ |
---|
| 9 | #*/ |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | #/** |
---|
| 13 | # ogAddRegistryKey path_mountpoint str_hive str_keyname |
---|
| 14 | #@brief Añade una nueva clave al registro de Windows. |
---|
[bf18bcbd] | 15 | #@param path_mountpoint directorio donde está montado el sistema Windows |
---|
| 16 | #@param str_hive sección del registro |
---|
| 17 | #@param str_keyname nombre de la clave |
---|
| 18 | #@return (nada) |
---|
| 19 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 20 | #@exception OG_ERR_NOTFOUND Fichero de registro no encontrado. |
---|
| 21 | #@note hive = { default, sam, security, software, system, components } |
---|
| 22 | #@warning Requisitos: chntpw |
---|
| 23 | #@warning El sistema de archivos de Windows debe estar montada previamente. |
---|
[9f577259] | 24 | #@version 1.0.1 - Nueva función |
---|
| 25 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
[cd2ae87] | 26 | #@date 2011-05-25 |
---|
[9f577259] | 27 | #*/ ## |
---|
[1b804cc] | 28 | function ogAddRegistryKey () |
---|
[9f577259] | 29 | { |
---|
[cd2ae87] | 30 | # Variables locales. |
---|
| 31 | local FILE |
---|
[9f577259] | 32 | |
---|
[cd2ae87] | 33 | # Si se solicita, mostrar ayuda. |
---|
| 34 | if [ "$*" == "help" ]; then |
---|
[bf18bcbd] | 35 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_key" \ |
---|
| 36 | "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey'" |
---|
[cd2ae87] | 37 | return |
---|
| 38 | fi |
---|
| 39 | # Error si no se reciben 3 parámetros. |
---|
| 40 | [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 41 | # Camino del fichero de registro. |
---|
| 42 | FILE=$(ogGetHivePath "$1" "$2") || return $? |
---|
[9f577259] | 43 | |
---|
[cd2ae87] | 44 | # Añadir nueva clave. |
---|
[367e04d] | 45 | chntpw "$FILE" << EOT &> /dev/null |
---|
[3907aaf] | 46 | cd ${3%\\*} |
---|
| 47 | nk ${3##*\\} |
---|
[cd2ae87] | 48 | q |
---|
| 49 | y |
---|
| 50 | EOT |
---|
[1b804cc] | 51 | } |
---|
| 52 | |
---|
| 53 | #/** |
---|
[9570719] | 54 | # ogAddRegistryValue path_mountpoint str_hive str_valuename [str_valuetype] |
---|
| 55 | #@brief Añade un nuevo valor al registro de Windows, indicando su tipo de datos. |
---|
[bf18bcbd] | 56 | #@param path_mountpoint directorio donde está montado el sistema Windows |
---|
| 57 | #@param str_hive sección del registro |
---|
| 58 | #@param str_valuename nombre del valor |
---|
| 59 | #@param str_valuetype tipo de datos del valor (opcional) |
---|
| 60 | #@return (nada) |
---|
| 61 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 62 | #@exception OG_ERR_NOTFOUND Fichero de registro no encontrado. |
---|
[1cd64e6] | 63 | #@note hive = { DEFAULT, SAM, SECURITY, SOFTWARE, SYSTEM, COMPONENTS } |
---|
| 64 | #@note valuetype = { STRING, BINARY, DWORD }, por defecto: STRING |
---|
[bf18bcbd] | 65 | #@warning Requisitos: chntpw |
---|
| 66 | #@warning El sistema de archivos de Windows debe estar montada previamente. |
---|
[1b804cc] | 67 | #@version 1.0.1 - Nueva función |
---|
| 68 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
[9570719] | 69 | #@date 2011-05-25 |
---|
[1b804cc] | 70 | #*/ ## |
---|
[cd2ae87] | 71 | function ogAddRegistryValue () |
---|
[1b804cc] | 72 | { |
---|
[9570719] | 73 | # Variables locales. |
---|
| 74 | local FILE TYPE |
---|
| 75 | |
---|
| 76 | # Si se solicita, mostrar ayuda. |
---|
| 77 | if [ "$*" == "help" ]; then |
---|
[bf18bcbd] | 78 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename [str_valuetype]" \ |
---|
| 79 | "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1'" \ |
---|
| 80 | "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1' DWORD" |
---|
[9570719] | 81 | return |
---|
| 82 | fi |
---|
| 83 | # Error si no se reciben 3 o 4 parámetros. |
---|
| 84 | [ $# == 3 -o $# == 4 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 85 | # Camino del fichero de registro. |
---|
| 86 | FILE=$(ogGetHivePath "$1" "$2") || return $? |
---|
| 87 | case "$4" in |
---|
| 88 | string|STRING|"") TYPE=1 ;; |
---|
| 89 | binary|BINARY) TYPE=3 ;; |
---|
| 90 | dword|DWORD) TYPE=4 ;; |
---|
| 91 | *) ogRaiseError $OG_ERR_OUTOFLIMIT "$4" |
---|
[367e04d] | 92 | return $? ;; |
---|
[9570719] | 93 | esac |
---|
| 94 | |
---|
| 95 | # Devolver el dato del valor de registro. |
---|
| 96 | # /* (comentario Doxygen) |
---|
[367e04d] | 97 | chntpw "$FILE" << EOT &> /dev/null |
---|
[9570719] | 98 | cd ${3%\\*} |
---|
| 99 | nv $TYPE ${3##*\\} |
---|
| 100 | q |
---|
| 101 | y |
---|
| 102 | EOT |
---|
| 103 | # (comentario Doxygen) */ |
---|
[1b804cc] | 104 | } |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | #/** |
---|
| 108 | # ogDeleteRegistryKey path_mountpoint str_hive str_keyname |
---|
| 109 | #@brief Elimina una clave del registro de Windows con todo su contenido. |
---|
[bf18bcbd] | 110 | #@param path_mountpoint directorio donde está montado el sistema Windows |
---|
| 111 | #@param str_hive sección del registro |
---|
| 112 | #@param str_keyname nombre de la clave |
---|
| 113 | #@return (nada) |
---|
| 114 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 115 | #@exception OG_ERR_NOTFOUND Fichero de registro no encontrado. |
---|
| 116 | #@note hive = { default, sam, security, software, system, components } |
---|
| 117 | #@warning Requisitos: chntpw |
---|
| 118 | #@warning El sistema de archivos de Windows debe estar montada previamente. |
---|
| 119 | #@warning La clave debe estar vacía para poder ser borrada. |
---|
[1b804cc] | 120 | #@version 1.0.1 - Nueva función |
---|
| 121 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
[cd2ae87] | 122 | #@date 2011-05-25 |
---|
[1b804cc] | 123 | #*/ ## |
---|
| 124 | function ogDeleteRegistryKey () |
---|
| 125 | { |
---|
[cd2ae87] | 126 | # Variables locales. |
---|
| 127 | local FILE |
---|
| 128 | |
---|
| 129 | # Si se solicita, mostrar ayuda. |
---|
| 130 | if [ "$*" == "help" ]; then |
---|
[bf18bcbd] | 131 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_key" \ |
---|
| 132 | "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey'" |
---|
[cd2ae87] | 133 | return |
---|
| 134 | fi |
---|
| 135 | # Error si no se reciben 3 parámetros. |
---|
| 136 | [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 137 | # Camino del fichero de registro. |
---|
| 138 | FILE=$(ogGetHivePath "$1" "$2") || return $? |
---|
| 139 | |
---|
| 140 | # Añadir nueva clave. |
---|
[367e04d] | 141 | chntpw "$FILE" << EOT &> /dev/null |
---|
[3907aaf] | 142 | cd ${3%\\*} |
---|
| 143 | dk ${3##*\\} |
---|
[cd2ae87] | 144 | q |
---|
| 145 | y |
---|
| 146 | EOT |
---|
[1b804cc] | 147 | } |
---|
| 148 | |
---|
[1cd64e6] | 149 | |
---|
[1b804cc] | 150 | #/** |
---|
[bf18bcbd] | 151 | # ogDeleteRegistryValue path_mountpoint str_hive str_valuename |
---|
[1b804cc] | 152 | #@brief Elimina un valor del registro de Windows. |
---|
[bf18bcbd] | 153 | #@param path_mountpoint directorio donde está montado el sistema Windows |
---|
| 154 | #@param str_hive sección del registro |
---|
| 155 | #@param str_valuename nombre del valor |
---|
| 156 | #@return (nada) |
---|
| 157 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 158 | #@exception OG_ERR_NOTFOUND Fichero de registro no encontrado. |
---|
| 159 | #@note hive = { default, sam, security, software, system, components } |
---|
| 160 | #@warning Requisitos: chntpw |
---|
| 161 | #@warning El sistema de archivos de Windows debe estar montada previamente. |
---|
[1b804cc] | 162 | #@version 1.0.1 - Nueva función |
---|
| 163 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
[cd2ae87] | 164 | #@date 2011-05-25 |
---|
[1b804cc] | 165 | #*/ ## |
---|
| 166 | function ogDeleteRegistryValue () |
---|
| 167 | { |
---|
[cd2ae87] | 168 | # Variables locales. |
---|
| 169 | local FILE |
---|
| 170 | |
---|
| 171 | # Si se solicita, mostrar ayuda. |
---|
| 172 | if [ "$*" == "help" ]; then |
---|
[bf18bcbd] | 173 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename" \ |
---|
| 174 | "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1'" |
---|
[cd2ae87] | 175 | return |
---|
| 176 | fi |
---|
| 177 | # Error si no se reciben 3 parámetros. |
---|
| 178 | [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 179 | # Camino del fichero de registro. |
---|
| 180 | FILE=$(ogGetHivePath "$1" "$2") || return $? |
---|
| 181 | |
---|
| 182 | # Devolver el dato del valor de registro. |
---|
| 183 | # /* (comentario Doxygen) |
---|
[367e04d] | 184 | chntpw "$FILE" << EOT &> /dev/null |
---|
[cd2ae87] | 185 | cd ${3%\\*} |
---|
| 186 | dv ${3##*\\} |
---|
| 187 | q |
---|
| 188 | y |
---|
| 189 | EOT |
---|
| 190 | # (comentario Doxygen) */ |
---|
[1b804cc] | 191 | } |
---|
| 192 | |
---|
| 193 | |
---|
| 194 | #/** |
---|
| 195 | # ogGetHivePath path_mountpoint str_hive |
---|
[9f577259] | 196 | #@brief Función básica que devuelve el camino del fichero con una sección del registro. |
---|
| 197 | #@param path_mountpoint directorio donde está montado el sistema Windows |
---|
| 198 | #@param str_hive sección del registro |
---|
| 199 | #@return str_path - camino del fichero de registro |
---|
| 200 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
[bf18bcbd] | 201 | #@exception OG_ERR_NOTFOUND Fichero de registro no encontrado. |
---|
[1cd64e6] | 202 | #@note hive = { DEFAULT, SAM, SECURITY, SOFTWARE, SYSTEM, COMPONENTS } |
---|
[9f577259] | 203 | #@warning El sistema de archivos de Windows debe estar montada previamente. |
---|
| 204 | #@version 1.0.1 - Nueva función |
---|
| 205 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 206 | #@date 2011-05-18 |
---|
| 207 | #*/ ## |
---|
[1b804cc] | 208 | function ogGetHivePath () |
---|
[9f577259] | 209 | { |
---|
| 210 | # Variables locales. |
---|
| 211 | local FILE FILENT FILEXP |
---|
| 212 | |
---|
| 213 | # Si se solicita, mostrar ayuda. |
---|
| 214 | if [ "$*" == "help" ]; then |
---|
| 215 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive" |
---|
[1cd64e6] | 216 | "$FUNCNAME /mnt/sda1 SOFTWARE => /mnt/sda1/WINDOWS/System32/config/SOFTWARE" |
---|
[9f577259] | 217 | return |
---|
| 218 | fi |
---|
| 219 | # Error si no se reciben 2 parámetros. |
---|
| 220 | [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 221 | |
---|
| 222 | # Camino del fichero de registro en NT/2000 o XP/Vista/7. |
---|
| 223 | FILENT=$(ogGetPath "/$1/winnt/system32/config/$2") |
---|
| 224 | [ -f $FILENT ] && FILE="$FILENT" |
---|
| 225 | FILEXP=$(ogGetPath "/$1/windows/system32/config/$2") |
---|
| 226 | [ -f $FLEHXP ] && FILE="$FILEXP" |
---|
| 227 | [ ! -f $FILE ] && ogRaiseError OG_ERR_NOTFOUND "$1,$2" && return $? |
---|
| 228 | |
---|
| 229 | echo "$FILE" |
---|
| 230 | } |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | #/** |
---|
| 234 | # ogGetRegistryValue path_mountpoint str_hive str_valuename |
---|
| 235 | #@brief Devuelve el dato de un valor del registro de Windows. |
---|
| 236 | #@param path_mountpoint directorio donde está montado el sistema Windows |
---|
| 237 | #@param str_hive sección del registro |
---|
| 238 | #@param str_valuename nombre del valor |
---|
| 239 | #@return str_valuedata - datos del valor. |
---|
| 240 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
[bf18bcbd] | 241 | #@exception OG_ERR_NOTFOUND Fichero de registro no encontrado. |
---|
[9f577259] | 242 | #@note hive = { default, sam, security, software, system, components } |
---|
| 243 | #@warning Requisitos: chntpw, awk |
---|
[bf18bcbd] | 244 | #@warning El sistema de archivos de Windows debe estar montado previamente. |
---|
[9f577259] | 245 | #@version 0.9 - Adaptación para OpenGNSys. |
---|
| 246 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 247 | #@date 2009-09-11 |
---|
| 248 | #*/ ## |
---|
| 249 | function ogGetRegistryValue () |
---|
| 250 | { |
---|
| 251 | # Variables locales. |
---|
| 252 | local FILE |
---|
| 253 | |
---|
| 254 | # Si se solicita, mostrar ayuda. |
---|
| 255 | if [ "$*" == "help" ]; then |
---|
[bf18bcbd] | 256 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename" \ |
---|
| 257 | "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1' ==> 1" |
---|
[9f577259] | 258 | return |
---|
| 259 | fi |
---|
| 260 | # Error si no se reciben 3 parámetros. |
---|
| 261 | [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 262 | # Camino del fichero de registro. |
---|
[1b804cc] | 263 | FILE=$(ogGetHivePath "$1" "$2") || return $? |
---|
[9f577259] | 264 | |
---|
| 265 | # Devolver el dato del valor de registro. |
---|
| 266 | # /* (comentario Doxygen) |
---|
[367e04d] | 267 | chntpw "$FILE" << EOT 2> /dev/null | awk '/> Value/ {getline;print $0;}' |
---|
[9f577259] | 268 | cd ${3%\\*} |
---|
| 269 | cat ${3##*\\} |
---|
| 270 | q |
---|
[cd2ae87] | 271 | EOT |
---|
[9f577259] | 272 | # (comentario Doxygen) */ |
---|
| 273 | } |
---|
| 274 | |
---|
| 275 | |
---|
| 276 | #/** |
---|
[3907aaf] | 277 | # ogListRegistryKeys path_mountpoint str_hive str_key |
---|
| 278 | #@brief Lista los nombres de subclaves de una determinada clave del registro de Windows. |
---|
[9f577259] | 279 | #@param path_mountpoint directorio donde está montado el sistema Windows |
---|
| 280 | #@param str_hive sección del registro |
---|
| 281 | #@param str_key clave de registro |
---|
| 282 | #@return str_subkey ... - lista de subclaves |
---|
| 283 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
[bf18bcbd] | 284 | #@exception OG_ERR_NOTFOUND Fichero de registro no encontrado. |
---|
[9f577259] | 285 | #@note hive = { default, sam, security, software, system, components } |
---|
| 286 | #@warning Requisitos: chntpw, awk |
---|
[bf18bcbd] | 287 | #@warning El sistema de archivos de Windows debe estar montado previamente. |
---|
[9f577259] | 288 | #@version 0.9 - Adaptación para OpenGNSys. |
---|
| 289 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 290 | #@date 2009-09-23 |
---|
| 291 | #*/ ## |
---|
[3907aaf] | 292 | function ogListRegistryKeys () |
---|
[9f577259] | 293 | { |
---|
| 294 | # Variables locales. |
---|
| 295 | local FILE |
---|
| 296 | |
---|
| 297 | # Si se solicita, mostrar ayuda. |
---|
| 298 | if [ "$*" == "help" ]; then |
---|
[bf18bcbd] | 299 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_key" \ |
---|
| 300 | "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\Windows\CurrentVersion'" |
---|
[9f577259] | 301 | return |
---|
| 302 | fi |
---|
| 303 | # Error si no se reciben 3 parámetros. |
---|
| 304 | [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 305 | |
---|
| 306 | # Camino del fichero de registro. |
---|
[1b804cc] | 307 | FILE=$(ogGetHivePath "$1" "$2") || return $? |
---|
[9f577259] | 308 | |
---|
| 309 | # Devolver la lista de claves de registro. |
---|
[367e04d] | 310 | chntpw "$FILE" << EOT 2> /dev/null | awk 'BEGIN {FS="[<>]"} $1~/^ $/ {print $2}' |
---|
[9f577259] | 311 | ls $3 |
---|
| 312 | q |
---|
[9570719] | 313 | EOT |
---|
[9f577259] | 314 | } |
---|
| 315 | |
---|
| 316 | |
---|
| 317 | #/** |
---|
[3907aaf] | 318 | # ogListRegistryValues path_mountpoint str_hive str_key |
---|
| 319 | #@brief Lista los nombres de valores de una determinada clave del registro de Windows. |
---|
[bf18bcbd] | 320 | #@param path_mountpoint directorio donde está montado el sistema Windows |
---|
| 321 | #@param str_hive sección del registro |
---|
| 322 | #@param str_key clave de registro |
---|
| 323 | #@return str_value ... - lista de valores |
---|
| 324 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
| 325 | #@exception OG_ERR_NOTFOUND Fichero de registro no encontrado. |
---|
| 326 | #@note hive = { default, sam, security, software, system, components } |
---|
| 327 | #@warning Requisitos: chntpw, awk |
---|
| 328 | #@warning El sistema de archivos de Windows debe estar montado previamente. |
---|
[3907aaf] | 329 | #@version 1.0.1 - Nueva función. |
---|
| 330 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 331 | #@date 2011-05-26 |
---|
| 332 | #*/ ## |
---|
| 333 | function ogListRegistryValues () |
---|
| 334 | { |
---|
| 335 | # Variables locales. |
---|
| 336 | local FILE |
---|
| 337 | |
---|
| 338 | # Si se solicita, mostrar ayuda. |
---|
| 339 | if [ "$*" == "help" ]; then |
---|
[bf18bcbd] | 340 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_key" \ |
---|
| 341 | "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\Windows\CurrentVersion'" |
---|
[3907aaf] | 342 | return |
---|
| 343 | fi |
---|
| 344 | # Error si no se reciben 3 parámetros. |
---|
| 345 | [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 346 | # Camino del fichero de registro. |
---|
| 347 | FILE=$(ogGetHivePath "$1" "$2") || return $? |
---|
| 348 | |
---|
| 349 | # Devolver la lista de claves de registro. |
---|
[367e04d] | 350 | chntpw "$FILE" << EOT 2> /dev/null | awk 'BEGIN {FS="[<>]"} $1~/REG_/ {print $2}' |
---|
[3907aaf] | 351 | ls $3 |
---|
| 352 | q |
---|
| 353 | EOT |
---|
| 354 | } |
---|
| 355 | |
---|
| 356 | |
---|
| 357 | #/** |
---|
[9f577259] | 358 | # ogSetRegistryValue path_mountpoint str_hive str_valuename str_valuedata |
---|
| 359 | #@brief Establece el dato asociado a un valor del registro de Windows. |
---|
| 360 | #@param path_mountpoint directorio donde está montado el sistema Windows |
---|
[bf18bcbd] | 361 | #@param str_hive sección del registro |
---|
[9f577259] | 362 | #@param str_valuename nombre del valor de registro |
---|
| 363 | #@param str_valuedata dato del valor de registro |
---|
| 364 | #@return (nada) |
---|
| 365 | #@exception OG_ERR_FORMAT Formato incorrecto. |
---|
[bf18bcbd] | 366 | #@exception OG_ERR_NOTFOUND Fichero de registro no encontrado. |
---|
[9f577259] | 367 | #@note hive = { default, sam, security, software, system, components } |
---|
[bf18bcbd] | 368 | #@warning Requisitos: chntpw |
---|
| 369 | #@warning El sistema de archivos de Windows debe estar montado previamente. |
---|
[9f577259] | 370 | #@version 0.9 - Adaptación para OpenGNSys. |
---|
| 371 | #@author Ramon Gomez, ETSII Universidad de Sevilla |
---|
| 372 | #@date 2009-09-24 |
---|
| 373 | #*/ ## |
---|
| 374 | function ogSetRegistryValue () |
---|
| 375 | { |
---|
| 376 | # Variables locales. |
---|
| 377 | local FILE |
---|
| 378 | |
---|
| 379 | # Si se solicita, mostrar ayuda. |
---|
| 380 | if [ "$*" == "help" ]; then |
---|
| 381 | ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename str_data" |
---|
[bf18bcbd] | 382 | "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1' 1" |
---|
[9f577259] | 383 | return |
---|
| 384 | fi |
---|
| 385 | # Error si no se reciben 4 parámetros. |
---|
| 386 | [ $# == 4 ] || ogRaiseError $OG_ERR_FORMAT || return $? |
---|
| 387 | # Camino del fichero de registro. |
---|
[1b804cc] | 388 | FILE=$(ogGetHivePath "$1" "$2") || return $? |
---|
[9f577259] | 389 | |
---|
| 390 | # Cambiar el dato del valor de registro. |
---|
[367e04d] | 391 | chntpw "$FILE" << EOT &> /dev/null |
---|
| 392 | cd ${3%\\*} |
---|
| 393 | ed ${3##*\\} |
---|
[9f577259] | 394 | $4 |
---|
| 395 | q |
---|
| 396 | y |
---|
[9570719] | 397 | EOT |
---|
[9f577259] | 398 | } |
---|
| 399 | |
---|