diff options
| author | Juan Linietsky | 2017-12-01 08:42:57 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2017-12-01 08:45:36 -0300 |
| commit | 0243803117b2a67a33a9e01cf97e79ea4cf48c54 (patch) | |
| tree | f17c3f1bc5905dda81c04808f83a0a374493cdda /platform/windows/os_windows.cpp | |
| parent | d81c5004b1eb7e2041e18e8f4af1a6ac38be3fce (diff) | |
| download | godot-0243803117b2a67a33a9e01cf97e79ea4cf48c54.tar.gz godot-0243803117b2a67a33a9e01cf97e79ea4cf48c54.tar.zst godot-0243803117b2a67a33a9e01cf97e79ea4cf48c54.zip | |
Diffstat (limited to 'platform/windows/os_windows.cpp')
| -rw-r--r-- | platform/windows/os_windows.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 3bdc307c3..9bcbb6ddb 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -69,8 +69,26 @@ __attribute__((visibility("default"))) DWORD NvOptimusEnablement = 0x00000001; #define WM_TOUCH 576 #endif +static String format_error_message(DWORD id) { + + LPWSTR messageBuffer = NULL; + size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL); + + String msg = "Error "+itos(id)+": "+String(messageBuffer,size); + + LocalFree(messageBuffer); + + return msg; + +} + + + extern HINSTANCE godot_hinstance; + + void RedirectIOToConsole() { int hConHandle; @@ -1604,7 +1622,7 @@ Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_han } if (!p_library_handle) { - ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + String::num(GetLastError())); + ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + format_error_message(GetLastError())); ERR_FAIL_V(ERR_CANT_OPEN); } return OK; |
