medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 767fc2b1483d0f495e6eb9de0db249415ac11de9
parent 007770b61ae2ff7485efb75af0de6f764ddc9c8a
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Wed Sep 14 16:04:43 +0100

Print real error messages in win32_library.h

Diffstat:
win32_library.h | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/win32_library.h b/win32_library.h @@ -14,9 +14,14 @@ FARPROC library_function( Library lib, const char * name ) { } const char * library_last_error() { - u32 error = GetLastError(); - static char buf[ 8 ]; - sprintf( buf, "%d", error ); + /* + * TODO: maybe this should go in a helper function + * these functions should really only get called by the main thread, so + * this should be ok + */ + static char buf[ 1024 ]; + FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError() + MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), buf, sizeof( buf ), NULL ); return buf; }