Installing DirectX with DirectSetup

Applications and games that depend on DirectX can use the DirectXSetup function to install the necessary system components into an existing Windows installation.

Checking the Installed Version of DirectX

Before you install, here are several ways to find out what version of DirectX is installed:

Use D3DXCheckVersion to make sure the D3DX headers you build against match the D3DX library you're linking with.

Standard Install

DXSetup.exe is a standard installer that comes with the DirectX SDK. It provides an easy way for developers to install the DirectX runtime without having to write a custom installer. The standard installer is included in the following folder:

(SDK root)\Redist

The installer uses the DirectSetup API for version checking, setting up the type of install, displaying the end user license agreement (EULA), installing DirectX, progress reporting, and message handling. The installer displays all user interface (UI) components during the installation including the click-through-EULA, progress meter, and message handling.

The standard install is easy:

  1. If your application requires managed code, verify that the Microsoft .NET Framework is installed. Otherwise, skip to the next step.
  2. Call DXSetup.exe from the command line.

The installer supports all Windows operating systems from Windows 98 and up. The installer also supports the following languages:

Chinese (Simplified) Chinese (Traditional) Czech
Dutch English (American) French
German Italian Japanese
Korean Polish Portuguese (Brazil)
Russian Spanish Swedish

The standard install supports one command line option:

Custom Install

DirectSetup facilitates one-call installation of the DirectX components. DirectSetup Reference includes several API functions and structures as well as a callback function for customizing the user interface during the installation process. The DirectX SDK includes a sample application that demonstrates the use of this callback function (see Dinstall Sample). Follow the instructions for Redistributable Code contained in the license agreements within the following folder: (SDK root)\Documentation\License Agreements.

The DirectXSetup function takes a parameter (lpszRootPath), that points to the root directory of the installation. It can be NULL to indicate that the root path is the current directory.

The root directory must contain DXupdate.cab, DXDllreg_x86.cab, Dsetup.dll, Dsetup32.dll and any of the optional DirectX SDK redistributable files. To create the proper structure on your application setup disk, copy the redistributable code from one of the following locations into the root path of your setup program.

DirectSetup enables you to define a callback function for customizing the DirectX setup process. This callback function is referred to as DirectXSetupCallbackFunction, but you can give it any name.

You can use the callback function to do the following:

If a callback function is not provided by the setup program, the DirectXSetup function displays status and error information in a dialog box and obtains user input by calling the MessageBox function. If a callback is provided, the information that would have been used to create the status dialog or message box is instead passed to the callback. The callback function is called once for each DirectX component that can be installed or upgraded.

Create a callback function that conforms to the DirectXSetupCallbackFunction prototype, as in the following declaration.

DWORD WINAPI DirectXSetupCallbackFunction(
        DWORD dwReason,  
        DWORD dwMsgType, 
        LPSTR szMessage, 
        LPSTR szName, 
        void *pInfo);

In the Dinstall Sample, the name of the function is the same as that of the prototype, but this is optional. The way your callback function interprets the parameters is entirely up to you. Typically, you would choose which messages to display (based on dwReason) and when to present the user with alternatives, and you would modify the interface accordingly.

The callback function must return:

Before calling DirectXSetup, notify DirectSetup that you want to use a callback by calling the DirectXSetupCallbackFunction function, passing a pointer to the callback.

Uninstalling the DirectX SDK

To uninstall, use Add/Remove Programs from the Control Panel to uninstall the SDK.

Enabling AutoPlay

If you are building an AutoPlay compact disc title, copy the Autorun.inf file in the root directory of the SDK compact disc to the root of your application directory. This text file contains the following information.

[autorun] 
OPEN=SETUP.EXE 

If your application's setup program is called Setup.exe, you do not have to make any changes to this file; otherwise, edit this file to contain the name of your setup program.

DirectX Redistribution

Stand-alone developer runtime installers only install the DirectX developer and debug runtime for redistribution purposes. These installers are available for all supported platforms and are located at:

(SDK root)\Developer Runtime\

Applications can use the supplied standard installer, DXSetup.exe to redistribute DirectX. Be sure to follow the instructions for Redistributable Code contained in the license agreements at:

(SDK root)\Documentation\License Agreements

These files must be included in any distribution of DirectX as explained by the "DirectX Redist.txt" file found at:

(CD root)\Documentation\License Agreements\DirectX Redist.txt

Note    The D3DX library included in this release is dependant on the Direct3D runtimes that shipped with this SDK. Applications linking against the version of D3DX in this release must also redistribute the runtime from this SDK.

Naming Convention

The following naming convention is used for the optional redistributable components that are included in the DirectX redist folder:

D3DX

For D3DX files, the naming convention is:

MonthYear_Component_HeaderVersion_Platform.Ext

If you were installing the D3DX components from the December 2005 SDK release, you would use:

Dec2005_d3dx9_28_x86.cab
Dec2005_d3dx9_28_x64.cab

Note    There were no changes to the D3DX component for the October 2005 SDK release.

If you were installing the D3DX components from the August 2005 SDK release, you would use:

Aug2005_d3dx9_27_x86.cab
Aug2005_d3dx9_27_x64.cab

If you were installing the D3DX components from the June 2005 SDK release, you would use:

Jun2005_d3dx9_26_x86.cab
Jun2005_d3dx9_26_x64.cab

If you were installing the D3DX components from the April 2005 SDK release, you would use:

Apr2005_d3dx9_25_x86.cab
Apr2005_d3dx9_25_x64.cab

If you were installing the D3DX components from the Feb 2005 SDK release, you would use:

Feb2005_d3dx9_24_x86.cab
Feb2005_d3dx9_24_x64.cab

Follow this naming convention for future SDK releases.

DirectX for Managed Code

For DirectX for Managed Code, the naming convention is:

MonthYear_Component_Platform.Ext

Note    Starting with the December release, managed components are named MDX1.

So if you were installing the managed code components from the December 2005 SDK release, you would use:

Dec2005_MDX1_x86.cab

Starting with the December release, older managed code components are contained in an archive .cab. Use this .cab file instead of previous release .cab files to support older MDX components:

Dec2005_MDX1_x86_Archive.cab

XInput

For XInput files, the naming convention is:

MonthYear_Component_Platform.Ext

If you were installing the XInput components from the December 2005 SDK release, you would use:

Oct2005_xinput_x86.cab
Oct2005_xinput_x64.cab

Note    There were no behavioral changes to XInput in the December 2005 SDK release.

Reducing the DirectX Redistribution Size

The DirectX redist default file set contains all the files that are needed to support all DirectX applications. It is highly recommend that developers use all the files in the DirectX redist folder. To reduce the size of the DirectX redist footprint, you may remove optional DirectX SDK redistributable files. These files are listed in the (CD root)\Documentation\License Agreements\DirectX Redist.txt.

For example, here are several common scenarios:

For instance, suppose you know that your customer has DirectX 9.0c installed, and you want the smallest redist that only includes the 32-bit version of the D3DX library from the December 2005 SDK release. For this scenario, you need to include the following CAB files in the redist folder:

Your installation can use the DirectXSetup API or run DXSetup.exe to install the D3DX component.

Dependency on previous released optional SDK components

By default the DirectX Redist includes the previous versions of SDK redistributable components.

All the developer would need to do is include the default DirectX redist, which includes the all of the previously released SDK redist component packages (CAB files). No other changes are required by the developer.

DirectX Setup detects that the component's CAB package is available and installs the component's files appropriately via file version checking of the DLLs. These files would only be installed if they had higher versions. If for instance, a component of your application requires an optional component from the August 2005 release of the SDK, you would need to copy the appropriate CAB files from the August 2005 release redist folder to the current redist folder.

D3DX Applications Require:

Aug2005_d3dx9_27_x86.CAB 
Aug2005_d3dx9_27_x64.CAB

Managed DirectX Applications Require:

Dec2005_MDX1_x86_Archive.cab
Aug2005_d3dx9_27_x86.CAB 
Aug2005_d3dx9_27_x64.CAB