ReactOS 0.4.15-dev-7934-g1dc8d80
kbsdll.c File Reference
#include "../kbswitch.h"
Include dependency graph for kbsdll.c:

Go to the source code of this file.

Functions

static VOID PostMessageToMainWnd (UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK WinHookProc (int code, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK ShellHookProc (int code, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI KbSwitchSetHooks (VOID)
 
VOID WINAPI KbSwitchDeleteHooks (VOID)
 
BOOL WINAPI DllMain (IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
 

Variables

HHOOK hWinHook = NULL
 
HHOOK hShellHook = NULL
 
HINSTANCE hInstance = NULL
 
HWND hKbSwitchWnd = NULL
 

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( IN HINSTANCE  hinstDLL,
IN DWORD  dwReason,
IN LPVOID  lpvReserved 
)

Definition at line 95 of file kbsdll.c.

98{
99 switch (dwReason)
100 {
102 {
103 hInstance = hinstDLL;
105 if (!hKbSwitchWnd)
106 {
107 return FALSE;
108 }
109 }
110 break;
111 }
112
113 return TRUE;
114}
DWORD dwReason
Definition: misc.cpp:154
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
HINSTANCE hInstance
Definition: kbsdll.c:12
HWND hKbSwitchWnd
Definition: kbsdll.c:13
TCHAR szKbSwitcherName[]
Definition: kbswitch.h:29
#define FindWindow
Definition: winuser.h:5777

◆ KbSwitchDeleteHooks()

VOID WINAPI KbSwitchDeleteHooks ( VOID  )

Definition at line 80 of file kbsdll.c.

81{
82 if (hWinHook)
83 {
85 hWinHook = NULL;
86 }
87 if (hShellHook)
88 {
91 }
92}
HHOOK hShellHook
Definition: kbsdll.c:11
HHOOK hWinHook
Definition: kbsdll.c:10
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)

◆ KbSwitchSetHooks()

BOOL WINAPI KbSwitchSetHooks ( VOID  )

Definition at line 66 of file kbsdll.c.

67{
70
71 if (!hWinHook || !hShellHook)
72 {
73 return FALSE;
74 }
75
76 return TRUE;
77}
LRESULT CALLBACK ShellHookProc(int code, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:46
LRESULT CALLBACK WinHookProc(int code, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:22
#define WH_SHELL
Definition: winuser.h:40
#define WH_CBT
Definition: winuser.h:35
#define SetWindowsHookEx
Definition: winuser.h:5856

◆ PostMessageToMainWnd()

static VOID PostMessageToMainWnd ( UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 16 of file kbsdll.c.

17{
19}
struct @1632 Msg[]
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define PostMessage
Definition: winuser.h:5832

Referenced by ShellHookProc(), and WinHookProc().

◆ ShellHookProc()

LRESULT CALLBACK ShellHookProc ( int  code,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 46 of file kbsdll.c.

47{
48 if (code < 0)
49 {
51 }
52
53 switch (code)
54 {
55 case HSHELL_LANGUAGE:
56 {
58 }
59 break;
60 }
61
63}
static VOID PostMessageToMainWnd(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: kbsdll.c:16
#define WM_LANG_CHANGED
Definition: kbswitch.h:23
Definition: inflate.c:139
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)

Referenced by KbSwitchSetHooks().

◆ WinHookProc()

LRESULT CALLBACK WinHookProc ( int  code,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 22 of file kbsdll.c.

23{
24 if (code < 0)
25 {
27 }
28
29 switch (code)
30 {
31 case HCBT_SETFOCUS:
32 {
33 HWND hwndFocus = (HWND)wParam;
34 if (hwndFocus && hwndFocus != hKbSwitchWnd)
35 {
37 }
38 }
39 break;
40 }
41
43}
HANDLE HWND
Definition: compat.h:19
#define WM_WINDOW_ACTIVATE
Definition: kbswitch.h:24
#define HCBT_SETFOCUS
Definition: winuser.h:64

Referenced by KbSwitchSetHooks().

Variable Documentation

◆ hInstance

HINSTANCE hInstance = NULL

Definition at line 12 of file kbsdll.c.

Referenced by DllMain(), and KbSwitchSetHooks().

◆ hKbSwitchWnd

HWND hKbSwitchWnd = NULL

Definition at line 13 of file kbsdll.c.

Referenced by DllMain(), PostMessageToMainWnd(), and WinHookProc().

◆ hShellHook

HHOOK hShellHook = NULL

Definition at line 11 of file kbsdll.c.

Referenced by KbSwitchDeleteHooks(), KbSwitchSetHooks(), and ShellHookProc().

◆ hWinHook

HHOOK hWinHook = NULL

Definition at line 10 of file kbsdll.c.

Referenced by KbSwitchDeleteHooks(), KbSwitchSetHooks(), and WinHookProc().