aboutsummaryrefslogtreecommitdiff
path: root/src/compat/win32.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compat/win32.cpp')
-rw-r--r--src/compat/win32.cpp22
1 files changed, 22 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
165Bu::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