user32/tests: Add tests for invalid instance passed to DdeCreateStringHandle.

Similar the DdeCreateDataHandle, DdeCreateStringHandle behaves the same 
way.  If an invalid instance Id is passed then lastError is set for all 
instances of that thread.
This commit is contained in:
Jeff Latimer 2009-01-24 21:34:35 +11:00 committed by Alexandre Julliard
parent 9a0a89271e
commit 77e0e9cccc
1 changed files with 24 additions and 0 deletions

View File

@ -1550,6 +1550,7 @@ static void test_DdeCreateDataHandle(void)
BOOL ret; BOOL ret;
HSZ item; HSZ item;
LPBYTE ptr; LPBYTE ptr;
WCHAR item_str[] = {'i','t','e','m',0};
dde_inst = 0; dde_inst = 0;
dde_inst2 = 0; dde_inst2 = 0;
@ -1559,6 +1560,29 @@ static void test_DdeCreateDataHandle(void)
res = DdeInitializeA(&dde_inst2, client_ddeml_callback, APPCMD_CLIENTONLY, 0); res = DdeInitializeA(&dde_inst2, client_ddeml_callback, APPCMD_CLIENTONLY, 0);
ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res); ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
/* 0 instance id
* This block tests an invalid instance Id. The correct behaviour is that if the instance Id
* is invalid then the lastError of all instances is set to the error. There are two instances
* created, lastError is cleared, an error is generated and then both instances are checked to
* ensure that they both have the same error set
*/
item = DdeCreateStringHandleA(0, "item", CP_WINANSI);
ok(item == NULL, "Expected NULL hsz got %p\n", item);
err = DdeGetLastError(dde_inst);
todo_wine
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
err = DdeGetLastError(dde_inst2);
todo_wine
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
item = DdeCreateStringHandleW(0, item_str, CP_WINUNICODE);
ok(item == NULL, "Expected NULL hsz got %p\n", item);
err = DdeGetLastError(dde_inst);
todo_wine
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
err = DdeGetLastError(dde_inst2);
todo_wine
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
item = DdeCreateStringHandleA(dde_inst, "item", CP_WINANSI); item = DdeCreateStringHandleA(dde_inst, "item", CP_WINANSI);
ok(item != NULL, "Expected non-NULL hsz\n"); ok(item != NULL, "Expected non-NULL hsz\n");
item = DdeCreateStringHandleA(dde_inst2, "item", CP_WINANSI); item = DdeCreateStringHandleA(dde_inst2, "item", CP_WINANSI);