ReactOS  0.4.15-dev-985-gd905dd5
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) {
42  case DLL_PROCESS_ATTACH:
45  WM_GETMODULEPATH = RegisterWindowMessageA("WM_GETMODULEPATH");
46  break;
47  }
48 
49  return TRUE;
50 }
static UINT WM_GETMODULEPATH
Definition: notifyhook.c:35
static HINSTANCE s_hInstance
Definition: notifyhook.c:34
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
DWORD dwReason
Definition: misc.cpp:154
HINSTANCE hInst
Definition: dxdiag.c:13
UINT WINAPI RegisterWindowMessageA(_In_ LPCSTR)

◆ GetWindowModulePath()

void GetWindowModulePath ( HWND  hwnd)

Definition at line 97 of file notifyhook.c.

98 {
100 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static UINT WM_GETMODULEPATH
Definition: notifyhook.c:35
#define SendMessage
Definition: winuser.h:5818

◆ 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 }
static UINT WM_GETMODULEPATH
Definition: notifyhook.c:35
char _path[MAX_PATH]
Definition: notifyhook.c:56
GLuint buffer
Definition: glext.h:5915
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
GLsizeiptr size
Definition: glext.h:5919
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct tagCOPYDATASTRUCT * PCOPYDATASTRUCT
#define lstrcpyn
Definition: winbase.h:3715

Referenced by NotifyHook::ModulePathCopyData().

◆ InstallNotifyHook()

UINT InstallNotifyHook ( void  )

Definition at line 83 of file notifyhook.c.

84 {
86 
87  return WM_GETMODULEPATH;
88 }
static UINT WM_GETMODULEPATH
Definition: notifyhook.c:35
#define WH_GETMESSAGE
Definition: winuser.h:33
static HINSTANCE s_hInstance
Definition: notifyhook.c:34
static HHOOK s_hNotifyHook
Definition: notifyhook.c:36
LRESULT CALLBACK NotifyHookProc(int code, WPARAM wparam, LPARAM lparam)
Definition: notifyhook.c:59
#define SetWindowsHookEx
Definition: winuser.h:5831

◆ 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 }
static UINT WM_GETMODULEPATH
Definition: notifyhook.c:35
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
UINT WINAPI GetWindowModuleFileNameA(_In_ HWND hwnd, _Out_writes_to_(cchFileNameMax, return) LPSTR pszFileName, _In_ UINT cchFileNameMax)
UINT_PTR WPARAM
Definition: windef.h:207
static HHOOK s_hNotifyHook
Definition: notifyhook.c:36
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_COPYDATA
Definition: winuser.h:1646
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: inflate.c:139
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define SendMessage
Definition: winuser.h:5818
#define COUNTOF(x)
Definition: utility.h:93
static UINT WPARAM wparam
Definition: combo.c:716

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