ReactOS 0.4.15-dev-7931-gfd331f1
ImmEnumInputContext.c File Reference
#include "precomp.h"
#include <windowsx.h>
Include dependency graph for ImmEnumInputContext.c:

Go to the source code of this file.

Functions

static BOOL CALLBACK ImcEnumProc (HIMC hImc, LPARAM lParam)
 
static DWORD WINAPI AnotherThreadFunc (LPVOID arg)
 
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
 
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
static INT_PTR CALLBACK DialogProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
 START_TEST (ImmEnumInputContext)
 

Variables

static HWND s_hwnd = NULL
 
static INT s_nCounter = 0
 
static HIMC s_hImc1 = NULL
 
static HIMC s_hImc2 = NULL
 
static HIMC s_hImc3 = NULL
 
static HIMC s_hImc4 = NULL
 

Function Documentation

◆ AnotherThreadFunc()

static DWORD WINAPI AnotherThreadFunc ( LPVOID  arg)
static

Definition at line 78 of file ImmEnumInputContext.c.

79{
82
85
87
90
92 s_hImc4 = NULL;
93
95 ok_int(s_nCounter, 11);
96
98 return 0;
99}
static HWND s_hwnd
static BOOL CALLBACK ImcEnumProc(HIMC hImc, LPARAM lParam)
static INT s_nCounter
static HIMC s_hImc4
#define ok_int(expression, result)
Definition: atltest.h:134
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
HIMC WINAPI ImmCreateContext(void)
Definition: imm.c:590
BOOL WINAPI ImmDestroyContext(HIMC hIMC)
Definition: imm.c:915
BOOL WINAPI ImmEnumInputContext(DWORD dwThreadId, IMCENUMPROC lpfn, LPARAM lParam)
Definition: imm.c:1096
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1740
#define IDYES
Definition: winuser.h:835

Referenced by OnInitDialog().

◆ DialogProc()

static INT_PTR CALLBACK DialogProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 158 of file ImmEnumInputContext.c.

159{
160 switch (uMsg)
161 {
164 }
165 return 0;
166}
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define HANDLE_MSG(hwnd, message, fn)
Definition: windowsx.h:322
#define WM_INITDIALOG
Definition: winuser.h:1739

Referenced by START_TEST().

◆ ImcEnumProc()

static BOOL CALLBACK ImcEnumProc ( HIMC  hImc,
LPARAM  lParam 
)
static

Definition at line 19 of file ImmEnumInputContext.c.

20{
21 trace("s_nCounter %d\n", s_nCounter);
22 switch (s_nCounter)
23 {
24 case 0:
25 ok_long((LONG)lParam, 0xDEADBEEF);
26 ok(hImc == s_hImc1, "hImc was %p, s_hImc1 was %p\n", hImc, s_hImc1);
27 break;
28 case 1:
29 ok_long((LONG)lParam, 0xDEADFACE);
30 ok(hImc == s_hImc1, "hImc was %p, s_hImc1 was %p\n", hImc, s_hImc1);
31 break;
32 case 2:
33 ok_long((LONG)lParam, 0xDEADFACE);
34 ok(hImc == s_hImc2, "hImc was %p, s_hImc2 was %p\n", hImc, s_hImc1);
35 break;
36 case 3:
37 ok_long((LONG)lParam, 0xBEEFCAFE);
38 ok(hImc == s_hImc1, "hImc was %p, s_hImc1 was %p\n", hImc, s_hImc1);
39 break;
40 case 4:
41 ok_long((LONG)lParam, 0xAC1DFACE);
42 ok(hImc == s_hImc1, "hImc was %p, s_hImc1 was %p\n", hImc, s_hImc1);
43 break;
44 case 5:
45 ok_long((LONG)lParam, 0xDEADBEEF);
46 s_hImc3 = hImc;
47 ok(hImc != s_hImc1, "hImc was %p, s_hImc1 was %p\n", hImc, s_hImc1);
48 break;
49 case 6:
50 ok_long((LONG)lParam, 0xBEEFCAFE);
51 ok(hImc == s_hImc3, "hImc was %p, s_hImc3 was %p\n", hImc, s_hImc3);
52 break;
53 case 7:
54 ok_long((LONG)lParam, 0xDEADFACE);
55 ok(hImc == s_hImc3, "hImc was %p, s_hImc3 was %p\n", hImc, s_hImc3);
56 break;
57 case 8:
58 ok_long((LONG)lParam, 0xDEADFACE);
59 ok(hImc == s_hImc4, "hImc was %p, s_hImc4 was %p\n", hImc, s_hImc4);
60 break;
61 case 9:
62 ok_long((LONG)lParam, 0xFEEDF00D);
63 ok(hImc == s_hImc3, "hImc was %p, s_hImc3 was %p\n", hImc, s_hImc3);
64 break;
65 case 10:
66 ok_long((LONG)lParam, 0xFEEDF00D);
67 ok(hImc == s_hImc1, "hImc was %p, s_hImc1 was %p\n", hImc, s_hImc1);
68 break;
69 default:
70 ok_long(0, 1);
71 ok_int(0, 1);
72 break;
73 }
74 ++s_nCounter;
75 return TRUE;
76}
static HIMC s_hImc1
static HIMC s_hImc3
static HIMC s_hImc2
#define ok_long(expression, result)
Definition: atltest.h:133
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
LPARAM lParam
Definition: combotst.c:139
long LONG
Definition: pedump.c:60

Referenced by AnotherThreadFunc(), and OnInitDialog().

◆ OnCommand()

static void OnCommand ( HWND  hwnd,
int  id,
HWND  hwndCtl,
UINT  codeNotify 
)
static

Definition at line 145 of file ImmEnumInputContext.c.

146{
147 switch (id)
148 {
149 case IDOK:
150 case IDCANCEL:
151 case IDYES:
152 EndDialog(hwnd, id);
153 break;
154 }
155}
#define IDCANCEL
Definition: winuser.h:831
#define IDOK
Definition: winuser.h:830
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by DialogProc().

◆ OnInitDialog()

static BOOL OnInitDialog ( HWND  hwnd,
HWND  hwndFocus,
LPARAM  lParam 
)
static

Definition at line 102 of file ImmEnumInputContext.c.

103{
105
106 s_hwnd = hwnd;
107 s_nCounter = 0;
108
110 ok(s_hImc1 != NULL, "s_hImc1 was NULL\n");
111
112 ok_int(ImmEnumInputContext(0, ImcEnumProc, 0xDEADBEEF), TRUE);
113 ok_int(s_nCounter, 1);
114
116 ok_int(s_nCounter, 1);
117
119 ok(s_hImc2 != NULL, "s_hImc1 was NULL\n");
120
121 ok_int(ImmEnumInputContext(0, ImcEnumProc, 0xDEADFACE), TRUE);
122 ok_int(s_nCounter, 3);
123
125 s_hImc2 = NULL;
126
127 ok_int(ImmEnumInputContext(0, ImcEnumProc, 0xBEEFCAFE), TRUE);
128 ok_int(s_nCounter, 4);
129
131 ok_int(s_nCounter, 5);
132
134 if (hThread == NULL)
135 {
136 skip("hThread was NULL\n");
138 }
140
141 return TRUE;
142}
static DWORD WINAPI AnotherThreadFunc(LPVOID arg)
#define skip(...)
Definition: atltest.h:64
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1044
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
HANDLE hThread
Definition: wizard.c:28
#define IDNO
Definition: winuser.h:836

Referenced by DialogProc().

◆ START_TEST()

START_TEST ( ImmEnumInputContext  )

Definition at line 168 of file ImmEnumInputContext.c.

169{
170 INT_PTR id;
172 if (id != IDYES)
173 {
174 skip("Tests skipped\n");
175 }
176}
static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
GLuint id
Definition: glext.h:5910
int32_t INT_PTR
Definition: typedefs.h:64
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4399
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Variable Documentation

◆ s_hImc1

HIMC s_hImc1 = NULL
static

Definition at line 13 of file ImmEnumInputContext.c.

Referenced by ImcEnumProc(), and OnInitDialog().

◆ s_hImc2

HIMC s_hImc2 = NULL
static

Definition at line 14 of file ImmEnumInputContext.c.

Referenced by ImcEnumProc(), and OnInitDialog().

◆ s_hImc3

HIMC s_hImc3 = NULL
static

Definition at line 15 of file ImmEnumInputContext.c.

Referenced by ImcEnumProc().

◆ s_hImc4

HIMC s_hImc4 = NULL
static

Definition at line 16 of file ImmEnumInputContext.c.

Referenced by AnotherThreadFunc(), and ImcEnumProc().

◆ s_hwnd

HWND s_hwnd = NULL
static

Definition at line 11 of file ImmEnumInputContext.c.

Referenced by AnotherThreadFunc(), and OnInitDialog().

◆ s_nCounter

INT s_nCounter = 0
static

Definition at line 12 of file ImmEnumInputContext.c.

Referenced by AnotherThreadFunc(), ImcEnumProc(), and OnInitDialog().