DirectXSetupGetVersion

Retrieves the version number of the DirectX core runtime components that are currently installed.

INT DirectXSetupGetVersion(
  DWORD * pdwVersion,
  DWORD * pdwRevision
);

Parameters

pdwVersion
Pointer to the address of a variable to receive the version number. This parameter can be NULL if the version number is not wanted.
pdwRevision
Pointer to the address of a variable to receive the revision number. This parameter can be NULL if the revision number is not wanted.

Return Values

If the function succeeds, it returns nonzero.

If it fails, it returns 0.

Remarks

The DirectXSetupGetVersion function can be used to retrieve the version and revision numbers before or after the DirectXSetup function is called. If it is called before DirectXSetup is invoked, it gives the version and revision numbers of the DirectX core runtime components that are currently installed. If it is called after DirectXSetup is called, but before the computer is restarted, it gives the version and revision numbers of the DirectX components that take effect after the computer is restarted.

The version number in the pdwVersion parameter is composed of the major version number and the minor version number. The major version number is in the 16 most significant bits of the DWORD when this function returns. The minor version number is in the 16 least significant bits of the DWORD when this function returns. The version numbers can be interpreted as follows:

DirectX version Value pointed to by pdwVersion
DirectX 5 0x00040005
DirectX 6 0x00040006
DirectX 7 0x00040007
DirectX 8 0x00040008
DirectX 9 0x00040009

DirectX 9 supports only operating systems and DirectX versions later than Windows 98 and DirectX 5. This method will not return a value less than 0x00040005 for pdwVersion.

The version number in the pdwRevision parameter is composed of the release number and the build number. The release number is in the 16 most significant bits of the DWORD when this function returns. The build number is in the 16 least significant bits of the DWORD when this function returns.

All DirectX 8 releases have the same pdwVersion value. The pdwRevision parameter differentiates them. DirectX 8 versions do not install on Windows XP. Windows XP shipped with DirectX 8.1 and the DirectX 8.1a and DirectX 8.1b updates were included in Windows XP Service Pack 1. The following table lists the pdwRevision values for DirectX 8.

DirectX release pdwRevision Notes
DirectX 8
DirectX 8.1 0x0001032A 4.08.01.0810. Windows XP version.
DirectX 8.1 0x00010371 4.08.01.0881. This is the DirectX 8.1 version for the down level operating systems. 0371 is the hex version for 0881 decimal revision value.
DirectX 8.1a 0x00010385 4.08.01.0901. This release includes an update to Direct3D (D3d8.dll).
DirectX 8.1b 0x00010385 4.08.01.0901. This update includes a fix to DirectShow on Windows 2000 (Quartz.dll).
DirectX 8.2 0x00020386 4.08.02.0134.

All DirectX 9 releases have the same pdwVersion value. The pdwRevision parameter differentiates them. The following table lists the pdwRevision values for DirectX 9 releases.

DirectX release pdwRevision Notes
DirectX 9 0x00000384 4.09.00.0900. This release includes many updates across all DirectX components.
DirectX 9a 0x00000385 4.09.00.0901. This is an incremental update to DirectX 9, which include updates to DirectX for managed code, Graphics, and DirectSetup components.
DirectX 9b 0x00000386 4.09.00.0902. This is an incremental update, which includes DirectX 9a updates, plus additional updates to the DirectShow and Direct3D components.
DirectX 9c 0x00000387 4.09.00.0903. This is an incremental update, which includes DirectX 9b updates, plus additional updates for Windows XP Service Pack 2 (SP2). This is the default version for SP2.
DirectX 9c 0x00000388 4.09.00.0904. This is the SP2 release for downlevel platforms.

Note    There is no way to tell the difference between DirectX 8.1a and DirectX 8.1b with the pdwVersion and pdwRevision values. DirectX 8.1a updates only D3d8.dll. DirectX 8.1b includes the changes in DirectX 8.1a as well as updates to other files. Use GetFileVersionInfo to get version information for the following files.

On Windows 2000:

Quartz.dll 6.03.01.0885
Stream.sys 5.01.2600.0885
Mpg2splt.ax 6.03.01.0885
D3d8.dll 5.01.2600.0901
D3d8d.dll 5.01.2600.0901

On Windows 95 or later:

Mpg2splt.ax 6.03.01.0885
D3d8.dll 4.08.01.0901
D3d8d.dll 4.08.01.0901

The following sample code fragment demonstrates how the information returned by DirectXSetupGetVersion can be extracted and used.

DWORD dwVersion;
DWORD dwRevision;
if (DirectXSetupGetVersion(&dwVersion, &dwRevision))
{
    printf("DirectX version is %d.%d.%d.%d\n",
           HIWORD(dwVersion), LOWORD(dwVersion),
           HIWORD(dwRevision), LOWORD(dwRevision));
}

Version and revision numbers can be concatenated into a 64-bit quantity for comparison. The version number is in the 32 most significant bits and the revision number is in the 32 least significant bits.

Requirements

Header: Declared in Dsetup.h.

See Also

DirectXSetup