[Spice-devel] [PATCH 2/6] usbclerk: move wdi driver extraction path to system32
Arnon Gilboa
agilboa at redhat.com
Mon Jul 23 02:23:04 PDT 2012
prevents user from replacing the drivers
---
usbclerk.cpp | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/usbclerk.cpp b/usbclerk.cpp
index 441f4a1..9100811 100644
--- a/usbclerk.cpp
+++ b/usbclerk.cpp
@@ -17,7 +17,7 @@
#define USB_CLERK_LOG_PATH TEXT("%susbclerk.log")
#define USB_CLERK_PIPE_TIMEOUT 10000
#define USB_CLERK_PIPE_BUF_SIZE 1024
-#define USB_DRIVER_PATH "%Swdi_usb_driver"
+#define USB_DRIVER_PATH "%S\\wdi_usb_driver"
#define USB_DRIVER_INFNAME_LEN 64
#define USB_DRIVER_INSTALL_RETRIES 10
#define USB_DRIVER_INSTALL_INTERVAL 2000
@@ -206,13 +206,15 @@ VOID WINAPI USBClerk::main(DWORD argc, TCHAR* argv[])
SERVICE_STATUS* status;
TCHAR log_path[MAX_PATH];
- TCHAR temp_path[MAX_PATH];
+ TCHAR path[MAX_PATH];
- if (GetTempPath(MAX_PATH, temp_path)) {
- sprintf_s(s->_wdi_path, MAX_PATH, USB_DRIVER_PATH, temp_path);
- swprintf_s(log_path, MAX_PATH, USB_CLERK_LOG_PATH, temp_path);
+ if (GetTempPath(MAX_PATH, path)) {
+ swprintf_s(log_path, MAX_PATH, USB_CLERK_LOG_PATH, path);
s->_log = VDLog::get(log_path);
}
+ if (GetSystemDirectory(path, MAX_PATH)) {
+ sprintf_s(s->_wdi_path, MAX_PATH, USB_DRIVER_PATH, path);
+ }
vd_printf("***Service started***");
SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);
status = &s->_status;
--
1.7.4.1
More information about the Spice-devel
mailing list