mirror of https://github.com/xemu-project/xemu.git
ui: Get Windows product and build number
This commit is contained in:
parent
bb05a4f181
commit
af3f832fd7
|
@ -19,13 +19,49 @@
|
|||
|
||||
#include "xemu-os-utils.h"
|
||||
#include <windows.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <wchar.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue