[IMM32_WINETEST]

* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=63059
This commit is contained in:
Amine Khaldi
2014-04-30 12:16:47 +00:00
parent 45d0525013
commit 450dbf0203
+474 -50
View File
@@ -102,9 +102,9 @@ static LRESULT CALLBACK call_wnd_proc_filter(int nCode, WPARAM wParam,
static void msg_spy_pump_msg_queue(void) {
MSG msg;
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
while(PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
DispatchMessageW(&msg);
}
return;
@@ -143,11 +143,11 @@ static imm_msgs* msg_spy_find_msg(UINT message) {
static void msg_spy_init(HWND hwnd) {
msg_spy.hwnd = hwnd;
msg_spy.get_msg_hook =
SetWindowsHookEx(WH_GETMESSAGE, get_msg_filter, GetModuleHandle(0),
GetCurrentThreadId());
SetWindowsHookExW(WH_GETMESSAGE, get_msg_filter, GetModuleHandleW(NULL),
GetCurrentThreadId());
msg_spy.call_wnd_proc_hook =
SetWindowsHookEx(WH_CALLWNDPROC, call_wnd_proc_filter,
GetModuleHandle(0), GetCurrentThreadId());
SetWindowsHookExW(WH_CALLWNDPROC, call_wnd_proc_filter,
GetModuleHandleW(NULL), GetCurrentThreadId());
msg_spy.i_msg = 0;
msg_spy_flush_msgs();
@@ -182,7 +182,7 @@ static LRESULT WINAPI wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
static BOOL init(void) {
WNDCLASSEX wc;
WNDCLASSEXA wc;
HIMC imc;
HMODULE hmod,huser;
@@ -192,25 +192,25 @@ static BOOL init(void) {
pImmIsUIMessageA = (void*)GetProcAddress(hmod, "ImmIsUIMessageA");
pSendInput = (void*)GetProcAddress(huser, "SendInput");
wc.cbSize = sizeof(WNDCLASSEX);
wc.cbSize = sizeof(WNDCLASSEXA);
wc.style = 0;
wc.lpfnWndProc = wndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(0);
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hInstance = GetModuleHandleA(NULL);
wc.hIcon = LoadIconA(NULL, (LPCSTR)IDI_APPLICATION);
wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = wndcls;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wc.hIconSm = LoadIconA(NULL, (LPCSTR)IDI_APPLICATION);
if (!RegisterClassExA(&wc))
return FALSE;
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL);
hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
if (!hwnd)
return FALSE;
@@ -234,7 +234,7 @@ static void cleanup(void) {
msg_spy_cleanup();
if (hwnd)
DestroyWindow(hwnd);
UnregisterClass(wndcls, GetModuleHandle(0));
UnregisterClassA(wndcls, GetModuleHandleW(NULL));
}
static void test_ImmNotifyIME(void) {
@@ -254,14 +254,14 @@ static void test_ImmNotifyIME(void) {
"WM_IME_COMPOSITION in response to NI_COMPOSITIONSTR / CPS_CANCEL, if "
"the composition string being canceled is empty.\n");
ImmSetCompositionString(imc, SCS_SETSTR, string, sizeof(string), NULL, 0);
ImmSetCompositionStringA(imc, SCS_SETSTR, string, sizeof(string), NULL, 0);
msg_spy_flush_msgs();
ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
msg_spy_flush_msgs();
/* behavior differs between win9x and NT */
ret = ImmGetCompositionString(imc, GCS_COMPSTR, resstr, sizeof(resstr));
ret = ImmGetCompositionStringA(imc, GCS_COMPSTR, resstr, sizeof(resstr));
ok(!ret, "After being cancelled the composition string is empty.\n");
msg_spy_flush_msgs();
@@ -276,6 +276,26 @@ static void test_ImmNotifyIME(void) {
msg_spy_flush_msgs();
ImmReleaseContext(hwnd, imc);
imc = ImmCreateContext();
ImmDestroyContext(imc);
SetLastError(0xdeadbeef);
ret = ImmNotifyIME((HIMC)0xdeadcafe, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
ok (ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmNotifyIME(0x00000000, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
ok (ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_SUCCESS, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
ok (ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
}
static void test_ImmGetCompositionString(void)
@@ -406,9 +426,9 @@ static DWORD WINAPI ImmGetContextThreadFunc( LPVOID lpParam)
COMPOSITIONFORM cf;
POINT pt;
igc_threadinfo *info= (igc_threadinfo*)lpParam;
info->hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL);
info->hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
h1 = ImmGetContext(hwnd);
todo_wine ok(info->himc == h1, "hwnd context changed in new thread\n");
@@ -417,9 +437,9 @@ static DWORD WINAPI ImmGetContextThreadFunc( LPVOID lpParam)
info->himc = h2;
ImmReleaseContext(hwnd,h1);
hwnd2 = CreateWindowEx(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL);
hwnd2 = CreateWindowExA(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
h1 = ImmGetContext(hwnd2);
ok(h1 == h2, "Windows in same thread should have same default context\n");
@@ -443,13 +463,14 @@ static void test_ImmThreads(void)
HANDLE hThread;
DWORD dwThreadId;
BOOL rc;
LOGFONT lf;
LOGFONTA lf;
COMPOSITIONFORM cf;
CANDIDATEFORM cdf;
DWORD status, sentence;
POINT pt;
himc = ImmGetContext(hwnd);
threadinfo.event = CreateEvent(NULL, TRUE, FALSE, NULL);
threadinfo.event = CreateEventA(NULL, TRUE, FALSE, NULL);
threadinfo.himc = himc;
hThread = CreateThread(NULL, 0, ImmGetContextThreadFunc, &threadinfo, 0, &dwThreadId );
WaitForSingleObject(threadinfo.event, INFINITE);
@@ -489,14 +510,14 @@ static void test_ImmThreads(void)
ok(rc == 0, "ImmGetOpenStatus failed\n");
/* CompositionFont */
rc = ImmGetCompositionFont(himc, &lf);
rc = ImmGetCompositionFontA(himc, &lf);
ok(rc != 0, "ImmGetCompositionFont failed\n");
rc = ImmSetCompositionFont(himc, &lf);
rc = ImmSetCompositionFontA(himc, &lf);
ok(rc != 0, "ImmSetCompositionFont failed\n");
rc = ImmGetCompositionFont(otherHimc, &lf);
rc = ImmGetCompositionFontA(otherHimc, &lf);
ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont failed\n");
rc = ImmSetCompositionFont(otherHimc, &lf);
rc = ImmSetCompositionFontA(otherHimc, &lf);
todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n");
/* CompositionWindow */
@@ -532,6 +553,23 @@ static void test_ImmThreads(void)
rc = ImmGetStatusWindowPos(otherHimc, &pt);
ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n");
/* Candidate Window */
rc = ImmGetCandidateWindow(himc, 0, &cdf);
ok (rc == 0, "ImmGetCandidateWindow should fail\n");
cdf.dwIndex = 0;
cdf.dwStyle = CFS_CANDIDATEPOS;
cdf.ptCurrentPos.x = 0;
cdf.ptCurrentPos.y = 0;
rc = ImmSetCandidateWindow(himc, &cdf);
ok (rc == 1, "ImmSetCandidateWindow should succeed\n");
rc = ImmGetCandidateWindow(himc, 0, &cdf);
ok (rc == 1, "ImmGetCandidateWindow should succeed\n");
rc = ImmGetCandidateWindow(otherHimc, 0, &cdf);
todo_wine ok (rc == 0, "ImmGetCandidateWindow should fail\n");
rc = ImmSetCandidateWindow(otherHimc, &cdf);
todo_wine ok (rc == 0, "ImmSetCandidateWindow should fail\n");
ImmReleaseContext(threadinfo.hwnd,otherHimc);
ImmReleaseContext(hwnd,himc);
@@ -609,18 +647,19 @@ static void test_ImmGetContext(void)
static void test_ImmGetDescription(void)
{
HKL hkl;
WCHAR japime[] = { 'E', '0', '0', '1', '0', '4', '1', '1', 0 };
WCHAR descW[100];
CHAR descA[100];
UINT ret, lret;
/* FIXME: invalid keyboard layouts should not pass */
ret = ImmGetDescriptionW(NULL, NULL, 0);
todo_wine ok(!ret, "ImmGetDescriptionW failed, expected 0 received %d.\n", ret);
ok(!ret, "ImmGetDescriptionW failed, expected 0 received %d.\n", ret);
ret = ImmGetDescriptionA(NULL, NULL, 0);
ok(!ret, "ImmGetDescriptionA failed, expected 0 received %d.\n", ret);
/* load a language with valid IMM descriptions */
hkl = LoadKeyboardLayoutW(japime, KLF_ACTIVATE);
todo_wine ok(hkl != 0, "LoadKeyboardLayoutW failed, expected != 0.\n");
hkl = GetKeyboardLayout(0);
ok(hkl != 0, "GetKeyboardLayout failed, expected != 0.\n");
ret = ImmGetDescriptionW(hkl, NULL, 0);
if(!ret)
@@ -629,6 +668,12 @@ static void test_ImmGetDescription(void)
return;
}
SetLastError(0xdeadcafe);
ret = ImmGetDescriptionW(0, NULL, 100);
ok (ret == 0, "ImmGetDescriptionW with 0 hkl should return 0\n");
ret = GetLastError();
ok (ret == 0xdeadcafe, "Last Error should remain unchanged\n");
ret = ImmGetDescriptionW(hkl, descW, 0);
ok(ret, "ImmGetDescriptionW failed, expected != 0 received 0.\n");
@@ -638,13 +683,16 @@ static void test_ImmGetDescription(void)
lret = ImmGetDescriptionA(hkl, descA, ret + 1);
ok(lret, "ImmGetDescriptionA failed, expected != 0 received 0.\n");
todo_wine ok(lret == ret, "ImmGetDescriptionA failed to return the correct amount of data. Expected %d, got %d.\n", ret, lret);
ok(lret == ret, "ImmGetDescriptionA failed to return the correct amount of data. Expected %d, got %d.\n", ret, lret);
ret /= 2; /* try to copy partially */
lret = ImmGetDescriptionW(hkl, descW, ret + 1);
ok(lret, "ImmGetDescriptionW failed, expected != 0 received 0.\n");
ok(lret == ret, "ImmGetDescriptionW failed to return the correct amount of data. Expected %d, got %d.\n", ret, lret);
lret = ImmGetDescriptionA(hkl, descA, ret + 1);
ok(!lret, "ImmGetDescriptionA should fail\n");
ret = ImmGetDescriptionW(hkl, descW, 1);
ok(!ret, "ImmGetDescriptionW failed, expected 0 received %d.\n", ret);
@@ -657,9 +705,9 @@ static void test_ImmDefaultHwnd(void)
HWND def1, def3;
HWND hwnd;
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL);
hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandleW(NULL), NULL);
ShowWindow(hwnd, SW_SHOWNORMAL);
@@ -694,6 +742,23 @@ static void test_ImmGetIMCLockCount(void)
DWORD count, ret, i;
INPUTCONTEXT *ic;
imc = ImmCreateContext();
ImmDestroyContext(imc);
SetLastError(0xdeadbeef);
count = ImmGetIMCLockCount((HIMC)0xdeadcafe);
ok(count == 0, "Invalid IMC should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
count = ImmGetIMCLockCount(0x00000000);
ok(count == 0, "NULL IMC should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "Last Error should remain unchangedi %08x\n",ret);
count = ImmGetIMCLockCount(imc);
ok(count == 0, "Destroyed IMC should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
imc = ImmCreateContext();
count = ImmGetIMCLockCount(imc);
ok(count == 0, "expect 0, returned %d\n", count);
@@ -732,7 +797,8 @@ static void test_ImmGetIMCLockCount(void)
static void test_ImmGetIMCCLockCount(void)
{
HIMCC imcc;
DWORD count, g_count, ret, i;
DWORD count, g_count, i;
BOOL ret;
VOID *p;
imcc = ImmCreateIMCC(sizeof(CANDIDATEINFO));
@@ -790,16 +856,16 @@ static void test_ImmDestroyContext(void)
ret = ImmDestroyContext(imc);
ok(ret == TRUE, "Destroy a locked IMC should success!\n");
ic = ImmLockIMC(imc);
todo_wine ok(ic == NULL, "Lock a destroyed IMC should fail!\n");
ok(ic == NULL, "Lock a destroyed IMC should fail!\n");
ret = ImmUnlockIMC(imc);
todo_wine ok(ret == FALSE, "Unlock a destroyed IMC should fail!\n");
ok(ret == FALSE, "Unlock a destroyed IMC should fail!\n");
count = ImmGetIMCLockCount(imc);
todo_wine ok(count == 0, "Get lock count of a destroyed IMC should return 0!\n");
ok(count == 0, "Get lock count of a destroyed IMC should return 0!\n");
SetLastError(0xdeadbeef);
ret = ImmDestroyContext(imc);
todo_wine ok(ret == FALSE, "Destroy a destroyed IMC should fail!\n");
ok(ret == FALSE, "Destroy a destroyed IMC should fail!\n");
ret = GetLastError();
todo_wine ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
}
static void test_ImmDestroyIMCC(void)
@@ -842,9 +908,9 @@ static void test_ImmMessages(void)
HIMC imc;
UINT idx = 0;
HWND hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL);
HWND hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandleA(NULL), NULL);
ShowWindow(hwnd, SW_SHOWNORMAL);
defwnd = ImmGetDefaultIMEWnd(hwnd);
@@ -852,7 +918,7 @@ static void test_ImmMessages(void)
ImmSetOpenStatus(imc, TRUE);
msg_spy_flush_msgs();
SendMessage(defwnd, WM_IME_CONTROL, IMC_GETCANDIDATEPOS, (LPARAM)&cf );
SendMessageA(defwnd, WM_IME_CONTROL, IMC_GETCANDIDATEPOS, (LPARAM)&cf );
do
{
msg = msg_spy_find_next_msg(WM_IME_CONTROL,&idx);
@@ -887,8 +953,8 @@ static void test_ime_processkey(void)
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = processkey_wnd_proc;
wclass.hInstance = hInstance;
wclass.hIcon = LoadIcon(0, IDI_APPLICATION);
wclass.hCursor = LoadCursor( NULL, IDC_ARROW);
wclass.hIcon = LoadIconW(0, (LPCWSTR)IDI_APPLICATION);
wclass.hCursor = LoadCursorW( NULL, (LPCWSTR)IDC_ARROW);
wclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
@@ -980,6 +1046,363 @@ static void test_ime_processkey(void)
DestroyWindow(hWndTest);
}
static void test_InvalidIMC(void)
{
HIMC imc_destroy;
HIMC imc_null = 0x00000000;
HIMC imc_bad = (HIMC)0xdeadcafe;
HIMC imc1, imc2, oldimc;
DWORD ret;
DWORD count;
CHAR buffer[1000];
INPUTCONTEXT *ic;
LOGFONTA lf;
memset(&lf, 0, sizeof(lf));
imc_destroy = ImmCreateContext();
ret = ImmDestroyContext(imc_destroy);
ok(ret == TRUE, "Destroy an IMC should success!\n");
/* Test associating destroyed imc */
imc1 = ImmGetContext(hwnd);
SetLastError(0xdeadbeef);
oldimc = ImmAssociateContext(hwnd, imc_destroy);
ok(!oldimc, "Associating to a destroyed imc should fail!\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
imc2 = ImmGetContext(hwnd);
ok(imc1 == imc2, "imc should not changed! imc1 %p, imc2 %p\n", imc1, imc2);
/* Test associating NULL imc, which is different from an invalid imc */
oldimc = ImmAssociateContext(hwnd, imc_null);
ok(oldimc != NULL, "Associating to NULL imc should success!\n");
imc2 = ImmGetContext(hwnd);
ok(!imc2, "expect NULL, returned %p\n", imc2);
oldimc = ImmAssociateContext(hwnd, imc1);
ok(!oldimc, "expect NULL, returned %p\n", oldimc);
imc2 = ImmGetContext(hwnd);
ok(imc2 == imc1, "imc should not changed! imc2 %p, imc1 %p\n", imc2, imc1);
/* Test associating invalid imc */
imc1 = ImmGetContext(hwnd);
SetLastError(0xdeadbeef);
oldimc = ImmAssociateContext(hwnd, imc_bad);
ok(!oldimc, "Associating to a destroyed imc should fail!\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
imc2 = ImmGetContext(hwnd);
ok(imc1 == imc2, "imc should not changed! imc1 %p, imc2 %p\n", imc1, imc2);
/* Test ImmGetCandidateListA */
SetLastError(0xdeadbeef);
ret = ImmGetCandidateListA(imc_bad, 0, NULL, 0);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCandidateListA(imc_null, 0, NULL, 0);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCandidateListA(imc_destroy, 0, NULL, 0);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmGetCandidateListCountA*/
SetLastError(0xdeadbeef);
ret = ImmGetCandidateListCountA(imc_bad,&count);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCandidateListCountA(imc_null,&count);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCandidateListCountA(imc_destroy,&count);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmGetCandidateWindow */
SetLastError(0xdeadbeef);
ret = ImmGetCandidateWindow(imc_bad, 0, (LPCANDIDATEFORM)buffer);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCandidateWindow(imc_null, 0, (LPCANDIDATEFORM)buffer);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCandidateWindow(imc_destroy, 0, (LPCANDIDATEFORM)buffer);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmGetCompositionFontA */
SetLastError(0xdeadbeef);
ret = ImmGetCompositionFontA(imc_bad, (LPLOGFONTA)buffer);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCompositionFontA(imc_null, (LPLOGFONTA)buffer);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCompositionFontA(imc_destroy, (LPLOGFONTA)buffer);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmGetCompositionWindow */
SetLastError(0xdeadbeef);
ret = ImmGetCompositionWindow(imc_bad, (LPCOMPOSITIONFORM)buffer);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCompositionWindow(imc_null, (LPCOMPOSITIONFORM)buffer);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCompositionWindow(imc_destroy, (LPCOMPOSITIONFORM)buffer);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmGetCompositionStringA */
SetLastError(0xdeadbeef);
ret = ImmGetCompositionStringA(imc_bad, GCS_COMPSTR, NULL, 0);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCompositionStringA(imc_null, GCS_COMPSTR, NULL, 0);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetCompositionStringA(imc_destroy, GCS_COMPSTR, NULL, 0);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmSetOpenStatus */
SetLastError(0xdeadbeef);
ret = ImmSetOpenStatus(imc_bad, 1);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetOpenStatus(imc_null, 1);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetOpenStatus(imc_destroy, 1);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmGetOpenStatus */
SetLastError(0xdeadbeef);
ret = ImmGetOpenStatus(imc_bad);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetOpenStatus(imc_null);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetOpenStatus(imc_destroy);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmGetStatusWindowPos */
SetLastError(0xdeadbeef);
ret = ImmGetStatusWindowPos(imc_bad, NULL);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetStatusWindowPos(imc_null, NULL);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetStatusWindowPos(imc_destroy, NULL);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmRequestMessageA */
SetLastError(0xdeadbeef);
ret = ImmRequestMessageA(imc_bad, WM_CHAR, 0);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmRequestMessageA(imc_null, WM_CHAR, 0);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmRequestMessageA(imc_destroy, WM_CHAR, 0);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmSetCompositionFontA */
SetLastError(0xdeadbeef);
ret = ImmSetCompositionFontA(imc_bad, &lf);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetCompositionFontA(imc_null, &lf);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetCompositionFontA(imc_destroy, &lf);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmSetCompositionWindow */
SetLastError(0xdeadbeef);
ret = ImmSetCompositionWindow(imc_bad, NULL);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetCompositionWindow(imc_null, NULL);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetCompositionWindow(imc_destroy, NULL);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmSetConversionStatus */
SetLastError(0xdeadbeef);
ret = ImmSetConversionStatus(imc_bad, 0, 0);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetConversionStatus(imc_null, 0, 0);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetConversionStatus(imc_destroy, 0, 0);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmSetStatusWindowPos */
SetLastError(0xdeadbeef);
ret = ImmSetStatusWindowPos(imc_bad, 0);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetStatusWindowPos(imc_null, 0);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmSetStatusWindowPos(imc_destroy, 0);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmGetImeMenuItemsA */
SetLastError(0xdeadbeef);
ret = ImmGetImeMenuItemsA(imc_bad, 0, 0, NULL, NULL, 0);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetImeMenuItemsA(imc_null, 0, 0, NULL, NULL, 0);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGetImeMenuItemsA(imc_destroy, 0, 0, NULL, NULL, 0);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmLockIMC */
SetLastError(0xdeadbeef);
ic = ImmLockIMC(imc_bad);
ok(ic == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ic = ImmLockIMC(imc_null);
ok(ic == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ic = ImmLockIMC(imc_destroy);
ok(ic == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmUnlockIMC */
SetLastError(0xdeadbeef);
ret = ImmUnlockIMC(imc_bad);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmUnlockIMC(imc_null);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == 0xdeadbeef, "last error should remain unchanged %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmUnlockIMC(imc_destroy);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
/* Test ImmGenerateMessage */
SetLastError(0xdeadbeef);
ret = ImmGenerateMessage(imc_bad);
ok(ret == 0, "Bad IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGenerateMessage(imc_null);
ok(ret == 0, "NULL IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
SetLastError(0xdeadbeef);
ret = ImmGenerateMessage(imc_destroy);
ok(ret == 0, "Destroyed IME should return 0\n");
ret = GetLastError();
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
}
START_TEST(imm32) {
if (init())
{
@@ -997,6 +1420,7 @@ START_TEST(imm32) {
test_ImmGetIMCCLockCount();
test_ImmDestroyContext();
test_ImmDestroyIMCC();
test_InvalidIMC();
msg_spy_cleanup();
/* Reinitialize the hooks to capture all windows */
msg_spy_init(NULL);