How to add SATA drivers offline to a WIM image of Windows XP

I have been using ImageX to create WIM images of Windows XP for some time now. After imaging a Toshiba A9 laptop with an image created on a Toshiba A8, Windows XP failed to boot, displaying instead the dreaded Stop Error 0x0000007B INACCESSIBLE_BOOT_DEVICE. To quote the Microsoft knowledge base article: “This error may occur if the registry entries and the drivers for the mass storage controller hardware in the backup computer are not installed in Windows XP.” In other words, Windows doesn’t have the SATA drivers needed to communicate with the hard disk. The next step is usually to:

  1. Download the necessary drivers
  2. Copy the drivers to a floppy disk
  3. Run a repair install of XP
  4. Press F6 when prompted during Setup to install the drivers
  5. Run Sysprep
  6. Recapture an image that will now have the necessary drivers installed

This time however, I decided to take advantage of ImageX’s ability to easily mount a WIM image for offline editing. So here is what I did (be aware that this is a hack, it worked for me but there’s no guarantee that it’ll work for you):

  1. Downloaded and extracted the needed SATA drivers from the Toshiba website. The archive contains 6 files: iaahci.cat, iaahci.inf, iastor.cat, iastor.inf, iaStor.sys, and TXTSETUP.OEM.
  2. Mounted the WIM image of Windows XP to an empty folder (C:\Mount) using the command:
    imagex /mountrw C:\PathToYourWIMImage\WindowsXP.wim 1 C:\Mount
  3. Followed the instructions on this thread to copy the driver files where they belong:
    • Copied the .inf files (iaahci.inf and iastor.inf) to C:\Mount\Windows\inf
    • Copied the .sys file (iaStor.sys) to C:\Mount\Windows\system32\drivers
    • Copied all remaining files (iaahci.cat, iastor.cat, iaStor.sys, and TXTSETUP.OEM) to C:\Mount\Windows\system32

    • Loaded the HKEY_LOCAL_MACHINE\SYSTEM hive of the mounted image in the registry:
      • Opened the Registry Editor (type regedit at the command prompt)
      • Selected the HKEY_LOCAL_MACHINE hive
      • Clicked on File>Load Hive and selected C:\Mount\Windows\system32\config\system
      • Named the loaded hive Temp (it can be named anything you want)
    • In Notepad, created a .reg file (SATA_Keys.reg for example) to import the appropriate settings into the mounted hive (click on the picture to download SATA_Keys.doc that you’ll have to rename SATA_Keys.reg):
    Registry File

    How do you come up with this file? Well again, this thread helped a lot, as did that one.  Basically you have to open the .inf files (iaahci.inf and iastor.inf) and locate:

    • the ClassGUID entry in the [version] section.
    • the PCI\VEN entries in the [ControlFlags] section
    • the AddService value in the [iaStor_Inst.Services] section in this case.

    If you look back at the .reg file, you’ll notice that the first 6 keys, derived from iaahci.inf, all have the same ClassGUID, only the PCI\VEN values change. The next 6, derived from the other .inf file (iastor.inf), share a different ClassGUID. Finally, both .inf files refer to the same service (iaStor) which has to be added. Note that in this example, the hexadecimal value of ImagePath means “system32\drivers\iaStor.sys”.

    6.   Double-clicked the .reg file to merge the settings in the registry

    7.   Unloaded the Temp hive (File>Unload Hive)

    8.   Unmounted the WIM image without forgetting the /commit switch (or all the changes would be lost):

    imagex /unmount C:\Mount /commit

    9.   Reimaged the laptop which booted just fine and installed the SATA drivers from within the OS to ensure proper installation.

    About these ads

    15 responses to “How to add SATA drivers offline to a WIM image of Windows XP

    1. Hello,
      I have tried above with no luck. My scanarios is a bit different. I have Toshiba Tecra M5 and a Toshiba Protege M600.
      My M600 came with vista preinstalled whereas Tecra M5 is with XP.
      I wanted to stop using Tecra M5 and hence removed its hard disk and connected to M600. As expected, the disk was not sensed by M600.

      I tried the above steps and got stuck at step 6.
      This what I did
      1. The Tecra M5 disk was put into an external SATA disk drive case. This was then connected to a usb port of a another Tecra M5(third machine).
      2. All the driver files were copied to this external disk.
      3. started regedit, file -> load hive and gave the external disk\system32\config\system.
      4. clicked file -> import -> sata_keys.reg
      At this point, the regedit gives error
      cannot import c:\temp\sata_keys.reg: Error accessing the registry.

      Can you pls help me what’s wrong here ?

      Pls note that I am not using imagex here to mount the image because I dont really have an image.. I just have an hard disk with a complete installation of Win XP and I want to connect and use it with M600.

      Since the regedit stuff failed, I thought to connect this hard disk to M600 hoping that it may be able to see the iastor.sys newly copied but as expected, it could not !!!!

      If I were to use imagex, how do i proceed in this case because I dont really have an image, but I have an hard disk with the complete installation and I really dont want to do the XP repair or Install again as my hard disk has a lot of applications and credentials already configured

    2. Manoj,

      I would check the properties of the system hive you loaded into the registry. On the General tab, make sure that Read-only is not checked, on the Security tab, make sure that you have Full Control permission on the file.

    3. Hi,
      i treid the same with my compaq laptop
      v 6409tu
      and got the same error cannot access registry
      and i ve checked the permissons and they are correct
      Also there is no Security tab on the properties of the file maybe because im using fat32

      any suggestions?

    4. Hi, im using a compaq laptop and have the same problem,
      Cannot access Registry
      I have checked all security options and they are ok
      Is is because i ve manually integrated sp2 into the install cd?

    5. Steve Rochford

      This is brilliant – thanks so much!

      For Manoj and Suji – if you’re still having problems then it might be because you’re trying to load the .reg file and you haven’t loaded the hive to the place it expects.

      The article says “load the hive and call it TEMP – it can be anything you want”. This is true but if you don’t call it temp and put it in HKEY_USERS then you need to adjust the reg file so that it’s trying to load to the same place.

    6. This looks so promising. I am trying to avoid intalling a floppy drive on top of sysprepping and reimaging.

      I’ ve mounted my WIM, added the drivers, modded the registry and unmounted /commit ed the changes.

      When I image my box with the modded image I get error windows cannot start because the file windows\system32\config\system is missing or corrupt.

      Any thoughts, prior to finding this the image did as described, blue screened.

    7. You say load in HKLM as Temp, but reg file says HKU…

      Those confused /not working should load the hive under HKEY_USERS!

    8. Its working perfect on my Lenovo M58p

    9. I concur with Brandon. There is a typo/mismatch which appears to be bogging down most people reading this (most of the comments above are all related). Some things say HKLM and some HKU; they need to match for this to work.

    10. G413xZ Excellent article, I will take note. Many thanks for the story!

    11. Thank you!
      The INACCESSIBLE_BOOT_DEVICE issue has been bugging me for years, more often than not appearing when I move a Windows installation to new hardware without wanting to reinstall (for whatever reason).

      With this trick (albeit without using WIM images) I’m finally able to repair after a hardware change. Just saved me a lot of trouble!

      Cheers!

    12. good post here about the drivers. thanks

    13. This is a fantastic workaround for this issue in Windows XP! Thanks for posting this info. Now, there is no need to go back and rebuild a new WIM from scratch.

      Before reading this post, I performed more lengthy steps to resolve the 0X7b issues in WinXP with our WIM images. I downloaded and installed nLite to build a custom Windows XP SP3 ISO using the driver injection feature to embed the newest SATA drivers. After the ISO was burned, I had to go back and re-build a new WIM all over again.

    14. Hi,
      it worked greatly [nondestrucive] even with TestDisk v6.13dos. I have a Netbook, had no chance to backup had, have 2hidden prePartitions from WINDOWS7 Premium Home Edition wich are Type 27hex [hiddenFAT32] ‘BiosRVY’ and ‘System’ wich later needs to stay hidden & nonActiv (the MBR-bootmanager boots them if you press F3/rescue) my 2 main partitions NFTS 225GB Win7 & the backupMirror where not accesable anymore from the WIN-XP-bootUSB from HIREN’s bootCD while as dynamicDrive. TestDisk has a very tricky menu/key-system! SOME PRACTICE ON SMALL HDDs BEFORE IS RECOMMENDED. Also you should at least backup MBR & firstSectors with some tools (I needed them – first did’nt “ScanDeeper” !) And you Win7-partition needs to be activated
      again (bootableFLAG) with a part_MANAGER. One tricky thing is if you look for the files via ‘P’ the menu dos’nt show [ESC] wich you need to press, instead it shows [QUIT] or otherwise pressing a wrong key can be offnerving when you have to scan[deeper] again for hours!
      Christophe Grenier should be supported in trading tipps & tool-collections 4free. MiniTool Partition Wizard Home Edition 7.0 from HBCD is another
      useful tool (wich but can not handle dyn.Discs).

    15. Greetings! Very helpful advice within this article! It’s the little changes that make the greatest changes. Thanks a lot for sharing!

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s