XPE tips

External debugging and compatibility

Installing DirectX 9.0c on XPE

Posted by himselfv on September 18, 2009

There’s a relatively well-known problem with DirectX 9.0c installer that manifests itself on some XP installations, including, maybe, your XPE image. The setup tool runs just fine, but when you click “Next” nothing happens. Installer window blinks for a moment, then displays “Installation complete. Installed components are ready to use”.

No general solution exists for this kind of problem because it might be caused by a different reasons. The simplest case is where you already have this or later DirectX version installed (you might have accidentally included “DirectX Registry Data” component in your configuration). To trick setup into thinking you don’t have DirectX yet, delete the following registry key:  HKLM\Software\Microsoft\DirectX. Actually, it’s enough to delete just subkeys “Version” and “InstalledVersion”, but if this is XPE image you probably have nothing else there anyway.

This does not always help. If it doesn’t, next thing to make sure of is that your DirectX redistributable is accessible by a simple file path. “Simple” means no spaces, no unicode symbols, preferably 8.3 folder and file names (yeah, this is most likely NOT required in any way, but making them 8.3 costs you nothing, so what’s the difference). For example, “E:\redist\dx9” is a simple path, and “E:\Application Installation Redistributables\Microsoft ® Windows © DiræctX 9.0c ” is a bad idea.

(When talking about DirectX redistributable, obviously I mean an unpacked local distributable. Web setup is another story which I’m not inclined to discuss since rarely anybody uses web setup on embedded systems, anyway. If you have a single-file setup, run it, type in a path and it’ll extract a bunch of files there. These files are the redistributable I’m talking about).

Another thing to remember is that DirectX 9.0c setup has an implicit dependency upon user.exe and ntkrnlpa.exe. If you’re working on your own XPE build, you have probably cut them down. User.exe is from “Dos Windows on Windows Support” component, which provides “Core architecture that is required to run 16-bit applications”. Who needs them, anyway. So you most likely don’t have neither user.exe nor ntkrnlpa.exe (most of XP distros don’t have the latter either). Theoretically these two are not explicitly required, but in practice you can try putting them in the setup folder and see if that helps.

Next come the obvious steps you would (be supposed to) do in such case. DirectX setup writes a log to “WinDir\DirectX.log”. Inspect it to see if there’s anything of help (usually not the case). Fire procmon and protocol the whole setup procedure to see if there’s any suspicious activity going on. Usually setup just loads dxsetup32.dll, which then enumerates audio devices, makes a few requests to ntkrnlpa.exe and user.exe, if they’re present, writes several messages into log, and that’s all. Run depwalker and inspect dxsetup.exe to check if there are any unresolved dynamic dependencies (for one, you need advpack.dll to unpack cabs, though this dependency is explicit and you’ll simply see an error when you run dxsetup.exe).

The above steps might help, but the chances are low. In some, if not in the majority of cases, neither procmon nor depwalker help, as the setup process seems to be going perfectly normal judging from their data. So we’re back at square one. What to do? Well, there are two ways of installing DirectX 9.0c if the installer is acting weird. One is more straightforward, but the other is cleaner and has better results. I’ll describe both.

First, you can use DirectX 9.0b setup to install DirectX 9.0c files. For that, download DirectX 9.0b redistributable from the internet (you’ll have to google for it a bit, since Microsoft does not seem to host it anymore). Ensure that what you have is indeed 9.0b and not 9.0c since some web pages tend to replace the underlying file with a new version without modifying the link description. Then, delete all the *.cab files from the 9.0b redist and replace them with *.cab files from the 9.0c redist. Delete the registry data as described in this post earlier, then run 9.0b setup and it’ll happily install 9.0c.

Well, it turns out, not so happily, because dxdiag will report some files being of older version than needed. I did not investigate this and my guess is that you can safely ignore this message because it’s probably caused not by files being outdated, but by dxdiag thinking wrong about which version they should be. Still, the warning is there, and this kinda makes me uneasy. So we will try installing 9.0c another way.

Open 9.0c redist. In there you see a bunch of *.cab files. These files contain:

  • BDA.cab – BDA for Windows 9x
  • BDANT.cab – BDA for Windows NT, excluding XP
  • BDAXP.cab – BDA for Windows XP
  • DirectX.cab – DirectX for Windows 9x
  • dxnt.cab – DirectX for Windows NT, including XP
  • ManagedDx.cab – Managed DirectX extensions (for any Windows family)

BDA stands for Broadcast Driver Architecture and is related to video capture. You might decide to leave it out if you don’t care about video capturing, or to install it with everything else. By the way, DirectX installer is smart enough to let you delete the cab files you don’t need. For example, if you’re planning on installing only native DirectX and only on XP systems, you’re fine to include only “dxnt.cab”, which will significantly lessen the size of your redistributable.

So, let’s say we want to install DirectX only on our XPE image. (BDA and DirectX for 9x are handled in a similar way, and ManagedDx contains a single msi installer which is even simpler to handle). Unpack dxnt.cab. It contains a bunch of things, including several *.inf files, which is what we need. These inf files contain all the information about DirectX installation. Unfortunately, not all of them have the DefaultInstall section, so we’ll need to go through the procedures of installing them from the command-line. For that, we need setupapi.dll and rundll32.exe (as usual, if they’re not in your image, you can just place them in the same folder with DirectX):

RunDll32 setupapi.dll,InstallHinfSection <section> <reboot-mode> <inf-file>

Here comes the trickiest part. As I noted before, often inf files have the “DefaultInstall” section which is triggered by the right-click install command. If an inf file has that section, just write “DefaultInstall” as the section name for it. If it doesn’t, you’ll have to look into it a bit and determine which section it is that you want. For example, in several DirectX inf files main section is called something like “[ComponentName].Install”, for instance, “KD.Install”, or something like that. In other files there are several main sections for different platforms. In this case you need the one for XP (i.e. “WINXP_INSTALL”), or, the next closest, for NT. These may be named arbitarily, there’s no convention dictating how to name them, so you’ll have to decide which section you need for yourself.

To simplify installation, write a command file:

@echo off
echo Installing DirectX 9.0c, please wait...
RunDll32 setupapi.dll,InstallHinfSection DefaultInstall 128 .\a.inf
RunDll32 setupapi.dll,InstallHinfSection DefaultInstall 128 .\b.inf
RunDll32 setupapi.dll,InstallHinfSection WINXP_INSTALL 128 .\c.inf
RunDll32 setupapi.dll,InstallHinfSection NTFamilyProductInstall 128 .\d.inf

Mention every file in that way, except for DxDllReg.inf. That file needs special treatment. Also don’t install ks.inf, kscaptur.inf and ksproxy.inf; these will be copied into your system’s inf directory. Yet, install ksreg.inf.
Now, add the following lines to the end of your script:

RunDll32 setupapi.dll,InstallHinfSection DXDllUnRegister 128 .\dxdllreg.inf
RunDll32 setupapi.dll,InstallHinfSection DXDllRegister 128 .\dxdllreg.inf

This way we re-register everything.

Run the script, wait for it to finish, ensure that there were no errors and start dxdiag. All the files are of the correct version now. DirectX 9.0c is installed!

Advertisements

One Response to “Installing DirectX 9.0c on XPE”

  1. As of XPE SP3, I can confirm that both the componentized DX9 installer, as well as a recent “consumer” 9.0c redistribution, or both, will install properly PROVIDED all required components are present.

    However, there are still a number of horrifying problems trying componentize high-definition audio (HDA) drivers under XPE… I’m going to try and summarize the most important of these, and some workarounds, in a full article shortly.

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

 
%d bloggers like this: