Blog Code Forum

Virtual Windows XP

From Wiki.cyring.fr

(Difference between revisions)
Jump to: navigation, search
(Start the VM)
 
(46 intermediate revisions not shown)
Line 1: Line 1:
 +
=== Prerequisite ===
 +
This HowTo has been written using ArchLinux x86_64 Kernel 3.6.5<br />
 +
The following packages are mandatory<br />
 +
<syntaxhighlight lang="bash" line start="1">
 +
pacman -S fuse qemu-kvm libvirt chntpw
 +
pacman -S base-devel
 +
pacman -S yaourt
 +
yaourt hivex
 +
</syntaxhighlight>
 +
* [https://wiki.archlinux.org/index.php/Yaourt Yaourt ArchWiki]<br />
 +
You may also installed the following ones
 +
<syntaxhighlight lang="bash" line start="5">
 +
pacman -S sudo wget libcdio
 +
</syntaxhighlight><br />
 +
 +
=== Convert VHD To KVM ===
<syntaxhighlight lang="bash" line start="1">
<syntaxhighlight lang="bash" line start="1">
qemu-img convert -f vpc -O raw "Virtual Windows XP.vhd" v2WinXP.img
qemu-img convert -f vpc -O raw "Virtual Windows XP.vhd" v2WinXP.img
 +
wget http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-0.1-30.iso
 +
iso-read -i virtio-win-0.1-30.iso -e WXP/X86/VIOSTOR.SYS -o VIOSTOR.SYS
 +
iso-read -i virtio-win-0.1-30.iso -e WXP/X86/VIOSTOR.INF -o VIOSTOR.INF
sudo mount -o loop,offset=32256 v2WinXP.img /mnt
sudo mount -o loop,offset=32256 v2WinXP.img /mnt
-
cp -R ~/tmp/WXP /mnt/
+
cp VIOSTOR.SYS /mnt/WINDOWS/system32/drivers/
-
cp ~/tmp/WXP/X86/VIOSER.SYS /mnt/WINDOWS/system32/drivers/
+
cp VIOSTOR.INF /mnt/WINDOWS/inf/
mkdir ~/tmp/config
mkdir ~/tmp/config
cp /mnt/WINDOWS/system32/config/* ~/tmp/config/
cp /mnt/WINDOWS/system32/config/* ~/tmp/config/
 +
wget http://code.cyring.fr/FTS/Source/VM/WinXP/virtio_keys1.reg
 +
wget http://code.cyring.fr/FTS/Source/VM/WinXP/virtio_keys2.reg
 +
wget http://code.cyring.fr/FTS/Source/VM/WinXP/virtio_keys3.reg
 +
wget http://code.cyring.fr/FTS/Source/VM/WinXP/virtio_keys4.reg
 +
hivexregedit --merge ~/tmp/config/system virtio_keys1.reg
 +
hivexregedit --merge ~/tmp/config/system virtio_keys2.reg
 +
hivexregedit --merge ~/tmp/config/system virtio_keys3.reg
 +
hivexregedit --merge ~/tmp/config/system virtio_keys4.reg
 +
chntpw -e ~/tmp/config/system << EOF
 +
> cd ControlSet001
 +
> cd Services
 +
> cd Processor
 +
> ed Start
 +
> 4
 +
> q
 +
> y
 +
> EOF
 +
cp ~/tmp/config/system /mnt/WINDOWS/system32/config/
 +
sudo umount /mnt
 +
</syntaxhighlight><br />
 +
 +
=== Import into the registry ===
 +
Download registry files @ [http://code.cyring.fr/FTS code.cyring.fr/FTS]
 +
=== Editing Registry ===
 +
<syntaxhighlight lang="bash" line start="1">
chntpw -e ~/tmp/config/system
chntpw -e ~/tmp/config/system
</syntaxhighlight><br />
</syntaxhighlight><br />
-
<syntaxhighlight lang="ini">
+
===== Commands =====
-
nk CurrentControlSet
+
<syntaxhighlight lang="reg">
-
cd CurrentControlSet
+
cd ControlSet001
-
nk Control
+
cd Control
cd Control
-
nk pci#ven_1af4&dev_1001&subsys_00000000
+
cd CriticalDeviceDatabase
-
nk pci#ven_1af4&dev_1001&subsys_00020000
+
nk pci#ven_1af4&dev_1001&subsys_00021af4
nk pci#ven_1af4&dev_1001&subsys_00021af4
-
 
+
cd pci#ven_1af4&dev_1001&subsys_00021af4
-
cd pci#ven_1af4&dev_1001&subsys_00000000
+
-
nv 1 ClassGUID
+
-
ed ClassGUID
+
-
{4D36E97B-E325-11CE-BFC1-08002BE10318}
+
nv 1 Service
nv 1 Service
ed Service
ed Service
viostor
viostor
-
cd ..
 
-
 
-
cd pci#ven_1af4&dev_1001&subsys_00020000
 
nv 1 ClassGUID
nv 1 ClassGUID
ed ClassGUID
ed ClassGUID
{4D36E97B-E325-11CE-BFC1-08002BE10318}
{4D36E97B-E325-11CE-BFC1-08002BE10318}
-
nv 1 Service
 
-
ed Service
 
-
viostor
 
-
cd ..
 
-
cd pci#ven_1af4&dev_1001&subsys_00021af4
 
-
nv 1 ClassGUID
 
-
ed ClassGUID
 
-
{4D36E97B-E325-11CE-BFC1-08002BE10318}
 
-
nv 1 Service
 
-
ed Service
 
-
viostor
 
cd ..
cd ..
cd ..
cd ..
cd ..
cd ..
-
nk Services
 
cd Services
cd Services
nk viostor
nk viostor
Line 57: Line 80:
ed Start
ed Start
00000000
00000000
-
 
-
nv 1 Group
 
-
ed Group
 
-
SCSI miniport
 
nv 4 ErrorControl
nv 4 ErrorControl
ed ErrorControl
ed ErrorControl
00000001
00000001
-
 
-
nv 1 ImagePath
 
-
ed ImagePath
 
-
system32\drivers\viostor.sys
 
nv 4 Tag
nv 4 Tag
ed Tag
ed Tag
-
00000021
+
00000033
 +
nv 2 ImagePath
 +
ed ImagePath
 +
System32\DRIVERS\viostor.sys
-
nk Parameters
+
nv 1 Group
-
nk Enum
+
ed Group
 +
SCSI miniport
 +
nk Parameters
cd Parameters
cd Parameters
nv 4 BusType
nv 4 BusType
Line 83: Line 103:
00000001
00000001
-
nk MaxTransferSize
+
nk PnpInterface
-
cd MaxTransferSize
+
cd PnpInterface
 +
nv 4 5
 +
ed 5
 +
00000001
 +
 
 +
cd ..
 +
cd ..
 +
 
 +
nk Security
 +
cd Security
 +
nv 3 Security
 +
 
 +
cd ..
 +
 
 +
cd Enum
 +
nk SCSI
 +
cd SCSI
 +
nk Disk&Ven_Red_Hat&Prod_VirtIO&Rev_0001
 +
cd Disk&Ven_Red_Hat&Prod_VirtIO&Rev_0001
 +
nk 4&1618751f&0&000
 +
cd 4&1618751f&0&000
 +
 
 +
nv 1 DeviceDesc
 +
ed DeviceDesc
 +
Lecteur de disque
-
nv 1 ParamDesc
+
nv 1 LocationInformation
-
ed ParamDesc
+
ed LocationInformation
-
Maximum Transfer Size
+
Bus Number 0, Target ID 0, LUN 0
-
nv 1 type
+
nv 4 Capabilities
-
ed type
+
ed Capabilities
-
enum
+
96
-
nv 1 default
+
nv 4 ConfigFlags
-
ed default
+
ed ConfigFlags
0
0
-
nk enum
+
nv 7 HardwareID
-
cd enum
+
ed HardwareID
 +
SCSI\DiskRed_Hat_VirtIO__________0001
 +
SCSI\DiskRed_Hat_VirtIO__________
 +
SCSI\DiskRed_Hat_
 +
SCSI\Red_Hat_VirtIO__________0
 +
Red_Hat_VirtIO__________0
 +
GenDisk
 +
--q
-
nv 1 0
+
nv 7 CompatibleIDs
-
ed 0
+
ed CompatibleIDs
-
64 KB
+
SCSI\Disk
 +
SCSI\RAW
 +
--q
-
nv 1 1
+
nv 1 ClassGUID
-
ed 1
+
ed ClassGUID
-
128 KB
+
{4D36E967-E325-11CE-BFC1-08002BE10318}
-
nv 1 2
+
nv 1 Service
-
ed 2
+
ed Service
-
256 KB
+
disk
-
cd ..
+
nv 1 Driver
-
cd ..
+
ed Driver
-
nk PnpInterface
+
{4D36E967-E325-11CE-BFC1-08002BE10318}\0002
-
cd PnpInterface
+
 
-
nv 4 5
+
nv 1 Class
-
ed 5
+
ed Class
-
00000001
+
DiskDrive
 +
 
 +
nv 1 Mfg
 +
ed Mfg
 +
(Lecteurs de disque standard)
 +
 
 +
nv 1 FriendlyName
 +
ed FriendlyName
 +
Red Hat VirtIO SCSI Disk Device
 +
 
 +
nk Device Parameters
 +
nk LogConf
cd ..
cd ..
cd ..
cd ..
-
cd Enum
+
cd ..
-
 
+
cd PCI
-
nv 1 0
+
nk VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00
-
ed 0
+
cd VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00
-
PCI\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\\3&13c0b0c5&0&20
+
nk 3&13c0b0c5&0&30
-
nv 4 Count
+
cd 3&13c0b0c5&0&30
-
ed Count
+
-
00000001
+
-
nv 4 NextInstance
+
-
ed NextInstance
+
-
00000001
+
q
q
y
y
-
</syntaxhighlight>
+
</syntaxhighlight><br />
-
<syntaxhighlight lang="bash" line start="1">
+
 
-
cp ~/tmp/config/system /mnt/WINDOWS/system32/config/
+
=== Define a new VM ===
-
sudo umount /mnt
+
* Arch : i686
-
</syntaxhighlight>
+
* Processor : 1 core
 +
* Memory : 1024 MB
 +
* HDD : VirtIO, raw, "v2WinXP.img"
 +
* CDROM : IDE, raw, "virtio-win-0.1-30.iso"
 +
* NIC : Bridge, virbr0
 +
http://blog.cyring.fr/wp-content/uploads/2012/11/VWINXP.png
 +
 
 +
=== Start the VM ===
 +
http://blog.cyring.fr/wp-content/uploads/2012/11/Win006.png<br />
 +
Tips: remove the previous driver to get the mouse back in work.

Latest revision as of 09:21, 5 November 2012

Contents

Prerequisite

This HowTo has been written using ArchLinux x86_64 Kernel 3.6.5
The following packages are mandatory

  1. pacman -S fuse qemu-kvm libvirt chntpw
  2. pacman -S base-devel
  3. pacman -S yaourt
  4. yaourt hivex

You may also installed the following ones

  1. pacman -S sudo wget libcdio

Convert VHD To KVM

  1. qemu-img convert -f vpc -O raw "Virtual Windows XP.vhd" v2WinXP.img
  2. wget http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-0.1-30.iso
  3. iso-read -i virtio-win-0.1-30.iso -e WXP/X86/VIOSTOR.SYS -o VIOSTOR.SYS
  4. iso-read -i virtio-win-0.1-30.iso -e WXP/X86/VIOSTOR.INF -o VIOSTOR.INF
  5. sudo mount -o loop,offset=32256 v2WinXP.img /mnt
  6. cp VIOSTOR.SYS /mnt/WINDOWS/system32/drivers/
  7. cp VIOSTOR.INF /mnt/WINDOWS/inf/
  8. mkdir ~/tmp/config
  9. cp /mnt/WINDOWS/system32/config/* ~/tmp/config/
  10. wget http://code.cyring.fr/FTS/Source/VM/WinXP/virtio_keys1.reg
  11. wget http://code.cyring.fr/FTS/Source/VM/WinXP/virtio_keys2.reg
  12. wget http://code.cyring.fr/FTS/Source/VM/WinXP/virtio_keys3.reg
  13. wget http://code.cyring.fr/FTS/Source/VM/WinXP/virtio_keys4.reg
  14. hivexregedit --merge ~/tmp/config/system virtio_keys1.reg
  15. hivexregedit --merge ~/tmp/config/system virtio_keys2.reg
  16. hivexregedit --merge ~/tmp/config/system virtio_keys3.reg
  17. hivexregedit --merge ~/tmp/config/system virtio_keys4.reg
  18. chntpw -e ~/tmp/config/system << EOF
  19. > cd ControlSet001
  20. > cd Services
  21. > cd Processor
  22. > ed Start
  23. > 4
  24. > q
  25. > y
  26. > EOF
  27. cp ~/tmp/config/system /mnt/WINDOWS/system32/config/
  28. sudo umount /mnt

Import into the registry

Download registry files @ code.cyring.fr/FTS

Editing Registry

  1. chntpw -e ~/tmp/config/system

Commands
cd ControlSet001
cd Control
cd CriticalDeviceDatabase
nk pci#ven_1af4&dev_1001&subsys_00021af4
cd pci#ven_1af4&dev_1001&subsys_00021af4
nv 1 Service
ed Service
viostor
nv 1 ClassGUID
ed ClassGUID
{4D36E97B-E325-11CE-BFC1-08002BE10318}
 
cd ..
cd ..
cd ..
cd Services
nk viostor
cd viostor
 
nv 4 Type
ed Type
00000001
 
nv 4 Start
ed Start
00000000
 
nv 4 ErrorControl
ed ErrorControl
00000001
 
nv 4 Tag
ed Tag
00000033
 
nv 2 ImagePath
ed ImagePath
System32\DRIVERS\viostor.sys
 
nv 1 Group
ed Group
SCSI miniport
 
nk Parameters
cd Parameters
nv 4 BusType
ed BusType
00000001
 
nk PnpInterface
cd PnpInterface
nv 4 5
ed 5
00000001
 
cd ..
cd ..
 
nk Security
cd Security
nv 3 Security
 
cd ..
 
cd Enum
nk SCSI
cd SCSI
nk Disk&Ven_Red_Hat&Prod_VirtIO&Rev_0001
cd Disk&Ven_Red_Hat&Prod_VirtIO&Rev_0001
nk 4&1618751f&0&000
cd 4&1618751f&0&000
 
nv 1 DeviceDesc
ed DeviceDesc
Lecteur de disque
 
nv 1 LocationInformation
ed LocationInformation
Bus Number 0, Target ID 0, LUN 0
 
nv 4 Capabilities
ed Capabilities
96
 
nv 4 ConfigFlags
ed ConfigFlags
0
 
nv 7 HardwareID
ed HardwareID
SCSI\DiskRed_Hat_VirtIO__________0001
SCSI\DiskRed_Hat_VirtIO__________
SCSI\DiskRed_Hat_
SCSI\Red_Hat_VirtIO__________0
Red_Hat_VirtIO__________0
GenDisk
--q
 
nv 7 CompatibleIDs
ed CompatibleIDs
SCSI\Disk
SCSI\RAW
--q
 
nv 1 ClassGUID
ed ClassGUID
{4D36E967-E325-11CE-BFC1-08002BE10318}
 
nv 1 Service
ed Service
disk
 
nv 1 Driver
ed Driver
{4D36E967-E325-11CE-BFC1-08002BE10318}\0002
 
nv 1 Class
ed Class
DiskDrive
 
nv 1 Mfg
ed Mfg
(Lecteurs de disque standard)
 
nv 1 FriendlyName
ed FriendlyName
Red Hat VirtIO SCSI Disk Device
 
nk Device Parameters
nk LogConf
 
cd ..
cd ..
cd ..
cd PCI
nk VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00
cd VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00
nk 3&13c0b0c5&0&30
cd 3&13c0b0c5&0&30
 
q
y

Define a new VM

  • Arch : i686
  • Processor : 1 core
  • Memory : 1024 MB
  • HDD : VirtIO, raw, "v2WinXP.img"
  • CDROM : IDE, raw, "virtio-win-0.1-30.iso"
  • NIC : Bridge, virbr0

VWINXP.png

Start the VM

Win006.png
Tips: remove the previous driver to get the mouse back in work.

Personal tools