Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WINE meta-data to OS context. #1004

Open
supervacuus opened this issue Jun 5, 2024 · 0 comments
Open

Add WINE meta-data to OS context. #1004

supervacuus opened this issue Jun 5, 2024 · 0 comments
Labels
area: core enhancement New feature or request help wanted We won't work on this but would accept PRs Platform: Native

Comments

@supervacuus
Copy link
Collaborator

supervacuus commented Jun 5, 2024

One can also add Wine metadata to the context if the app is ran under that:

{
    // Add WINE version metadata if running under WINE
    HMODULE hntdll;
    typedef const char* (CDECL* wine_get_version_t)();
    typedef const char* (CDECL* wine_get_build_id_t)();
    typedef void (CDECL* wine_get_host_version_t)(const char** sysname, const char** release);
    wine_get_version_t wine_get_version;
    wine_get_build_id_t wine_get_build_id;
    wine_get_host_version_t wine_get_host_version;
    if ((hntdll = GetModuleHandleA("ntdll.dll")) && (wine_get_version = reinterpret_cast<wine_get_version_t>(GetProcAddress(hntdll, "wine_get_version"))))
    {
        sentry_value_t wine_ctx = sentry_value_new_object();

        sentry_value_set_by_key(wine_ctx, "version", sentry_value_new_string(wine_get_version())); // example: 7.11
        if (wine_get_build_id = reinterpret_cast<wine_get_build_id_t>(GetProcAddress(hntdll, "wine_get_build_id")))
            sentry_value_set_by_key(wine_ctx, "build", sentry_value_new_string(wine_get_build_id())); // example: wine-7.11
        if (wine_get_host_version = reinterpret_cast<wine_get_host_version_t>(GetProcAddress(hntdll, "wine_get_host_version")))
        {
            const char* sysname; // example: Linux
            const char* release; // example: 5.16.20-2-MANJARO
            wine_get_host_version(&sysname, &release);
            sentry_value_set_by_key(wine_ctx, "sysname", sentry_value_new_string(sysname));
            sentry_value_set_by_key(wine_ctx, "release", sentry_value_new_string(release));
        }

        sentry_set_context("wine", wine_ctx);
    }
}

Originally posted by @p0358 in #943 (comment)

Adding this to Sentry must essentially follow the same steps as in this PR: #963

@github-project-automation github-project-automation bot moved this to Needs Discussion in Mobile & Cross Platform SDK Jun 5, 2024
@supervacuus supervacuus added enhancement New feature or request help wanted We won't work on this but would accept PRs area: core labels Jun 5, 2024
@kahest kahest moved this from Needs Discussion to Backlog in Mobile & Cross Platform SDK Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core enhancement New feature or request help wanted We won't work on this but would accept PRs Platform: Native
Projects
Status: Backlog
Development

No branches or pull requests

2 participants