Author: ekohl
Date: Sun Nov 27 11:14:25 2016
New Revision: 73394
URL:
http://svn.reactos.org/svn/reactos?rev=73394&view=rev
Log:
[SETUPAPI]
Partial implementation of CMP_RegisterNotification and CMP_UnregisterNotification.
[UMPNPMGR]
Partial implementation of PNP_RegisterNotification and PNP_UnregisterNotification.
CORE-12217 #comment This should fix one of the issues.
Modified:
trunk/reactos/base/services/umpnpmgr/umpnpmgr.c
trunk/reactos/dll/win32/setupapi/cfgmgr.c
trunk/reactos/sdk/include/reactos/idl/pnp.idl
Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
==============================================================================
--- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Sun Nov 27 11:14:25 2016
@@ -2857,10 +2857,28 @@
DWORD
WINAPI
PNP_RegisterNotification(
- handle_t hBinding)
-{
- UNIMPLEMENTED;
- return CR_CALL_NOT_IMPLEMENTED;
+ handle_t hBinding,
+ DWORD ulFlags,
+ DWORD *pulNotify)
+{
+#if 0
+ PNOTIFY_DATA pNotifyData;
+#endif
+
+ DPRINT1("PNP_RegisterNotification(%p 0x%lx %p)\n",
+ hBinding, ulFlags, pulNotify);
+
+#if 0
+ pNotifyData = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(NOTIFY_DATA));
+ if (pNotifyData == NULL)
+ return CR_OUT_OF_MEMORY;
+
+ *pulNotify = (DWORD)pNotifyData;
+#endif
+
+ *pulNotify = 1;
+
+ return CR_SUCCESS;
}
@@ -2868,10 +2886,18 @@
DWORD
WINAPI
PNP_UnregisterNotification(
- handle_t hBinding)
-{
- UNIMPLEMENTED;
- return CR_CALL_NOT_IMPLEMENTED;
+ handle_t hBinding,
+ DWORD ulNotify)
+{
+ DPRINT1("PNP_UnregisterNotification(%p 0x%lx)\n",
+ hBinding, ulNotify);
+
+#if 0
+ UNIMPLEMENTED;
+ return CR_CALL_NOT_IMPLEMENTED;
+#endif
+
+ return CR_SUCCESS;
}
Modified: trunk/reactos/dll/win32/setupapi/cfgmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/cfgmgr.…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/cfgmgr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/cfgmgr.c [iso-8859-1] Sun Nov 27 11:14:25 2016
@@ -21,6 +21,7 @@
#include "setupapi_private.h"
+#include <dbt.h>
#include <pnp_c.h>
#include "rpc_private.h"
@@ -59,6 +60,15 @@
#define LOG_CONF_MAGIC 0x464E434C /* "LCNF" */
+typedef struct _NOTIFY_DATA
+{
+ ULONG ulMagic;
+ ULONG ulNotifyData;
+} NOTIFY_DATA, *PNOTIFY_DATA;
+
+#define NOTIFY_MAGIC 0x44556677
+
+
static BOOL GuidToString(LPGUID Guid, LPWSTR String)
{
LPWSTR lpString;
@@ -121,14 +131,76 @@
*/
CONFIGRET
WINAPI
-CMP_RegisterNotification(IN HANDLE hRecipient,
- IN LPVOID lpvNotificationFilter,
- IN DWORD dwFlags,
- OUT PULONG pluhDevNotify)
-{
- FIXME("Stub %p %p %lu %p\n", hRecipient, lpvNotificationFilter, dwFlags,
pluhDevNotify);
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return CR_FAILURE;
+CMP_RegisterNotification(
+ IN HANDLE hRecipient,
+ IN LPVOID lpvNotificationFilter,
+ IN DWORD dwFlags,
+ OUT PHDEVNOTIFY phDevNotify)
+{
+ RPC_BINDING_HANDLE BindingHandle = NULL;
+ PNOTIFY_DATA pNotifyData = NULL;
+ CONFIGRET ret = CR_SUCCESS;
+
+ TRACE("CMP_RegisterNotification(%p %p %lu %p)\n", hRecipient,
lpvNotificationFilter, dwFlags, phDevNotify);
+
+ if ((hRecipient == NULL) ||
+ (lpvNotificationFilter == NULL) ||
+ (phDevNotify == NULL))
+ return CR_INVALID_POINTER;
+
+ if (dwFlags & ~0x7)
+ return CR_INVALID_FLAG;
+
+ if (((PDEV_BROADCAST_HDR)lpvNotificationFilter)->dbch_size <
sizeof(DEV_BROADCAST_HDR))
+ return CR_INVALID_DATA;
+
+ if (!PnpGetLocalHandles(&BindingHandle, NULL))
+ return CR_FAILURE;
+
+ pNotifyData = HeapAlloc(GetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ sizeof(NOTIFY_DATA));
+ if (pNotifyData == NULL)
+ return CR_OUT_OF_MEMORY;
+
+ pNotifyData->ulMagic = NOTIFY_MAGIC;
+
+/*
+ if (dwFlags & DEVICE_NOTIFY_SERVICE_HANDLE == DEVICE_NOTYFY_WINDOW_HANDLE)
+ {
+
+ }
+ else if (dwFlags & DEVICE_NOTIFY_SERVICE_HANDLE == DEVICE_NOTYFY_SERVICE_HANDLE)
+ {
+
+ }
+*/
+
+ RpcTryExcept
+ {
+ ret = PNP_RegisterNotification(BindingHandle,
+ dwFlags,
+ &pNotifyData->ulNotifyData);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ret = RpcStatusToCmStatus(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ if (ret == CR_SUCCESS)
+ {
+ *phDevNotify = (HDEVNOTIFY)pNotifyData;
+ }
+ else
+ {
+ if (pNotifyData != NULL)
+ HeapFree(GetProcessHeap(), 0, pNotifyData);
+
+ *phDevNotify = (HDEVNOTIFY)NULL;
+ }
+
+ return ret;
}
@@ -144,7 +216,7 @@
BOOL bAdmin;
DWORD i;
- TRACE("%lu\n", dwMagic);
+ TRACE("CMP_Report_LogOn(%lu %lu)\n", dwMagic, dwProcessId);
if (dwMagic != CMP_MAGIC)
return CR_INVALID_DATA;
@@ -183,10 +255,39 @@
*/
CONFIGRET
WINAPI
-CMP_UnregisterNotification(IN HDEVNOTIFY handle)
-{
- FIXME("Stub %p\n", handle);
- return CR_SUCCESS;
+CMP_UnregisterNotification(
+ IN HDEVNOTIFY hDevNotify)
+{
+ RPC_BINDING_HANDLE BindingHandle = NULL;
+ PNOTIFY_DATA pNotifyData;
+ CONFIGRET ret = CR_SUCCESS;
+
+ TRACE("CMP_UnregisterNotification(%p)\n", hDevNotify);
+
+ pNotifyData = (PNOTIFY_DATA)hDevNotify;
+
+ if ((pNotifyData == NULL) ||
+ (pNotifyData->ulMagic != NOTIFY_MAGIC))
+ return CR_INVALID_POINTER;
+
+ if (!PnpGetLocalHandles(&BindingHandle, NULL))
+ return CR_FAILURE;
+
+ RpcTryExcept
+ {
+ ret = PNP_UnregisterNotification(BindingHandle,
+ pNotifyData->ulNotifyData);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ret = RpcStatusToCmStatus(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ if (ret == CR_SUCCESS)
+ HeapFree(GetProcessHeap(), 0, pNotifyData);
+
+ return ret;
}
Modified: trunk/reactos/sdk/include/reactos/idl/pnp.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/idl/pn…
==============================================================================
--- trunk/reactos/sdk/include/reactos/idl/pnp.idl [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/reactos/idl/pnp.idl [iso-8859-1] Sun Nov 27 11:14:25 2016
@@ -874,13 +874,16 @@
DWORD
__stdcall
PNP_RegisterNotification(
- [in] handle_t hBinding);
+ [in] handle_t hBinding,
+ [in] DWORD ulFlags,
+ [out] DWORD *pulNotifyData);
/* Function 60 */
DWORD
__stdcall
PNP_UnregisterNotification(
- [in] handle_t hBinding);
+ [in] handle_t hBinding,
+ [in] DWORD ulNotifyData);
cpp_quote("#if _WIN32_WINNT >= 0x0501")