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

This commit is contained in:
Jeff Latimer 2009-01-24 21:34:44 +11:00 committed by Alexandre Julliard
parent 77e0e9cccc
commit c743f9d0bd
2 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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);