Commit 304b094d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

setupapi: Reënumerate root PnP devices in SetupDiInstallDevice().

If the service is already running, starting it has no effect. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 73bfe36e
......@@ -104,6 +104,8 @@ static const WCHAR AddInterface[] = {'A','d','d','I','n','t','e','r','f','a','c'
static const WCHAR backslashW[] = {'\\',0};
static const WCHAR emptyW[] = {0};
#define SERVICE_CONTROL_REENUMERATE_ROOT_DEVICES 128
struct driver
{
WCHAR inf_path[MAX_PATH];
......@@ -5123,13 +5125,20 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
if (!wcsnicmp(device->instanceId, rootW, lstrlenW(rootW)) && svc_name[0]
&& (manager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT)))
{
if ((service = OpenServiceW(manager, svc_name, SERVICE_START)))
if ((service = OpenServiceW(manager, svc_name, SERVICE_START | SERVICE_USER_DEFINED_CONTROL)))
{
SERVICE_STATUS status;
if (!StartServiceW(service, 0, NULL) && GetLastError() != ERROR_SERVICE_ALREADY_RUNNING)
{
ERR("Failed to start service %s for device %s, error %u.\n",
debugstr_w(svc_name), debugstr_w(device->instanceId), GetLastError());
}
if (!ControlService(service, SERVICE_CONTROL_REENUMERATE_ROOT_DEVICES, &status))
{
ERR("Failed to control service %s for device %s, error %u.\n",
debugstr_w(svc_name), debugstr_w(device->instanceId), GetLastError());
}
CloseServiceHandle(service);
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment