.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "hivexregedit 1" .TH hivexregedit 1 "2021-05-04" "hivex-1.3.20" "Windows Registry" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" hivexregedit \- Merge and export Registry changes from regedit\-format files. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& hivexregedit \-\-merge [\-\-prefix prefix] [\-\-encoding enc] \e \& hivefile [regfile] \& \& hivexregedit \-\-export [\-\-prefix prefix] hivefile key > regfile .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Please note hivexregedit is a low-level tool for manipulating hive files directly. To merge or export registry changes to Windows virtual machines it's better to use \fBvirt\-win\-reg\fR\|(1). .PP Given a local binary (\*(L"hive\*(R") file, there are two modes. \f(CW\*(C`\-\-merge\*(C'\fR imports (merges) changes from a regedit-format file into the hive. It is similar to using the \f(CW\*(C`/s\*(C'\fR switch in Windows regedit.exe. .PP \&\f(CW\*(C`\-\-export\*(C'\fR exports a Registry key (recursively) into the regedit format. .SS "\s-1ENCODING\s0" .IX Subsection "ENCODING" \&\f(CW\*(C`hivexregedit\*(C'\fR expects that regedit files have already been re-encoded in the local encoding. Usually on Linux hosts, this means \s-1UTF\-8\s0 with Unix-style line endings. Since Windows regedit files are often in \&\s-1UTF\-16LE\s0 with Windows-style line endings, you may need to re-encode the whole file before or after processing. .PP To re-encode a file from Windows format to Linux (before processing it with the \f(CW\*(C`\-\-merge\*(C'\fR option), you would do something like this: .PP .Vb 1 \& iconv \-f utf\-16le \-t utf\-8 < win.reg | dos2unix > linux.reg .Ve .PP To go in the opposite direction, after using \f(CW\*(C`\-\-export\*(C'\fR and before sending the file to a Windows user, do something like this: .PP .Vb 1 \& unix2dos < linux.reg | iconv \-f utf\-8 \-t utf\-16le > win.reg .Ve .PP For more information about encoding, see \fBWin::Hivex::Regedit\fR\|(3). .PP If you are unsure about the current encoding, use the \fBfile\fR\|(1) command. Recent versions of Windows regedit.exe produce a \s-1UTF\-16LE\s0 file with Windows-style (\s-1CRLF\s0) line endings, like this: .PP .Vb 3 \& $ file software.reg \& software.reg: Little\-endian UTF\-16 Unicode text, with very long lines, \& with CRLF line terminators .Ve .PP This file would need conversion before you could \f(CW\*(C`\-\-merge\*(C'\fR it. .SS "\s-1SHELL QUOTING\s0" .IX Subsection "SHELL QUOTING" Be careful when passing parameters containing \f(CW\*(C`\e\*(C'\fR (backslash) in the shell. Usually you will have to use 'single quotes' or double backslashes (but not both) to protect them from the shell. .SS "CurrentControlSet etc." .IX Subsection "CurrentControlSet etc." Registry keys like \f(CW\*(C`CurrentControlSet\*(C'\fR don't really exist in the Windows Registry at the level of the hive file, and therefore you cannot modify these. .PP \&\f(CW\*(C`CurrentControlSet\*(C'\fR is usually an alias for \f(CW\*(C`ControlSet001\*(C'\fR. In some circumstances it might refer to another control set. The way to find out is to look at the \f(CW\*(C`HKLM\eSYSTEM\eSelect\*(C'\fR key: .PP .Vb 6 \& $ hivexregedit \-\-export SYSTEM \*(Aq\eSelect\*(Aq \& [\eSelect] \& "Current"=dword:00000001 \& "Default"=dword:00000001 \& "Failed"=dword:00000000 \& "LastKnownGood"=dword:00000002 .Ve .PP \&\*(L"Current\*(R" is the one which Windows will choose when it boots. .PP Similarly, other \f(CW\*(C`Current...\*(C'\fR keys in the path may need to be replaced. .SH "EXAMPLE" .IX Header "EXAMPLE" .Vb 4 \& $ virt\-cat WindowsGuest /Windows/System32/config/software > software.hive \& $ hivexregedit \-\-export \e \& \-\-prefix \*(AqHKEY_LOCAL_MACHINE\eSOFTWARE\*(Aq \e \& software.hive \*(Aq\eMicrosoft\*(Aq > ms\-keys.reg \& \& $ hivexregedit \-\-merge system.hive \e \& \-\-prefix \*(AqHKEY_LOCAL_MACHINE\eSYSTEM\*(Aq additions.reg .Ve .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-\-help\fR" 4 .IX Item "--help" Display help. .IP "\fB\-\-debug\fR" 4 .IX Item "--debug" Enable debugging in the hivex library. This is useful for diagnosing bugs and also malformed hive files. .IP "\fB\-\-merge\fR" 4 .IX Item "--merge" .Vb 2 \& hivexregedit \-\-merge [\-\-prefix prefix] [\-\-encoding enc] \e \& hivefile [regfile] .Ve .Sp Merge \f(CW\*(C`regfile\*(C'\fR (a regedit-format text file) into the hive \&\f(CW\*(C`hivefile\*(C'\fR. If \f(CW\*(C`regfile\*(C'\fR is omitted, then the program reads from standard input. (Also you can give multiple input files). .Sp \&\f(CW\*(C`\-\-prefix\*(C'\fR specifies the Windows Registry prefix. It is almost always necessary to use this when dealing with real hive files. .Sp \&\f(CW\*(C`\-\-encoding\*(C'\fR specifies the encoding for unmarked strings in the input. It defaults to \f(CW\*(C`UTF\-16LE\*(C'\fR which should work for recent versions of Windows. Another possibility is to use \f(CW\*(C`ASCII\*(C'\fR. .IP "\fB\-\-export\fR" 4 .IX Item "--export" .Vb 1 \& hivexregedit \-\-export [\-\-prefix prefix] hivefile key > regfile .Ve .Sp \&\f(CW\*(C`key\*(C'\fR is a path within the hive \f(CW\*(C`hivefile\*(C'\fR. (The key should not contain any prefix and should be quoted to defend backslashes from the shell). The key is exported, recursively, to standard output in the textual regedit format. .Sp \&\f(CW\*(C`\-\-prefix\*(C'\fR specifies the Windows Registry prefix. It is almost always necessary to use this when dealing with real hive files. .IP "\fB\-\-prefix\fR prefix" 4 .IX Item "--prefix prefix" Hive files and Windows Registry key names are indirectly related. For example, inside the software hive, all keys are stored relative to \&\f(CW\*(C`HKEY_LOCAL_MACHINE\eSOFTWARE\*(C'\fR. Thus \&\f(CW\*(C`HKEY_LOCAL_MACHINE\eSOFTWARE\eMicrosoft\*(C'\fR appears in the hive file as \&\f(CW\*(C`\eMicrosoft\*(C'\fR. .Sp The hive format itself does not store this prefix, so you have to supply it based on outside knowledge. (\fBvirt\-win\-reg\fR\|(1), amongst other things, already knows about this). .Sp Usually it is sufficient to pass the parameter \&\f(CW\*(C`\-\-prefix \*(AqHKEY_LOCAL_MACHINE\eSOFTWARE\*(Aq\*(C'\fR or similar when doing merges and exports. .IP "\fB\-\-encoding\fR UTF\-16LE|ASCII" 4 .IX Item "--encoding UTF-16LE|ASCII" When merging (only), you may need to specify the encoding for strings to be used in the hive file. This is explained in detail in \&\*(L"\s-1ENCODING STRINGS\*(R"\s0 in \fBWin::Hivex::Regedit\fR\|(3). .Sp The default is to use \s-1UTF\-16LE,\s0 which should work with recent versions of Windows. .IP "\fB\-\-unsafe\-printable\-strings\fR" 4 .IX Item "--unsafe-printable-strings" When exporting (only), assume strings are \s-1UTF\-16LE\s0 and print them as strings instead of hex sequences. Remove the final zero codepoint from strings if present. .Sp This is unsafe and does not preserve the fidelity of strings in the original hive for various reasons: .RS 4 .IP "\(bu" 4 Assumes the original encoding is \s-1UTF\-16LE.\s0 \s-1ASCII\s0 strings and strings in other encodings will be corrupted by this transformation. .IP "\(bu" 4 Assumes that everything which has type 1 or 2 is really a string and that everything else is not a string, but the type field in real hives is not reliable. .IP "\(bu" 4 Loses information about whether a zero codepoint followed the string in the hive or not. .RE .RS 4 .Sp This all happens because the hive itself contains no information about how strings are encoded (see \&\*(L"\s-1ENCODING STRINGS\*(R"\s0 in \fBWin::Hivex::Regedit\fR\|(3)). .Sp You should only use this option for quick hacking and debugging of the hive contents, and \fInever\fR use it if the output is going to be passed into another program or stored in another hive. .RE .IP "\fB\-\-unsafe\fR" 4 .IX Item "--unsafe" Use heuristics to tolerate certain levels of corruption within hives. .Sp This is unsafe but may allow to export/merge valid keys/values in an othewise corrupted hive. .IP "\fB\-\-max\-depth\fR depth" 4 .IX Item "--max-depth depth" Limits the recursion depth of the export. For example, an export with a max depth of 1 will only include values directly under the specified key/prefix. A max depth of 0 will return no values. .Sp Exports include all child keys by default (fully recursive), which may take a while if the registry hive is large / bloated. This behavior can also be achieved by providing a negative max depth. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBvirt\-win\-reg\fR\|(1), \&\fBWin::Hivex::Regedit\fR\|(3), \&\fBWin::Hivex\fR\|(3), \&\fBhivexsh\fR\|(1), \&\fBdos2unix\fR\|(1), \&\fBunix2dos\fR\|(1), \&\fBiconv\fR\|(1), . .SH "AUTHOR" .IX Header "AUTHOR" Richard W.M. Jones .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2010 Red Hat Inc. .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, \s-1MA 02139, USA.\s0