From a287ebaaf970c5ca34639264d1dbc5156fbb2f5f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 27 Mar 2024 14:00:11 -0600 Subject: [PATCH] lsteamclient: Propagate Unix side access violation to the PE side exception. CW-Bug-Id: #23623 --- lsteamclient/steamclient_main.c | 13 +++++++++++++ lsteamclient/unixlib.h | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lsteamclient/steamclient_main.c b/lsteamclient/steamclient_main.c index 22262bf0..a9fab1b2 100644 --- a/lsteamclient/steamclient_main.c +++ b/lsteamclient/steamclient_main.c @@ -73,6 +73,19 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) return TRUE; } +NTSTATUS steamclient_call( unsigned int code, void *args, const char *name ) +{ + NTSTATUS status = WINE_UNIX_CALL( code, args ); + + if (status == STATUS_ACCESS_VIOLATION) + { + ERR( "Access violation in %s.\n", name ); + RaiseException( status, 0, 0, NULL ); + } + if (status) WARN( "%s failed, status %#x\n", name, (UINT)status ); + return status; +} + static BYTE *alloc_start, *alloc_end; static int8_t allocated_from_steamclient_dll( void *ptr ) diff --git a/lsteamclient/unixlib.h b/lsteamclient/unixlib.h index 991e2b01..c5f6eea6 100644 --- a/lsteamclient/unixlib.h +++ b/lsteamclient/unixlib.h @@ -216,10 +216,11 @@ struct networking_message #include +NTSTATUS steamclient_call( unsigned int code, void *args, const char *name ); + #define STEAMCLIENT_CALL( code, args ) \ ({ \ - NTSTATUS status = WINE_UNIX_CALL( unix_ ## code, args ); \ - if (status) WARN( #code " failed, status %#x\n", (UINT)status ); \ + NTSTATUS status = steamclient_call( unix_ ## code, args, #code ); \ assert( !status ); \ status; \ })