diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2018-06-30 09:14:08 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2018-07-05 18:35:31 +0100 |
commit | 55290d17666d2237896ba0c8cd9c028ddc29f5c9 (patch) | |
tree | 1bc6a57ed85ef59a0aff2d712960492bb631c0c8 /vdagent | |
parent | e9421d09b82c7c1ff284175d335b23303ac80e69 (diff) |
Avoids to call supported_system_version()
The only reason we call this function is to check if the
system should support some APIs.
Instead just check directly if these APIs are supported
calling GetProcAddress directly.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Diffstat (limited to 'vdagent')
-rw-r--r-- | vdagent/vdagent.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp index 95783c1..423c3ee 100644 --- a/vdagent/vdagent.cpp +++ b/vdagent/vdagent.cpp @@ -268,22 +268,22 @@ bool VDAgent::run() if (!SetProcessShutdownParameters(0x100, 0)) { vd_printf("SetProcessShutdownParameters failed %lu", GetLastError()); } - if (supported_system_version() == SYS_VER_WIN_7_CLASS) { - _user_lib = LoadLibrary(L"User32.dll"); - if (!_user_lib) { - vd_printf("LoadLibrary failed %lu", GetLastError()); - return false; - } - _add_clipboard_listener = - (PCLIPBOARD_OP)GetProcAddress(_user_lib, "AddClipboardFormatListener"); - _remove_clipboard_listener = - (PCLIPBOARD_OP)GetProcAddress(_user_lib, "RemoveClipboardFormatListener"); - if (!_add_clipboard_listener || !_remove_clipboard_listener) { - vd_printf("GetProcAddress failed %lu", GetLastError()); - cleanup(); - return false; - } + + _user_lib = LoadLibrary(L"User32.dll"); + if (!_user_lib) { + vd_printf("LoadLibrary failed %lu", GetLastError()); + return false; } + _add_clipboard_listener = + (PCLIPBOARD_OP)GetProcAddress(_user_lib, "AddClipboardFormatListener"); + _remove_clipboard_listener = + (PCLIPBOARD_OP)GetProcAddress(_user_lib, "RemoveClipboardFormatListener"); + // do not use FormatListener APIs if not available + if (!_add_clipboard_listener || !_remove_clipboard_listener) { + _add_clipboard_listener = nullptr; + _remove_clipboard_listener = nullptr; + } + if (!_control_event) _control_event = CreateEvent(NULL, FALSE, FALSE, NULL); if (!_control_event) { |