Commit c743f9d0 authored by Jeff Latimer's avatar Jeff Latimer Committed by Alexandre Julliard

user32: DdeCreateStringHandle checks for an invalid instance Id and sets…

user32: DdeCreateStringHandle checks for an invalid instance Id and sets lastError for instances on that thread.
parent 77e0e9cc
...@@ -1128,7 +1128,9 @@ HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage) ...@@ -1128,7 +1128,9 @@ HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage)
TRACE("(%d,%s,%d)\n", idInst, debugstr_a(psz), codepage); TRACE("(%d,%s,%d)\n", idInst, debugstr_a(psz), codepage);
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (pInstance) if (pInstance == NULL)
WDML_SetAllLastError(DMLERR_INVALIDPARAMETER);
else
{ {
if (codepage == 0) codepage = CP_WINANSI; if (codepage == 0) codepage = CP_WINANSI;
hsz = WDML_CreateString(pInstance, psz, codepage); hsz = WDML_CreateString(pInstance, psz, codepage);
...@@ -1155,7 +1157,9 @@ HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage) ...@@ -1155,7 +1157,9 @@ HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage)
HSZ hsz = 0; HSZ hsz = 0;
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (pInstance) if (pInstance == NULL)
WDML_SetAllLastError(DMLERR_INVALIDPARAMETER);
else
{ {
if (codepage == 0) codepage = CP_WINUNICODE; if (codepage == 0) codepage = CP_WINUNICODE;
hsz = WDML_CreateString(pInstance, psz, codepage); hsz = WDML_CreateString(pInstance, psz, codepage);
......
...@@ -1569,18 +1569,14 @@ static void test_DdeCreateDataHandle(void) ...@@ -1569,18 +1569,14 @@ static void test_DdeCreateDataHandle(void)
item = DdeCreateStringHandleA(0, "item", CP_WINANSI); item = DdeCreateStringHandleA(0, "item", CP_WINANSI);
ok(item == NULL, "Expected NULL hsz got %p\n", item); ok(item == NULL, "Expected NULL hsz got %p\n", item);
err = DdeGetLastError(dde_inst); err = DdeGetLastError(dde_inst);
todo_wine
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err); ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
err = DdeGetLastError(dde_inst2); err = DdeGetLastError(dde_inst2);
todo_wine
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err); ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
item = DdeCreateStringHandleW(0, item_str, CP_WINUNICODE); item = DdeCreateStringHandleW(0, item_str, CP_WINUNICODE);
ok(item == NULL, "Expected NULL hsz got %p\n", item); ok(item == NULL, "Expected NULL hsz got %p\n", item);
err = DdeGetLastError(dde_inst); err = DdeGetLastError(dde_inst);
todo_wine
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err); ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
err = DdeGetLastError(dde_inst2); err = DdeGetLastError(dde_inst2);
todo_wine
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err); 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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment