Author: jimtabor
Date: Sat Apr 12 15:53:08 2008
New Revision: 32931
URL:
http://svn.reactos.org/svn/reactos?rev=32931&view=rev
Log:
More hook implementations.
Modified:
trunk/reactos/dll/win32/user32/windows/hook.c
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
Modified: trunk/reactos/dll/win32/user32/windows/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/h…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] Sat Apr 12 15:53:08 2008
@@ -34,6 +34,44 @@
WINE_DEFAULT_DEBUG_CHANNEL(user32);
+DWORD Bogus_SrvEventActivity = 0; // Fixme, need to ref to share data.
+
+/* PRIVATE FUNCTIONS *********************************************************/
+
+static
+DWORD
+FASTCALL
+GetMaskFromEvent(DWORD Event)
+{
+ DWORD Ret = 0;
+
+ if ( Event > EVENT_OBJECT_STATECHANGE )
+ {
+ if ( Event == EVENT_OBJECT_LOCATIONCHANGE ) return SRV_EVENT_LOCATIONCHANGE;
+ if ( Event == EVENT_OBJECT_NAMECHANGE ) return SRV_EVENT_NAMECHANGE;
+ if ( Event == EVENT_OBJECT_VALUECHANGE ) return SRV_EVENT_VALUECHANGE;
+ return SRV_EVENT_CREATE;
+ }
+
+ if ( Event == EVENT_OBJECT_STATECHANGE ) return SRV_EVENT_STATECHANGE;
+
+ Ret = SRV_EVENT_RUNNING;
+
+ if ( Event < EVENT_SYSTEM_MENUSTART ) return SRV_EVENT_CREATE;
+
+ if ( Event <= EVENT_SYSTEM_MENUPOPUPEND )
+ {
+ Ret = SRV_EVENT_MENU;
+ }
+ else
+ {
+ if ( Event <= EVENT_CONSOLE_CARET-1 ) return SRV_EVENT_CREATE;
+ if ( Event <= EVENT_CONSOLE_END_APPLICATION ) return SRV_EVENT_END_APPLICATION;
+ if ( Event != EVENT_OBJECT_FOCUS ) return SRV_EVENT_CREATE;
+ }
+ return Ret;
+}
+
/* FUNCTIONS *****************************************************************/
/*
@@ -221,7 +259,7 @@
}
/*
- * @unimplemented
+ * @implemented
*/
VOID
STDCALL
@@ -232,7 +270,11 @@
LONG idChild
)
{
- NtUserNotifyWinEvent(event, hwnd, idObject, idChild);
+// "Servers call NotifyWinEvent to announce the event to the system after the
+// event has occurred; they must never notify the system of an event before
+// the event has occurred." msdn on NotifyWinEvent.
+ if (Bogus_SrvEventActivity & GetMaskFromEvent(event)) // Check to see.
+ NtUserNotifyWinEvent(event, hwnd, idObject, idChild);
}
/*
@@ -277,7 +319,7 @@
}
/*
- * @unimplemented
+ * @implemented
*/
BOOL
STDCALL
@@ -286,6 +328,7 @@
{
if ((PW32THREADINFO)NtCurrentTeb()->Win32ThreadInfo)
{
+ return (Bogus_SrvEventActivity & GetMaskFromEvent(event)) != 0;
}
return FALSE;
}
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Sat Apr 12 15:53:08 2008
@@ -241,6 +241,16 @@
} W32CLIENTINFO, *PW32CLIENTINFO;
#define GetWin32ClientInfo() (PW32CLIENTINFO)(NtCurrentTeb()->Win32ClientInfo)
+
+// Server event activity bits.
+#define SRV_EVENT_MENU 0x0001
+#define SRV_EVENT_END_APPLICATION 0x0002
+#define SRV_EVENT_RUNNING 0x0004
+#define SRV_EVENT_NAMECHANGE 0x0008
+#define SRV_EVENT_VALUECHANGE 0x0010
+#define SRV_EVENT_STATECHANGE 0x0020
+#define SRV_EVENT_LOCATIONCHANGE 0x0040
+#define SRV_EVENT_CREATE 0x8000
PW32THREADINFO GetW32ThreadInfo(VOID);
PW32PROCESSINFO GetW32ProcessInfo(VOID);
@@ -2205,12 +2215,12 @@
HRGN hRgn,
BOOL bRedraw);
-DWORD
+HHOOK
NTAPI
NtUserSetWindowsHookAW(
- DWORD Unknown0,
- DWORD Unknown1,
- DWORD Unknown2);
+ int idHook,
+ HOOKPROC lpfn,
+ BOOL Ansi);
HHOOK
NTAPI
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Sat Apr 12 15:53:08
2008
@@ -16,8 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id$
- *
+/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Window hooks
@@ -38,6 +37,44 @@
#define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1))
static PHOOKTABLE GlobalHooks;
+DWORD Bogus_SrvEventActivity = 0;
+
+
+/* PRIVATE FUNCTIONS *********************************************************/
+
+static
+DWORD
+FASTCALL
+GetMaskFromEvent(DWORD Event)
+{
+ DWORD Ret = 0;
+
+ if ( Event > EVENT_OBJECT_STATECHANGE )
+ {
+ if ( Event == EVENT_OBJECT_LOCATIONCHANGE ) return SRV_EVENT_LOCATIONCHANGE;
+ if ( Event == EVENT_OBJECT_NAMECHANGE ) return SRV_EVENT_NAMECHANGE;
+ if ( Event == EVENT_OBJECT_VALUECHANGE ) return SRV_EVENT_VALUECHANGE;
+ return SRV_EVENT_CREATE;
+ }
+
+ if ( Event == EVENT_OBJECT_STATECHANGE ) return SRV_EVENT_STATECHANGE;
+
+ Ret = SRV_EVENT_RUNNING;
+
+ if ( Event < EVENT_SYSTEM_MENUSTART ) return SRV_EVENT_CREATE;
+
+ if ( Event <= EVENT_SYSTEM_MENUPOPUPEND )
+ {
+ Ret = SRV_EVENT_MENU;
+ }
+ else
+ {
+ if ( Event <= EVENT_CONSOLE_CARET-1 ) return SRV_EVENT_CREATE;
+ if ( Event <= EVENT_CONSOLE_END_APPLICATION ) return SRV_EVENT_END_APPLICATION;
+ if ( Event != EVENT_OBJECT_FOCUS ) return SRV_EVENT_CREATE;
+ }
+ return Ret;
+}
/* create a new hook table */
static PHOOKTABLE
@@ -485,16 +522,16 @@
END_CLEANUP;
}
-DWORD
+HHOOK
STDCALL
NtUserSetWindowsHookAW(
- DWORD Unknown0,
- DWORD Unknown1,
- DWORD Unknown2)
-{
- UNIMPLEMENTED
-
- return 0;
+ int idHook,
+ HOOKPROC lpfn,
+ BOOL Ansi)
+{
+ UNICODE_STRING USModuleName;
+ RtlInitUnicodeString(&USModuleName, NULL);
+ return NtUserSetWindowsHookEx(NULL, &USModuleName, 0, idHook, lpfn, Ansi);
}
HHOOK
@@ -709,6 +746,9 @@
DWORD idThread,
UINT dwflags)
{
+
+ Bogus_SrvEventActivity |= GetMaskFromEvent(eventMin); // Fake it out for now.
+ Bogus_SrvEventActivity &= ~GetMaskFromEvent(eventMin);
UNIMPLEMENTED
return 0;