52 TRACE(
"co_IntClientLoadLibrary returned %d\n", bResult );
56 ppi->W32PF_flags &= ~W32PF_APIHOOKLOADED;
66 ppi->W32PF_flags &= ~W32PF_APIHOOKLOADED;
94 TRACE(
"IntHookModuleUnloaded: iHookID=%d\n", iHookID);
99 while(ListEntry != &pdesk->
PtiList)
107 ptiCurrent->
ppi != ppiCsr)
111 TRACE(
"IntHookModuleUnloaded: sending message to PID %p, ppi=%p\n",
PsGetProcessId(ptiCurrent->
ppi->peProcess), ptiCurrent->
ppi);
123 ListEntry = ListEntry->
Flink;
175 if(pwndCurrent ==
NULL)
179 ptiCurrent = pwndCurrent->
head.pti;
183 ptiCurrent->
ppi == ppiCsr)
255 pti = Hook->
head.pti;
308 ERR(
"Error Hook Call SendMsg. %d Status: 0x%x\n", Hook->
HookId,
Status);
420 ERR(
"HOOK WH_DEBUG read from lParam ERROR!\n");
434 Size =
sizeof(MOUSEHOOKSTRUCTEX);
505 ERR(
"HOOK WH_DEBUG read from Debug.lParam ERROR!\n");
534 MOUSEHOOKSTRUCTEX
Mouse;
540 sizeof(MOUSEHOOKSTRUCTEX),
545 sizeof(MOUSEHOOKSTRUCTEX));
555 ERR(
"HOOK WH_MOUSE read from lParam ERROR!\n");
593 ERR(
"HOOK WH_MOUSE_LL read from lParam ERROR!\n");
628 ERR(
"HOOK WH_KEYBORD_LL read from lParam ERROR!\n");
665 ERR(
"HOOK WH_XMESSAGEX read from lParam ERROR!\n");
693 ERR(
"HOOK WH_GETMESSAGE write to lParam ERROR!\n");
701 TRACE(
"HOOK WH_CBT!\n");
708 TRACE(
"HOOK HCBT_CREATEWND\n");
760 ERR(
"HOOK HCBT_CREATEWND write ERROR!\n");
763 if (!BadChk && Hook->
Proc)
774 TRACE(
"HOOK HCBT_MOVESIZE\n");
796 ERR(
"HOOK HCBT_MOVESIZE read from lParam ERROR!\n");
811 TRACE(
"HOOK HCBT_ACTIVATE\n");
832 ERR(
"HOOK HCBT_ACTIVATE read from lParam ERROR!\n");
880 ERR(
"HOOK WH_JOURNAL read from lParam ERROR!\n");
908 ERR(
"HOOK WH_JOURNAL write to lParam ERROR!\n");
929 ERR(
"Unsupported HOOK Id -> %d\n",Hook->
HookId);
971 for (pElem = pLastHead->
Flink; pElem != pLastHead; pElem = pElem->
Flink)
981 for (pElem = pLastHead->
Flink; pElem != pLastHead; pElem = pElem->
Flink)
997 int HookId = Hook->
HookId;
1013 if (pElem != pLastHead)
1059 ptiHook->
fsHooks &= ~HOOKID_TO_FLAG(HookId);
1060 bOtherProcess = (ptiHook->
ppi != pti->
ppi);
1107 PHOOK Hook, SaveHook;
1127 TRACE(
"No PDO %d\n", HookId);
1138 TRACE(
"Hook Thread dead %d\n", HookId);
1144 TRACE(
"Local Hooker %d\n", HookId);
1150 TRACE(
"Global Hooker %d\n", HookId);
1166 ERR(
"No Local Hook Found!\n");
1229 HHOOK *pHookHandles;
1241 for(
i = 0; pHookHandles[
i]; ++
i)
1246 ERR(
"Invalid hook!\n");
1251 ptiHook = Hook->
head.pti;
1255 TRACE(
"Next Hook %p, %p\n", ptiHook->
rpdesk, pdo);
1260 if (ptiHook != pti )
1270 TRACE(
"\nGlobal Hook posting to another Thread! %d\n",HookId );
1273 else if (ptiHook->
ppi == pti->
ppi)
1275 TRACE(
"\nGlobal Hook calling to another Thread! %d\n",HookId );
1293 TRACE(
"Global going Local Hook calling to Thread! %d\n",HookId );
1311 TRACE(
"Ret: Global HookId %d Result 0x%x\n", HookId,
Result);
1335 pElement = pLastHead->
Flink;
1336 while (pElement != pLastHead)
1343 if (Hook->
Proc == pfnFilterProc)
1345 if (Hook->
head.pti == pti)
1376 PHOOK HookObj, NextObj;
1380 TRACE(
"Enter NtUserCallNextHookEx\n");
1412 TRACE(
"Leave NtUserCallNextHookEx, ret=%i\n", lResult);
1454 TRACE(
"Enter NtUserSetWindowsHookEx\n");
1479 TRACE(
"Local hook installing Global HookId: %d\n",HookId);
1487 ERR(
"Invalid thread id 0x%x\n", ThreadId);
1494 ERR(
"Local hook wrong desktop HookId: %d\n",HookId);
1499 if (ptiHook->
ppi != pti->
ppi)
1511 ERR(
"Local hook needs hMod HookId: %d\n",HookId);
1545 ERR(
"Global hook needs hMod HookId: %d\n",HookId);
1575 Hook->
Proc = HookProc;
1589 if ( ptiHook->
ppi == pti->
ppi)
1598 ERR(
"Problem writing to Local ClientInfo!\n");
1614 ERR(
"Problem writing to Remote ClientInfo!\n");
1671 FIXME(
"NtUserSetWindowsHookEx Setting process hMod instance addressing.\n");
1678 TRACE(
"Installing: HookId %d Global %s\n", HookId, !ThreadId ?
"TRUE" :
"FALSE");
1684 TRACE(
"Leave NtUserSetWindowsHookEx, ret=%p\n", Ret);
1696 TRACE(
"Enter NtUserUnhookWindowsHookEx\n");
1701 ERR(
"Invalid handle passed to NtUserUnhookWindowsHookEx\n");
1715 TRACE(
"Leave NtUserUnhookWindowsHookEx, ret=%i\n", Ret);
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
#define UlongToHandle(ul)
#define DBG_DEFAULT_CHANNEL(ch)
#define ERROR_NOT_ENOUGH_MEMORY
#define NT_SUCCESS(StatCode)
#define ERROR_INVALID_PARAMETER
#define ERROR_ACCESS_DENIED
static const WCHAR Cleanup[]
#define RemoveEntryList(Entry)
#define InsertHeadList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define IsListEmpty(ListHead)
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
static VOID NTAPI Unload(PDRIVER_OBJECT DriverObject)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define HOOKID_TO_INDEX(HookId)
#define ISITHOOKED(HookId)
#define HOOKID_TO_FLAG(HookId)
#define EXCEPTION_EXECUTE_HANDLER
#define UserHMGetHandle(obj)
struct _THREADINFO * GetW32ThreadInfo(VOID)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ExFreePoolWithTag(_P, _T)
#define _Analysis_assume_(expr)
NTSTATUS FASTCALL co_MsqSendMessage(PTHREADINFO ptirec, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uTimeout, BOOL Block, INT HookMessage, ULONG_PTR *uResult)
BOOL FASTCALL co_MsqSendMessageAsync(PTHREADINFO ptiReceiver, HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, BOOL HasPackedLParam, INT HookMessage)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_Out_ PKAPC_STATE ApcState
BOOLEAN NTAPI PsIsSystemProcess(IN PEPROCESS Process)
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
HANDLE NTAPI PsGetProcessId(PEPROCESS Process)
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
static HHOOK *FASTCALL IntGetGlobalHookHandles(PDESKTOP pdo, int HookId)
LRESULT APIENTRY co_CallHook(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
struct _HOOKPACK HOOKPACK
UNICODE_STRING strUahModule
static LRESULT APIENTRY co_HOOK_CallHookNext(PHOOK Hook, INT Code, WPARAM wParam, LPARAM lParam)
static LRESULT FASTCALL co_IntCallLowLevelHook(PHOOK Hook, INT Code, WPARAM wParam, LPARAM lParam)
BOOL FASTCALL UserUnregisterUserApiHook(VOID)
UNICODE_STRING strUahInitFunc
BOOL APIENTRY NtUserUnregisterUserApiHook(VOID)
BOOL APIENTRY NtUserRegisterUserApiHook(PUNICODE_STRING m_dllname1, PUNICODE_STRING m_funname1, DWORD dwUnknown3, DWORD dwUnknown4)
LRESULT APIENTRY NtUserCallNextHookEx(int Code, WPARAM wParam, LPARAM lParam, BOOL Ansi)
PHOOK FASTCALL IntGetNextHook(PHOOK Hook)
struct _HOOKPACK * PHOOKPACK
BOOL IntHookModuleUnloaded(PDESKTOP pdesk, int iHookID, HHOOK hHook)
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
BOOL APIENTRY NtUserUnhookWindowsHookEx(HHOOK Hook)
BOOL FASTCALL UserLoadApiHook(VOID)
HHOOK APIENTRY NtUserSetWindowsHookEx(HINSTANCE Mod, PUNICODE_STRING UnsafeModuleName, DWORD ThreadId, int HookId, HOOKPROC HookProc, BOOL Ansi)
static LRESULT FASTCALL co_IntCallDebugHook(PHOOK Hook, int Code, WPARAM wParam, LPARAM lParam, BOOL Ansi)
HHOOK APIENTRY NtUserSetWindowsHookAW(int idHook, HOOKPROC lpfn, BOOL Ansi)
static VOID FASTCALL IntFreeHook(PHOOK Hook)
static LRESULT APIENTRY co_UserCallNextHookEx(PHOOK Hook, int Code, WPARAM wParam, LPARAM lParam, BOOL Ansi)
PHOOK FASTCALL IntGetHookObject(HHOOK hHook)
PPROCESSINFO ppiUahServer
BOOLEAN IntRemoveHook(PVOID Object)
BOOL IntLoadHookModule(int iHookID, HHOOK hHook, BOOL Unload)
BOOL FASTCALL IntUnhookWindowsHook(int HookId, HOOKPROC pfnFilterProc)
BOOL FASTCALL UserRegisterUserApiHook(PUNICODE_STRING pstrDllName, PUNICODE_STRING pstrFuncName)
NTSTATUS FASTCALL IntValidateWindowStationHandle(HWINSTA WindowStation, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, PWINSTATION_OBJECT *Object, POBJECT_HANDLE_INFORMATION pObjectHandleInfo)
VOID FASTCALL UserLeave(VOID)
VOID FASTCALL UserEnterExclusive(VOID)
BOOL FASTCALL UserIsEnteredExclusive(VOID)
static __inline VOID UserDerefObjectCo(PVOID obj)
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
VOID NTAPI KeStackAttachProcess(IN PKPROCESS Process, OUT PRKAPC_STATE ApcState)
VOID NTAPI KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
#define _SEH2_EXCEPT(...)
static __inline NTSTATUS ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest, IN KPROCESSOR_MODE CurrentMode, IN const UNICODE_STRING *UnsafeSrc)
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Implementation of the Explorer desktop window.
LIST_ENTRY aphkStart[NB_HOOKS]
struct _LIST_ENTRY * Flink
struct _DESKTOPINFO * pDeskInfo
struct tagHOOK * sphkCurrent
struct _CLIENTINFO * pClientInfo
LIST_ENTRY aphkStart[NB_HOOKS]
FIXME!
struct _THREADINFO * ptiHooked
UNICODE_STRING ModuleName
TW_UINT32 TW_UINT16 TW_UINT16 MSG
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
PWND FASTCALL UserGetWindowObject(HWND hWnd)
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_In_ UCHAR _In_ UCHAR _In_ ULONG Code
_Must_inspect_result_ _In_ WDFCMRESLIST List
#define IntDereferenceThreadInfo(pti)
#define IntReferenceThreadInfo(pti)
#define W32PF_APIHOOKLOADED
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
BOOL NTAPI co_IntClientLoadLibrary(PUNICODE_STRING pstrLibName, PUNICODE_STRING pstrInitFunc, BOOL Unload, BOOL ApiHook)
LRESULT APIENTRY co_IntCallHookProc(INT HookId, INT Code, WPARAM wParam, LPARAM lParam, HOOKPROC Proc, INT Mod, ULONG_PTR offPfn, BOOLEAN Ansi, PUNICODE_STRING ModuleName)
PDESKTOP FASTCALL IntGetActiveDesktop(VOID)
HWND FASTCALL IntGetDesktopWindow(VOID)
PTHREADINFO FASTCALL IntTID2PTI(HANDLE id)
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
BOOL FASTCALL UserDereferenceObject(PVOID Object)
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
PUSER_HANDLE_TABLE gHandleTable
BOOL FASTCALL UserObjectInDestroy(HANDLE h)
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
VOID FASTCALL UserReferenceObject(PVOID obj)
HWND *FASTCALL IntWinListChildren(PWND Window)
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
#define ERROR_HOOK_TYPE_NOT_ALLOWED
#define ERROR_INVALID_FILTER_PROC
#define ERROR_HOOK_NEEDS_HMOD
#define ERROR_INVALID_HOOK_FILTER
#define ERROR_INVALID_HOOK_HANDLE
#define ERROR_GLOBAL_ONLY_HOOK
LRESULT(CALLBACK * HOOKPROC)(int, WPARAM, LPARAM)
#define WH_CALLWNDPROCRET
struct tagEVENTMSG EVENTMSG
struct tagMOUSEHOOKSTRUCT MOUSEHOOKSTRUCT
struct tagCBTACTIVATESTRUCT CBTACTIVATESTRUCT
CBT_CREATEWNDA CBT_CREATEWND
#define WH_JOURNALPLAYBACK
#define HCBT_CLICKSKIPPED
struct tagMSLLHOOKSTRUCT MSLLHOOKSTRUCT
struct tagKBDLLHOOKSTRUCT KBDLLHOOKSTRUCT
#define WH_FOREGROUNDIDLE
struct tagCBT_CREATEWNDW * LPCBT_CREATEWNDW
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
_Out_ PCLIENT_ID ClientId
#define ObDereferenceObject
#define ObReferenceObject
#define PsGetCurrentProcess