Zebediah Figura : setupapi: Reënumerate root PnP devices in SetupDiInstallDevice().
Alexandre Julliard
julliard at winehq.org
Fri Apr 2 16:10:12 CDT 2021
Module: wine
Branch: master
Commit: 304b094d1633361d7a6ea69451b48b48d88686f5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=304b094d1633361d7a6ea69451b48b48d88686f5
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Fri Apr 2 10:53:37 2021 -0500
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 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/setupapi/devinst.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index de0413e74f5..0a396cc8464 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -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
More information about the wine-cvs
mailing list