From: Bin Meng <bmeng.cn@gmail.com>
To: qemu-devel@nongnu.org
Cc: Bin Meng <bin.meng@windriver.com>,
Konstantin Kostiuk <kkostiuk@redhat.com>,
Michael Roth <michael.roth@amd.com>
Subject: [PATCH v2 3/6] qga/commands-win32: Use os_get_win_version()
Date: Wed, 27 Jul 2022 21:27:59 +0800 [thread overview]
Message-ID: <20220727132802.812580-4-bmeng.cn@gmail.com> (raw)
In-Reply-To: <20220727132802.812580-1-bmeng.cn@gmail.com>
From: Bin Meng <bin.meng@windriver.com>
Drop its own ga_get_win_version() implementation, and use the one
provided in oslib-win32 instead.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
(no changes since v1)
qga/commands-win32.c | 27 +--------------------------
1 file changed, 1 insertion(+), 26 deletions(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 7ed7664715..6186f2e1f2 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -2178,26 +2178,6 @@ static ga_win_10_0_t const WIN_10_0_CLIENT_VERSION_MATRIX[3] = {
{0, 0}
};
-static void ga_get_win_version(RTL_OSVERSIONINFOEXW *info, Error **errp)
-{
- typedef NTSTATUS(WINAPI *rtl_get_version_t)(
- RTL_OSVERSIONINFOEXW *os_version_info_ex);
-
- info->dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
-
- HMODULE module = GetModuleHandle("ntdll");
- PVOID fun = GetProcAddress(module, "RtlGetVersion");
- if (fun == NULL) {
- error_setg(errp, QERR_QGA_COMMAND_FAILED,
- "Failed to get address of RtlGetVersion");
- return;
- }
-
- rtl_get_version_t rtl_get_version = (rtl_get_version_t)fun;
- rtl_get_version(info);
- return;
-}
-
static char *ga_get_win_name(OSVERSIONINFOEXW const *os_version, bool id)
{
DWORD major = os_version->dwMajorVersion;
@@ -2312,17 +2292,12 @@ static char *ga_get_current_arch(void)
GuestOSInfo *qmp_guest_get_osinfo(Error **errp)
{
- Error *local_err = NULL;
OSVERSIONINFOEXW os_version = {0};
bool server;
char *product_name;
GuestOSInfo *info;
- ga_get_win_version(&os_version, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- return NULL;
- }
+ os_get_win_version(&os_version);
server = os_version.wProductType != VER_NT_WORKSTATION;
product_name = ga_get_win_product_name(errp);
--
2.34.1
next prev parent reply other threads:[~2022-07-27 13:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 13:27 [PATCH v2 0/6] Enable unix socket support on Windows Bin Meng
2022-07-27 13:27 ` [PATCH v2 1/6] util/qemu-sockets: Replace the call to close a socket with closesocket() Bin Meng
2022-07-28 12:51 ` Marc-André Lureau
2022-07-27 13:27 ` [PATCH v2 2/6] util/oslib-win32: Add a helper to get the Windows version Bin Meng
2022-07-28 12:54 ` Marc-André Lureau
2022-07-27 13:27 ` Bin Meng [this message]
2022-07-28 12:55 ` [PATCH v2 3/6] qga/commands-win32: Use os_get_win_version() Marc-André Lureau
2022-07-27 13:28 ` [PATCH v2 4/6] util/qemu-sockets: Enable unix socket support on Windows Bin Meng
2022-07-27 13:28 ` [PATCH v2 5/6] chardev/char-socket: Update AF_UNIX for Windows Bin Meng
2022-07-28 13:03 ` Marc-André Lureau
2022-07-27 13:28 ` [PATCH v2 6/6] tests/unit: Update test-io-channel-socket.c " Bin Meng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220727132802.812580-4-bmeng.cn@gmail.com \
--to=bmeng.cn@gmail.com \
--cc=bin.meng@windriver.com \
--cc=kkostiuk@redhat.com \
--cc=michael.roth@amd.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).