ReactOS  0.4.14-dev-77-gd9e7c48
dde_private.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  WINE_DDEHEAD
 
struct  tagHSZNode
 
struct  tagWDML_SERVER
 
struct  tagWDML_XACT
 
struct  tagWDML_CONV
 
struct  tagWDML_LINK
 
struct  tagWDML_INSTANCE
 
struct  tagDDE_DATAHANDLE_HEAD
 

Macros

#define MAX_ATOM_LEN   255
 
#define MAX_BUFFER_LEN   (MAX_ATOM_LEN + 1)
 
#define WDML_CONV_MAGIC   0xbabe1234
 
#define WM_WDML_REGISTER   (WM_USER + 0x200)
 
#define WM_WDML_UNREGISTER   (WM_USER + 0x201)
 
#define WM_WDML_CONNECT_CONFIRM   (WM_USER + 0x202)
 
#define GWL_WDML_INSTANCE   (0)
 
#define GWL_WDML_CONVERSATION   (sizeof(ULONG_PTR))
 
#define GWL_WDML_SERVER   (sizeof(ULONG_PTR))
 

Typedefs

typedef struct tagHSZNode HSZNode
 
typedef struct tagWDML_SERVER WDML_SERVER
 
typedef struct tagWDML_XACT WDML_XACT
 
typedef struct tagWDML_CONV WDML_CONV
 
typedef struct tagWDML_LINK WDML_LINK
 
typedef struct tagWDML_INSTANCE WDML_INSTANCE
 
typedef struct tagDDE_DATAHANDLE_HEAD DDE_DATAHANDLE_HEAD
 
typedef enum tagWDML_SIDE WDML_SIDE
 

Enumerations

enum  tagWDML_SIDE { WDML_CLIENT_SIDE = 0, WDML_SERVER_SIDE = 1 }
 
enum  WDML_QUEUE_STATE {
  WDML_QS_ERROR, WDML_QS_HANDLED, WDML_QS_PASS, WDML_QS_SWALLOWED,
  WDML_QS_BLOCK
}
 

Functions

HDDEDATA WDML_InvokeCallback (WDML_INSTANCE *pInst, UINT uType, UINT uFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2) DECLSPEC_HIDDEN
 
WDML_SERVERWDML_AddServer (WDML_INSTANCE *pInstance, HSZ hszService, HSZ hszTopic) DECLSPEC_HIDDEN
 
void WDML_RemoveServer (WDML_INSTANCE *pInstance, HSZ hszService, HSZ hszTopic) DECLSPEC_HIDDEN
 
WDML_SERVERWDML_FindServer (WDML_INSTANCE *pInstance, HSZ hszService, HSZ hszTopic) DECLSPEC_HIDDEN
 
WDML_QUEUE_STATE WDML_ServerHandle (WDML_CONV *pConv, WDML_XACT *pXAct) DECLSPEC_HIDDEN
 
HDDEDATA WDML_ClientHandle (WDML_CONV *pConv, WDML_XACT *pXAct, DWORD dwTimeout, LPDWORD pdwResult) DECLSPEC_HIDDEN
 
WDML_CONVWDML_AddConv (WDML_INSTANCE *pInstance, WDML_SIDE side, HSZ hszService, HSZ hszTopic, HWND hwndClient, HWND hwndServer) DECLSPEC_HIDDEN
 
void WDML_RemoveConv (WDML_CONV *pConv, WDML_SIDE side) DECLSPEC_HIDDEN
 
WDML_CONVWDML_GetConv (HCONV hConv, BOOL checkConnected) DECLSPEC_HIDDEN
 
WDML_CONVWDML_GetConvFromWnd (HWND hWnd) DECLSPEC_HIDDEN
 
WDML_CONVWDML_FindConv (WDML_INSTANCE *pInstance, WDML_SIDE side, HSZ hszService, HSZ hszTopic) DECLSPEC_HIDDEN
 
BOOL WDML_PostAck (WDML_CONV *pConv, WDML_SIDE side, WORD appRetCode, BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg) DECLSPEC_HIDDEN
 
void WDML_AddLink (WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, UINT wType, HSZ hszItem, UINT wFmt) DECLSPEC_HIDDEN
 
WDML_LINKWDML_FindLink (WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, HSZ hszItem, BOOL use_fmt, UINT uFmt) DECLSPEC_HIDDEN
 
void WDML_RemoveLink (WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, HSZ hszItem, UINT wFmt) DECLSPEC_HIDDEN
 
BOOL WDML_DecHSZ (WDML_INSTANCE *pInstance, HSZ hsz) DECLSPEC_HIDDEN
 
BOOL WDML_IncHSZ (WDML_INSTANCE *pInstance, HSZ hsz) DECLSPEC_HIDDEN
 
ATOM WDML_MakeAtomFromHsz (HSZ hsz) DECLSPEC_HIDDEN
 
HSZ WDML_MakeHszFromAtom (const WDML_INSTANCE *pInstance, ATOM atom) DECLSPEC_HIDDEN
 
WDML_XACTWDML_AllocTransaction (WDML_INSTANCE *pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem) DECLSPEC_HIDDEN
 
void WDML_QueueTransaction (WDML_CONV *pConv, WDML_XACT *pXAct) DECLSPEC_HIDDEN
 
BOOL WDML_UnQueueTransaction (WDML_CONV *pConv, WDML_XACT *pXAct) DECLSPEC_HIDDEN
 
void WDML_FreeTransaction (WDML_INSTANCE *pInstance, WDML_XACT *pXAct, BOOL doFreePmt) DECLSPEC_HIDDEN
 
HGLOBAL WDML_DataHandle2Global (HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease, BOOL fDeferUpd, BOOL dAckReq) DECLSPEC_HIDDEN
 
HDDEDATA WDML_Global2DataHandle (WDML_CONV *pConv, HGLOBAL hMem, WINE_DDEHEAD *da) DECLSPEC_HIDDEN
 
BOOL WDML_IsAppOwned (HDDEDATA hDdeData) DECLSPEC_HIDDEN
 
WDML_INSTANCEWDML_GetInstance (DWORD InstId) DECLSPEC_HIDDEN
 
WDML_INSTANCEWDML_GetInstanceFromWnd (HWND hWnd) DECLSPEC_HIDDEN
 
void WDML_BroadcastDDEWindows (LPCWSTR clsName, UINT uMsg, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN
 
void WDML_NotifyThreadExit (DWORD tid) DECLSPEC_HIDDEN
 
void WDML_NotifyThreadDetach (void) DECLSPEC_HIDDEN
 
static __inline void WDML_ExtractAck (WORD status, DDEACK *da)
 

Variables

const WCHAR WDML_szEventClass [] DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ GWL_WDML_CONVERSATION

#define GWL_WDML_CONVERSATION   (sizeof(ULONG_PTR))

Definition at line 260 of file dde_private.h.

◆ GWL_WDML_INSTANCE

#define GWL_WDML_INSTANCE   (0)

Definition at line 259 of file dde_private.h.

◆ GWL_WDML_SERVER

#define GWL_WDML_SERVER   (sizeof(ULONG_PTR))

Definition at line 261 of file dde_private.h.

◆ MAX_ATOM_LEN

#define MAX_ATOM_LEN   255

Definition at line 30 of file dde_private.h.

◆ MAX_BUFFER_LEN

#define MAX_BUFFER_LEN   (MAX_ATOM_LEN + 1)

Definition at line 34 of file dde_private.h.

◆ WDML_CONV_MAGIC

#define WDML_CONV_MAGIC   0xbabe1234

Definition at line 141 of file dde_private.h.

◆ WM_WDML_CONNECT_CONFIRM

#define WM_WDML_CONNECT_CONFIRM   (WM_USER + 0x202)

Definition at line 250 of file dde_private.h.

◆ WM_WDML_REGISTER

#define WM_WDML_REGISTER   (WM_USER + 0x200)

Definition at line 248 of file dde_private.h.

◆ WM_WDML_UNREGISTER

#define WM_WDML_UNREGISTER   (WM_USER + 0x201)

Definition at line 249 of file dde_private.h.

Typedef Documentation

◆ DDE_DATAHANDLE_HEAD

◆ HSZNode

◆ WDML_CONV

◆ WDML_INSTANCE

◆ WDML_LINK

◆ WDML_SERVER

◆ WDML_SIDE

◆ WDML_XACT

Enumeration Type Documentation

◆ tagWDML_SIDE

Enumerator
WDML_CLIENT_SIDE 
WDML_SERVER_SIDE 

Definition at line 179 of file dde_private.h.

180 {
182 } WDML_SIDE;
enum tagWDML_SIDE WDML_SIDE

◆ WDML_QUEUE_STATE

Enumerator
WDML_QS_ERROR 
WDML_QS_HANDLED 
WDML_QS_PASS 
WDML_QS_SWALLOWED 
WDML_QS_BLOCK 

Definition at line 184 of file dde_private.h.

Function Documentation

◆ WDML_AddConv()

WDML_CONV* WDML_AddConv ( WDML_INSTANCE pInstance,
WDML_SIDE  side,
HSZ  hszService,
HSZ  hszTopic,
HWND  hwndClient,
HWND  hwndServer 
)

Definition at line 2008 of file ddemisc.c.

2010 {
2011  WDML_CONV* pConv;
2012 
2013  /* no conversation yet, add it */
2014  pConv = HeapAlloc(GetProcessHeap(), 0, sizeof(WDML_CONV));
2015  if (!pConv) return NULL;
2016 
2017  pConv->instance = pInstance;
2018  WDML_IncHSZ(pInstance, pConv->hszService = hszService);
2019  WDML_IncHSZ(pInstance, pConv->hszTopic = hszTopic);
2020  pConv->magic = WDML_CONV_MAGIC;
2021  pConv->hwndServer = hwndServer;
2022  pConv->hwndClient = hwndClient;
2023  pConv->transactions = NULL;
2024  pConv->hUser = 0;
2025  pConv->wStatus = (side == WDML_CLIENT_SIDE) ? ST_CLIENT : 0L;
2026  pConv->wStatus |= pInstance->wStatus;
2027  /* check if both side of the conversation are of the same instance */
2028  if (GetWindowThreadProcessId(hwndClient, NULL) == GetWindowThreadProcessId(hwndServer, NULL) &&
2029  WDML_GetInstanceFromWnd(hwndClient) == WDML_GetInstanceFromWnd(hwndServer))
2030  {
2031  pConv->wStatus |= ST_ISSELF;
2032  }
2033  pConv->wConvst = XST_NULL;
2034 
2035  pConv->next = pInstance->convs[side];
2036  pInstance->convs[side] = pConv;
2037 
2038  TRACE("pConv->wStatus %04x pInstance(%p)\n", pConv->wStatus, pInstance);
2039 
2040  return pConv;
2041 }
struct tagWDML_CONV * next
Definition: dde_private.h:126
#define ST_CLIENT
Definition: ddeml.h:84
WDML_XACT * transactions
Definition: dde_private.h:135
BOOL WDML_IncHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:362
WDML_CONV * convs[2]
Definition: dde_private.h:168
#define XST_NULL
Definition: ddeml.h:62
#define WDML_CONV_MAGIC
Definition: dde_private.h:141
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ST_ISSELF
Definition: ddeml.h:88
static const WCHAR L[]
Definition: oid.c:1250
static HSZ hszTopic
Definition: shlexec.c:155
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
WDML_INSTANCE * WDML_GetInstanceFromWnd(HWND hWnd)
Definition: ddemisc.c:1261

Referenced by WDML_ClientProc(), and WDML_CreateServerConv().

◆ WDML_AddLink()

void WDML_AddLink ( WDML_INSTANCE pInstance,
HCONV  hConv,
WDML_SIDE  side,
UINT  wType,
HSZ  hszItem,
UINT  wFmt 
)

Definition at line 1755 of file ddemisc.c.

1757 {
1758  WDML_LINK* pLink;
1759 
1760  pLink = HeapAlloc(GetProcessHeap(), 0, sizeof(WDML_LINK));
1761  if (pLink == NULL)
1762  {
1763  ERR("OOM\n");
1764  return;
1765  }
1766 
1767  pLink->hConv = hConv;
1768  pLink->transactionType = wType;
1769  WDML_IncHSZ(pInstance, pLink->hszItem = hszItem);
1770  pLink->uFmt = wFmt;
1771  pLink->next = pInstance->links[side];
1772  pInstance->links[side] = pLink;
1773 }
BOOL WDML_IncHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:362
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
WDML_LINK * links[2]
Definition: dde_private.h:169
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by WDML_HandleAdviseReply(), and WDML_ServerHandleAdvise().

◆ WDML_AddServer()

WDML_SERVER* WDML_AddServer ( WDML_INSTANCE pInstance,
HSZ  hszService,
HSZ  hszTopic 
)

Definition at line 1638 of file ddemisc.c.

1639 {
1640  static const WCHAR fmtW[] = {'%','s','(','0','x','%','*','x',')',0};
1641  WDML_SERVER* pServer;
1642  WCHAR buf1[256];
1643  WCHAR buf2[256];
1644 
1645  pServer = HeapAlloc(GetProcessHeap(), 0, sizeof(WDML_SERVER));
1646  if (pServer == NULL) return NULL;
1647 
1648  pServer->hszService = hszService;
1649  WDML_IncHSZ(pInstance, hszService);
1650 
1651  DdeQueryStringW(pInstance->instanceID, hszService, buf1, 256, CP_WINUNICODE);
1652  snprintfW(buf2, 256, fmtW, buf1, 2*sizeof(ULONG_PTR), GetCurrentProcessId());
1653  pServer->hszServiceSpec = DdeCreateStringHandleW(pInstance->instanceID, buf2, CP_WINUNICODE);
1654 
1655  pServer->atomService = WDML_MakeAtomFromHsz(pServer->hszService);
1657 
1658  pServer->filterOn = TRUE;
1659 
1660  pServer->next = pInstance->servers;
1661  pInstance->servers = pServer;
1662  return pServer;
1663 }
#define TRUE
Definition: types.h:120
#define snprintfW
Definition: unicode.h:60
ATOM WDML_MakeAtomFromHsz(HSZ hsz)
Definition: ddemisc.c:325
BOOL WDML_IncHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:362
ATOM atomServiceSpec
Definition: dde_private.h:104
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD WINAPI DdeQueryStringW(DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, INT iCodePage)
Definition: ddemisc.c:525
#define CP_WINUNICODE
Definition: ddeml.h:33
HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage)
Definition: ddemisc.c:608
WDML_SERVER * servers
Definition: dde_private.h:167
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158
struct tagWDML_SERVER * next
Definition: dde_private.h:100

Referenced by DdeNameService().

◆ WDML_AllocTransaction()

WDML_XACT* WDML_AllocTransaction ( WDML_INSTANCE pInstance,
UINT  ddeMsg,
UINT  wFmt,
HSZ  hszItem 
)

Definition at line 1900 of file ddemisc.c.

1902 {
1903  WDML_XACT* pXAct;
1904  static WORD tid = 1; /* FIXME: wrap around */
1905 
1906  pXAct = HeapAlloc(GetProcessHeap(), 0, sizeof(WDML_XACT));
1907  if (!pXAct)
1908  {
1909  pInstance->lastError = DMLERR_MEMORY_ERROR;
1910  return NULL;
1911  }
1912 
1913  pXAct->xActID = tid++;
1914  pXAct->ddeMsg = ddeMsg;
1915  pXAct->hDdeData = 0;
1916  pXAct->hUser = 0;
1917  pXAct->next = NULL;
1918  pXAct->wType = 0;
1919  pXAct->wFmt = wFmt;
1920  if ((pXAct->hszItem = hszItem)) WDML_IncHSZ(pInstance, pXAct->hszItem);
1921  pXAct->atom = 0;
1922  pXAct->hMem = 0;
1923  pXAct->lParam = 0;
1924 
1925  return pXAct;
1926 }
HDDEDATA hDdeData
Definition: dde_private.h:113
HGLOBAL hMem
Definition: dde_private.h:120
#define DMLERR_MEMORY_ERROR
Definition: ddeml.h:254
BOOL WDML_IncHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:362
LPARAM lParam
Definition: dde_private.h:121
struct tagWDML_XACT * next
Definition: dde_private.h:110
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned short WORD
Definition: ntddk_ex.h:93
static TfClientId tid

Referenced by WDML_ClientQueueAdvise(), WDML_ClientQueueExecute(), WDML_ClientQueuePoke(), WDML_ClientQueueRequest(), WDML_ClientQueueTerminate(), WDML_ClientQueueUnadvise(), WDML_ServerQueueAdvise(), WDML_ServerQueueExecute(), WDML_ServerQueuePoke(), WDML_ServerQueueRequest(), WDML_ServerQueueTerminate(), and WDML_ServerQueueUnadvise().

◆ WDML_BroadcastDDEWindows()

void WDML_BroadcastDDEWindows ( LPCWSTR  clsName,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2502 of file ddemisc.c.

2503 {
2504  struct tagWDML_BroadcastPmt s;
2505 
2506  s.clsName = clsName;
2507  s.uMsg = uMsg;
2508  s.wParam = wParam;
2509  s.lParam = lParam;
2511 }
static BOOL CALLBACK WDML_BroadcastEnumProc(HWND hWnd, LPARAM lParam)
Definition: ddemisc.c:2484
WPARAM wParam
Definition: combotst.c:138
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC, _In_ LPARAM)
GLdouble s
Definition: gl.h:2039
LPARAM lParam
Definition: combotst.c:139

Referenced by DdeNameService(), and WDML_RemoveServer().

◆ WDML_ClientHandle()

HDDEDATA WDML_ClientHandle ( WDML_CONV pConv,
WDML_XACT pXAct,
DWORD  dwTimeout,
LPDWORD  pdwResult 
)

Definition at line 1090 of file ddeclient.c.

1091 {
1092  HDDEDATA hDdeData;
1093 
1094  if (!PostMessageW(pConv->hwndServer, pXAct->ddeMsg, (WPARAM)pConv->hwndClient, pXAct->lParam))
1095  {
1096  WARN("Failed posting message %x to %p (error=0x%x)\n",
1097  pXAct->ddeMsg, pConv->hwndServer, GetLastError());
1098  pConv->wStatus &= ~ST_CONNECTED;
1099  pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
1100  return 0;
1101  }
1102  pXAct->dwTimeout = dwTimeout;
1103  /* FIXME: should set the app bits on *pdwResult */
1104 
1105  if (dwTimeout == TIMEOUT_ASYNC)
1106  {
1107  if (pdwResult)
1108  *pdwResult = MAKELONG(0, pXAct->xActID);
1109 
1110  hDdeData = (HDDEDATA)1;
1111  }
1112  else
1113  hDdeData = WDML_SyncWaitTransactionReply((HCONV)pConv, dwTimeout, pXAct, pdwResult);
1114 
1115  return hDdeData;
1116 }
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ST_CONNECTED
Definition: ddeml.h:80
UINT_PTR WPARAM
Definition: windef.h:207
#define DMLERR_POSTMSG_FAILED
Definition: ddeml.h:258
#define TIMEOUT_ASYNC
Definition: ddeml.h:200
LPARAM lParam
Definition: dde_private.h:121
DWORD dwTimeout
Definition: dde_private.h:114
#define MAKELONG(a, b)
Definition: typedefs.h:248
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, const WDML_XACT *pXAct, DWORD *ack)
Definition: ddeclient.c:1007
_In_ UINT _In_ DWORD _Out_ DWORD * pdwResult
Definition: ntgdi.h:248
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by DdeClientTransaction(), and WDML_EnableCallback().

◆ WDML_DataHandle2Global()

HGLOBAL WDML_DataHandle2Global ( HDDEDATA  hDdeData,
BOOL  fResponse,
BOOL  fRelease,
BOOL  fDeferUpd,
BOOL  dAckReq 
)

Definition at line 1563 of file ddemisc.c.

1565 {
1566  DDE_DATAHANDLE_HEAD* pDdh;
1567  DWORD dwSize;
1568  HGLOBAL hMem = 0;
1569 
1570  dwSize = GlobalSize(hDdeData) - sizeof(DDE_DATAHANDLE_HEAD);
1571  pDdh = GlobalLock(hDdeData);
1572  if (dwSize && pDdh)
1573  {
1574  WINE_DDEHEAD* wdh = NULL;
1575 
1576  switch (pDdh->cfFormat)
1577  {
1578  default:
1579  FIXME("Unsupported format (%04x) for data %p, passing raw information\n",
1580  pDdh->cfFormat, hDdeData);
1581  /* fall through */
1582  case 0:
1583  case CF_TEXT:
1585  if (hMem && (wdh = GlobalLock(hMem)))
1586  {
1587  memcpy(wdh + 1, pDdh + 1, dwSize);
1588  }
1589  break;
1590  case CF_BITMAP:
1591  if (dwSize >= sizeof(HBITMAP))
1592  {
1593  BITMAP bmp;
1594  DWORD count;
1595  HBITMAP hbmp = *(HBITMAP*)(pDdh + 1);
1596 
1597  if (GetObjectW(hbmp, sizeof(bmp), &bmp))
1598  {
1599  count = bmp.bmWidthBytes * bmp.bmHeight;
1601  sizeof(WINE_DDEHEAD) + sizeof(bmp) + count);
1602  if (hMem && (wdh = GlobalLock(hMem)))
1603  {
1604  memcpy(wdh + 1, &bmp, sizeof(bmp));
1605  GetBitmapBits(hbmp, count, ((char*)(wdh + 1)) + sizeof(bmp));
1606  }
1607  }
1608  }
1609  break;
1610  }
1611  if (wdh)
1612  {
1613  wdh->unused = 0;
1614  wdh->fResponse = fResponse;
1615  wdh->fRelease = fRelease;
1616  wdh->fDeferUpd = fDeferUpd;
1617  wdh->fAckReq = fAckReq;
1618  wdh->cfFormat = pDdh->cfFormat;
1619  GlobalUnlock(hMem);
1620  }
1621  GlobalUnlock(hDdeData);
1622  }
1623 
1624  return hMem;
1625 }
unsigned short fResponse
Definition: dde_private.h:83
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
unsigned short fAckReq
Definition: dde_private.h:83
GLuint GLuint GLsizei count
Definition: gl.h:1545
unsigned short fRelease
Definition: dde_private.h:83
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
#define FIXME(fmt,...)
Definition: debug.h:110
#define CF_BITMAP
Definition: constants.h:397
smooth NULL
Definition: ftsmooth.c:416
#define CF_TEXT
Definition: constants.h:396
HBITMAP hbmp
unsigned short fDeferUpd
Definition: dde_private.h:83
LONG WINAPI GetBitmapBits(_In_ HBITMAP hbit, _In_ LONG cb, _Out_writes_bytes_(cb) LPVOID lpvBits)
unsigned long DWORD
Definition: ntddk_ex.h:95
BITMAP bmp
Definition: alphablend.c:62
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
unsigned short unused
Definition: dde_private.h:83
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct tagDDE_DATAHANDLE_HEAD DDE_DATAHANDLE_HEAD
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
Definition: bl.h:1331
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GMEM_DDESHARE
Definition: winbase.h:295
short cfFormat
Definition: dde_private.h:88
static HBITMAP
Definition: button.c:44
#define GMEM_MOVEABLE
Definition: winbase.h:291
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by DdePostAdvise(), and WDML_ServerHandleRequest().

◆ WDML_DecHSZ()

BOOL WDML_DecHSZ ( WDML_INSTANCE pInstance,
HSZ  hsz 
)

Definition at line 380 of file ddemisc.c.

381 {
382  HSZNode* pPrev = NULL;
383  HSZNode* pCurrent;
384 
385  for (pCurrent = pInstance->nodeList; pCurrent != NULL; pCurrent = (pPrev = pCurrent)->next)
386  {
387  /* If we found the node we were looking for and its ref count is one,
388  * we can remove it
389  */
390  if (pCurrent->hsz == hsz)
391  {
392  if (--pCurrent->refCount == 0)
393  {
394  if (pCurrent == pInstance->nodeList)
395  {
396  pInstance->nodeList = pCurrent->next;
397  }
398  else
399  {
400  pPrev->next = pCurrent->next;
401  }
402  HeapFree(GetProcessHeap(), 0, pCurrent);
403  DeleteAtom(HSZ2ATOM(hsz));
404  }
405  return TRUE;
406  }
407  }
408  WARN("HSZ %p not found\n", hsz);
409 
410  return FALSE;
411 }
#define HSZ2ATOM(hsz)
Definition: ddemisc.c:34
struct tagHSZNode * next
Definition: dde_private.h:93
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
ATOM WINAPI DeleteAtom(ATOM nAtom)
Definition: atom.c:546
smooth NULL
Definition: ftsmooth.c:416
HSZNode * nodeList
Definition: dde_private.h:160
#define GetProcessHeap()
Definition: compat.h:395
unsigned refCount
Definition: dde_private.h:95
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by DdeFreeStringHandle(), WDML_EventProc(), WDML_FreeTransaction(), WDML_HandleIncomingData(), WDML_RemoveAllLinks(), WDML_RemoveConv(), WDML_RemoveLink(), WDML_RemoveServer(), WDML_ServerHandleAdvise(), WDML_ServerHandlePoke(), WDML_ServerHandleRequest(), and WDML_ServerHandleUnadvise().

◆ WDML_ExtractAck()

static __inline void WDML_ExtractAck ( WORD  status,
DDEACK da 
)
static

Definition at line 237 of file dde_private.h.

238 {
239  *da = *((DDEACK*)&status);
240 }
Definition: dde.h:50
Definition: ps.c:97

Referenced by WDML_HandleAdviseReply(), WDML_HandleExecuteReply(), WDML_HandleRequestReply(), and WDML_HandleUnadviseReply().

◆ WDML_FindConv()

WDML_CONV* WDML_FindConv ( WDML_INSTANCE pInstance,
WDML_SIDE  side,
HSZ  hszService,
HSZ  hszTopic 
)

Definition at line 2048 of file ddemisc.c.

2050 {
2051  WDML_CONV* pCurrent;
2052 
2053  for (pCurrent = pInstance->convs[side]; pCurrent != NULL; pCurrent = pCurrent->next)
2054  {
2055  if (DdeCmpStringHandles(pCurrent->hszService, hszService) == 0 &&
2056  DdeCmpStringHandles(pCurrent->hszTopic, hszTopic) == 0)
2057  {
2058  return pCurrent;
2059  }
2060 
2061  }
2062  return NULL;
2063 }
struct tagWDML_CONV * next
Definition: dde_private.h:126
WDML_CONV * convs[2]
Definition: dde_private.h:168
smooth NULL
Definition: ftsmooth.c:416
static HSZ hszTopic
Definition: shlexec.c:155
INT WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2)
Definition: ddemisc.c:685

Referenced by DdeConnect().

◆ WDML_FindLink()

WDML_LINK* WDML_FindLink ( WDML_INSTANCE pInstance,
HCONV  hConv,
WDML_SIDE  side,
HSZ  hszItem,
BOOL  use_fmt,
UINT  uFmt 
)

Definition at line 1868 of file ddemisc.c.

1870 {
1871  WDML_LINK* pCurrent;
1872 
1873  for (pCurrent = pInstance->links[side]; pCurrent != NULL; pCurrent = pCurrent->next)
1874  {
1875  /* we don't need to check for transaction type as it can be altered */
1876 
1877  if (pCurrent->hConv == hConv &&
1878  DdeCmpStringHandles(pCurrent->hszItem, hszItem) == 0 &&
1879  (!use_fmt || pCurrent->uFmt == uFmt))
1880  {
1881  break;
1882  }
1883 
1884  }
1885 
1886  return pCurrent;
1887 }
smooth NULL
Definition: ftsmooth.c:416
WDML_LINK * links[2]
Definition: dde_private.h:169
INT WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2)
Definition: ddemisc.c:685

Referenced by WDML_HandleAdviseReply(), WDML_HandleIncomingData(), WDML_ServerHandleAdvise(), and WDML_ServerHandleUnadvise().

◆ WDML_FindServer()

WDML_SERVER* WDML_FindServer ( WDML_INSTANCE pInstance,
HSZ  hszService,
HSZ  hszTopic 
)

Definition at line 1729 of file ddemisc.c.

1730 {
1731  WDML_SERVER* pServer;
1732 
1733  for (pServer = pInstance->servers; pServer != NULL; pServer = pServer->next)
1734  {
1735  if (hszService == pServer->hszService)
1736  {
1737  return pServer;
1738  }
1739  }
1740  TRACE("Service name missing\n");
1741  return NULL;
1742 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
WDML_SERVER * servers
Definition: dde_private.h:167
struct tagWDML_SERVER * next
Definition: dde_private.h:100

Referenced by DdeNameService().

◆ WDML_FreeTransaction()

void WDML_FreeTransaction ( WDML_INSTANCE pInstance,
WDML_XACT pXAct,
BOOL  doFreePmt 
)

Definition at line 1967 of file ddemisc.c.

1968 {
1969  /* free pmt(s) in pXAct too. check against one for not deleting TRUE return values */
1970  if (doFreePmt && (ULONG_PTR)pXAct->hMem > 1)
1971  {
1972  GlobalFree(pXAct->hMem);
1973  }
1974  if (pXAct->hszItem) WDML_DecHSZ(pInstance, pXAct->hszItem);
1975 
1976  HeapFree(GetProcessHeap(), 0, pXAct);
1977 }
HGLOBAL hMem
Definition: dde_private.h:120
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOL WDML_DecHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:380
#define GetProcessHeap()
Definition: compat.h:395
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by DdeAbandonTransaction(), DdeClientTransaction(), DdeDisconnect(), WDML_EnableCallback(), WDML_RemoveConv(), and WDML_ServerConvProc().

◆ WDML_GetConv()

WDML_CONV* WDML_GetConv ( HCONV  hConv,
BOOL  checkConnected 
)

Definition at line 2230 of file ddemisc.c.

2231 {
2232  WDML_CONV* pConv = (WDML_CONV*)hConv;
2233 
2234  /* FIXME: should do better checking */
2235  if (pConv == NULL || pConv->magic != WDML_CONV_MAGIC) return NULL;
2236 
2237  if (!pConv->instance)
2238  {
2239  WARN("wrong thread ID, no instance\n");
2240  return NULL;
2241  }
2242 
2243  if (pConv->instance->threadID != GetCurrentThreadId())
2244  {
2245  WARN("wrong thread ID\n");
2246  pConv->instance->lastError = DMLERR_INVALIDPARAMETER; /* FIXME: check */
2247  return NULL;
2248  }
2249 
2250  if (checkConnected && !(pConv->wStatus & ST_CONNECTED))
2251  {
2252  WARN("found conv but ain't connected\n");
2253  pConv->instance->lastError = DMLERR_NO_CONV_ESTABLISHED;
2254  return NULL;
2255  }
2256 
2257  return pConv;
2258 }
#define WARN(fmt,...)
Definition: debug.h:111
#define ST_CONNECTED
Definition: ddeml.h:80
#define WDML_CONV_MAGIC
Definition: dde_private.h:141
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
#define DMLERR_INVALIDPARAMETER
Definition: ddeml.h:252
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
#define DMLERR_NO_CONV_ESTABLISHED
Definition: ddeml.h:256

Referenced by DdeAbandonTransaction(), DdeClientTransaction(), DdeDisconnect(), DdeEnableCallback(), DdeImpersonateClient(), DdePostAdvise(), DdeQueryConvInfo(), DdeReconnect(), DdeSetUserHandle(), and WDML_SyncWaitTransactionReply().

◆ WDML_GetConvFromWnd()

WDML_CONV* WDML_GetConvFromWnd ( HWND  hWnd)

Definition at line 2265 of file ddemisc.c.

2266 {
2268 }
HWND hWnd
Definition: settings.c:17
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define GWL_WDML_CONVERSATION
Definition: dde_private.h:260

Referenced by DdeConnect(), DdeReconnect(), WDML_ClientProc(), and WDML_ServerConvProc().

◆ WDML_GetInstance()

WDML_INSTANCE* WDML_GetInstance ( DWORD  InstId)

Definition at line 1230 of file ddemisc.c.

1231 {
1232  WDML_INSTANCE* pInstance;
1233 
1235 
1236  for (pInstance = WDML_InstanceList; pInstance != NULL; pInstance = pInstance->next)
1237  {
1238  if (pInstance->instanceID == instId)
1239  {
1240  if (GetCurrentThreadId() != pInstance->threadID)
1241  {
1242  FIXME("Tried to get instance from wrong thread\n");
1243  continue;
1244  }
1245  break;
1246  }
1247  }
1248 
1250 
1251  if (!pInstance)
1252  WARN("Instance entry missing for id %04x\n", instId);
1253  return pInstance;
1254 }
static CRITICAL_SECTION WDML_CritSect
Definition: ddemisc.c:41
static WDML_INSTANCE * WDML_InstanceList
Definition: ddemisc.c:36
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
struct tagWDML_INSTANCE * next
Definition: dde_private.h:154
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by DdeAbandonTransaction(), DdeConnect(), DdeCreateDataHandle(), DdeCreateStringHandleA(), DdeCreateStringHandleW(), DdeEnableCallback(), DdeFreeStringHandle(), DdeGetLastError(), DdeKeepStringHandle(), DdeNameService(), DdePostAdvise(), DdeQueryStringA(), DdeQueryStringW(), and DdeUninitialize().

◆ WDML_GetInstanceFromWnd()

WDML_INSTANCE* WDML_GetInstanceFromWnd ( HWND  hWnd)

Definition at line 1261 of file ddemisc.c.

1262 {
1264 }
HWND hWnd
Definition: settings.c:17
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define GWL_WDML_INSTANCE
Definition: dde_private.h:259

Referenced by WDML_AddConv(), WDML_ClientProc(), WDML_EventProc(), WDML_ServerConvProc(), and WDML_ServerNameProc().

◆ WDML_Global2DataHandle()

HDDEDATA WDML_Global2DataHandle ( WDML_CONV pConv,
HGLOBAL  hMem,
WINE_DDEHEAD da 
)

Definition at line 1504 of file ddemisc.c.

1505 {
1506  DDEDATA* pDd;
1507  HDDEDATA ret = 0;
1508  DWORD size;
1509 
1510  if (hMem)
1511  {
1512  pDd = GlobalLock(hMem);
1513  size = GlobalSize(hMem) - sizeof(WINE_DDEHEAD);
1514  if (pDd)
1515  {
1516  if (p) memcpy(p, pDd, sizeof(WINE_DDEHEAD));
1517  switch (pDd->cfFormat)
1518  {
1519  default:
1520  FIXME("Unsupported format (%04x) for data %p, passing raw information\n",
1521  pDd->cfFormat, hMem);
1522  /* fall through */
1523  case 0:
1524  case CF_TEXT:
1525  ret = DdeCreateDataHandle(pConv->instance->instanceID, pDd->Value, size, 0, 0, pDd->cfFormat, 0);
1526  break;
1527  case CF_BITMAP:
1528  if (size >= sizeof(BITMAP))
1529  {
1530  BITMAP* bmp = (BITMAP*)pDd->Value;
1531  int count = bmp->bmWidthBytes * bmp->bmHeight * bmp->bmPlanes;
1532  if (size >= sizeof(BITMAP) + count)
1533  {
1534  HBITMAP hbmp;
1535 
1536  if ((hbmp = CreateBitmap(bmp->bmWidth, bmp->bmHeight,
1537  bmp->bmPlanes, bmp->bmBitsPixel,
1538  pDd->Value + sizeof(BITMAP))))
1539  {
1540  ret = DdeCreateDataHandle(pConv->instance->instanceID, (LPBYTE)&hbmp, sizeof(hbmp),
1541  0, 0, CF_BITMAP, 0);
1542  }
1543  else ERR("Can't create bmp\n");
1544  }
1545  else
1546  {
1547  ERR("Wrong count: %u / %d\n", size, count);
1548  }
1549  } else ERR("No bitmap header\n");
1550  break;
1551  }
1552  GlobalUnlock(hMem);
1553  }
1554  }
1555  return ret;
1556 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
short cfFormat
Definition: dde.h:59
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
unsigned char * LPBYTE
Definition: typedefs.h:52
#define FIXME(fmt,...)
Definition: debug.h:110
#define CF_BITMAP
Definition: constants.h:397
#define CF_TEXT
Definition: constants.h:396
Definition: dde.h:56
HBITMAP hbmp
GLsizeiptr size
Definition: glext.h:5919
if(!(yy_init))
Definition: macro.lex.yy.c:714
unsigned long DWORD
Definition: ntddk_ex.h:95
BITMAP bmp
Definition: alphablend.c:62
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
Definition: bl.h:1331
HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD cbOff, HSZ hszItem, UINT wFmt, UINT afCmd)
Definition: ddemisc.c:1275
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static HBITMAP
Definition: button.c:44
GLfloat GLfloat p
Definition: glext.h:8902
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
BYTE Value[1]
Definition: dde.h:60

Referenced by WDML_HandleIncomingData(), and WDML_HandleRequestReply().

◆ WDML_IncHSZ()

BOOL WDML_IncHSZ ( WDML_INSTANCE pInstance,
HSZ  hsz 
)

Definition at line 362 of file ddemisc.c.

363 {
364  HSZNode* pNode;
365 
366  pNode = WDML_FindNode(pInstance, hsz);
367  if (!pNode) return FALSE;
368 
369  pNode->refCount++;
370  return TRUE;
371 }
#define TRUE
Definition: types.h:120
unsigned refCount
Definition: dde_private.h:95
static HSZNode * WDML_FindNode(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:305

Referenced by DdeKeepStringHandle(), DdeNameService(), WDML_AddConv(), WDML_AddLink(), WDML_AddServer(), and WDML_AllocTransaction().

◆ WDML_InvokeCallback()

HDDEDATA WDML_InvokeCallback ( WDML_INSTANCE pInst,
UINT  uType,
UINT  uFmt,
HCONV  hConv,
HSZ  hsz1,
HSZ  hsz2,
HDDEDATA  hdata,
ULONG_PTR  dwData1,
ULONG_PTR  dwData2 
)

Definition at line 1206 of file ddemisc.c.

1209 {
1210  HDDEDATA ret;
1211 
1212  if (pInstance == NULL)
1213  return NULL;
1214 
1215  TRACE("invoking CB[%p] (%x %x %p %p %p %p %lx %lx)\n",
1216  pInstance->callback, uType, uFmt,
1217  hConv, hsz1, hsz2, hdata, dwData1, dwData2);
1218  ret = pInstance->callback(uType, uFmt, hConv, hsz1, hsz2, hdata, dwData1, dwData2);
1219  TRACE("done => %p\n", ret);
1220  return ret;
1221 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret

Referenced by DdePostAdvise(), WDML_EventProc(), WDML_HandleIncomingData(), WDML_HandleReply(), WDML_HandleTerminateReply(), WDML_ServerHandleAdvise(), WDML_ServerHandleExecute(), WDML_ServerHandlePoke(), WDML_ServerHandleRequest(), WDML_ServerHandleTerminate(), WDML_ServerHandleUnadvise(), and WDML_ServerNameProc().

◆ WDML_IsAppOwned()

BOOL WDML_IsAppOwned ( HDDEDATA  hDdeData)

Definition at line 1477 of file ddemisc.c.

1478 {
1479  DDE_DATAHANDLE_HEAD* pDdh;
1480  BOOL ret = FALSE;
1481 
1482  pDdh = GlobalLock(hData);
1483  if (pDdh != NULL)
1484  {
1485  ret = pDdh->bAppOwned;
1486  GlobalUnlock(hData);
1487  }
1488  return ret;
1489 }
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Referenced by DdePostAdvise(), and WDML_ServerNameProc().

◆ WDML_MakeAtomFromHsz()

ATOM WDML_MakeAtomFromHsz ( HSZ  hsz)

Definition at line 325 of file ddemisc.c.

326 {
327  WCHAR nameBuffer[MAX_BUFFER_LEN];
328 
329  if (GetAtomNameW(HSZ2ATOM(hsz), nameBuffer, MAX_BUFFER_LEN))
330  return GlobalAddAtomW(nameBuffer);
331  WARN("HSZ %p not found\n", hsz);
332  return 0;
333 }
#define HSZ2ATOM(hsz)
Definition: ddemisc.c:34
#define WARN(fmt,...)
Definition: debug.h:111
UINT WINAPI GetAtomNameW(ATOM nAtom, LPWSTR lpBuffer, int nSize)
Definition: atom.c:589
#define MAX_BUFFER_LEN
Definition: dde_private.h:34
__wchar_t WCHAR
Definition: xmlstorage.h:180
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444

Referenced by DdeConnect(), DdePostAdvise(), DdeReconnect(), WDML_AddServer(), WDML_ClientQueueAdvise(), WDML_ClientQueuePoke(), WDML_ClientQueueRequest(), WDML_ClientQueueUnadvise(), and WDML_CreateServerConv().

◆ WDML_MakeHszFromAtom()

HSZ WDML_MakeHszFromAtom ( const WDML_INSTANCE pInstance,
ATOM  atom 
)

Definition at line 342 of file ddemisc.c.

343 {
344  WCHAR nameBuffer[MAX_BUFFER_LEN];
345 
346  if (!atom) return NULL;
347 
348  if (GlobalGetAtomNameW(atom, nameBuffer, MAX_BUFFER_LEN))
349  {
350  TRACE("%x => %s\n", atom, debugstr_w(nameBuffer));
351  return DdeCreateStringHandleW(pInstance->instanceID, nameBuffer, CP_WINUNICODE);
352  }
353  WARN("ATOM 0x%x not found\n", atom);
354  return 0;
355 }
#define WARN(fmt,...)
Definition: debug.h:111
#define MAX_BUFFER_LEN
Definition: dde_private.h:34
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI GlobalGetAtomNameW(ATOM nAtom, LPWSTR lpBuffer, int nSize)
Definition: atom.c:496
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_WINUNICODE
Definition: ddeml.h:33
HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage)
Definition: ddemisc.c:608

Referenced by WDML_ClientProc(), WDML_EventProc(), WDML_HandleAdviseReply(), WDML_HandleIncomingData(), WDML_HandlePokeReply(), WDML_HandleRequestReply(), WDML_HandleUnadviseReply(), WDML_ServerNameProc(), WDML_ServerQueueAdvise(), WDML_ServerQueuePoke(), WDML_ServerQueueRequest(), and WDML_ServerQueueUnadvise().

◆ WDML_NotifyThreadDetach()

void WDML_NotifyThreadDetach ( void  )

Definition at line 1181 of file ddemisc.c.

1182 {
1183  WDML_INSTANCE* pInstance;
1186 
1188  for (pInstance = WDML_InstanceList; pInstance != NULL; pInstance = next)
1189  {
1190  next = pInstance->next;
1191  if (pInstance->threadID == tid)
1192  {
1194  DdeUninitialize(pInstance->instanceID);
1196  }
1197  }
1199 }
static CRITICAL_SECTION WDML_CritSect
Definition: ddemisc.c:41
static WDML_INSTANCE * WDML_InstanceList
Definition: ddemisc.c:36
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI DdeUninitialize(DWORD idInst)
Definition: ddemisc.c:1112
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
unsigned long DWORD
Definition: ntddk_ex.h:95
static unsigned __int64 next
Definition: rand_nt.c:6
struct tagWDML_INSTANCE * next
Definition: dde_private.h:154
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static TfClientId tid

◆ WDML_NotifyThreadExit()

void WDML_NotifyThreadExit ( DWORD  tid)

◆ WDML_PostAck()

BOOL WDML_PostAck ( WDML_CONV pConv,
WDML_SIDE  side,
WORD  appRetCode,
BOOL  fBusy,
BOOL  fAck,
UINT_PTR  pmt,
LPARAM  lParam,
UINT  oldMsg 
)

Definition at line 2275 of file ddemisc.c.

2277 {
2278  DDEACK ddeAck;
2279  HWND from, to;
2280 
2281  if (side == WDML_SERVER_SIDE)
2282  {
2283  from = pConv->hwndServer;
2284  to = pConv->hwndClient;
2285  }
2286  else
2287  {
2288  to = pConv->hwndServer;
2289  from = pConv->hwndClient;
2290  }
2291 
2292  ddeAck.bAppReturnCode = appRetCode;
2293  ddeAck.reserved = 0;
2294  ddeAck.fBusy = fBusy;
2295  ddeAck.fAck = fAck;
2296 
2297  TRACE("Posting a %s ack\n", ddeAck.fAck ? "positive" : "negative");
2298 
2299  lParam = (lParam) ? ReuseDDElParam(lParam, oldMsg, WM_DDE_ACK, *(WORD*)&ddeAck, pmt) :
2300  PackDDElParam(WM_DDE_ACK, *(WORD*)&ddeAck, pmt);
2301  if (!PostMessageW(to, WM_DDE_ACK, (WPARAM)from, lParam))
2302  {
2303  pConv->wStatus &= ~ST_CONNECTED;
2304  pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
2306  return FALSE;
2307  }
2308  return TRUE;
2309 }
#define TRUE
Definition: types.h:120
unsigned short bAppReturnCode
Definition: dde.h:52
#define ST_CONNECTED
Definition: ddeml.h:80
UINT_PTR WPARAM
Definition: windef.h:207
#define DMLERR_POSTMSG_FAILED
Definition: ddeml.h:258
LPARAM WINAPI ReuseDDElParam(LPARAM lParam, UINT msgIn, UINT msgOut, UINT_PTR uiLo, UINT_PTR uiHi)
Definition: ddemisc.c:171
Definition: dde.h:50
unsigned short fAck
Definition: dde.h:52
unsigned short reserved
Definition: dde.h:52
#define TRACE(s)
Definition: solgame.cpp:4
unsigned short WORD
Definition: ntddk_ex.h:93
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
unsigned short fBusy
Definition: dde.h:52
BOOL WINAPI FreeDDElParam(UINT msg, LPARAM lParam)
Definition: ddemisc.c:147
LPARAM WINAPI PackDDElParam(UINT msg, UINT_PTR uiLo, UINT_PTR uiHi)
Definition: ddemisc.c:63
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_DDE_ACK
Definition: dde.h:41
CardRegion * from
Definition: spigame.cpp:19
LPARAM lParam
Definition: combotst.c:139

Referenced by WDML_HandleIncomingData(), WDML_ServerHandleAdvise(), WDML_ServerHandleExecute(), WDML_ServerHandlePoke(), WDML_ServerHandleRequest(), and WDML_ServerHandleUnadvise().

◆ WDML_QueueTransaction()

void WDML_QueueTransaction ( WDML_CONV pConv,
WDML_XACT pXAct 
)

Definition at line 1933 of file ddemisc.c.

1934 {
1935  WDML_XACT** pt;
1936 
1937  /* advance to last in queue */
1938  for (pt = &pConv->transactions; *pt != NULL; pt = &(*pt)->next);
1939  *pt = pXAct;
1940 }
#define pt(x, y)
Definition: drawing.c:79
WDML_XACT * transactions
Definition: dde_private.h:135
smooth NULL
Definition: ftsmooth.c:416
struct define * next
Definition: wpp.c:35

Referenced by DdeClientTransaction(), and WDML_ServerConvProc().

◆ WDML_RemoveConv()

void WDML_RemoveConv ( WDML_CONV pConv,
WDML_SIDE  side 
)

Definition at line 2070 of file ddemisc.c.

2071 {
2072  WDML_CONV* pPrev = NULL;
2073  WDML_CONV* pCurrent;
2074  WDML_XACT* pXAct;
2075  WDML_XACT* pXActNext;
2076  HWND hWnd;
2077 
2078  if (!pRef)
2079  return;
2080 
2081  /* remove any pending transaction */
2082  for (pXAct = pRef->transactions; pXAct != NULL; pXAct = pXActNext)
2083  {
2084  pXActNext = pXAct->next;
2085  WDML_FreeTransaction(pRef->instance, pXAct, TRUE);
2086  }
2087 
2088  WDML_RemoveAllLinks(pRef->instance, pRef, side);
2089 
2090  /* FIXME: should we keep the window around ? it seems so (at least on client side
2091  * to let QueryConvInfo work after conv termination, but also to implement
2092  * DdeReconnect...
2093  */
2094  /* destroy conversation window, but first remove pConv from hWnd.
2095  * this would help the wndProc do appropriate handling upon a WM_DESTROY message
2096  */
2097  hWnd = (side == WDML_CLIENT_SIDE) ? pRef->hwndClient : pRef->hwndServer;
2099 
2100  DestroyWindow((side == WDML_CLIENT_SIDE) ? pRef->hwndClient : pRef->hwndServer);
2101 
2102  WDML_DecHSZ(pRef->instance, pRef->hszService);
2103  WDML_DecHSZ(pRef->instance, pRef->hszTopic);
2104 
2105  for (pCurrent = pRef->instance->convs[side]; pCurrent != NULL; pCurrent = (pPrev = pCurrent)->next)
2106  {
2107  if (pCurrent == pRef)
2108  {
2109  if (pCurrent == pRef->instance->convs[side])
2110  {
2111  pRef->instance->convs[side] = pCurrent->next;
2112  }
2113  else
2114  {
2115  pPrev->next = pCurrent->next;
2116  }
2117  pCurrent->magic = 0;
2118  HeapFree(GetProcessHeap(), 0, pCurrent);
2119  break;
2120  }
2121  }
2122 }
#define TRUE
Definition: types.h:120
struct tagWDML_CONV * next
Definition: dde_private.h:126
HWND hWnd
Definition: settings.c:17
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WDML_DecHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:380
struct tagWDML_XACT * next
Definition: dde_private.h:110
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
#define GWL_WDML_CONVERSATION
Definition: dde_private.h:260
void WDML_FreeTransaction(WDML_INSTANCE *pInstance, WDML_XACT *pXAct, BOOL doFreePmt)
Definition: ddemisc.c:1967
#define SetWindowLongPtrW
Definition: winuser.h:5247
static void WDML_RemoveAllLinks(WDML_INSTANCE *pInstance, WDML_CONV *pConv, WDML_SIDE side)
Definition: ddemisc.c:1822
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by DdeDisconnect(), WDML_HandleTerminateReply(), WDML_RemoveServer(), and WDML_ServerHandleTerminate().

◆ WDML_RemoveLink()

void WDML_RemoveLink ( WDML_INSTANCE pInstance,
HCONV  hConv,
WDML_SIDE  side,
HSZ  hszItem,
UINT  wFmt 
)

Definition at line 1780 of file ddemisc.c.

1782 {
1783  WDML_LINK* pPrev = NULL;
1784  WDML_LINK* pCurrent = NULL;
1785 
1786  pCurrent = pInstance->links[side];
1787 
1788  while (pCurrent != NULL)
1789  {
1790  if (pCurrent->hConv == hConv &&
1791  DdeCmpStringHandles(pCurrent->hszItem, hszItem) == 0 &&
1792  pCurrent->uFmt == uFmt)
1793  {
1794  if (pCurrent == pInstance->links[side])
1795  {
1796  pInstance->links[side] = pCurrent->next;
1797  }
1798  else
1799  {
1800  pPrev->next = pCurrent->next;
1801  }
1802 
1803  WDML_DecHSZ(pInstance, pCurrent->hszItem);
1804  HeapFree(GetProcessHeap(), 0, pCurrent);
1805  break;
1806  }
1807 
1808  pPrev = pCurrent;
1809  pCurrent = pCurrent->next;
1810  }
1811 }
BOOL WDML_DecHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:380
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
WDML_LINK * links[2]
Definition: dde_private.h:169
INT WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2)
Definition: ddemisc.c:685
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by WDML_HandleUnadviseReply(), and WDML_ServerHandleUnadvise().

◆ WDML_RemoveServer()

void WDML_RemoveServer ( WDML_INSTANCE pInstance,
HSZ  hszService,
HSZ  hszTopic 
)

Definition at line 1670 of file ddemisc.c.

1671 {
1672  WDML_SERVER* pPrev = NULL;
1673  WDML_SERVER* pServer = NULL;
1674  WDML_CONV* pConv;
1675  WDML_CONV* pConvNext;
1676 
1677  pServer = pInstance->servers;
1678 
1679  while (pServer != NULL)
1680  {
1681  if (DdeCmpStringHandles(pServer->hszService, hszService) == 0)
1682  {
1684  pServer->atomService, pServer->atomServiceSpec);
1685  /* terminate all conversations for given topic */
1686  for (pConv = pInstance->convs[WDML_SERVER_SIDE]; pConv != NULL; pConv = pConvNext)
1687  {
1688  pConvNext = pConv->next;
1689  if (DdeCmpStringHandles(pConv->hszService, hszService) == 0)
1690  {
1691  HWND client = pConv->hwndClient, server = pConv->hwndServer;
1693  /* don't care about return code (whether client window is present or not) */
1695  }
1696  }
1697  if (pServer == pInstance->servers)
1698  {
1699  pInstance->servers = pServer->next;
1700  }
1701  else
1702  {
1703  pPrev->next = pServer->next;
1704  }
1705 
1706  DestroyWindow(pServer->hwndServer);
1707  WDML_DecHSZ(pInstance, pServer->hszServiceSpec);
1708  WDML_DecHSZ(pInstance, pServer->hszService);
1709 
1710  GlobalDeleteAtom(pServer->atomService);
1712 
1713  HeapFree(GetProcessHeap(), 0, pServer);
1714  break;
1715  }
1716 
1717  pPrev = pServer;
1718  pServer = pServer->next;
1719  }
1720 }
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
struct tagWDML_CONV * next
Definition: dde_private.h:126
static rfbScreenInfoPtr server
Definition: vnc.c:74
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI DestroyWindow(_In_ HWND)
ATOM atomServiceSpec
Definition: dde_private.h:104
WDML_CONV * convs[2]
Definition: dde_private.h:168
BOOL WDML_DecHSZ(WDML_INSTANCE *pInstance, HSZ hsz)
Definition: ddemisc.c:380
#define WM_DDE_TERMINATE
Definition: dde.h:38
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
static FILE * client
Definition: client.c:41
const WCHAR WDML_szEventClass[]
Definition: ddemisc.c:38
void WDML_RemoveConv(WDML_CONV *pRef, WDML_SIDE side)
Definition: ddemisc.c:2070
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void WDML_BroadcastDDEWindows(LPCWSTR clsName, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ddemisc.c:2502
INT WINAPI DdeCmpStringHandles(HSZ hsz1, HSZ hsz2)
Definition: ddemisc.c:685
WDML_SERVER * servers
Definition: dde_private.h:167
#define HeapFree(x, y, z)
Definition: compat.h:394
struct tagWDML_SERVER * next
Definition: dde_private.h:100
#define WM_WDML_UNREGISTER
Definition: dde_private.h:249

Referenced by DdeNameService().

◆ WDML_ServerHandle()

WDML_QUEUE_STATE WDML_ServerHandle ( WDML_CONV pConv,
WDML_XACT pXAct 
)

Definition at line 968 of file ddeserver.c.

969 {
971 
972  switch (pXAct->ddeMsg)
973  {
974  case WM_DDE_INITIATE:
975  FIXME("WM_DDE_INITIATE shouldn't be there!\n");
976  break;
977  case WM_DDE_REQUEST:
978  qs = WDML_ServerHandleRequest(pConv, pXAct);
979  break;
980 
981  case WM_DDE_ADVISE:
982  qs = WDML_ServerHandleAdvise(pConv, pXAct);
983  break;
984 
985  case WM_DDE_UNADVISE:
986  qs = WDML_ServerHandleUnadvise(pConv, pXAct);
987  break;
988 
989  case WM_DDE_EXECUTE:
990  qs = WDML_ServerHandleExecute(pConv, pXAct);
991  break;
992 
993  case WM_DDE_POKE:
994  qs = WDML_ServerHandlePoke(pConv, pXAct);
995  break;
996 
997  case WM_DDE_TERMINATE:
998  qs = WDML_ServerHandleTerminate(pConv, pXAct);
999  break;
1000 
1001  case WM_DDE_ACK:
1002  WARN("Shouldn't receive a ACK message (never requests them). Ignoring it\n");
1003  break;
1004 
1005  default:
1006  FIXME("Unsupported message %d\n", pXAct->ddeMsg);
1007  }
1008  return qs;
1009 }
static WDML_QUEUE_STATE WDML_ServerHandleUnadvise(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddeserver.c:695
#define WM_DDE_UNADVISE
Definition: dde.h:40
#define WARN(fmt,...)
Definition: debug.h:111
static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddeserver.c:802
WDML_QUEUE_STATE
Definition: dde_private.h:184
#define WM_DDE_REQUEST
Definition: dde.h:43
static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddeserver.c:534
#define WM_DDE_TERMINATE
Definition: dde.h:38
#define FIXME(fmt,...)
Definition: debug.h:110
static WDML_QUEUE_STATE WDML_ServerHandleTerminate(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddeserver.c:947
static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddeserver.c:610
#define WM_DDE_POKE
Definition: dde.h:44
#define WM_DDE_INITIATE
Definition: dde.h:37
static WDML_QUEUE_STATE WDML_ServerHandlePoke(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddeserver.c:875
#define WM_DDE_ACK
Definition: dde.h:41
#define WM_DDE_ADVISE
Definition: dde.h:39
#define WM_DDE_EXECUTE
Definition: dde.h:45

Referenced by WDML_EnableCallback(), and WDML_ServerConvProc().

◆ WDML_UnQueueTransaction()

BOOL WDML_UnQueueTransaction ( WDML_CONV pConv,
WDML_XACT pXAct 
)

Definition at line 1947 of file ddemisc.c.

1948 {
1949  WDML_XACT** pt;
1950 
1951  for (pt = &pConv->transactions; *pt; pt = &(*pt)->next)
1952  {
1953  if (*pt == pXAct)
1954  {
1955  *pt = pXAct->next;
1956  return TRUE;
1957  }
1958  }
1959  return FALSE;
1960 }
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
WDML_XACT * transactions
Definition: dde_private.h:135
struct tagWDML_XACT * next
Definition: dde_private.h:110
struct define * next
Definition: wpp.c:35

Referenced by DdeAbandonTransaction(), DdeClientTransaction(), and WDML_EnableCallback().

Variable Documentation

◆ DECLSPEC_HIDDEN

const WCHAR WDML_szClientConvClassW [] DECLSPEC_HIDDEN

Definition at line 243 of file dde_private.h.