Alexandre Julliard : advapi32: Launch winedevice.
exe when asked to start a kernel driver service.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri May 18 08:03:54 CDT 2007
Module: wine
Branch: master
Commit: 020bd631ed302b5e6ae5b09c0f8c251ad67e9115
URL: http://source.winehq.org/git/wine.git/?a=commit;h=020bd631ed302b5e6ae5b09c0f8c251ad67e9115
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu May 17 16:52:18 2007 +0200
advapi32: Launch winedevice.exe when asked to start a kernel driver service.
---
dlls/advapi32/service.c | 47 ++++++++++++++++++++++++++++++++---------------
1 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index e1d1065..e9a1160 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -1486,26 +1486,43 @@ static DWORD service_start_process(struct sc_service *hsvc, LPDWORD ppid)
PROCESS_INFORMATION pi;
STARTUPINFOW si;
LPWSTR path = NULL, str;
- DWORD type, size, ret;
+ DWORD type, size, ret, svc_type;
HANDLE handles[2];
BOOL r;
- /* read the executable path from memory */
- size = 0;
- ret = RegQueryValueExW(hsvc->hkey, _ImagePathW, NULL, &type, NULL, &size);
- if (ret!=ERROR_SUCCESS)
- return FALSE;
- str = HeapAlloc(GetProcessHeap(),0,size);
- ret = RegQueryValueExW(hsvc->hkey, _ImagePathW, NULL, &type, (LPBYTE)str, &size);
- if (ret==ERROR_SUCCESS)
+ size = sizeof(svc_type);
+ if (RegQueryValueExW(hsvc->hkey, szType, NULL, &type, (LPBYTE)&svc_type, &size) || type != REG_DWORD)
+ svc_type = 0;
+
+ if (svc_type == SERVICE_KERNEL_DRIVER)
{
- size = ExpandEnvironmentStringsW(str,NULL,0);
- path = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
- ExpandEnvironmentStringsW(str,path,size);
+ static const WCHAR winedeviceW[] = {'\\','w','i','n','e','d','e','v','i','c','e','.','e','x','e',' ',0};
+ DWORD len = GetSystemDirectoryW( NULL, 0 ) + sizeof(winedeviceW)/sizeof(WCHAR) + strlenW(hsvc->name);
+
+ if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE;
+ GetSystemDirectoryW( path, len );
+ lstrcatW( path, winedeviceW );
+ lstrcatW( path, hsvc->name );
+ }
+ else
+ {
+ /* read the executable path from the registry */
+ size = 0;
+ ret = RegQueryValueExW(hsvc->hkey, _ImagePathW, NULL, &type, NULL, &size);
+ if (ret!=ERROR_SUCCESS)
+ return FALSE;
+ str = HeapAlloc(GetProcessHeap(),0,size);
+ ret = RegQueryValueExW(hsvc->hkey, _ImagePathW, NULL, &type, (LPBYTE)str, &size);
+ if (ret==ERROR_SUCCESS)
+ {
+ size = ExpandEnvironmentStringsW(str,NULL,0);
+ path = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
+ ExpandEnvironmentStringsW(str,path,size);
+ }
+ HeapFree(GetProcessHeap(),0,str);
+ if (!path)
+ return FALSE;
}
- HeapFree(GetProcessHeap(),0,str);
- if (!path)
- return FALSE;
/* wait for the process to start and set an event or terminate */
handles[0] = service_get_event_handle( hsvc->name );
More information about the wine-cvs
mailing list