add win32_throw_error function

This commit is contained in:
Doug MacEachern committed 2005-06-27 04:22:36 +00:00
1 parent 9e79ac3d83
commit 73eed8b1c7
2 files changed
+8 -1

No files matched your search

+6 -1
View File
@@ -21,13 +21,18 @@ void win32_throw_exception(JNIEnv *env, char *msg)
}
void win32_throw_last_error(JNIEnv *env)
{
win32_throw_error(env, GetLastError());
}
void win32_throw_error(JNIEnv *env, LONG err)
{
char msg[8192];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
err,
0, /* default language */
(LPTSTR)msg,
(DWORD)sizeof(msg),
@@ -28,6 +28,8 @@ extern "C" {
#endif
void win32_throw_exception(JNIEnv *env, char *msg);
void win32_throw_error(JNIEnv *env, LONG err);
void win32_throw_last_error(JNIEnv *env);
#ifdef __cplusplus
}