diff options
author | Arnon Gilboa <agilboa@redhat.com> | 2010-11-09 20:50:21 +0200 |
---|---|---|
committer | Arnon Gilboa <agilboa@redhat.com> | 2010-11-09 20:50:21 +0200 |
commit | 35d1b7c835561d44f631e2e1777a13b3573c3ccf (patch) | |
tree | 4f934447e133cab5ff910c3d5c13547a35fc0672 | |
parent | 1e7f9e85a78be3a6d70557de43f968387278bd05 (diff) |
Revert "vdservice: don't start when no qxl device present"
This reverts commit 349e6a5bf8804b25c3af6e1f439122a7cc269cc2 which breaks vsdervice on Windows 7
-rw-r--r-- | common/vdcommon.h | 2 | ||||
-rw-r--r-- | vdagent/desktop_layout.cpp | 19 | ||||
-rw-r--r-- | vdagent/desktop_layout.h | 1 | ||||
-rw-r--r-- | vdagent/vdagent.vcproj | 8 | ||||
-rw-r--r-- | vdservice/vdservice.cpp | 31 | ||||
-rw-r--r-- | vdservice/vdservice.vcproj | 4 |
6 files changed, 21 insertions, 44 deletions
diff --git a/common/vdcommon.h b/common/vdcommon.h index 24d18d6..1097720 100644 --- a/common/vdcommon.h +++ b/common/vdcommon.h @@ -63,7 +63,5 @@ typedef struct VDPipeState { VDPipeBuffer read; } VDPipeState; -bool get_qxl_device_id(TCHAR* device_key, DWORD* device_id); - #endif diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp index b7a6b9c..32502bc 100644 --- a/vdagent/desktop_layout.cpp +++ b/vdagent/desktop_layout.cpp @@ -17,7 +17,6 @@ #include "desktop_layout.h" #include "vdlog.h" -#include "vdcommon.h" void DisplayMode::set_res(DWORD width, DWORD height, DWORD depth) { @@ -156,6 +155,24 @@ bool DesktopLayout::is_attached(LPCTSTR dev_name) return !!dev_mode.dmBitsPerPel; } +bool DesktopLayout::get_qxl_device_id(WCHAR* device_key, DWORD* device_id) +{ + DWORD type = REG_BINARY; + DWORD size = sizeof(*device_id); + bool key_found = false; + HKEY key; + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, wcsstr(device_key, L"System"), + 0L, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS) { + if (RegQueryValueEx(key, L"QxlDeviceID", NULL, &type, (LPBYTE)device_id, &size) == + ERROR_SUCCESS) { + key_found = true; + } + RegCloseKey(key); + } + return key_found; +} + void DesktopLayout::init_dev_mode(DEVMODE* dev_mode, DisplayMode* mode, bool set_pos) { ZeroMemory(dev_mode, sizeof(DEVMODE)); diff --git a/vdagent/desktop_layout.h b/vdagent/desktop_layout.h index fe70e36..a43ee49 100644 --- a/vdagent/desktop_layout.h +++ b/vdagent/desktop_layout.h @@ -72,6 +72,7 @@ public: private: void clean_displays(); static bool is_attached(LPCTSTR dev_name); + static bool get_qxl_device_id(WCHAR* device_key, DWORD* device_id); static void init_dev_mode(DEVMODE* dev_mode, DisplayMode* mode, bool set_pos); private: diff --git a/vdagent/vdagent.vcproj b/vdagent/vdagent.vcproj index ec703a5..0453c12 100644 --- a/vdagent/vdagent.vcproj +++ b/vdagent/vdagent.vcproj @@ -352,10 +352,6 @@ RelativePath="..\common\vdlog.cpp"
>
</File>
- <File
- RelativePath="..\common\vdcommon.cpp"
- >
- </File>
</Filter>
<Filter
Name="Header Files"
@@ -382,10 +378,6 @@ RelativePath="..\common\vdlog.h"
>
</File>
- <File
- RelativePath="..\common\vdcommon.cpp"
- >
- </File>
</Filter>
<Filter
Name="Resource Files"
diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp index 1e63694..ae5ad87 100644 --- a/vdservice/vdservice.cpp +++ b/vdservice/vdservice.cpp @@ -140,27 +140,6 @@ int supported_system_version() return 0; } -bool has_qxl_device() -{ - DISPLAY_DEVICE dev_info; - bool ret = false; - DWORD dev_id = 0; - DWORD qxl_id; - - ZeroMemory(&dev_info, sizeof(dev_info)); - dev_info.cb = sizeof(dev_info); - while (EnumDisplayDevices(NULL, dev_id, &dev_info, 0)) { - if (wcsstr(dev_info.DeviceString, L"QXL") != NULL - && get_qxl_device_id(dev_info.DeviceKey, &qxl_id)) { - vd_printf("found QXL device at id %d, qxl_id %d", dev_id, qxl_id); - ret = true; - break; - } - dev_id++; - } - return ret; -} - VDService::VDService() : _status_handle (0) , _vdi_port (NULL) @@ -359,10 +338,8 @@ VOID WINAPI VDService::main(DWORD argc, TCHAR* argv[]) swprintf_s(log_path, MAX_PATH, VD_SERVICE_LOG_PATH, temp_path); s->_log = VDLog::get(log_path); } - vd_printf("***Service started***"); log_version(); - if (!SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS)) { vd_printf("SetPriorityClass failed %u", GetLastError()); } @@ -392,12 +369,8 @@ VOID WINAPI VDService::main(DWORD argc, TCHAR* argv[]) status->dwCurrentState = SERVICE_RUNNING; SetServiceStatus(s->_status_handle, status); - if (has_qxl_device()) { - s->_running = true; - s->execute(); - } else { - vd_printf("didn't find any qxl devices\n"); - } + s->_running = true; + s->execute(); // service was stopped status->dwCurrentState = SERVICE_STOP_PENDING; diff --git a/vdservice/vdservice.vcproj b/vdservice/vdservice.vcproj index e23d235..32ec7c8 100644 --- a/vdservice/vdservice.vcproj +++ b/vdservice/vdservice.vcproj @@ -375,10 +375,6 @@ >
</File>
<File
- RelativePath="..\common\vdcommon.cpp"
- >
- </File>
- <File
RelativePath=".\vdservice.cpp"
>
</File>
|