]> git.sur5r.net Git - openldap/blob - libraries/liblutil/nt_err.c
fix flag on formatMessage to not allocate buffer
[openldap] / libraries / liblutil / nt_err.c
1 #include <windows.h>
2 #include <winerror.h>
3
4 #define __RETSTR( x ) case x: return #x;
5
6 char *GetErrorString( int err )
7 {
8         static char msgBuf[1024];
9
10         FormatMessage(
11                 FORMAT_MESSAGE_FROM_SYSTEM,
12                 NULL,
13                 err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
14                 msgBuf, 1024, NULL );
15         return msgBuf;
16 }
17
18 char *GetLastErrorString( void )
19 {
20         return GetErrorString( GetLastError() );
21 }
22
23 #undef __RETSTR