diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-01-12 19:27:48 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-12 19:27:48 +0000 |
commit | 1effc94df7e558de6319082e390803911cf45c24 (patch) | |
tree | f1b058ba18c1107621150bce9a2fc0eb410b4cb3 /src/compat/win32.cpp | |
parent | 4e0cd382dc4252306e0c2dc880c06b1fa4857c89 (diff) | |
download | libbu++-1effc94df7e558de6319082e390803911cf45c24.tar.gz libbu++-1effc94df7e558de6319082e390803911cf45c24.tar.bz2 libbu++-1effc94df7e558de6319082e390803911cf45c24.tar.xz libbu++-1effc94df7e558de6319082e390803911cf45c24.zip |
Plugger, and potentially anything that can use windows, can report windows
errors now...uh...woo?
Diffstat (limited to 'src/compat/win32.cpp')
-rw-r--r-- | src/compat/win32.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/compat/win32.cpp b/src/compat/win32.cpp index 6fcac15..052644a 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::FString 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::FString sRet( (char *)lpMsgBuf ); | ||
181 | |||
182 | LocalFree(lpMsgBuf); | ||
183 | |||
184 | return sRet; | ||
185 | } | ||
186 | |||
165 | #endif | 187 | #endif |
166 | 188 | ||