Jeff Latimer : user32: DdeCreateStringHandle checks for an invalid instance Id and sets lastError for instances on that thread .

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


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

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

user32: DdeCreateStringHandle checks for an invalid instance Id and sets lastError for instances on that thread.

---

 dlls/user32/dde_misc.c  |    8 ++++++--
 dlls/user32/tests/dde.c |    4 ----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/dde_misc.c b/dlls/user32/dde_misc.c
index 2b7fb81..3cbbae8 100644
--- a/dlls/user32/dde_misc.c
+++ b/dlls/user32/dde_misc.c
@@ -1128,7 +1128,9 @@ HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage)
     TRACE("(%d,%s,%d)\n", idInst, debugstr_a(psz), codepage);
 
     pInstance = WDML_GetInstance(idInst);
-    if (pInstance)
+    if (pInstance == NULL)
+	WDML_SetAllLastError(DMLERR_INVALIDPARAMETER);
+    else
     {
 	if (codepage == 0) codepage = CP_WINANSI;
 	hsz = WDML_CreateString(pInstance, psz, codepage);
@@ -1155,7 +1157,9 @@ HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage)
     HSZ			hsz = 0;
 
     pInstance = WDML_GetInstance(idInst);
-    if (pInstance)
+    if (pInstance == NULL)
+	WDML_SetAllLastError(DMLERR_INVALIDPARAMETER);
+    else
     {
 	if (codepage == 0) codepage = CP_WINUNICODE;
 	hsz = WDML_CreateString(pInstance, psz, codepage);
diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c
index 01dc529..a60e562 100644
--- a/dlls/user32/tests/dde.c
+++ b/dlls/user32/tests/dde.c
@@ -1569,18 +1569,14 @@ static void test_DdeCreateDataHandle(void)
     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);




More information about the wine-cvs mailing list