summaryrefslogtreecommitdiff
path: root/pjlib/src/pj/os_error_win32.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-01-20 21:03:36 +0000
committerBenny Prijono <bennylp@teluu.com>2006-01-20 21:03:36 +0000
commit7638eeee106fe58a1225f642e733629f29418818 (patch)
tree154947de290f76741923bbf8541dccd9c6386d93 /pjlib/src/pj/os_error_win32.c
parent47e7de1c94be7f826080b3711451eafee894791f (diff)
Completed testing for WinCE port
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@126 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/os_error_win32.c')
-rw-r--r--pjlib/src/pj/os_error_win32.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/pjlib/src/pj/os_error_win32.c b/pjlib/src/pj/os_error_win32.c
index 5001af4a..b8f0d039 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 @@ int platform_strerror( pj_os_err_type os_errcode,
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 @@ int platform_strerror( pj_os_err_type os_errcode,
//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;