diff options
Diffstat (limited to 'src/compat')
| -rw-r--r-- | src/compat/win32.cpp | 22 | ||||
| -rw-r--r-- | src/compat/win32.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/compat/win32.cpp b/src/compat/win32.cpp index 2a43ff9..b689322 100644 --- a/src/compat/win32.cpp +++ b/src/compat/win32.cpp | |||
| @@ -162,5 +162,27 @@ int Bu::Winsock2::__WSAFDIsSet( SOCKET s, fd_set *set ) { | |||
| 162 | return (*Bu::Winsock2::_fnptr___WSAFDIsSet)( s, set ); | 162 | return (*Bu::Winsock2::_fnptr___WSAFDIsSet)( s, set ); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | Bu::String Bu::getLastWinError() | ||
| 166 | { | ||
| 167 | LPVOID lpMsgBuf; | ||
| 168 | DWORD dw = GetLastError(); | ||
| 169 | |||
| 170 | FormatMessageA( | ||
| 171 | FORMAT_MESSAGE_ALLOCATE_BUFFER | | ||
| 172 | FORMAT_MESSAGE_FROM_SYSTEM | | ||
| 173 | FORMAT_MESSAGE_IGNORE_INSERTS, | ||
| 174 | NULL, | ||
| 175 | dw, | ||
| 176 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | ||
| 177 | (LPSTR) &lpMsgBuf, | ||
| 178 | 0, NULL ); | ||
| 179 | |||
| 180 | Bu::String sRet( (char *)lpMsgBuf ); | ||
| 181 | |||
| 182 | LocalFree(lpMsgBuf); | ||
| 183 | |||
| 184 | return sRet; | ||
| 185 | } | ||
| 186 | |||
| 165 | #endif | 187 | #endif |
| 166 | 188 | ||
diff --git a/src/compat/win32.h b/src/compat/win32.h index 67d80d3..1d82fbe 100644 --- a/src/compat/win32.h +++ b/src/compat/win32.h | |||
| @@ -89,6 +89,8 @@ namespace Bu | |||
| 89 | static char scode[15]; | 89 | static char scode[15]; |
| 90 | static char *gai_strerror( int iCode ); | 90 | static char *gai_strerror( int iCode ); |
| 91 | }; | 91 | }; |
| 92 | |||
| 93 | Bu::String getLastWinError(); | ||
| 92 | }; | 94 | }; |
| 93 | 95 | ||
| 94 | #ifdef FD_ISSET | 96 | #ifdef FD_ISSET |
