From 73eed8b1c7318b3b0e02e020f681f8b4f6597d6d Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 27 Jun 2005 04:22:36 +0000 Subject: [PATCH] add win32_throw_error function --- bindings/java/src/jni/win32/util.c | 7 ++++++- bindings/java/src/jni/win32/win32bindings.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bindings/java/src/jni/win32/util.c b/bindings/java/src/jni/win32/util.c index b3feefca..2b17c9bb 100644 --- a/bindings/java/src/jni/win32/util.c +++ b/bindings/java/src/jni/win32/util.c @@ -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), diff --git a/bindings/java/src/jni/win32/win32bindings.h b/bindings/java/src/jni/win32/win32bindings.h index 1b16fad0..190336db 100644 --- a/bindings/java/src/jni/win32/win32bindings.h +++ b/bindings/java/src/jni/win32/win32bindings.h @@ -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 }