Author: tfaber
Date: Sat Sep 10 14:45:47 2011
New Revision: 53672
URL:
http://svn.reactos.org/svn/reactos?rev=53672&view=rev
Log:
[KMTEST]
- Load the driver from the application directory, not the current directory
Modified:
trunk/rostests/kmtests/kmtest/service.c
Modified: trunk/rostests/kmtests/kmtest/service.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest/service.c?…
==============================================================================
--- trunk/rostests/kmtests/kmtest/service.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest/service.c [iso-8859-1] Sat Sep 10 14:45:47 2011
@@ -87,18 +87,18 @@
assert(ServiceHandle);
assert(ServiceName && ServicePath);
- if (!GetCurrentDirectory(sizeof DriverPath / sizeof DriverPath[0], DriverPath))
- error_goto(Error, cleanup);
-
- if (DriverPath[wcslen(DriverPath) - 1] != L'\\')
- {
- DriverPath[wcslen(DriverPath) + 1] = L'\0';
- DriverPath[wcslen(DriverPath)] = L'\\';
- }
+ if (!GetModuleFileName(NULL, DriverPath, sizeof DriverPath / sizeof DriverPath[0]))
+ error_goto(Error, cleanup);
+
+ assert(wcsrchr(DriverPath, L'\\') != NULL);
+ wcsrchr(DriverPath, L'\\')[1] = L'\0';
result = StringCbCat(DriverPath, sizeof DriverPath, ServicePath);
if (FAILED(result))
error_value_goto(Error, result, cleanup);
+
+ if (GetFileAttributes(DriverPath) == INVALID_FILE_ATTRIBUTES)
+ error_goto(Error, cleanup);
*ServiceHandle = CreateService(ScmHandle, ServiceName, DisplayName,
SERVICE_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START,