setupapi: Reënumerate root PnP devices in SetupDiInstallDevice().
If the service is already running, starting it has no effect. Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
73bfe36eab
commit
304b094d16
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue