HOWTO: Windows XP in both VM and native

HOWTO: Windows XP in both VM and native

Postby vkov_tinsky » 17. Sep 2008, 01:00

Windows XP: In both VM and native (using Linux as host OS)

Please post any comments/suggestions etc in this thread: Howto: Windows XP in both VM and native - DISCUSSION
Modedit: [TerryE] I have told VT that we will police this request by deleting any posts other than his from this topic, so please follow this suggestion.

I thought I'd summarise how I got WinXP running in a "dual" boot (running a single Windows installation both in VirtualBox and natively). Many thanks to TerryE for his input.
This article covers how to set up such a configuration from scratch. If you're looking to boot an existing Windows installation in VirtualBox please have a look at HOWTO: manage VDIs and import native installations instead. While using an existing installation is less work initially you're very likely to encounter driver related problems if you want to keep booting the installation natively also. This is why I chose to write about a from-scratch method instead.

WARNING: Only follow these instructions if you understand what you're doing, I'm not responsible for you losing your data!

  • The methods described below have been tested using VirtualBox v1.6.6 and v2.0.4 with a Windows XP SP2 32-bit guest and Ubuntu 8.04 32-bit host.
  • SATA support for raw disk access is broken in VirtualBox v2 versions prior to 2.0.4 (but not v1.6.6, see ticket #2182) ** Edit: v2.0.4 needs a workaround, see the ticket
  • If you find any errors or spelling mistakes (however small) please let me know via PM (unless it's major). If on the other hand you have suggestions reply to this thread.
  • And finally: Before replying with a question a) read the manual and b) search the forums. Most questions will have been answered before.
  1. Virtual Machine Configuration
  2. Partitioning
  3. VMDK creation and usage
  4. Installation (in VM)
  5. Booting natively
  6. Backup
  7. Windows activation
  8. What about Vista?
  9. Changes
Last edited by vkov_tinsky on 28. Oct 2008, 22:05, edited 23 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 17. Sep 2008, 02:19

I) Virtual Machine Configuration
  1. General Standard settings (as chosen by the wizard) will be adequate, taking the following into account:

    • [I/O APIC] This does not have to be turned on. (It would incur a slight performance penalty). Note: ACPI on the other hand has to be turned on, of course.
    • [SATA Controller] Enable this since it will offer much better I/O performance (see Installation section)
    • [Network] Enable one adapter and set its MAC address to that of your real network card (see Windows Activation section).
    • [Devices] Apart from the network adapter no other devices should be selected at this point, i.e. leaving USB, Audio etc. off. (These can be enabled, as required, after a second hardware profile has been created.)
  2. DMI BIOS settings (information taken from this thread)
    If you have an OEM version of Windows XP you should set these additional parameters as follows so your copy of Windows does not have to be reactivated. In total there are 13 such parameters (which you can set, see section 9.13 in the manual). To determine them use the below commands.

    First use dmidecode -t0:
    Code: Select all   Expand viewCollapse view
    vt@vt:~$ sudo dmidecode -t0
    # dmidecode 2.9
    SMBIOS 2.3 present.

    Handle 0x0000, DMI type 0, 20 bytes
    BIOS Information
            Vendor: Dell Computer Corporation
            Version: A12
            Release Date: 08/26/2004
            Address: 0xF0000
            Runtime Size: 64 kB
            ROM Size: 512 kB
                    PCI is supported
                    PNP is supported
            Bios Revision: 2.3
            Firmware Revision: 2.3

    This determines: DmiBIOSVendor (Dell Computer Corporation), DmiBIOSVersion (A12), DmiBIOSReleaseDate (08/26/2004), DmiBIOSReleaseMajor (2), DmiBIOSReleaseMinor (3), DmiBIOSFirmwareMajor (2) and DmiBIOSFirmwareMinor (3).
    • If Bios and Firmware Revisions are not listed, set them both to the version of SMBIOS.
    Subsequently run dmidecode -t1:
    Code: Select all   Expand viewCollapse view
    vt@vt:~$ sudo dmidecode -t1
    # dmidecode 2.9
    SMBIOS 2.3 present.

    Handle 0x0100, DMI type 1, 25 bytes
    System Information
            Manufacturer: Dell Computer Corporation
            Product Name: Dimension 4600i             
            Version: Not Specified
            Serial Number: JTGL999
            UUID: 99999C9C-9999-9999-999C-CAC99F999999
            Wake-up Type: Power Switch
            Family: X86-based PC

    This determines: DmiSystemVendor (Dell Computer Corporation), DmiSystemProduct (Dimension 4600i), DmiSystemVersion (Not Specified), DmiSystemSerial (JTGL999), DmiSystemUuid (99999C9C-9999-9999-999C-CAC99F999999) and DmiSystemFamily (X86-based PC).
    • If a field is not shown or indicates "Not Specified" fill it in as "<EMPTY>" (see below).
    Now you can use the VBoxManage setextradata command to set these fields. The easiest way is to do this with a script:
    Code: Select all   Expand viewCollapse view
    #! /bin/bash
    VM_NAME="xpraw" # Name of your Virtual Machine
    VSETED="VBoxManage setextradata $VM_NAME"
    $VSETED $CFG_PATH/DmiBIOSVendor       "Dell Computer Corporation"
    $VSETED $CFG_PATH/DmiBIOSVersion      "A12"
    $VSETED $CFG_PATH/DmiBIOSReleaseDate  "08/26/2004"
    $VSETED $CFG_PATH/DmiBIOSReleaseMajor  2
    $VSETED $CFG_PATH/DmiBIOSReleaseMinor  3
    $VSETED $CFG_PATH/DmiBIOSFirmwareMajor 2
    $VSETED $CFG_PATH/DmiBIOSFirmwareMinor 3
    $VSETED $CFG_PATH/DmiSystemVendor     "Dell Computer Corporation"
    $VSETED $CFG_PATH/DmiSystemProduct    "Dimension 4600i"
    $VSETED $CFG_PATH/DmiSystemVersion    "<EMPTY>"
    $VSETED $CFG_PATH/DmiSystemSerial     "JTGL999"
    $VSETED $CFG_PATH/DmiSystemUuid       "99999C9C-9999-9999-999C-CAC99F999999"
    $VSETED $CFG_PATH/DmiSystemFamily     "X86-based PC"
Last edited by vkov_tinsky on 24. Oct 2008, 13:00, edited 8 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 17. Sep 2008, 02:21

II) Partitioning

  • Note: Make sure you choose partition type 0x07 (instead of 0x17 - Hidden HPFS/NTFS) if you're planning to use NTFS (recommended) or you might end up with the "Autochk program not found" error when trying to boot natively. (See this posting.)
Configurations fall into the following three categories. By this I mean the location of the primary Windows partition. You might of course decide to use multiple partitions.
  1. Using the first partition on a disk or a whole disk
    This is the most straightforward scenario.
  2. Using a primary partition (but not the first)
    The Windows installer will try by default to install boot files (ntldr, NTDETECT.COM, etc.) onto the first partition of a disk and will fail if it is not allowed write to it. The solution to this is to set the partition you want to install Windows on as active (aka boot flag). The safest way to do it is to boot a LiveCD in VirtualBox with the raw vmdk attached and set it there. Alternatively, and only if you know what you're doing, you can do the following before and after you create the raw vmdk.
    Code: Select all   Expand viewCollapse view
    sudo parted [DISK] set [PARTITION] boot [on|off]
  3. Using a logical disk in the extended partition
    If you've already got one or more operating systems installed, or you only have one disk, chances are you fall into this category. In this case Windows will try to write to the first (or active) partition just like mentioned above. The solution in this case to create a tiny virtual disk (16MB will do) for Windows to put the boot partition on. Set this as the first disk in VirtualBox.
Last edited by vkov_tinsky on 24. Oct 2008, 16:11, edited 5 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 17. Sep 2008, 02:23

III) VMDK creation and usage

WARNING: You do not want applications on the Host OS to write to the partitions you're using in the guest as this can lead to data corruption. If you're using e.g. Ubuntu which automounts certain partitions it is advisable that you add the Windows partition(s) to fstab with the read-only flag.

  • For in-depth information about virtual disk images please see Tutorial: All about VDIs by TerryE.
  • The following assumes you have already created partitions (not necessarily formatted) to house your new Windows installation (unless you're planning to use the a whole disk).
  • Normally you won't want not use the -register parameter under Linux since it will register the vmdk with the root account instead of your own.
  • After you've created the vmdk you might have to change its permissions, owner and group so VirtualBox can access it.
  1. Check which partition you'll be using (if you're not planning to use the whole disk; This illustrates listing partitions on your first disk.)
    Code: Select all   Expand viewCollapse view
    sudo VBoxManage internalcommands listpartitions -rawdisk /dev/sda
    1. Create vmdk for whole disk (Note: Only use this method if you're planning to dedicate the whole disk to the guest Windows)
      Code: Select all   Expand viewCollapse view
       sudo VBoxManage internalcommands createrawvmdk -filename rawDiskXP.vmdk -rawdisk /dev/sda
    2. Create vmdk for one or more partitions. (This illustrates using only the 2nd partition, i.e. /dev/sda2. Using the -relative parameter means only access to your chosen partitions will be required afterwards.)
      Code: Select all   Expand viewCollapse view
       sudo VBoxManage internalcommands createrawvmdk -filename rawDiskXP.vmdk -rawdisk /dev/sda -partitions 2 -relative
  2. Set access to raw partitions from host

    For VirtualBox to be able to access the raw disk partitions you have several options:
    1. Run VirtualBox as root, or add your user to the disk group. This is not advisable in ANY scenario!
    2. Change permissions of the relevant partitions or disks.
      This involves giving yourself read and write access to a whole disk or partition, for example:
      Code: Select all   Expand viewCollapse view
      sudo chmod 666 /dev/sdb2

      This is however still somewhat dangerous since any application running under your account has full access to that partition (or disk).
    3. Use a separate user, just for raw disk access - (suggested by TerryE)
      To set up such a user and give it the right privileges and permissions you can do the following (where MYGROUP is the group you belong to which most likely has the same name as your username - you can check by running the id command):
      Code: Select all   Expand viewCollapse view
      sudo adduser rawvb --ingroup MYGROUP --no-create-home
      sudo usermod -a -G disk rawvb
      sudo usermod -a -G vboxusers rawvb

      To then start VirtualBox as this user use the following script:
      Code: Select all   Expand viewCollapse view
      #! /bin/bash
      VBUSER=rawvb                           # name of custom account created (which is a member of disk group)
      VM_NAME=xpraw                          # name of virtual machine

      chmod -R g=u /home/$USER/.VirtualBox   # make sure the other user will be able to access VirtualBox settings etc.
      xauth extract /home/$USER/cookieTmp $DISPLAY
      chmod g+r /home/$USER/cookieTmp
      sudo -u $VBUSER XAUTHORITY=/tmp/.Xauthority_$VBUSER xauth merge /home/$USER/cookieTmp
      rm /home/$USER/cookieTmp
      sudo -u $VBUSER XAUTHORITY=/tmp/.Xauthority_$VBUSER VBOX_USER_HOME=/home/$USER/.VirtualBox VBoxManage startvm $VM_NAME

      By default you will be prompted for your password when you run this script since you're trying to run xauth and VBoxManage as a different user. You can get around this by adding a rule to (the end of) /etc/sudoers. As an example the following would allow the user vt to run xauth and VBoxManage startvm xpraw as user rawvb without supplying a password and allowing changes to the environment (since we want to set VBOX_USER_HOME to that of the original user).
      Code: Select all   Expand viewCollapse view
      vt ALL=(rawvb) SETENV: NOPASSWD: /usr/bin/xauth, /usr/bin/VBoxManage startvm xpraw

      • Note: By default vi is the editor used to make changes to /etc/visudo. To edit it with a different program (in this example nano) run: sudo EDITOR=/usr/bin/nano visudo
  3. Add the newly created vmdk to VirtualBox using the Virtual Disk Manager

    Assuming you've given yourself (or a dedicated user) enough privileges VirtualBox should not report any errors.
Last edited by vkov_tinsky on 8. Oct 2008, 04:16, edited 14 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 17. Sep 2008, 02:24

IV) Installation (in VM)

[Optional] If you wish to enable SATA now see How to install a Windows XP guest with SATA support. (You can also enable SATA afterwards.)
  • Note: You might get an error message that Windows cannot format your partition (see here). If that is the case a possible workaround is to use IDE for now (and switch to SATA at step 7).
Boot your Windows XP CD in VirtualBox and install to your chosen partition (or disk). Once you get to the Windows desktop do the following:
  1. [Optional] Disable System Restore (This is recommended if you already have another Windows installation present.) However, if you do wish to disable System Restore, then we strongly recommend that you back up the system at key milestones as discussed in the Backup section below.
    Code: Select all   Expand viewCollapse view
    sc config srservice start= disabled
  2. Create a second hardware profile ("My Computer" -> Properties -> Hardware; This 2nd profile will be your VM profile.)
    • It's advisable to not set a timeout so you don't accidently end up booting using the wrong profile.
    • Give the hardware profiles meaningful names, e.g. "native" for the current one and "vm" for the one you've just created.
  3. Download MergeIDE
  4. Disable any VirtualBox related hardware (e.g. network card, Audio, Graphics, etc.) using Device Manager.
  5. Run MergeIDE with the Windows CD inserted as follows (where X is the CD drive letter):
    Code: Select all   Expand viewCollapse view
    MergeIDE.bat X
    Now this profile has been prepared for booting natively. (Warning: Do not boot this native profile anymore through VirtualBox.)
  6. Shut down, enable all additional devices you require (e.g. USB and Audio).
    Then boot again in VirtualBox using the vm hardware profile and install guest additions.

  7. [Optional] Download and run the Intel Matrix Storage Manager to install SATA drivers.
    Shutdown the VM and change your disk(s) from IDE to SATA and boot up again (using the vm hardware profile, of course).
    Note: You might also want to disable the Intel Matrix Storage Event Monitor service (IAANTMON) as well as removing IAAnotif from HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run since neither of these are needed.

  8. [Optional] Make startup programs only run in VM (and vice versa)
    This can be done by checking the name of the network card which in most cases will differ from that of the real adapter. Create a .cmd file (e.g. vm_only.cmd) with the following contents and save it to %windir%\system32:
    Code: Select all   Expand viewCollapse view
    ipconfig /all | find "AMD PCNET Family PCI Ethernet"
    if NOT ERRORLEVEL 1 start "" %1 %2 %3 %4 %5 %6 %7 %8 %9

    Now replace all VM specific entries in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. For example:
    Code: Select all   Expand viewCollapse view

    becomes (remember to put paths with spaces in quotes otherwise it will be interpreted as more than one argument):
    Code: Select all   Expand viewCollapse view
    cmd /c vm_only "C:\WINDOWS\system32\VBoxTray.exe"

    By the time you've also configured drivers and programs natively (in the Booting Natively section) you might end up with something like this.
  9. [Optional] Disable services not required in VM (and vice-versa)
    Wireless Zero Configuration (WZCSVC) and VirtualBox Guest Additions Service (VBoxService) are not needed in both VM and native hardware profiles. To disable them for just one profile select the desired service (Start -> Run -> services.msc) and choose properties. Under the "Log On" tab you can then choose whether to disable/enable the service for each hardware profile separately (like so).
    • Note: Other services which are only needed in the native hardware profile will appear with certain graphics drivers, e.g. NVIDIA Display Driver Service (NVSvc) and ATI Hotkey Poller.
  10. [Optional] Enable multi-core/processor support (for booting natively, also applies to Hyperthreading)
    Extract the following files from your Windows CD (also creating copies of the non-SMP files):
    Code: Select all   Expand viewCollapse view
    copy %WINDIR%\system32\hal.dll %WINDIR%\system32\halsp.dll
    copy %WINDIR%\system32\ntoskrnl.exe %WINDIR%\system32\ntkrnlsp.exe
    expand d:\i386\HALMACPI.DL_ -r %WINDIR%\system32
    expand d:\i386\NTKRNLMP.EX_ -r %WINDIR%\system32

    Add another entry to boot.ini (this is a hidden system file in your root directory) and modify the existing one to accommodate this, for example:
    Code: Select all   Expand viewCollapse view
    multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="WinXP (vm)" /execute /fastdetect /kernel=ntkrnlsp.exe /hal=halsp.dll
    multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="WinXP (native - SMP)" /execute /fastdetect /kernel=ntkrnlmp.exe /hal=halmacpi.dll
    • Note: The reason you have to also modify the existing entry (and copy the original files as shown above) is because Windows will overwrite them when it detects SMP support for the first time.
  11. If you installed your guest Windows to a logical drive, copy boot.ini, NTDETECT.COM and ntldr from the boot to the windows partition.
Last edited by vkov_tinsky on 29. Oct 2008, 17:02, edited 18 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 17. Sep 2008, 02:24

V) Booting natively

WARNING: Do not boot natively with the wrong hardware profile. This can stop your installation from working under VirtualBox.
  1. Add an entry to grub's menu.lst (where (hd0,0) denotes the disk and partition numbers).
    Code: Select all   Expand viewCollapse view
    title      Windows XP
    root      (hd0,0)
    chainloader   +1
    • Note: You might also have to add another entry to boot.ini on your Windows partition to point to the correct disk and partition. (See also this posting.)
  2. Boot your new Windows installation natively (using the native hardware profile)
    • Notes: It can take quite some time (~2mins) before Windows has finished scanning your hardware, i.e. USB keyboards and mice might not work at first, be patient. Be aware this will not work if auto-login is enabled, so keep it off. (See also this posting.) There is also a chance that you need to have your Windows CD inserted when booting or some drivers might not be installed.
    • [Optional] If you chose to enable multiprocessor support check in Device Manager whether your PC is shown as ACPI Multiprocessor PC.
  3. Install additional drivers
  4. [Optional] Make startup programs/services only run natively
    See points 8) and 9) in the Installation section on how this works. For programs, simply create another .cmd file, this time with the opposite rule:
    Code: Select all   Expand viewCollapse view
    ipconfig /all | find "AMD PCNET Family PCI Ethernet"
    if ERRORLEVEL 1 start "" %1 %2 %3 %4 %5 %6 %7 %8 %9
    • Note: One could alternatively check for the number of processors (if the smp kernel is in use) using the NUMBER_OF_PROCESSORS environment variable.
  5. [Optional] Get rid of the need to choose the correct hardware profile and boot.ini options on startup

    • Hardware profiles
      Set the native profile as default and reduce the profile prompt timeout to zero (HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB\UserWaitInterval). To now automatically choose the vm profile when booting in VirtualBox create a script as detailed here (under Hardware profiles - Usage). This basically boils down to modifying a registry key before boot and after shutdown.

    • boot.ini
      There are two options: You can either incorporate this into the script which already sets the correct hardware profile. Create a second boot.ini configuration and replace it before boot (vm). As above you obviously need to restore the original afterwards (so it's ready to be be booted natively again).
      The other solution is to create a tiny virtual disk to hold the Windows boot files (boot.ini, NTDETECT.COM and ntldr). This way you automatically have two separate boot.ini configurations.
Last edited by vkov_tinsky on 28. Oct 2008, 22:07, edited 15 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 17. Sep 2008, 23:54

VI) Backup

Instead of using backup software within the guest Windows you can simply save the whole partition (as suggested by TerryE).
  1. Compact and Zero free space on the partition by defragmenting the drive then running scdelete on the guest (where X is the raw partition which you want to back up, as it appears under the guest OS).
    Code: Select all   Expand viewCollapse view
    defrag /v X:
    scdelet -c X:
  2. Shut down the guest.
  3. Create a compressed copy of the partition on the host (were /dev/sdbX is the desired partition):
    Code: Select all   Expand viewCollapse view
    sudo dd if=/dev/sdbX | gzip -c > rawVMPartXBackup.gz

    You may of course choose a different compression method (e.g. bzip2 or 7zip) depending on space/time trade-offs. Gzip is the fastest and 7zip gives the best compression, with bzip2 lying between the two.

  4. To subsequently restore your backup you perform the reverse operation:
    Code: Select all   Expand viewCollapse view
    gunzip -c rawVMPartXBackup.gz | sudo dd of=/dev/sdbX

    WARNING: Be extremely careful which partition you specify to restore to. A single digit mistype and you could lose all information stored on another partition!
Last edited by vkov_tinsky on 18. Sep 2008, 21:36, edited 5 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 17. Sep 2008, 23:57

VII) Windows activation

Switching between VirtualBox and native boots normally would result in Windows XP deciding that reactivation is required due to the sheer number of hardware changes (e.g. chipset, graphics, audio, hdd, NIC - see this article). I have found a remedy for this (which works with my hardware setup at least).
  1. Activate Windows natively
    Create a backup copy of %WINDIR%\system32\wpa.dbl after activation.
  2. Set the virtual network adapter's MAC address to that of your real network adapter.
    • You can determine your MAC address(es) under Linux by running ifconfig.
    • If you have multiple network cards in your computer you will have to try each in turn (see next step): wrote:[...] It then calculates and records a number based on the first device of each type that was found during setup, [...]
  3. Boot Windows in VirtualBox
    If you set the correct MAC address Windows should not ask for reactivation. If it does:

    1. Shut down the guest.
    2. Temporarily mount the Windows partition and replace %WINDIR%\system32\wpa.dbl with your backup copy.
    3. Repeat step 2. using the MAC address of your next network adapter.
Last edited by vkov_tinsky on 18. Sep 2008, 15:53, edited 6 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 18. Sep 2008, 00:41

VIII) What about Vista?

A large portion of this howto applies to Windows Vista too but there are some key differences.
  1. SATA
    There is no need to install the driver for this anymore (as it comes with Vista).
  2. Multi-processor/core support (untested)
    Since Vista has a new boot manager (BCD) I do not know whether it is possible (and whether there is any need) to specify an alternate kernel to have multi-core support when booting natively.
  3. Activation (untested)
    This might work as described in the Activation section above.
  4. Hardware profiles (partially tested)
    Although hardware profiles are still used in Vista they are hidden from the user, i.e. there is neither an option to create a new one nor the possibility to choose a hardware profile when booting. It is however possible to manually create a second profile by editing the registry.

    • Creation
      1. Export the active hardware profile: HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current
      2. Open the exported .reg file with an editor and replace all occurences of \Current\ with \000X\ (where X is the next available number - check HKLM\SYSTEM\CurrentControlSet\Hardware Profiles.) Then import the modified .reg file.
      3. Export the following key for the active hardware profile: HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB\AcpiAlias\000a (where a denotes the active profile - HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB\CurrentConfig will tell you which one is active.)
      4. Edit the exported .reg file, replacing 000a with 000X (just as above) and import the changes back.
      5. Export the profile summary: HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB\000a
      6. Again edit and replace all occurences of 000a with 000X. Subsequently modify the last digit of HwProfileGuid in your exported .reg.
        • Warning: The new HwProfileGuid has to be unique. To check this do a search for it in the registry first.
        • Note: You can also change the FriendlyName value to e.g. "Native Profile".
        Once this is done re-import the modified profile summary.
      7. After rebooting Vista should be aware of your new profile: You can check via Services->[Any Service]->Properties->Log On which should now also show your new profile.
      • Usage
        Since it not possible to select a profile upon boot the only way (as far as I know) to achieve profile switching is to edit the registry before running Vista in the VM as the below script illustrates. In this example the normally read-only Vista partition is temporarily mounted writeable and the required registry key is set. Afterwards (when VirtualBox is closed) it is returned back to its original value (so Vista can be booted natively again).
        The regsetdword utility source is attached. (It is based on Petter Nordahl-Hagen's ntreg library.)
        Code: Select all   Expand viewCollapse view
        #! /bin/bash

        HWPROFILEVM=1     # VM hardware profile number
        HWPROFILENATIVE=2 # Native hardware profile number

        setHwProfile() {
          sudo umount $VISTA_MOUNT
          sudo mount -t ntfs-3g -o rw $VISTA_PARTITION $VISTA_MOUNT
          /home/vt/regsetdword/regsetdword -f $VISTA_MOUNT/$HIVE_PATH/SYSTEM $HWPROFILEKEY $1
          sleep 1
          sudo umount $VISTA_MOUNT
          sudo mount -t ntfs-3g -o ro $VISTA_PARTITION $VISTA_MOUNT

        setHwProfile $HWPROFILEVM
        /usr/bin/VirtualBox -startvm $VISTA_VM
        setHwProfile $HWPROFILENATIVE

        • Note: It is not possible to substitute VirtualBox with VBoxmanage since that will exit as soon as the VM has been initialised (unless of course a loop monitors the vm state for example).
regsetdword source code
(42.65 KiB) Downloaded 909 times
Last edited by vkov_tinsky on 11. Dec 2009, 22:57, edited 5 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Postby vkov_tinsky » 8. Oct 2008, 03:57


17/09/08 (vkov_tinsky)
  • Added possible solution to Activation section
  • Started backup section
  • Replaced grep in favour of find for selective startup
  • Added comment to highlight ACPI option requirement.
  • Removed GParted Live reference from Partitioning section (since it doesn't seem to work when creating VMDKs with the -relative parameter)
  • Instruction changed from uninstall to disable in Installation section
18/09/08 (vkov_tinsky)
  • Corrected commands (added sudo) in Backup section
  • Expanded script (running VirtualBox as different user) under VMDK usage section
  • Added DMI BIOS information to configuration section
  • Changed Activation solution
  • Changed selective startup example to use name of network device instead of MAC (since this will be need to be the same for activation purposes).
18/09/08 (terrye)
  • Added defrag before sdelete in backup section
  • Reformatted DMI script
  • BBCode tweaks to remove extraneous blank lines.
19/09/08 (vkov_tinsky)
  • Corrected multiprocessor enabling steps (now instructs to create copies of the non-SMP files first)
  • Completed VBox startup script how-to (for using with different user)
  • Replaced .bat with .cmd (selective startup)
  • Mentioned possibility for selective startup check to use env. var. detailing number of processors
20/09/08 (vkov_tinsky)
  • Corrected mistake in VBox startup script, added permission change
  • Corrected several spelling mistakes
08/10/08 (vkov_tinsky)
  • Added section detailing challenges with Vista
21/10/08 (vkov_tinsky)
  • Added point about selective service startup
  • Added a couple of screenshots to illustrate both types of selective startup
24/10/08 (vkov_tinsky)
  • Added note about possible need to modify boot.ini before booting natively
  • Added note about auto-login preventing device driver installation on first native boot
  • Added command to disable System Restore
  • Added comment about wrong NTFS partition type possibly causing boot problems
  • Added comment about needing to have Windows CD inserted in certain cases to have drivers installed correctly (when booting natively for the first time)
  • Modified note about SATA now that v2.0.4 is out
25/10/08 (vkov_tinsky)
  • Modified note about SATA: Still broken in 2.0.4 (but works with workaround)
  • Added notes about removing need for boot.ini & hardware profile choice on boot (in Booting natively section)
28/10/08 (vkov_tinsky)
  • Added comment about possible disadvantage of using an existing installation
29/10/08 (vkov_tinsky)
  • Added note about SATA possibly causing problems when Windows is trying to format the partition
11/12/09 (vkov_tinsky)
  • Attached regsetdword source to thread
Last edited by vkov_tinsky on 11. Dec 2009, 22:59, edited 2 times in total.
Posts: 218
Joined: 5. Apr 2008, 20:18

Return to Windows Guests

Who is online

Users browsing this forum: No registered users and 1 guest