d3dx9_42.dll
This file belongs to DirectX End-User Runtime. Install that package and the DLL arrives with it, in the right place and correctly registered.
Do not download this DLL on its own
Searching for a missing DLL by name leads to sites that hand you that single file. It is one of the oldest and most effective malware delivery methods there is, and a system DLL from an unknown source is indistinguishable from a deliberately modified one. There is never a legitimate reason to obtain a runtime component that way.
What it is
Another build of the DirectX 9 helper library. Each game was compiled against one specific version, which is why the trailing number varies between titles.
Where you see it: Games from the late 2000s and early 2010s.
The End-User Runtime installs every version at once, so there is no need to match the number yourself.
Install DirectX End-User Runtime
The official package, with the download URL Microsoft declares and the SHA-256 of every installer so you can verify it before running.
After downloading you can check the file against our index to confirm it is the installer the publisher shipped.