soulsmods / ModEngine2

Runtime injection library for modding Souls games. WIP
MIT License
885 stars 160 forks source link

Better diagnostics for failed DLL loads #159

Open nex3 opened 11 months ago

nex3 commented 11 months ago

Currently, if LoadLibraryW fails, ModEngine2 just prints a generic failure message without any additional details. This makes it very difficult to debug why a DLL can't be loaded, especially when it's failing for mod users but not the mod author. According to the LoadLibraryW documentation, extended error information can be retrieved with GetLastError() and formatted with FormatMessage (end-to-end example here). Including this message in the output would make these issues substantially easier to debug.