images: Make phony Windows image for testing.

This commit is contained in:
Richard W.M. Jones
2010-11-16 17:37:30 +00:00
parent 9becb385b7
commit fcc631dedb
8 changed files with 124 additions and 2 deletions

1
.gitignore vendored
View File

@@ -134,6 +134,7 @@ images/initrd-x86_64.img.gz
images/test.iso
images/test-grep.txt.gz
images/ubuntu.img
images/windows.img
initramfs
initramfs.timestamp
inspector/virt-inspector.1

View File

@@ -42,13 +42,19 @@ EXTRA_DIST = \
guest-aux/make-fedora-img.sh \
guest-aux/fedora-name.db.txt \
guest-aux/fedora-name.db \
guest-aux/make-ubuntu-img.sh
guest-aux/make-ubuntu-img.sh \
guest-aux/make-windows-img.sh \
guest-aux/windows-software \
guest-aux/windows-software.reg \
guest-aux/windows-system \
guest-aux/windows-system.reg \
guest-aux/minimal-hive
noinst_DATA = test.iso
# This is 'check_DATA' because we don't need it until 'make check'
# time and we need the tools we have built in order to make it.
check_DATA = debian.img fedora.img ubuntu.img
check_DATA = debian.img fedora.img ubuntu.img windows.img
CLEANFILES = \
test.iso test.sqsh \
@@ -181,3 +187,24 @@ ubuntu.img: guest-aux/make-ubuntu-img.sh
LIBGUESTFS_PATH=../appliance \
LD_LIBRARY_PATH=../src/.libs \
bash $<
# Make a (dummy) Windows image.
windows.img: guest-aux/make-windows-img.sh \
guest-aux/windows-software guest-aux/windows-system
LIBGUESTFS_PATH=../appliance \
LD_LIBRARY_PATH=../src/.libs \
bash $<
# Since users might not have the tools needed to create this, we
# also distribute these files.
guest-aux/windows-software: guest-aux/windows-software.reg
rm -f $@ $@-t
cp guest-aux/minimal-hive $@-t
hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SOFTWARE' $<
mv $@-t $@
guest-aux/windows-system: guest-aux/windows-system.reg
rm -f $@ $@-t
cp guest-aux/minimal-hive $@-t
hivexregedit --merge $@-t --prefix 'HKEY_LOCAL_MACHINE\SYSTEM' $<
mv $@-t $@

View File

@@ -0,0 +1,54 @@
#!/bin/bash -
# libguestfs
# Copyright (C) 2010 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Make a Windows image which is enough to fool the inspection heuristics.
export LANG=C
set -e
# Create a disk image.
../fish/guestfish <<'EOF'
sparse windows.img.tmp 512M
run
# Format the disk.
part-init /dev/sda mbr
part-add /dev/sda p 64 524287
part-add /dev/sda p 524288 -64
# Phony boot loader filesystem.
mkfs ntfs /dev/sda1
# Phony root filesystem.
mkfs ntfs /dev/sda2
# Enough to fool inspection API.
mount-options "" /dev/sda2 /
mkdir-p /Windows/System32/Config
upload guest-aux/windows-software /Windows/System32/Config/SOFTWARE
upload guest-aux/windows-system /Windows/System32/Config/SYSTEM
upload bin-win32.exe /Windows/System32/cmd.exe
mkdir "/Program Files"
touch /autoexec.bat
EOF
mv windows.img.tmp windows.img

BIN
images/guest-aux/minimal-hive Executable file

Binary file not shown.

BIN
images/guest-aux/windows-software Executable file

Binary file not shown.

View File

@@ -0,0 +1,32 @@
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
"ProductName"=str(1):"Microsoft Windows 7 Phony Edition"
"CurrentVersion"=str(1):"6.1"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\test1]
"DisplayName"=str(1):"Test1 is not real software"
"URLInfoAbout"=str(1):"http://libguestfs.org/"
"DisplayVersion"=str(1):"1.2.3"
"VersionMajor"=dword:00000001
"VersionMinor"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\test2]
"DisplayName"=str(1):"Test2 is not real software"
"URLInfoAbout"=str(1):"http://libguestfs.org/"
"DisplayVersion"=str(1):"1.2.4"
"Comments"=str(1):"Longer description about phony test2 software"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\test3]
"DisplayName"=str(1):"Test3 is not real software"
"DisplayVersion"=str(1):"1.2.5"
"Publisher"=str(1):"Red Hat Inc."
"InstallLocation"=str(1):"C:\\Program Files\\Red Hat\\test3"

BIN
images/guest-aux/windows-system Executable file

Binary file not shown.

View File

@@ -0,0 +1,8 @@
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001]
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services]
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip]
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters]
"Hostname"=str(1):"windows.invalid"