return uiHi;
default:
- return MAKELPARAM(uiLo, uiHi);
+ return MAKELONG(uiLo, uiHi);
}
}
UINT ret;
WNDCLASSEXW wndclass;
- TRACE("(%p,%p,0x%x,%d)\n",
- pidInst, pfnCallback, afCmd, ulRes);
+ TRACE("(%p,%p,0x%x,%d,0x%x)\n",
+ pidInst, pfnCallback, afCmd, ulRes, bUnicode);
if (ulRes)
{
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
cchMax = MAX_BUFFER_LEN;
}
+ /* if there is no input windows returns a NULL string */
+ if (hsz == NULL)
+ {
+ CHAR *t_ptr = ptr;
+ *t_ptr = '\0';
+ return 1;
+ }
+
switch (codepage)
{
case CP_WINANSI:
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);
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);
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);
return 0;
}
- pDdh = (DDE_DATAHANDLE_HEAD*)GlobalLock(hMem);
+ pDdh = GlobalLock(hMem);
if (!pDdh)
{
GlobalFree(hMem);
TRACE("(%p,%p)\n", hData, pcbDataSize);
- pDdh = (DDE_DATAHANDLE_HEAD*)GlobalLock(hMem);
+ pDdh = GlobalLock(hMem);
if (pDdh == NULL)
{
ERR("Failed on GlobalLock(%p)\n", hMem);
DDE_DATAHANDLE_HEAD* pDdh;
BOOL ret = FALSE;
- pDdh = (DDE_DATAHANDLE_HEAD*)GlobalLock(hData);
+ pDdh = GlobalLock(hData);
if (pDdh != NULL)
{
ret = pDdh->bAppOwned;
* 2 16 clipboard format
* 4 ? data to be used
*/
-HDDEDATA WDML_Global2DataHandle(HGLOBAL hMem, WINE_DDEHEAD* p)
+HDDEDATA WDML_Global2DataHandle(WDML_CONV* pConv, HGLOBAL hMem, WINE_DDEHEAD* p)
{
DDEDATA* pDd;
HDDEDATA ret = 0;
/* fall thru */
case 0:
case CF_TEXT:
- ret = DdeCreateDataHandle(0, pDd->Value, size, 0, 0, pDd->cfFormat, 0);
+ ret = DdeCreateDataHandle(pConv->instance->instanceID, pDd->Value, size, 0, 0, pDd->cfFormat, 0);
break;
case CF_BITMAP:
if (size >= sizeof(BITMAP))
bmp->bmPlanes, bmp->bmBitsPixel,
pDd->Value + sizeof(BITMAP))))
{
- ret = DdeCreateDataHandle(0, (LPBYTE)&hbmp, sizeof(hbmp),
+ ret = DdeCreateDataHandle(pConv->instance->instanceID, (LPBYTE)&hbmp, sizeof(hbmp),
0, 0, CF_BITMAP, 0);
}
else ERR("Can't create bmp\n");
HGLOBAL hMem = 0;
dwSize = GlobalSize((HGLOBAL)hDdeData) - sizeof(DDE_DATAHANDLE_HEAD);
- pDdh = (DDE_DATAHANDLE_HEAD*)GlobalLock((HGLOBAL)hDdeData);
+ pDdh = GlobalLock((HGLOBAL)hDdeData);
if (dwSize && pDdh)
{
WINE_DDEHEAD* wdh = NULL;
pConvNext = pConv->next;
if (DdeCmpStringHandles(pConv->hszService, hszService) == 0)
{
+ HWND client = pConv->hwndClient, server = pConv->hwndServer;
WDML_RemoveConv(pConv, WDML_SERVER_SIDE);
/* don't care about return code (whether client window is present or not) */
- PostMessageW(pConv->hwndClient, WM_DDE_TERMINATE, (WPARAM)pConv->hwndServer, 0);
+ PostMessageW(client, WM_DDE_TERMINATE, (WPARAM)server, 0);
}
}
if (pServer == pInstance->servers)
pConv->next = pInstance->convs[side];
pInstance->convs[side] = pConv;
- TRACE("pConv->wStatus %04x\n", pConv->wStatus);
+ TRACE("pConv->wStatus %04x pInstance(%p)\n", pConv->wStatus, pInstance);
return pConv;
}