From 436a97dd25b613e09266d9b374c8bdc33db920ce Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 30 Jun 2026 11:05:38 +0200 Subject: [PATCH 1/2] feat: add wide-char versions of sentry_capture_minidump* --- include/sentry.h | 10 ++++++++++ src/sentry_core.c | 27 +++++++++++++++++++++++---- tests/unit/test_basic.c | 26 ++++++++++++++++++++++++++ tests/unit/tests.inc | 1 + 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/include/sentry.h b/include/sentry.h index 28c3cde0ce..341d1af10b 100644 --- a/include/sentry.h +++ b/include/sentry.h @@ -2158,6 +2158,16 @@ SENTRY_API sentry_uuid_t sentry_capture_minidump(const char *path); SENTRY_API sentry_uuid_t sentry_capture_minidump_n( const char *path, size_t path_len); +#ifdef SENTRY_PLATFORM_WINDOWS +/** + * Wide char versions of `sentry_capture_minidump` and + * `sentry_capture_minidump_n`. + */ +SENTRY_API sentry_uuid_t sentry_capture_minidumpw(const wchar_t *path); +SENTRY_API sentry_uuid_t sentry_capture_minidumpw_n( + const wchar_t *path, size_t path_len); +#endif + /** * Captures a system-native exception that you retrieve when you manually handle * `POSIX` signals or `SEH` exceptions and want to keep using that handling diff --git a/src/sentry_core.c b/src/sentry_core.c index 6fdc4116dd..984e50a83a 100644 --- a/src/sentry_core.c +++ b/src/sentry_core.c @@ -1798,11 +1798,9 @@ sentry_capture_minidump(const char *path) return sentry_capture_minidump_n(path, sentry__guarded_strlen(path)); } -sentry_uuid_t -sentry_capture_minidump_n(const char *path, size_t path_len) +static sentry_uuid_t +capture_minidump(sentry_path_t *dump_path) { - sentry_path_t *dump_path = sentry__path_from_str_n(path, path_len); - if (!dump_path) { SENTRY_WARN( "sentry_capture_minidump() failed due to null path to minidump"); @@ -1879,6 +1877,13 @@ sentry_capture_minidump_n(const char *path, size_t path_len) return sentry_uuid_nil(); } +sentry_uuid_t +sentry_capture_minidump_n(const char *path, size_t path_len) +{ + sentry_path_t *dump_path = sentry__path_from_str_n(path, path_len); + return capture_minidump(dump_path); +} + static sentry_attachment_t * add_attachment(sentry_attachment_t *attachment) { @@ -1982,4 +1987,18 @@ sentry_attach_bytesw_n(const char *buf, size_t buf_len, const wchar_t *filename, return add_attachment(sentry__attachment_from_buffer( buf, buf_len, sentry__path_from_wstr_n(filename, filename_len))); } + +sentry_uuid_t +sentry_capture_minidumpw(const wchar_t *path) +{ + size_t path_len = path ? wcslen(path) : 0; + return sentry_capture_minidumpw_n(path, path_len); +} + +sentry_uuid_t +sentry_capture_minidumpw_n(const wchar_t *path, size_t path_len) +{ + sentry_path_t *dump_path = sentry__path_from_wstr_n(path, path_len); + return capture_minidump(dump_path); +} #endif diff --git a/tests/unit/test_basic.c b/tests/unit/test_basic.c index 9fa06b7477..4978a424f7 100644 --- a/tests/unit/test_basic.c +++ b/tests/unit/test_basic.c @@ -275,6 +275,32 @@ SENTRY_TEST(capture_minidump_basic) #endif } +SENTRY_TEST(capture_minidump_wide) +{ +#if !defined(SENTRY_PLATFORM_WINDOWS) || defined(SENTRY_PLATFORM_XBOX) + SKIP_TEST(); +#else + SENTRY_TEST_OPTIONS_NEW(options); + sentry_init(options); + + const wchar_t *minidump_rel_path = L"../fixtures/minidump.dmp"; + sentry_path_t *path = sentry__path_from_str(__FILE__); + sentry_path_t *dir = sentry__path_dir(path); + sentry_path_t *minidump_path + = sentry__path_join_wstr(dir, minidump_rel_path); + + const sentry_uuid_t event_id + = sentry_capture_minidumpw(minidump_path->path_w); + TEST_CHECK(!sentry_uuid_is_nil(&event_id)); + + sentry__path_free(minidump_path); + sentry__path_free(dir); + sentry__path_free(path); + + sentry_close(); +#endif +} + SENTRY_TEST(capture_minidump_null_path) { // a NULL path will activate the path check at the beginning of the function diff --git a/tests/unit/tests.inc b/tests/unit/tests.inc index 8adce0aadf..8170e4570c 100644 --- a/tests/unit/tests.inc +++ b/tests/unit/tests.inc @@ -80,6 +80,7 @@ XX(capture_minidump_basic) XX(capture_minidump_discard) XX(capture_minidump_invalid_path) XX(capture_minidump_null_path) +XX(capture_minidump_wide) XX(capture_minidump_without_sentry_init) XX(check_version) XX(child_spans) From 2561c8bd80d82e478a039ba98d20159aa7c4f7c6 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 30 Jun 2026 11:12:42 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d6f56c5ef..c4c9cae9f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ **Features** - Android: Expose app-hang detection through the NDK bindings via `NdkOptions.setEnableAppHangTracking()` and `NdkOptions.setAppHangTimeoutMillis()`. ([#1823](https://github.com/getsentry/sentry-native/pull/1823)) +- Windows: add wide-char versions of `sentry_capture_minidump` and `sentry_capture_minidump_n`. ([#1827](https://github.com/getsentry/sentry-native/pull/1827)) ## 0.15.2