Skip to content

Commit

Permalink
libobs: Log windows release version
Browse files Browse the repository at this point in the history
This logs the Windows release version (e.g. 1809, 1903, etc)
  • Loading branch information
jp9000 committed Jan 4, 2020
1 parent de3de2a commit eadb96f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libobs/obs-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,22 @@ static void log_available_memory(void)
(DWORD)(ms.ullAvailPhys / 1048576), note);
}

extern const char *get_win_release_id();

static void log_windows_version(void)
{
struct win_version_info ver;
get_win_ver(&ver);

const char *release_id = get_win_release_id();

bool b64 = is_64_bit_windows();
const char *windows_bitness = b64 ? "64" : "32";

blog(LOG_INFO, "Windows Version: %d.%d Build %d (revision: %d; %s-bit)",
ver.major, ver.minor, ver.build, ver.revis, windows_bitness);
blog(LOG_INFO,
"Windows Version: %d.%d Build %d (release: %s; revision: %d; %s-bit)",
ver.major, ver.minor, ver.build, release_id, ver.revis,
windows_bitness);
}

static void log_admin_status(void)
Expand Down
10 changes: 10 additions & 0 deletions libobs/util/platform-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
static bool have_clockfreq = false;
static LARGE_INTEGER clock_freq;
static uint32_t winver = 0;
static char win_release_id[MAX_SZ_LEN] = "unavailable";

static inline uint64_t get_clockfreq(void)
{
Expand Down Expand Up @@ -927,6 +928,10 @@ static inline void get_reg_ver(struct win_version_info *ver)
ver->build = wcstol(str, NULL, 10);
}

if (get_reg_sz(key, L"ReleaseId", str, sizeof(str))) {
os_wcs_to_utf8(str, 0, win_release_id, MAX_SZ_LEN);
}

RegCloseKey(key);
}

Expand Down Expand Up @@ -988,6 +993,11 @@ void get_win_ver(struct win_version_info *info)
*info = ver;
}

const char *get_win_release_id(void)
{
return win_release_id;
}

uint32_t get_win_ver_int(void)
{
return get_winver();
Expand Down

0 comments on commit eadb96f

Please sign in to comment.