Completed testing for WinCE port
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@126 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pj/os_error_win32.c b/pjlib/src/pj/os_error_win32.c
index 5001af4..b8f0d03 100644
--- a/pjlib/src/pj/os_error_win32.c
+++ b/pjlib/src/pj/os_error_win32.c
@@ -21,6 +21,7 @@
#include <pj/compat/stdarg.h>
#include <pj/compat/sprintf.h>
#include <pj/compat/vsprintf.h>
+#include <pj/unicode.h>
#include <pj/string.h>
@@ -121,6 +122,7 @@
char *buf, pj_size_t bufsize)
{
int len;
+ PJ_DECL_UNICODE_TEMP_BUF(wbuf,128);
pj_assert(buf != NULL);
pj_assert(bufsize >= 0);
@@ -131,14 +133,28 @@
//PJ_CHECK_STACK();
*/
+#if PJ_NATIVE_STRING_IS_UNICODE
len = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
os_errcode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)buf,
- (DWORD)bufsize,
+ wbuf,
+ sizeof(wbuf),
NULL);
+ if (len) {
+ pj_unicode_to_ansi(wbuf, len, buf, bufsize);
+ }
+#else
+ len = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM
+ | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ os_errcode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ buf,
+ bufsize,
+ NULL);
+#endif
if (!len) {
int i;