Revert "vdservice: don't start when no qxl device present"

This reverts commit 349e6a5bf8 which breaks vsdervice on Windows 7
This commit is contained in:
Arnon Gilboa
2010-11-09 20:50:21 +02:00
parent 1e7f9e85a7
commit 35d1b7c835
6 changed files with 21 additions and 44 deletions
-2
View File
@@ -63,7 +63,5 @@ typedef struct VDPipeState {
VDPipeBuffer read;
} VDPipeState;
bool get_qxl_device_id(TCHAR* device_key, DWORD* device_id);
#endif
+18 -1
View File
@@ -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));
+1
View File
@@ -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:
-8
View File
@@ -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"
+2 -29
View File
@@ -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;
-4
View File
@@ -374,10 +374,6 @@
RelativePath="..\common\vdlog.cpp"
>
</File>
<File
RelativePath="..\common\vdcommon.cpp"
>
</File>
<File
RelativePath=".\vdservice.cpp"
>