There's a lot of code bloat here. How about something like:
```
const char *format = "__imp_%s" + (config.exe != EX_WIN64);
```
?