Author: jimtabor
Date: Wed Sep 26 02:28:35 2007
New Revision: 29204
URL:
http://svn.reactos.org/svn/reactos?rev=29204&view=rev
Log:
Implement RegisterDeviceNotificationAW and UnregisterDeviceNotification, based on Gdi32
OpenGL.
Modified:
trunk/reactos/dll/win32/user32/misc/resources.c
trunk/reactos/dll/win32/user32/misc/stubs.c
trunk/reactos/dll/win32/user32/user32.def
Modified: trunk/reactos/dll/win32/user32/misc/resources.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/reso…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/resources.c (original)
+++ trunk/reactos/dll/win32/user32/misc/resources.c Wed Sep 26 02:28:35 2007
@@ -1,6 +1,17 @@
#include <user32.h>
#include <wine/debug.h>
+
+#ifndef _CFGMGR32_H_
+#define CR_SUCCESS 0x00000000
+#define CR_OUT_OF_MEMORY 0x00000002
+#define CR_INVALID_POINTER 0x00000003
+#define CR_FAILURE 0x00000013
+#define CR_INVALID_DATA 0x0000001F
+#endif
+
+typedef DWORD (*CMP_REGNOTIFY) (HANDLE, LPVOID, DWORD, PULONG);
+typedef DWORD (*CMP_UNREGNOTIFY) (ULONG );
/* FIXME: Currently IsBadWritePtr is implemented using VirtualQuery which
does not seem to work properly for stack address space. */
@@ -228,4 +239,92 @@
return nStringLen;
}
+
+/*
+ * @implemented
+ */
+HDEVNOTIFY
+STDCALL
+RegisterDeviceNotificationW(
+ HANDLE hRecipient,
+ LPVOID NotificationFilter,
+ DWORD Flags
+ )
+{
+ DWORD ConfigRet = 0;
+ CMP_REGNOTIFY RegNotify = NULL;
+ HDEVNOTIFY hDevNotify = NULL;
+ HINSTANCE hSetupApi = LoadLibraryA("SETUPAPI.DLL");
+ if (hSetupApi == NULL) return NULL;
+ RegNotify = (CMP_REGNOTIFY) GetProcAddress ( hSetupApi,
"CMP_RegisterNotification");
+ if (RegNotify == NULL)
+ {
+ FreeLibrary ( hSetupApi );
+ return NULL;
+ }
+ ConfigRet = RegNotify ( hRecipient, NotificationFilter, Flags, (PULONG)
&hDevNotify);
+ FreeLibrary ( hSetupApi );
+ if (ConfigRet != CR_SUCCESS)
+ {
+ switch (ConfigRet)
+ {
+ case CR_OUT_OF_MEMORY:
+ SetLastError (ERROR_NOT_ENOUGH_MEMORY);
+ break;
+ case CR_INVALID_POINTER:
+ SetLastError (ERROR_INVALID_PARAMETER);
+ break;
+ case CR_INVALID_DATA:
+ SetLastError (ERROR_INVALID_DATA);
+ break;
+ case CR_FAILURE:
+ default:
+ SetLastError (ERROR_SERVICE_SPECIFIC_ERROR);
+ break;
+ }
+ }
+ return hDevNotify;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+STDCALL
+UnregisterDeviceNotification(
+ HDEVNOTIFY Handle)
+{
+ DWORD ConfigRet = 0;
+ CMP_UNREGNOTIFY UnRegNotify = NULL;
+ HINSTANCE hSetupApi = LoadLibraryA("SETUPAPI.DLL");
+ if (hSetupApi == NULL) return FALSE;
+ UnRegNotify = (CMP_UNREGNOTIFY) GetProcAddress ( hSetupApi,
"CMP_UnregisterNotification");
+ if (UnRegNotify == NULL)
+ {
+ FreeLibrary ( hSetupApi );
+ return FALSE;
+ }
+ ConfigRet = UnRegNotify ( (ULONG) Handle );
+ FreeLibrary ( hSetupApi );
+ if (ConfigRet != CR_SUCCESS)
+ {
+ switch (ConfigRet)
+ {
+ case CR_INVALID_POINTER:
+ SetLastError (ERROR_INVALID_PARAMETER);
+ break;
+ case CR_INVALID_DATA:
+ SetLastError (ERROR_INVALID_DATA);
+ break;
+ case CR_FAILURE:
+ default:
+ SetLastError (ERROR_SERVICE_SPECIFIC_ERROR);
+ break;
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
+
/* EOF */
Modified: trunk/reactos/dll/win32/user32/misc/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/stub…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/stubs.c (original)
+++ trunk/reactos/dll/win32/user32/misc/stubs.c Wed Sep 26 02:28:35 2007
@@ -108,19 +108,6 @@
/*
* @unimplemented
*/
-BOOL
-STDCALL
-UnregisterDeviceNotification(
- HDEVNOTIFY Handle)
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
DWORD
STDCALL
WaitForInputIdle(
@@ -333,21 +320,6 @@
/*
* @unimplemented
*/
-HDEVNOTIFY
-STDCALL
-RegisterDeviceNotificationW(
- HANDLE hRecipient,
- LPVOID NotificationFilter,
- DWORD Flags
- )
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
-/*
- * @unimplemented
- */
UINT
STDCALL
GetRawInputDeviceInfoW(
@@ -397,21 +369,6 @@
/*
* @unimplemented
*/
-HDEVNOTIFY
-STDCALL
-RegisterDeviceNotificationA(
- HANDLE hRecipient,
- LPVOID NotificationFilter,
- DWORD Flags
- )
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
-/*
- * @unimplemented
- */
UINT
STDCALL
GetRawInputDeviceInfoA(
Modified: trunk/reactos/dll/win32/user32/user32.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/user32.de…
==============================================================================
--- trunk/reactos/dll/win32/user32/user32.def (original)
+++ trunk/reactos/dll/win32/user32/user32.def Wed Sep 26 02:28:35 2007
@@ -549,7 +549,7 @@
RegisterClassW@4
RegisterClipboardFormatA@4
RegisterClipboardFormatW@4
-RegisterDeviceNotificationA@12
+RegisterDeviceNotificationA@12=RegisterDeviceNotificationW@12
RegisterDeviceNotificationW@12
RegisterHotKey@16
RegisterLogonProcess@8