https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8dc70d245461b5576ff17…
commit 8dc70d245461b5576ff17995a3a064556c9926fe
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Jun 22 20:50:51 2019 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sat Jun 22 21:01:25 2019 +0200
[SETUPAPI] Implement SetupDiRestartDevices()
---
dll/win32/setupapi/devinst.c | 45 ++++++++++++++++++++++++++++++++++++++++
dll/win32/setupapi/setupapi.spec | 2 +-
sdk/include/psdk/setupapi.h | 1 +
3 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/dll/win32/setupapi/devinst.c b/dll/win32/setupapi/devinst.c
index e396b5ddfc4..14a9a5faa10 100644
--- a/dll/win32/setupapi/devinst.c
+++ b/dll/win32/setupapi/devinst.c
@@ -6090,3 +6090,48 @@ BOOL WINAPI SetupDiDeleteDevRegKey(
RegCloseKey(RootKey);
return ret;
}
+
+/***********************************************************************
+ * SetupDiRestartDevices (SETUPAPI.@)
+ */
+BOOL
+WINAPI
+SetupDiRestartDevices(
+ HDEVINFO DeviceInfoSet,
+ PSP_DEVINFO_DATA DeviceInfoData)
+{
+ struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
+ struct DeviceInfo *devInfo;
+ CONFIGRET cr;
+
+ TRACE("%p %p\n", DeviceInfoSet, DeviceInfoData);
+
+ if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE)
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+ if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ if (!DeviceInfoData || DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)
+ || !DeviceInfoData->Reserved)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
+
+ cr = CM_Enable_DevNode_Ex(devInfo->dnDevInst, 0, set->hMachine);
+ if (cr != CR_SUCCESS)
+ {
+ SetLastError(GetErrorCodeFromCrCode(cr));
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/dll/win32/setupapi/setupapi.spec b/dll/win32/setupapi/setupapi.spec
index bfe00fa1141..d6ad0e70bb0 100644
--- a/dll/win32/setupapi/setupapi.spec
+++ b/dll/win32/setupapi/setupapi.spec
@@ -369,7 +369,7 @@
@ stdcall SetupDiRegisterDeviceInfo(ptr ptr long ptr ptr ptr)
@ stdcall SetupDiRemoveDevice(ptr ptr)
@ stdcall SetupDiRemoveDeviceInterface(ptr ptr)
-@ stub SetupDiRestartDevices
+@ stdcall SetupDiRestartDevices(ptr ptr)
@ stdcall SetupDiSelectBestCompatDrv(ptr ptr)
@ stdcall SetupDiSelectDevice(ptr ptr)
@ stub SetupDiSelectOEMDrv
diff --git a/sdk/include/psdk/setupapi.h b/sdk/include/psdk/setupapi.h
index 2053267dad6..00fd1b9dd4f 100644
--- a/sdk/include/psdk/setupapi.h
+++ b/sdk/include/psdk/setupapi.h
@@ -1795,6 +1795,7 @@ WINSETUPAPI BOOL WINAPI SetupDiRegisterCoDeviceInstallers(_In_
HDEVINFO, _In_ PS
WINSETUPAPI BOOL WINAPI SetupDiRegisterDeviceInfo(_In_ HDEVINFO, _Inout_
PSP_DEVINFO_DATA, _In_ DWORD, _In_opt_ PSP_DETSIG_CMPPROC, _In_opt_ PVOID, _Out_opt_
PSP_DEVINFO_DATA);
WINSETUPAPI BOOL WINAPI SetupDiRemoveDevice(_In_ HDEVINFO, _Inout_ PSP_DEVINFO_DATA);
WINSETUPAPI BOOL WINAPI SetupDiRemoveDeviceInterface(_In_ HDEVINFO, _Inout_
PSP_DEVICE_INTERFACE_DATA);
+WINSETUPAPI BOOL WINAPI SetupDiRestartDevices(_In_ HDEVINFO, _Inout_ PSP_DEVINFO_DATA);
WINSETUPAPI BOOL WINAPI SetupDiSelectBestCompatDrv(_In_ HDEVINFO, _Inout_opt_
PSP_DEVINFO_DATA);
WINSETUPAPI BOOL WINAPI SetupDiSelectDevice(_In_ HDEVINFO, _Inout_opt_
PSP_DEVINFO_DATA);
WINSETUPAPI BOOL WINAPI SetupDiSelectOEMDrv(_In_opt_ HWND, _In_ HDEVINFO, _In_opt_
PSP_DEVINFO_DATA);