https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ece54dcd2f4424d516040…
commit ece54dcd2f4424d516040d6802320c413d57b0c6
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Jul 7 13:41:00 2019 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Jul 7 13:41:00 2019 +0200
[SETUPAPI][UMPNPMGR] The 3rd parameter of PNP_RegisterNotification() seems to be the
service name
---
base/services/umpnpmgr/rpcserver.c | 6 +++---
dll/win32/setupapi/cfgmgr.c | 38 ++++++++++++++++++++++++++++++--------
sdk/include/reactos/idl/pnp.idl | 2 +-
3 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c
index b76e250fc6b..63148af8623 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -3531,7 +3531,7 @@ WINAPI
PNP_RegisterNotification(
handle_t hBinding,
DWORD ulUnknown2,
- DWORD ulUnknown3,
+ LPWSTR pszName,
BYTE *pNotificationFilter,
DWORD ulNotificationFilterSize,
DWORD ulFlags,
@@ -3545,8 +3545,8 @@ PNP_RegisterNotification(
PNOTIFY_DATA pNotifyData;
#endif
- DPRINT1("PNP_RegisterNotification(%p %lx %lx %p %lu 0x%lx %p %lx %p)\n",
- hBinding, ulUnknown2, ulUnknown3, pNotificationFilter,
+ DPRINT1("PNP_RegisterNotification(%p %lx '%S' %p %lu 0x%lx %p %lx
%p)\n",
+ hBinding, ulUnknown2, pszName, pNotificationFilter,
ulNotificationFilterSize, ulFlags, pulNotify, ulUnknown8, pulUnknown9);
if (pNotificationFilter == NULL ||
diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c
index b5823a99f64..0624ed8f5c8 100644
--- a/dll/win32/setupapi/cfgmgr.c
+++ b/dll/win32/setupapi/cfgmgr.c
@@ -23,9 +23,17 @@
#include <dbt.h>
#include <pnp_c.h>
+#include <winsvc.h>
#include "rpc_private.h"
+DWORD
+WINAPI
+I_ScPnPGetServiceName(IN SERVICE_STATUS_HANDLE hServiceStatus,
+ OUT LPWSTR lpServiceName,
+ IN DWORD cchServiceName);
+
+
/* Registry key and value names */
static const WCHAR Backslash[] = {'\\', 0};
static const WCHAR Class[] =
{'C','l','a','s','s',0};
@@ -593,6 +601,8 @@ CMP_RegisterNotification(
{
RPC_BINDING_HANDLE BindingHandle = NULL;
PNOTIFY_DATA pNotifyData = NULL;
+ WCHAR szNameBuffer[256];
+ DWORD dwError;
DWORD ulUnknown9 = 0;
CONFIGRET ret = CR_SUCCESS;
@@ -621,28 +631,40 @@ CMP_RegisterNotification(
pNotifyData->ulMagic = NOTIFY_MAGIC;
-/*
- if (dwFlags & DEVICE_NOTIFY_SERVICE_HANDLE == DEVICE_NOTYFY_WINDOW_HANDLE)
+ if ((ulFlags & DEVICE_NOTIFY_SERVICE_HANDLE) == DEVICE_NOTIFY_WINDOW_HANDLE)
{
+ FIXME("Register a window\n");
+ /* FIXME */
+ szNameBuffer[0] = UNICODE_NULL;
}
- else if (dwFlags & DEVICE_NOTIFY_SERVICE_HANDLE == DEVICE_NOTYFY_SERVICE_HANDLE)
+ else if ((ulFlags & DEVICE_NOTIFY_SERVICE_HANDLE) ==
DEVICE_NOTIFY_SERVICE_HANDLE)
{
+ FIXME("Register a service\n");
+
+ dwError = I_ScPnPGetServiceName((SERVICE_STATUS_HANDLE)hRecipient,
+ szNameBuffer,
+ ARRAYSIZE(szNameBuffer));
+ if (dwError != ERROR_SUCCESS)
+ {
+ HeapFree(GetProcessHeap(), 0, pNotifyData);
+ return CR_INVALID_DATA;
+ }
+ FIXME("Register service: %S\n", szNameBuffer);
}
-*/
RpcTryExcept
{
ret = PNP_RegisterNotification(BindingHandle,
- 0,
- 0,
+ 0, /* ??? */
+ szNameBuffer,
(BYTE*)lpvNotificationFilter,
((DEV_BROADCAST_HDR*)lpvNotificationFilter)->dbch_size,
ulFlags,
&pNotifyData->ulNotifyData,
- 0,
- &ulUnknown9);
+ 0, /* ??? */
+ &ulUnknown9); /* ??? */
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
diff --git a/sdk/include/reactos/idl/pnp.idl b/sdk/include/reactos/idl/pnp.idl
index 13983a4e18d..6856c4e5ac0 100644
--- a/sdk/include/reactos/idl/pnp.idl
+++ b/sdk/include/reactos/idl/pnp.idl
@@ -876,7 +876,7 @@ interface pnp
PNP_RegisterNotification(
[in] handle_t hBinding,
[in] DWORD ulUnknown2,
- [in] DWORD ulUnknown3,
+ [in, string, ref] LPWSTR pszName,
[in, size_is(ulNotificationFilterSize)] BYTE *pNotificationFilter,
[in] DWORD ulNotificationFilterSize,
[in] DWORD ulFlags,