Implement RegisterDeviceNotificationAW and UnregisterDeviceNotification, based on Gdi32 OpenGL.

svn path=/trunk/; revision=29204
This commit is contained in:
James Tabor 2007-09-25 22:28:35 +00:00
parent a9892925a1
commit 5baf5558ff
3 changed files with 100 additions and 44 deletions

View file

@ -2,6 +2,17 @@
#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. */
/* kill `left-hand operand of comma expression has no effect' warning */
@ -228,4 +239,92 @@ int STDCALL LoadStringW
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 */

View file

@ -105,19 +105,6 @@ LockWorkStation(VOID)
}
/*
* @unimplemented
*/
BOOL
STDCALL
UnregisterDeviceNotification(
HDEVNOTIFY Handle)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
@ -330,21 +317,6 @@ ClientThreadSetup ( VOID )
return FALSE;
}
/*
* @unimplemented
*/
HDEVNOTIFY
STDCALL
RegisterDeviceNotificationW(
HANDLE hRecipient,
LPVOID NotificationFilter,
DWORD Flags
)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/
@ -394,21 +366,6 @@ CsrBroadcastSystemMessageExW(
return FALSE;
}
/*
* @unimplemented
*/
HDEVNOTIFY
STDCALL
RegisterDeviceNotificationA(
HANDLE hRecipient,
LPVOID NotificationFilter,
DWORD Flags
)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/

View file

@ -549,7 +549,7 @@ RegisterClassExW@4
RegisterClassW@4
RegisterClipboardFormatA@4
RegisterClipboardFormatW@4
RegisterDeviceNotificationA@12
RegisterDeviceNotificationA@12=RegisterDeviceNotificationW@12
RegisterDeviceNotificationW@12
RegisterHotKey@16
RegisterLogonProcess@8