diff --git a/ui/xemu-os-utils-windows.c b/ui/xemu-os-utils-windows.c index 8fc323746e4..58c763e4afb 100644 --- a/ui/xemu-os-utils-windows.c +++ b/ui/xemu-os-utils-windows.c @@ -19,13 +19,49 @@ #include "xemu-os-utils.h" #include +#include +#include +#include + +static const char *get_windows_build_info(void) +{ + WCHAR current_build[1024], product_name[1024]; + WCHAR build_size = 1024, product_size = 1024; + + if (RegGetValueW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", + L"ProductName", RRF_RT_REG_SZ, (LPVOID)NULL, &product_name, + (LPDWORD)&product_size) != ERROR_SUCCESS) { + return "Windows"; + } + + if ((RegGetValueW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", + L"DisplayVersion", RRF_RT_REG_SZ, (LPVOID)NULL, + ¤t_build, (LPDWORD)&build_size) == ERROR_SUCCESS) || + (RegGetValueW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", + L"CSDVersion", RRF_RT_REG_SZ, (LPVOID)NULL, + ¤t_build, (LPDWORD)&build_size) == ERROR_SUCCESS)) { + return g_strdup_printf("%ls %ls", product_name, current_build); + } + + return g_strdup_printf("%ls", product_name); +} const char *xemu_get_os_info(void) { - return "Windows"; + static const char *buffer = NULL; + + if (buffer == NULL) { + buffer = get_windows_build_info(); + } + + return buffer; } + void xemu_open_web_browser(const char *url) { - ShellExecute(0, "open", url, 0, 0 , SW_SHOW); + ShellExecute(0, "open", url, 0, 0, SW_SHOW); }