summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnon Gilboa <agilboa@redhat.com>2012-07-23 10:50:27 +0300
committerArnon Gilboa <agilboa@redhat.com>2012-07-23 10:50:27 +0300
commit4023cedc78efef2f7bd3da80ec77006fcd51d7d7 (patch)
treefd38956cc390f99a1e7679ba79841df633745826
parentebc4da2e3eb675b72fd006e07379e12aa33d08d2 (diff)
usbclerk: move wdi driver extraction path to system32
prevents user from replacing the drivers
-rw-r--r--usbclerk.cpp12
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;