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

Alexandre Julliard julliard at winehq.org
Mon Jan 26 10:13:51 CST 2009


Module: wine
Branch: master
Commit: 77e0e9cccc67537fa49409407174d8e5905e372d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=77e0e9cccc67537fa49409407174d8e5905e372d

Author: Jeff Latimer <lats at yless4u.com.au>
Date:   Sat Jan 24 21:34:35 2009 +1100

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.

---

 dlls/user32/tests/dde.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c
index eaea63c..01dc529 100644
--- a/dlls/user32/tests/dde.c
+++ b/dlls/user32/tests/dde.c
@@ -1550,6 +1550,7 @@ static void test_DdeCreateDataHandle(void)
     BOOL ret;
     HSZ item;
     LPBYTE ptr;
+    WCHAR item_str[] = {'i','t','e','m',0};
 
     dde_inst = 0;
     dde_inst2 = 0;
@@ -1559,6 +1560,29 @@ static void test_DdeCreateDataHandle(void)
     res = DdeInitializeA(&dde_inst2, client_ddeml_callback, APPCMD_CLIENTONLY, 0);
     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);
     ok(item != NULL, "Expected non-NULL hsz\n");
     item = DdeCreateStringHandleA(dde_inst2, "item", CP_WINANSI);




More information about the wine-cvs mailing list