.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Podwrapper::Man 1.52.0 (Pod::Simple 3.45) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .\" ======================================================================== .\" .IX Title "virt-win-reg 1" .TH virt-win-reg 1 2024-01-04 guestfs-tools-1.52.0 "Virtualization Support" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH 名前 .IX Header "名前" virt-win-reg \- Windows 仮想マシンからの Windows レジストリエントリーのエクスポートおよびマージ .SH 書式 .IX Header "書式" .Vb 1 \& virt\-win\-reg domname \*(AqHKLM\ePath\eTo\eSubkey\*(Aq \& \& virt\-win\-reg domname \*(AqHKLM\ePath\eTo\eSubkey\*(Aq name \& \& virt\-win\-reg domname \*(AqHKLM\ePath\eTo\eSubkey\*(Aq @ \& \& virt\-win\-reg \-\-merge domname [input.reg ...] \& \& virt\-win\-reg [\-\-options] disk.img ... # 仮想マシン名の代わり .Ve .SH 警告 .IX Header "警告" You must \fInot\fR use \f(CW\*(C`virt\-win\-reg\*(C'\fR with the \fI\-\-merge\fR option on live virtual machines. If you do this, you \fIwill\fR get irreversible disk corruption in the VM. \f(CW\*(C`virt\-win\-reg\*(C'\fR tries to stop you from doing this, but doesn't catch all cases. .PP Modifying the Windows Registry is an inherently risky operation. The format is deliberately obscure and undocumented, and Registry changes can leave the system unbootable. Therefore when using the \fI\-\-merge\fR option, make sure you have a reliable backup first. .SH 説明 .IX Header "説明" このプログラムは Windows 仮想マシンから Windows レジストリのエントリーをエクスポートおよびマージできます。 .PP 第一パラメーターは Windows 仮想マシンの libvirt 仮想マシン名または生のディスクイメージです。 .PP If \fI\-\-merge\fR is \fInot\fR specified, then the chosen registry key is displayed/exported (recursively). For example: .PP .Vb 1 \& $ virt\-win\-reg Windows7 \*(AqHKEY_LOCAL_MACHINE\eSOFTWARE\eMicrosoft\*(Aq .Ve .PP You can also display single values from within registry keys, for example: .PP .Vb 3 \& $ cvkey=\*(AqHKLM\eSOFTWARE\eMicrosoft\eWindows NT\eCurrentVersion\*(Aq \& $ virt\-win\-reg Windows7 $cvkey ProductName \& Windows 7 Enterprise .Ve .PP \&\fI\-\-merge\fR を用いると、テキストの regedit ファイルを Windows レジストリーの中に結合できます: .PP .Vb 1 \& $ virt\-win\-reg \-\-merge Windows7 changes.reg .Ve .SS 注記 .IX Subsection "注記" This program is only meant for simple access to the registry. If you want to do complicated things with the registry, we suggest you download the Registry hive files from the guest using \fBlibguestfs\fR\|(3) or \fBguestfish\fR\|(1) and access them locally, eg. using \fBhivex\fR\|(3), \fBhivexsh\fR\|(1) or \fBhivexregedit\fR\|(1). .SH オプション .IX Header "オプション" .IP \fB\-\-help\fR 4 .IX Item "--help" 簡単なヘルプを表示します。 .IP \fB\-\-version\fR 4 .IX Item "--version" バージョン番号を表示して、終了します。 .IP \fB\-\-debug\fR 4 .IX Item "--debug" デバッグメッセージを有効にします。 .IP "\fB\-c URI\fR" 4 .IX Item "-c URI" .PD 0 .IP "\fB\-\-connect URI\fR" 4 .IX Item "--connect URI" .PD libvirt を使用していると、指定された \fIURI\fR に接続します。 省略すると、デフォルトの libvirt ハイパーバイザーに接続します。 .Sp 仮想マシンのブロックデバイスを直接指定すると、libvirt はまったく使用されません。 .IP "\fB\-\-format\fR raw" 4 .IX Item "--format raw" Specify the format of disk images given on the command line. If this is omitted then the format is autodetected from the content of the disk image. .Sp If disk images are requested from libvirt, then this program asks libvirt for this information. In this case, the value of the format parameter is ignored. .Sp If working with untrusted raw-format guest disk images, you should ensure the format is always specified. .IP \fB\-\-merge\fR 4 .IX Item "--merge" In merge mode, this merges a textual regedit file into the Windows Registry of the virtual machine. If this flag is \fInot\fR given then virt-win-reg displays or exports Registry entries instead. .Sp Note that \fI\-\-merge\fR is \fIunsafe\fR to use on live virtual machines, and will result in disk corruption. However exporting (without this flag) is always safe. .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 "ENCODING STRINGS" in \fBWin::Hivex::Regedit\fR\|(3). .Sp The default is to use UTF\-16LE, 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 UTF\-16LE 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 Registry for various reasons: .RS 4 .IP \(bu 4 Assumes the original encoding is UTF\-16LE. ASCII 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 Registries is not reliable. .IP \(bu 4 Loses information about whether a zero codepoint followed the string in the Registry or not. .RE .RS 4 .Sp This all happens because the Registry itself contains no information about how strings are encoded (see "ENCODING STRINGS" in \fBWin::Hivex::Regedit\fR\|(3)). .Sp You should only use this option for quick hacking and debugging of the Registry contents, and \fInever\fR use it if the output is going to be passed into another program or stored in another Registry. .RE .SH サポートされるシステム .IX Header "サポートされるシステム" The program currently supports Windows NT-derived guests starting with Windows XP through to at least Windows 8. .PP 以下のレジストリキーがサポートされます: .ie n .IP """HKEY_LOCAL_MACHINE\eSAM""" 4 .el .IP \f(CWHKEY_LOCAL_MACHINE\eSAM\fR 4 .IX Item "HKEY_LOCAL_MACHINESAM" .PD 0 .ie n .IP """HKEY_LOCAL_MACHINE\eSECURITY""" 4 .el .IP \f(CWHKEY_LOCAL_MACHINE\eSECURITY\fR 4 .IX Item "HKEY_LOCAL_MACHINESECURITY" .ie n .IP """HKEY_LOCAL_MACHINE\eSOFTWARE""" 4 .el .IP \f(CWHKEY_LOCAL_MACHINE\eSOFTWARE\fR 4 .IX Item "HKEY_LOCAL_MACHINESOFTWARE" .ie n .IP """HKEY_LOCAL_MACHINE\eSYSTEM""" 4 .el .IP \f(CWHKEY_LOCAL_MACHINE\eSYSTEM\fR 4 .IX Item "HKEY_LOCAL_MACHINESYSTEM" .ie n .IP """HKEY_USERS\e.DEFAULT""" 4 .el .IP \f(CWHKEY_USERS\e.DEFAULT\fR 4 .IX Item "HKEY_USERS.DEFAULT" .ie n .IP """HKEY_USERS\e\fISID\fR""" 4 .el .IP \f(CWHKEY_USERS\e\fR\f(CISID\fR\f(CW\fR 4 .IX Item "HKEY_USERSSID" .PD ここで \fISID\fR は Windows User SID です (例: \f(CW\*(C`S\-1\-5\-18\*(C'\fR)。 .ie n .IP """HKEY_USERS\e\fIusername\fR""" 4 .el .IP \f(CWHKEY_USERS\e\fR\f(CIusername\fR\f(CW\fR 4 .IX Item "HKEY_USERSusername" ここで \fIusername\fR はローカルユーザー名です (これは libguestfs の拡張です)。 .PP You can use \f(CW\*(C`HKLM\*(C'\fR as a shorthand for \f(CW\*(C`HKEY_LOCAL_MACHINE\*(C'\fR, and \f(CW\*(C`HKU\*(C'\fR for \f(CW\*(C`HKEY_USERS\*(C'\fR. .PP The literal keys \f(CW\*(C`HKEY_USERS\e$SID\*(C'\fR and \f(CW\*(C`HKEY_CURRENT_USER\*(C'\fR are not supported (there is no "current user"). .SS "WINDOWS 8" .IX Subsection "WINDOWS 8" Windows 8 "fast startup" can prevent virt-win-reg from being able to edit the Registry. See "WINDOWS HIBERNATION AND WINDOWS 8 FAST STARTUP" in \fBguestfs\fR\|(3). .SH エンコーディング .IX Header "エンコーディング" \&\f(CW\*(C`virt\-win\-reg\*(C'\fR expects that regedit files have already been reencoded in the local encoding. Usually on Linux hosts, this means UTF\-8 with Unix-style line endings. Since Windows regedit files are often in UTF\-16LE with Windows-style line endings, you may need to reencode the whole file before or after processing. .PP To reencode a file from Windows format to Linux (before processing it with the \fI\-\-merge\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 exporting 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 エンコーディングの詳細は \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 UTF\-16LE file with Windows-style (CRLF) 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 \fI\-\-merge\fR it. .SH "CurrentControlSet など。" .IX Header "CurrentControlSet など。" 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 \& # virt\-win\-reg WindowsGuest \*(AqHKLM\eSYSTEM\eSelect\*(Aq \& [HKEY_LOCAL_MACHINE\eSYSTEM\eSelect] \& "Current"=dword:00000001 \& "Default"=dword:00000001 \& "Failed"=dword:00000000 \& "LastKnownGood"=dword:00000002 .Ve .PP "Current" 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 レジストリーキーおよび値の削除方法 .IX Header "レジストリーキーおよび値の削除方法" レジストリキー全体を削除するには、この構文を使用します: .PP .Vb 1 \& [\-HKEY_LOCAL_MACHINE\eFoo] .Ve .PP キーにある単一の値を削除するには、この構文を使用します: .PP .Vb 2 \& [HKEY_LOCAL_MACHINE\eFoo] \& "Value"=\- .Ve .SH "Windows のヒント" .IX Header "Windows のヒント" Note that some of these tips modify the guest disk image. The guest \fImust\fR be shut off, else you will get disk corruption. .SS "RUNNING A BATCH SCRIPT WHEN A USER LOGS IN" .IX Subsection "RUNNING A BATCH SCRIPT WHEN A USER LOGS IN" Prepare a DOS batch script, VBScript or executable. Upload this using \fBguestfish\fR\|(1). For this example the script is called \f(CW\*(C`test.bat\*(C'\fR and it is uploaded into \f(CW\*(C`C:\e\*(C'\fR: .PP .Vb 1 \& guestfish \-i \-d WindowsGuest upload test.bat /test.bat .Ve .PP Prepare a regedit file containing the registry change: .PP .Vb 4 \& cat > test.reg <<\*(AqEOF\*(Aq \& [HKLM\eSoftware\eMicrosoft\eWindows\eCurrentVersion\eRunOnce] \& "Test"="c:\e\etest.bat" \& EOF .Ve .PP In this example we use the key \f(CW\*(C`RunOnce\*(C'\fR which means that the script will run precisely once when the first user logs in. If you want it to run every time a user logs in, replace \f(CW\*(C`RunOnce\*(C'\fR with \f(CW\*(C`Run\*(C'\fR. .PP Now update the registry: .PP .Vb 1 \& virt\-win\-reg \-\-merge WindowsGuest test.reg .Ve .SS サービスのインストール方法 .IX Subsection "サービスのインストール方法" This section assumes you are familiar with Windows services, and you either have a program which handles the Windows Service Control Protocol directly or you want to run any program using a service wrapper like SrvAny or the free RHSrvAny. .PP First upload the program and optionally the service wrapper. In this case the test program is called \f(CW\*(C`test.exe\*(C'\fR and we are using the RHSrvAny wrapper: .PP .Vb 4 \& guestfish \-i \-d WindowsGuest < service.reg <<\*(AqEOF\*(Aq \& [HKLM\eSYSTEM\eControlSet001\eservices\eRHSrvAny] \& "Type"=dword:00000010 \& "Start"=dword:00000002 \& "ErrorControl"=dword:00000001 \& "ImagePath"="c:\e\erhsrvany.exe" \& "DisplayName"="RHSrvAny" \& "ObjectName"="NetworkService" \& \& [HKLM\eSYSTEM\eControlSet001\eservices\eRHSrvAny\eParameters] \& "CommandLine"="c:\e\etest.exe" \& "PWD"="c:\e\eTemp" \& EOF .Ve .PP 注: .IP \(bu 4 For use of \f(CW\*(C`ControlSet001\*(C'\fR see the section above in this manual page. You may need to adjust this according to the control set that is in use by the guest. .IP \(bu 4 \&\f(CW"ObjectName"\fR controls the privileges that the service will have. An alternative is \f(CW"ObjectName"="LocalSystem"\fR which would be the most privileged account. .IP \(bu 4 マジックナンバーの意味は次の Microsoft KB 記事を参照してください: http://support.microsoft.com/kb/103000. .PP レジストリを更新します: .PP .Vb 1 \& virt\-win\-reg \-\-merge WindowsGuest service.reg .Ve .SH "SHELL QUOTING" .IX Header "SHELL QUOTING" シェルにおいて \f(CW\*(C`\e\*(C'\fR (backslash) を含むパラメーターを渡すとき、注意する必要があります。通常シェルからそれらを保護するには、'単一引用符' または二つのバックスラッシュ (しかし、両方ではない) を使用する必要があります。 .PP パスおよび値の名前は大文字小文字を区別します。 .SH 関連項目 .IX Header "関連項目" \&\fBhivex\fR\|(3), \fBhivexsh\fR\|(1), \fBhivexregedit\fR\|(1), \fBguestfs\fR\|(3), \fBguestfish\fR\|(1), \fBvirt\-cat\fR\|(1), \fBvirt\-tail\fR\|(1), \fBSys::Guestfs\fR\|(3), \fBWin::Hivex\fR\|(3), \fBWin::Hivex::Regedit\fR\|(3), \fBSys::Virt\fR\|(3), http://libguestfs.org/. .SH 著者 .IX Header "著者" Richard W.M. Jones http://people.redhat.com/~rjones/ .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (C) 2010 Red Hat Inc. .SH LICENSE .IX Header "LICENSE" .SH BUGS .IX Header "BUGS" To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools .PP To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools .PP When reporting a bug, please supply: .IP \(bu 4 The version of libguestfs. .IP \(bu 4 Where you got libguestfs (eg. which Linux distro, compiled from source, etc) .IP \(bu 4 Describe the bug accurately and give a way to reproduce it. .IP \(bu 4 Run \fBlibguestfs\-test\-tool\fR\|(1) and paste the \fBcomplete, unedited\fR output into the bug report.