Why so complicated? What about this?
```
#if defined(DX_OLD_SDK) || defined(__MINGW32__)
    #include <dxerr9.h>
    #ifndef DXGetErrorString
        #define DXGetErrorString DXGetErrorString9
    #endif
#else
    #include <dxerr.h>
#endif
```