Skip to content

Commit

Permalink
Format exception message with neutral locale.
Browse files Browse the repository at this point in the history
  • Loading branch information
rschatz committed May 6, 2024
1 parent 9016d16 commit 52f7096
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion truffle/src/com.oracle.truffle.nfi.native/src/lookup_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ static void throwError(JNIEnv *env, jlong context) {
DWORD error = GetLastError();
struct __TruffleContextInternal *ctx = (struct __TruffleContextInternal *) context;
LPSTR msg;
DWORD lang = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);

FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, 0, (LPSTR) &msg, 0,
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, lang, (LPSTR) &msg, 0,
NULL);
(*env)->ThrowNew(env, ctx->UnsatisfiedLinkError, msg);
LocalFree(msg);
Expand Down

0 comments on commit 52f7096

Please sign in to comment.