问题
I am creating an installer which checks the registry for softwares/ components that are not installed and installs them if needed. The problem I am having is that the software I need to run launches correctly if I install the latest DirectX End-User Runtime from the DirectX End-User Runtime web installer on a fresh copy of Windows(http://www.microsoft.com/en-au/download/details.aspx?id=35).
The error I get if not installed is "The program can't start because d3dx9_43.dll is missing from your computer". Now even in a fresh install of windows, the DirectX registry entry from HKEY_LOCAL_MACHINE\Software\Microsoft\DirectX shows "4.09.00.0904" for the Version key.
So my question is, where do I look in the registry to check whether all components from the DirectX End-User Runtime are installed.
Really appreciate the help.
回答1:
You didn't mention what installer, script, or programming language you were using. That would be helpful to know.
If you aren't worried about download size, the easiest thing might be to just always install the DirectX Runtime blindly. It won't hurt to install it if it's already there.
Here's some other things you can consider:
If you are on Vista or later (including Win7, Win8, Server 2K8), then you likely don't need to install anything. As these operating systems likely ship with the binary pre-installed. Ditto for XP SP2 and later. Is your "fresh copy of Windows" something newer than XP?
Another simple idea is to just search for the existence of d3dx9_43.dll in either the Windows\System32 or Windows\SysWow64 directory.
Programatically, you can have your Installer code detect for the installation of the DLL as follows
#include <windows.h>
BOOL HasD3DX9()
{
HMODULE hMod = LoadLibrary("d3dx9_43.dll");
return (hMOD != NULL) ? TRUE : FALSE;
}
来源:https://stackoverflow.com/questions/11627013/check-registry-for-directx-end-user-runtime