user32: Check the instance id on DdeCreateDataHandle and retire a couple of todos.
This commit is contained in:
parent
10dfcfb9a0
commit
c5bc4b2c9a
|
@ -817,6 +817,25 @@ UINT WINAPI DdeGetLastError(DWORD idInst)
|
|||
return error_code;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* WDML_SetAllLastError
|
||||
*
|
||||
*
|
||||
*/
|
||||
static void WDML_SetAllLastError(DWORD lastError)
|
||||
{
|
||||
DWORD threadID;
|
||||
WDML_INSTANCE* pInstance;
|
||||
threadID = GetCurrentThreadId();
|
||||
pInstance = WDML_InstanceList;
|
||||
while (pInstance)
|
||||
{
|
||||
if (pInstance->threadID == threadID)
|
||||
pInstance->lastError = lastError;
|
||||
pInstance = pInstance->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
*
|
||||
* String management
|
||||
|
@ -1267,15 +1286,24 @@ INT WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2)
|
|||
HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD cbOff,
|
||||
HSZ hszItem, UINT wFmt, UINT afCmd)
|
||||
{
|
||||
/* For now, we ignore idInst, hszItem.
|
||||
|
||||
/* Other than check for validity we will ignore for now idInst, hszItem.
|
||||
* The purpose of these arguments still need to be investigated.
|
||||
*/
|
||||
|
||||
WDML_INSTANCE* pInstance;
|
||||
HGLOBAL hMem;
|
||||
LPBYTE pByte;
|
||||
DDE_DATAHANDLE_HEAD* pDdh;
|
||||
WCHAR psz[MAX_BUFFER_LEN];
|
||||
|
||||
pInstance = WDML_GetInstance(idInst);
|
||||
if (pInstance == NULL)
|
||||
{
|
||||
WDML_SetAllLastError(DMLERR_INVALIDPARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!GetAtomNameW(HSZ2ATOM(hszItem), psz, MAX_BUFFER_LEN))
|
||||
{
|
||||
psz[0] = HSZ2ATOM(hszItem);
|
||||
|
|
|
@ -1544,7 +1544,7 @@ static void test_DdeCreateStringHandleW(DWORD dde_inst, int codepage)
|
|||
static void test_DdeCreateDataHandle(void)
|
||||
{
|
||||
HDDEDATA hdata;
|
||||
DWORD dde_inst;
|
||||
DWORD dde_inst, dde_inst2;
|
||||
DWORD size;
|
||||
UINT res, err;
|
||||
BOOL ret;
|
||||
|
@ -1552,27 +1552,41 @@ static void test_DdeCreateDataHandle(void)
|
|||
LPBYTE ptr;
|
||||
|
||||
dde_inst = 0;
|
||||
dde_inst2 = 0;
|
||||
res = DdeInitializeA(&dde_inst, client_ddeml_callback, APPCMD_CLIENTONLY, 0);
|
||||
ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
|
||||
|
||||
res = DdeInitializeA(&dde_inst2, client_ddeml_callback, APPCMD_CLIENTONLY, 0);
|
||||
ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
|
||||
|
||||
item = DdeCreateStringHandleA(dde_inst, "item", CP_WINANSI);
|
||||
ok(item != NULL, "Expected non-NULL hsz\n");
|
||||
item = DdeCreateStringHandleA(dde_inst2, "item", CP_WINANSI);
|
||||
ok(item != NULL, "Expected non-NULL hsz\n");
|
||||
|
||||
if (0) {
|
||||
/* do not test with an invalid instance id: that crashes on win9x */
|
||||
hdata = DdeCreateDataHandle(0xdeadbeef, (LPBYTE)"data", MAX_PATH, 0, item, CF_TEXT, 0);
|
||||
}
|
||||
|
||||
/* 0 instance id */
|
||||
/* 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
|
||||
*/
|
||||
DdeGetLastError(dde_inst);
|
||||
DdeGetLastError(dde_inst2);
|
||||
hdata = DdeCreateDataHandle(0, (LPBYTE)"data", MAX_PATH, 0, item, CF_TEXT, 0);
|
||||
err = DdeGetLastError(dde_inst);
|
||||
todo_wine
|
||||
{
|
||||
ok(hdata == NULL, "Expected NULL, got %p\n", hdata);
|
||||
ok(err == DMLERR_INVALIDPARAMETER,
|
||||
"Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
|
||||
}
|
||||
ok(hdata == NULL, "Expected NULL, got %p\n", hdata);
|
||||
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
|
||||
err = DdeGetLastError(dde_inst2);
|
||||
ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
|
||||
|
||||
ret = DdeUninitialize(dde_inst2);
|
||||
ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
|
||||
|
||||
|
||||
/* NULL pSrc */
|
||||
DdeGetLastError(dde_inst);
|
||||
|
|
Loading…
Reference in New Issue