ReactOS 0.4.15-dev-7958-gcd0bb1a
notifyhook.c File Reference
#include "../utility/utility.h"
#include "notifyhook.h"
Include dependency graph for notifyhook.c:

Go to the source code of this file.

Classes

struct  COPYDATA_STRUCT
 

Functions

BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD dwReason, LPVOID param)
 
LRESULT CALLBACK NotifyHookProc (int code, WPARAM wparam, LPARAM lparam)
 
UINT InstallNotifyHook ()
 
void DeinstallNotifyHook ()
 
void GetWindowModulePath (HWND hwnd)
 
DECL_NOTIFYHOOK int GetWindowModulePathCopyData (LPARAM lparam, HWND *phwnd, LPSTR buffer, int size)
 

Variables

static HINSTANCE s_hInstance
 
static UINT WM_GETMODULEPATH
 
static HHOOK s_hNotifyHook
 

Function Documentation

◆ DeinstallNotifyHook()

void DeinstallNotifyHook ( void  )

Definition at line 90 of file notifyhook.c.

91{
93 s_hNotifyHook = 0;
94}
static HHOOK s_hNotifyHook
Definition: notifyhook.c:36
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)

Referenced by NotifyHook::~NotifyHook().

◆ DllMain()

BOOL APIENTRY DllMain ( HINSTANCE  hInst,
DWORD  dwReason,
LPVOID  param 
)

Definition at line 39 of file notifyhook.c.

40{
41 switch(dwReason) {
45 WM_GETMODULEPATH = RegisterWindowMessageA("WM_GETMODULEPATH");
46 break;
47 }
48
49 return TRUE;
50}
DWORD dwReason
Definition: misc.cpp:154
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
HINSTANCE hInst
Definition: dxdiag.c:13
static HINSTANCE s_hInstance
Definition: notifyhook.c:34
static UINT WM_GETMODULEPATH
Definition: notifyhook.c:35
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)

◆ GetWindowModulePath()

void GetWindowModulePath ( HWND  hwnd)

Definition at line 97 of file notifyhook.c.

98{
100}
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define SendMessage
Definition: winuser.h:5843

◆ GetWindowModulePathCopyData()

DECL_NOTIFYHOOK int GetWindowModulePathCopyData ( LPARAM  lparam,
HWND phwnd,
LPSTR  buffer,
int  size 
)

Definition at line 103 of file notifyhook.c.

104{
106
107 if (data->dwData == WM_GETMODULEPATH) {
108 struct COPYDATA_STRUCT* cds = (struct COPYDATA_STRUCT*) data->lpData;
109
110 *phwnd = cds->_hwnd;
111 lstrcpyn(buffer, cds->_path, size);
112
113 return cds->_len;
114 } else
115 return 0;
116}
@ lparam
Definition: SystemMenu.c:31
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
char _path[MAX_PATH]
Definition: notifyhook.c:56
#define lstrcpyn
Definition: winbase.h:3875
struct tagCOPYDATASTRUCT * PCOPYDATASTRUCT

Referenced by NotifyHook::ModulePathCopyData().

◆ InstallNotifyHook()

UINT InstallNotifyHook ( void  )

Definition at line 83 of file notifyhook.c.

84{
86
87 return WM_GETMODULEPATH;
88}
LRESULT CALLBACK NotifyHookProc(int code, WPARAM wparam, LPARAM lparam)
Definition: notifyhook.c:59
#define SetWindowsHookEx
Definition: winuser.h:5856
#define WH_GETMESSAGE
Definition: winuser.h:33

◆ NotifyHookProc()

LRESULT CALLBACK NotifyHookProc ( int  code,
WPARAM  wparam,
LPARAM  lparam 
)

Definition at line 59 of file notifyhook.c.

60{
61 MSG* pmsg = (MSG*)lparam;
62
63 if (pmsg->message == WM_GETMODULEPATH) {
64 struct COPYDATA_STRUCT cds;
66
67 cds._hwnd = pmsg->hwnd;
68 cds._len = GetWindowModuleFileNameA(pmsg->hwnd, cds._path, COUNTOF(cds._path));
69
70 data.dwData = WM_GETMODULEPATH;
71 data.cbData = sizeof(cds);
72 data.lpData = &cds;
73
74 SendMessage((HWND)pmsg->wParam, WM_COPYDATA, (WPARAM)pmsg->hwnd, (LPARAM)&data);
75
76 return 0;
77 }
78
80}
@ wparam
Definition: SystemMenu.c:30
#define COUNTOF(x)
Definition: utility.h:93
Definition: inflate.c:139
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_COPYDATA
Definition: winuser.h:1664
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
UINT WINAPI GetWindowModuleFileNameA(_In_ HWND hwnd, _Out_writes_to_(cchFileNameMax, return) LPSTR pszFileName, _In_ UINT cchFileNameMax)

Referenced by InstallNotifyHook().

Variable Documentation

◆ s_hInstance

HINSTANCE s_hInstance
static

Definition at line 34 of file notifyhook.c.

Referenced by DllMain(), and InstallNotifyHook().

◆ s_hNotifyHook

HHOOK s_hNotifyHook
static

Definition at line 36 of file notifyhook.c.

Referenced by DeinstallNotifyHook(), InstallNotifyHook(), and NotifyHookProc().

◆ WM_GETMODULEPATH

UINT WM_GETMODULEPATH
static