ReactOS  0.4.13-dev-100-gc8611ae
ddeserver.c File Reference
#include <user32.h>
Include dependency graph for ddeserver.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ddeml)
 
static LRESULT CALLBACK WDML_ServerNameProc (HWND, UINT, WPARAM, LPARAM)
 
static LRESULT CALLBACK WDML_ServerConvProc (HWND, UINT, WPARAM, LPARAM)
 
BOOL WINAPI DdePostAdvise (DWORD idInst, HSZ hszTopic, HSZ hszItem)
 
HDDEDATA WINAPI DdeNameService (DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
 
static WDML_CONVWDML_CreateServerConv (WDML_INSTANCE *pInstance, HWND hwndClient, HWND hwndServerName, HSZ hszApp, HSZ hszTopic)
 
static WDML_XACTWDML_ServerQueueRequest (WDML_CONV *pConv, LPARAM lParam)
 
static WDML_QUEUE_STATE WDML_ServerHandleRequest (WDML_CONV *pConv, WDML_XACT *pXAct)
 
static WDML_XACTWDML_ServerQueueAdvise (WDML_CONV *pConv, LPARAM lParam)
 
static WDML_QUEUE_STATE WDML_ServerHandleAdvise (WDML_CONV *pConv, WDML_XACT *pXAct)
 
static WDML_XACTWDML_ServerQueueUnadvise (WDML_CONV *pConv, LPARAM lParam)
 
static WDML_QUEUE_STATE WDML_ServerHandleUnadvise (WDML_CONV *pConv, WDML_XACT *pXAct)
 
static WDML_XACTWDML_ServerQueueExecute (WDML_CONV *pConv, LPARAM lParam)
 
static BOOL data_looks_unicode (const WCHAR *data, DWORD size)
 
static HDDEDATA map_A_to_W (DWORD instance, void *ptr, DWORD size)
 
static HDDEDATA map_W_to_A (DWORD instance, void *ptr, DWORD size)
 
static WDML_QUEUE_STATE WDML_ServerHandleExecute (WDML_CONV *pConv, WDML_XACT *pXAct)
 
static WDML_XACTWDML_ServerQueuePoke (WDML_CONV *pConv, LPARAM lParam)
 
static WDML_QUEUE_STATE WDML_ServerHandlePoke (WDML_CONV *pConv, WDML_XACT *pXAct)
 
static WDML_XACTWDML_ServerQueueTerminate (WDML_CONV *pConv, LPARAM lParam)
 
static WDML_QUEUE_STATE WDML_ServerHandleTerminate (WDML_CONV *pConv, WDML_XACT *pXAct)
 
WDML_QUEUE_STATE WDML_ServerHandle (WDML_CONV *pConv, WDML_XACT *pXAct)
 

Variables

static const WCHAR szServerNameClass [] = L"DDEMLMom"
 
const char WDML_szServerConvClassA [] = "DDEMLAnsiServer"
 
const WCHAR WDML_szServerConvClassW [] = L"DDEMLUnicodeServer"
 

Function Documentation

◆ data_looks_unicode()

static BOOL data_looks_unicode ( const WCHAR data,
DWORD  size 
)
static

Definition at line 749 of file ddeserver.c.

750 {
751  DWORD i;
752 
753  if (size % sizeof(WCHAR)) return FALSE;
754  for (i = 0; i < size / sizeof(WCHAR); i++) if (data[i] > 255) return FALSE;
755  return TRUE;
756 }
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by map_A_to_W(), and map_W_to_A().

◆ DdeNameService()

HDDEDATA WINAPI DdeNameService ( DWORD  idInst,
HSZ  hsz1,
HSZ  hsz2,
UINT  afCmd 
)

Definition at line 154 of file ddeserver.c.

155 {
156  WDML_SERVER* pServer;
157  WDML_INSTANCE* pInstance;
158  HWND hwndServer;
159  WNDCLASSEXW wndclass;
160 
161  TRACE("(%d,%p,%p,%x)\n", idInst, hsz1, hsz2, afCmd);
162 
163  /* First check instance
164  */
165  pInstance = WDML_GetInstance(idInst);
166  if (pInstance == NULL)
167  {
168  TRACE("Instance not found as initialised\n");
169  /* Nothing has been initialised - exit now ! can return TRUE since effect is the same */
170  return NULL;
171  }
172 
173  if (hsz2 != 0L)
174  {
175  /* Illegal, reserved parameter
176  */
177  pInstance->lastError = DMLERR_INVALIDPARAMETER;
178  WARN("Reserved parameter no-zero !!\n");
179  return NULL;
180  }
181  if (hsz1 == 0 && !(afCmd & DNS_UNREGISTER))
182  {
183  /* don't know if we should check this but it makes sense
184  * why supply REGISTER or filter flags if de-registering all
185  */
186  TRACE("General unregister unexpected flags\n");
187  pInstance->lastError = DMLERR_INVALIDPARAMETER;
188  return NULL;
189  }
190 
191  switch (afCmd & (DNS_REGISTER | DNS_UNREGISTER))
192  {
193  case DNS_REGISTER:
194  pServer = WDML_FindServer(pInstance, hsz1, 0);
195  if (pServer)
196  {
197  ERR("Trying to register already registered service!\n");
198  pInstance->lastError = DMLERR_DLL_USAGE;
199  return NULL;
200  }
201 
202  TRACE("Adding service name\n");
203 
204  WDML_IncHSZ(pInstance, hsz1);
205 
206  pServer = WDML_AddServer(pInstance, hsz1, 0);
207 
209  pServer->atomService, pServer->atomServiceSpec);
210 
211  wndclass.cbSize = sizeof(wndclass);
212  wndclass.style = 0;
213  wndclass.lpfnWndProc = WDML_ServerNameProc;
214  wndclass.cbClsExtra = 0;
215  wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR);
216  wndclass.hInstance = 0;
217  wndclass.hIcon = 0;
218  wndclass.hCursor = 0;
219  wndclass.hbrBackground = 0;
220  wndclass.lpszMenuName = NULL;
221  wndclass.lpszClassName = szServerNameClass;
222  wndclass.hIconSm = 0;
223 
224  RegisterClassExW(&wndclass);
225 
226  hwndServer = CreateWindowW(szServerNameClass, NULL,
227  WS_POPUP, 0, 0, 0, 0,
228  0, 0, 0, 0);
229 
230  SetWindowLongPtrW(hwndServer, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
231  SetWindowLongPtrW(hwndServer, GWL_WDML_SERVER, (ULONG_PTR)pServer);
232  TRACE("Created nameServer=%p for instance=%08x\n", hwndServer, idInst);
233 
234  pServer->hwndServer = hwndServer;
235  break;
236 
237  case DNS_UNREGISTER:
238  if (hsz1 == 0L)
239  {
240  /* General unregister situation
241  * terminate all server side pending conversations
242  */
243  while (pInstance->servers)
244  WDML_RemoveServer(pInstance, pInstance->servers->hszService, 0);
245  pInstance->servers = NULL;
246  TRACE("General de-register - finished\n");
247  }
248  else
249  {
250  WDML_RemoveServer(pInstance, hsz1, 0L);
251  }
252  break;
253  }
254 
255  if (afCmd & (DNS_FILTERON | DNS_FILTEROFF))
256  {
257  /* Set filter flags on to hold notifications of connection
258  */
259  pServer = WDML_FindServer(pInstance, hsz1, 0);
260  if (!pServer)
261  {
262  /* trying to filter where no service names !!
263  */
264  pInstance->lastError = DMLERR_DLL_USAGE;
265  return NULL;
266  }
267  else
268  {
269  pServer->filterOn = (afCmd & DNS_FILTERON) != 0;
270  }
271  }
272  return (HDDEDATA)TRUE;
273 }
#define DNS_UNREGISTER
Definition: ddeml.h:153
#define TRUE
Definition: types.h:120
int cbWndExtra
Definition: winuser.h:3173
#define DNS_FILTERON
Definition: ddeml.h:154
#define WARN(fmt,...)
Definition: debug.h:111
#define GWL_WDML_SERVER
Definition: dde_private.h:261
static const WCHAR szServerNameClass[]
Definition: ddeserver.c:30
HICON hIcon
Definition: winuser.h:3175
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4185
#define DNS_REGISTER
Definition: ddeml.h:152
ATOM atomServiceSpec
Definition: dde_private.h:104
WDML_SERVER * WDML_FindServer(WDML_INSTANCE *pInstance, HSZ hszService, HSZ hszTopic) DECLSPEC_HIDDEN
Definition: ddemisc.c:1729
uint32_t ULONG_PTR
Definition: typedefs.h:63
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
LPCWSTR lpszMenuName
Definition: winuser.h:3178
WDML_SERVER * WDML_AddServer(WDML_INSTANCE *pInstance, HSZ hszService, HSZ hszTopic) DECLSPEC_HIDDEN
Definition: ddemisc.c:1638
void WDML_RemoveServer(WDML_INSTANCE *pInstance, HSZ hszService, HSZ hszTopic) DECLSPEC_HIDDEN
Definition: ddemisc.c:1670
smooth NULL
Definition: ftsmooth.c:416
int cbClsExtra
Definition: winuser.h:3172
LPCWSTR lpszClassName
Definition: winuser.h:3179
void WDML_BroadcastDDEWindows(LPCWSTR clsName, UINT uMsg, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN
Definition: ddemisc.c:2502
#define TRACE(s)
Definition: solgame.cpp:4
#define DNS_FILTEROFF
Definition: ddeml.h:155
HBRUSH hbrBackground
Definition: winuser.h:3177
UINT cbSize
Definition: winuser.h:3169
static LRESULT CALLBACK WDML_ServerNameProc(HWND, UINT, WPARAM, LPARAM)
Definition: ddeserver.c:365
HINSTANCE hInstance
Definition: winuser.h:3174
#define GWL_WDML_INSTANCE
Definition: dde_private.h:259
static const WCHAR L[]
Definition: oid.c:1250
HCURSOR hCursor
Definition: winuser.h:3176
#define DMLERR_DLL_USAGE
Definition: ddeml.h:250
UINT style
Definition: winuser.h:3170
WNDPROC lpfnWndProc
Definition: winuser.h:3171
const WCHAR WDML_szEventClass[]
Definition: ddemisc.c:38
#define ERR(fmt,...)
Definition: debug.h:109
#define DMLERR_INVALIDPARAMETER
Definition: ddeml.h:252
#define WM_WDML_REGISTER
Definition: dde_private.h:248
#define WS_POPUP
Definition: pedump.c:616
HICON hIconSm
Definition: winuser.h:3180
WDML_INSTANCE * WDML_GetInstance(DWORD InstId) DECLSPEC_HIDDEN
Definition: ddemisc.c:1230
#define ULONG_PTR
Definition: config.h:101
#define SetWindowLongPtrW
Definition: winuser.h:5215
BOOL WDML_IncHSZ(WDML_INSTANCE *pInstance, HSZ hsz) DECLSPEC_HIDDEN
Definition: ddemisc.c:362
WDML_SERVER * servers
Definition: dde_private.h:167

Referenced by DdeUninitialize(), doChild(), init_dde(), release_dde(), ShellDDEInit(), test_dde_default_app(), test_ddeml_server(), and test_end_to_end_server().

◆ DdePostAdvise()

BOOL WINAPI DdePostAdvise ( DWORD  idInst,
HSZ  hszTopic,
HSZ  hszItem 
)

Definition at line 49 of file ddeserver.c.

50 {
51  WDML_INSTANCE* pInstance;
52  WDML_LINK* pLink;
53  HDDEDATA hDdeData;
54  HGLOBAL hItemData;
55  WDML_CONV* pConv;
56  ATOM atom;
57  UINT count;
58 
59  TRACE("(%d,%p,%p)\n", idInst, hszTopic, hszItem);
60 
61  pInstance = WDML_GetInstance(idInst);
62 
63  if (pInstance == NULL)
64  return FALSE;
65 
66  atom = WDML_MakeAtomFromHsz(hszItem);
67  if (!atom) return FALSE;
68 
69  /* first compute the number of links which will trigger a message */
70  count = 0;
71  for (pLink = pInstance->links[WDML_SERVER_SIDE]; pLink != NULL; pLink = pLink->next)
72  {
73  if (DdeCmpStringHandles(hszItem, pLink->hszItem) == 0)
74  {
75  count++;
76  }
77  }
78  if (count >= CADV_LATEACK)
79  {
80  FIXME("too high value for count\n");
81  count &= 0xFFFF;
82  }
83 
84  for (pLink = pInstance->links[WDML_SERVER_SIDE]; pLink != NULL; pLink = pLink->next)
85  {
86  if (DdeCmpStringHandles(hszItem, pLink->hszItem) == 0)
87  {
88  hDdeData = WDML_InvokeCallback(pInstance, XTYP_ADVREQ, pLink->uFmt, pLink->hConv,
89  hszTopic, hszItem, 0, --count, 0);
90 
91  if (hDdeData == CBR_BLOCK)
92  {
93  /* MS doc is not consistent here */
94  FIXME("CBR_BLOCK returned for ADVREQ\n");
95  continue;
96  }
97  if (hDdeData)
98  {
99  if (pLink->transactionType & XTYPF_NODATA)
100  {
101  TRACE("no data\n");
102  hItemData = 0;
103  }
104  else
105  {
106  TRACE("with data\n");
107 
108  hItemData = WDML_DataHandle2Global(hDdeData, FALSE, FALSE, FALSE, FALSE);
109  }
110 
111  pConv = WDML_GetConv(pLink->hConv, TRUE);
112 
113  if (pConv == NULL)
114  {
115  if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData);
116  goto theError;
117  }
118 
119  if (!PostMessageW(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
120  PackDDElParam(WM_DDE_DATA, (UINT_PTR)hItemData, atom)))
121  {
122  ERR("post message failed\n");
123  pConv->wStatus &= ~ST_CONNECTED;
124  pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
125  if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData);
126  GlobalFree(hItemData);
127  goto theError;
128  }
129  if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData);
130  }
131  }
132  }
133  return TRUE;
134 
135  theError:
136  GlobalDeleteAtom(atom);
137  return FALSE;
138 }
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
#define TRUE
Definition: types.h:120
WORD ATOM
Definition: dimm.idl:113
GLuint GLuint GLsizei count
Definition: gl.h:1545
ATOM WDML_MakeAtomFromHsz(HSZ hsz) DECLSPEC_HIDDEN
Definition: ddemisc.c:325
#define ST_CONNECTED
Definition: ddeml.h:80
LPARAM WINAPI PackDDElParam(UINT, UINT_PTR, UINT_PTR)
Definition: ddemisc.c:63
UINT_PTR WPARAM
Definition: windef.h:207
#define DMLERR_POSTMSG_FAILED
Definition: ddeml.h:258
BOOL WINAPI DdeFreeDataHandle(HDDEDATA)
Definition: ddemisc.c:1461
#define CADV_LATEACK
Definition: ddeml.h:202
#define CBR_BLOCK
Definition: ddeml.h:117
WDML_CONV * WDML_GetConv(HCONV hConv, BOOL checkConnected) DECLSPEC_HIDDEN
Definition: ddemisc.c:2230
#define WM_DDE_DATA
Definition: dde.h:42
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
INT WINAPI DdeCmpStringHandles(HSZ, HSZ)
Definition: ddemisc.c:685
#define XTYP_ADVREQ
Definition: ddeml.h:182
#define TRACE(s)
Definition: solgame.cpp:4
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define XTYPF_NODATA
Definition: ddeml.h:171
WDML_LINK * links[2]
Definition: dde_private.h:169
static HSZ hszTopic
Definition: shlexec.c:155
#define ERR(fmt,...)
Definition: debug.h:109
HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease, BOOL fDeferUpd, BOOL dAckReq) DECLSPEC_HIDDEN
Definition: ddemisc.c:1563
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
BOOL WDML_IsAppOwned(HDDEDATA hDdeData) DECLSPEC_HIDDEN
Definition: ddemisc.c:1477
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WDML_INSTANCE * WDML_GetInstance(DWORD InstId) DECLSPEC_HIDDEN
Definition: ddemisc.c:1230
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
Definition: ddemisc.c:1206

◆ map_A_to_W()

static HDDEDATA map_A_to_W ( DWORD  instance,
void ptr,
DWORD  size 
)
static

Definition at line 759 of file ddeserver.c.

760 {
761  HDDEDATA ret;
762  DWORD len;
763  const char *end;
764 
765  if (!data_looks_unicode( ptr, size ))
766  {
767  if ((end = memchr( ptr, 0, size ))) size = end + 1 - (const char *)ptr;
768  len = MultiByteToWideChar( CP_ACP, 0, ptr, size, NULL, 0 );
769  ret = DdeCreateDataHandle( instance, NULL, len * sizeof(WCHAR), 0, 0, CF_TEXT, 0);
771  }
772  else ret = DdeCreateDataHandle( instance, ptr, size, 0, 0, CF_TEXT, 0 );
773 
774  return ret;
775 }
HDDEDATA WINAPI DdeCreateDataHandle(DWORD, LPBYTE, DWORD, DWORD, HSZ, UINT, UINT)
Definition: ddemisc.c:1275
#define memchr(s, c, n)
Definition: mkisofs.h:875
LPBYTE WINAPI DdeAccessData(HDDEDATA, LPDWORD)
Definition: ddemisc.c:1422
#define CP_ACP
Definition: compat.h:99
GLuint GLuint end
Definition: gl.h:1545
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define CF_TEXT
Definition: constants.h:396
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
static HINSTANCE instance
Definition: main.c:40
#define MultiByteToWideChar
Definition: compat.h:100
static BOOL data_looks_unicode(const WCHAR *data, DWORD size)
Definition: ddeserver.c:749

Referenced by WDML_ServerHandleExecute().

◆ map_W_to_A()

static HDDEDATA map_W_to_A ( DWORD  instance,
void ptr,
DWORD  size 
)
static

Definition at line 778 of file ddeserver.c.

779 {
780  HDDEDATA ret;
781  DWORD len;
782  const WCHAR *end;
783 
784  if (data_looks_unicode( ptr, size ))
785  {
786  size /= sizeof(WCHAR);
787  if ((end = memchrW( ptr, 0, size ))) size = end + 1 - (const WCHAR *)ptr;
791  }
792  else ret = DdeCreateDataHandle( instance, ptr, size, 0, 0, CF_TEXT, 0 );
793 
794  return ret;
795 }
HDDEDATA WINAPI DdeCreateDataHandle(DWORD, LPBYTE, DWORD, DWORD, HSZ, UINT, UINT)
Definition: ddemisc.c:1275
#define WideCharToMultiByte
Definition: compat.h:101
LPBYTE WINAPI DdeAccessData(HDDEDATA, LPDWORD)
Definition: ddemisc.c:1422
#define CP_ACP
Definition: compat.h:99
GLuint GLuint end
Definition: gl.h:1545
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define CF_TEXT
Definition: constants.h:396
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
static HINSTANCE instance
Definition: main.c:40
static BOOL data_looks_unicode(const WCHAR *data, DWORD size)
Definition: ddeserver.c:749
WINE_UNICODE_INLINE WCHAR * memchrW(const WCHAR *ptr, WCHAR ch, size_t n)
Definition: unicode.h:295

Referenced by WDML_ServerHandleExecute().

◆ WDML_CreateServerConv()

static WDML_CONV* WDML_CreateServerConv ( WDML_INSTANCE pInstance,
HWND  hwndClient,
HWND  hwndServerName,
HSZ  hszApp,
HSZ  hszTopic 
)
static

Definition at line 280 of file ddeserver.c.

282 {
283  HWND hwndServerConv;
284  WDML_CONV* pConv;
285 
286  if (pInstance->unicode)
287  {
288  WNDCLASSEXW wndclass;
289 
290  wndclass.cbSize = sizeof(wndclass);
291  wndclass.style = 0;
292  wndclass.lpfnWndProc = WDML_ServerConvProc;
293  wndclass.cbClsExtra = 0;
294  wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR);
295  wndclass.hInstance = 0;
296  wndclass.hIcon = 0;
297  wndclass.hCursor = 0;
298  wndclass.hbrBackground = 0;
299  wndclass.lpszMenuName = NULL;
301  wndclass.hIconSm = 0;
302 
303  RegisterClassExW(&wndclass);
304 
305  hwndServerConv = CreateWindowW(WDML_szServerConvClassW, 0,
306  WS_CHILD, 0, 0, 0, 0,
307  hwndServerName, 0, 0, 0);
308  }
309  else
310  {
311  WNDCLASSEXA wndclass;
312 
313  wndclass.cbSize = sizeof(wndclass);
314  wndclass.style = 0;
315  wndclass.lpfnWndProc = WDML_ServerConvProc;
316  wndclass.cbClsExtra = 0;
317  wndclass.cbWndExtra = 2 * sizeof(ULONG_PTR);
318  wndclass.hInstance = 0;
319  wndclass.hIcon = 0;
320  wndclass.hCursor = 0;
321  wndclass.hbrBackground = 0;
322  wndclass.lpszMenuName = NULL;
324  wndclass.hIconSm = 0;
325 
326  RegisterClassExA(&wndclass);
327 
328  hwndServerConv = CreateWindowA(WDML_szServerConvClassA, 0,
329  WS_CHILD, 0, 0, 0, 0,
330  hwndServerName, 0, 0, 0);
331  }
332 
333  TRACE("Created convServer=%p (nameServer=%p) for instance=%08x unicode=%d\n",
334  hwndServerConv, hwndServerName, pInstance->instanceID, pInstance->unicode);
335 
336  pConv = WDML_AddConv(pInstance, WDML_SERVER_SIDE, hszApp, hszTopic,
337  hwndClient, hwndServerConv);
338  if (pConv)
339  {
340  SetWindowLongPtrW(hwndServerConv, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
341  SetWindowLongPtrW(hwndServerConv, GWL_WDML_CONVERSATION, (ULONG_PTR)pConv);
342 
343  /* this should be the only place using SendMessage for WM_DDE_ACK */
344  /* note: sent messages shall not use packing */
345  SendMessageW(hwndClient, WM_DDE_ACK, (WPARAM)hwndServerConv,
347  /* we assume we're connected since we've sent an answer...
348  * I'm not sure what we can do... it doesn't look like the return value
349  * of SendMessage is used... sigh...
350  */
351  pConv->wStatus |= ST_CONNECTED;
352  }
353  else
354  {
355  DestroyWindow(hwndServerConv);
356  }
357  return pConv;
358 }
UINT style
Definition: winuser.h:3155
LPCSTR lpszMenuName
Definition: winuser.h:3163
int cbWndExtra
Definition: winuser.h:3173
HCURSOR hCursor
Definition: winuser.h:3161
WNDPROC lpfnWndProc
Definition: winuser.h:3156
LPCSTR lpszClassName
Definition: winuser.h:3164
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
ATOM WDML_MakeAtomFromHsz(HSZ hsz) DECLSPEC_HIDDEN
Definition: ddemisc.c:325
HICON hIcon
Definition: winuser.h:3175
#define ST_CONNECTED
Definition: ddeml.h:80
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
HICON hIconSm
Definition: winuser.h:3165
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4185
const WCHAR WDML_szServerConvClassW[]
Definition: ddeserver.c:32
uint32_t ULONG_PTR
Definition: typedefs.h:63
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
LPCWSTR lpszMenuName
Definition: winuser.h:3178
HINSTANCE hInstance
Definition: winuser.h:3159
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
smooth NULL
Definition: ftsmooth.c:416
UINT cbSize
Definition: winuser.h:3154
int cbClsExtra
Definition: winuser.h:3172
HBRUSH hbrBackground
Definition: winuser.h:3162
LPCWSTR lpszClassName
Definition: winuser.h:3179
#define TRACE(s)
Definition: solgame.cpp:4
HBRUSH hbrBackground
Definition: winuser.h:3177
UINT cbSize
Definition: winuser.h:3169
WDML_CONV * WDML_AddConv(WDML_INSTANCE *pInstance, WDML_SIDE side, HSZ hszService, HSZ hszTopic, HWND hwndClient, HWND hwndServer) DECLSPEC_HIDDEN
Definition: ddemisc.c:2008
int cbWndExtra
Definition: winuser.h:3158
static LRESULT CALLBACK WDML_ServerConvProc(HWND, UINT, WPARAM, LPARAM)
Definition: ddeserver.c:1016
HINSTANCE hInstance
Definition: winuser.h:3174
#define GWL_WDML_INSTANCE
Definition: dde_private.h:259
HICON hIcon
Definition: winuser.h:3160
HCURSOR hCursor
Definition: winuser.h:3176
#define GWL_WDML_CONVERSATION
Definition: dde_private.h:260
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
UINT style
Definition: winuser.h:3170
static HSZ hszTopic
Definition: shlexec.c:155
WNDPROC lpfnWndProc
Definition: winuser.h:3171
int cbClsExtra
Definition: winuser.h:3157
const char WDML_szServerConvClassA[]
Definition: ddeserver.c:31
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON hIconSm
Definition: winuser.h:3180
#define WM_DDE_ACK
Definition: dde.h:41
#define ULONG_PTR
Definition: config.h:101
#define SetWindowLongPtrW
Definition: winuser.h:5215

Referenced by WDML_ServerNameProc().

◆ WDML_ServerConvProc()

static LRESULT CALLBACK WDML_ServerConvProc ( HWND  hwndServer,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1016 of file ddeserver.c.

1017 {
1018  WDML_INSTANCE* pInstance;
1019  WDML_CONV* pConv;
1020  WDML_XACT* pXAct = NULL;
1021 
1022  TRACE("%p %04x %08lx %08lx\n", hwndServer, iMsg, wParam, lParam);
1023 
1024  if (iMsg == WM_DESTROY)
1025  {
1026  pConv = WDML_GetConvFromWnd(hwndServer);
1027  if (pConv && !(pConv->wStatus & ST_TERMINATED))
1028  {
1030  }
1031  }
1032  if (iMsg < WM_DDE_FIRST || iMsg > WM_DDE_LAST)
1033  {
1034  return IsWindowUnicode(hwndServer) ? DefWindowProcW(hwndServer, iMsg, wParam, lParam) :
1035  DefWindowProcA(hwndServer, iMsg, wParam, lParam);
1036  }
1037 
1038  pInstance = WDML_GetInstanceFromWnd(hwndServer);
1039  pConv = WDML_GetConvFromWnd(hwndServer);
1040 
1041  if (!pConv)
1042  {
1043  ERR("Got a message (%x) on a not known conversation, dropping request\n", iMsg);
1044  return 0;
1045  }
1046  if (pConv->hwndClient != WIN_GetFullHandle( (HWND)wParam ) || pConv->hwndServer != hwndServer)
1047  {
1048  ERR("mismatch between C/S windows and conversation\n");
1049  return 0;
1050  }
1051  if (pConv->instance != pInstance || pConv->instance == NULL)
1052  {
1053  ERR("mismatch in instances\n");
1054  return 0;
1055  }
1056 
1057  switch (iMsg)
1058  {
1059  case WM_DDE_INITIATE:
1060  FIXME("WM_DDE_INITIATE message received!\n");
1061  break;
1062 
1063  case WM_DDE_REQUEST:
1064  pXAct = WDML_ServerQueueRequest(pConv, lParam);
1065  break;
1066 
1067  case WM_DDE_ADVISE:
1068  pXAct = WDML_ServerQueueAdvise(pConv, lParam);
1069  break;
1070 
1071  case WM_DDE_UNADVISE:
1072  pXAct = WDML_ServerQueueUnadvise(pConv, lParam);
1073  break;
1074 
1075  case WM_DDE_EXECUTE:
1076  pXAct = WDML_ServerQueueExecute(pConv, lParam);
1077  break;
1078 
1079  case WM_DDE_POKE:
1080  pXAct = WDML_ServerQueuePoke(pConv, lParam);
1081  break;
1082 
1083  case WM_DDE_TERMINATE:
1084  pXAct = WDML_ServerQueueTerminate(pConv, lParam);
1085  break;
1086 
1087  case WM_DDE_ACK:
1088  WARN("Shouldn't receive a ACK message (never requests them). Ignoring it\n");
1089  break;
1090 
1091  default:
1092  FIXME("Unsupported message %x\n", iMsg);
1093  break;
1094  }
1095 
1096  if (pXAct)
1097  {
1098  pXAct->lParam = lParam;
1099 
1100  if ((pConv->wStatus & ST_BLOCKED) || WDML_ServerHandle(pConv, pXAct) == WDML_QS_BLOCK)
1101  {
1102  TRACE("Transactions are blocked, add to the queue and exit\n");
1103  WDML_QueueTransaction(pConv, pXAct);
1104  }
1105  else
1106  {
1107  WDML_FreeTransaction(pInstance, pXAct, TRUE);
1108  }
1109  }
1110  else
1111  pConv->instance->lastError = DMLERR_MEMORY_ERROR;
1112 
1113  return 0;
1114 }
#define TRUE
Definition: types.h:120
#define WM_DDE_UNADVISE
Definition: dde.h:40
#define ST_BLOCKED
Definition: ddeml.h:83
#define WARN(fmt,...)
Definition: debug.h:111
#define DMLERR_MEMORY_ERROR
Definition: ddeml.h:254
static WDML_XACT * WDML_ServerQueueUnadvise(WDML_CONV *pConv, LPARAM lParam)
Definition: ddeserver.c:677
#define WM_DDE_REQUEST
Definition: dde.h:43
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WDML_INSTANCE * WDML_GetInstanceFromWnd(HWND hWnd) DECLSPEC_HIDDEN
Definition: ddemisc.c:1261
LPARAM lParam
Definition: dde_private.h:121
#define WM_DDE_TERMINATE
Definition: dde.h:38
void WDML_QueueTransaction(WDML_CONV *pConv, WDML_XACT *pXAct) DECLSPEC_HIDDEN
Definition: ddemisc.c:1933
#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_XACT * WDML_ServerQueueRequest(WDML_CONV *pConv, LPARAM lParam)
Definition: ddeserver.c:516
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI IsWindowUnicode(_In_ HWND)
static WDML_XACT * WDML_ServerQueueAdvise(WDML_CONV *pConv, LPARAM lParam)
Definition: ddeserver.c:584
#define WM_DESTROY
Definition: winuser.h:1591
WDML_QUEUE_STATE WDML_ServerHandle(WDML_CONV *pConv, WDML_XACT *pXAct)
Definition: ddeserver.c:968
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_DDE_LAST
Definition: dde.h:46
#define WM_DDE_POKE
Definition: dde.h:44
static WDML_XACT * WDML_ServerQueuePoke(WDML_CONV *pConv, LPARAM lParam)
Definition: ddeserver.c:853
static WDML_XACT * WDML_ServerQueueTerminate(WDML_CONV *pConv, LPARAM lParam)
Definition: ddeserver.c:934
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static WDML_XACT * WDML_ServerQueueExecute(WDML_CONV *pConv, LPARAM lParam)
Definition: ddeserver.c:737
#define ERR(fmt,...)
Definition: debug.h:109
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
void WDML_FreeTransaction(WDML_INSTANCE *pInstance, WDML_XACT *pXAct, BOOL doFreePmt) DECLSPEC_HIDDEN
Definition: ddemisc.c:1967
#define WM_DDE_INITIATE
Definition: dde.h:37
#define ST_TERMINATED
Definition: ddeml.h:85
#define WM_DDE_ACK
Definition: dde.h:41
#define WM_DDE_ADVISE
Definition: dde.h:39
#define WM_DDE_EXECUTE
Definition: dde.h:45
LPARAM lParam
Definition: combotst.c:139
WDML_CONV * WDML_GetConvFromWnd(HWND hWnd) DECLSPEC_HIDDEN
Definition: ddemisc.c:2265
#define WIN_GetFullHandle(h)
Definition: user_x.h:108

Referenced by WDML_CreateServerConv().

◆ 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_ServerHandleAdvise()

static WDML_QUEUE_STATE WDML_ServerHandleAdvise ( WDML_CONV pConv,
WDML_XACT pXAct 
)
static

Definition at line 610 of file ddeserver.c.

611 {
612  UINT uType;
613  WDML_LINK* pLink;
614  DDEADVISE* pDdeAdvise;
615  HDDEDATA hDdeData = 0;
616  BOOL fAck = TRUE;
617 
618  pDdeAdvise = GlobalLock(pXAct->hMem);
619  uType = XTYP_ADVSTART |
620  (pDdeAdvise->fDeferUpd ? XTYPF_NODATA : 0) |
621  (pDdeAdvise->fAckReq ? XTYPF_ACKREQ : 0);
622 
623  if (!(pConv->instance->CBFflags & CBF_FAIL_ADVISES))
624  {
625  hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_ADVSTART, pDdeAdvise->cfFormat,
626  (HCONV)pConv, pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
627  }
628 
629  switch ((ULONG_PTR)hDdeData)
630  {
631  case 0:
632  TRACE("No data returned from the Callback\n");
633  fAck = FALSE;
634  break;
635 
636  case (ULONG_PTR)CBR_BLOCK:
637  return WDML_QS_BLOCK;
638 
639  default:
640  /* billx: first to see if the link is already created. */
641  pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
642  pXAct->hszItem, TRUE, pDdeAdvise->cfFormat);
643 
644  if (pLink != NULL)
645  {
646  /* we found a link, and only need to modify it in case it changes */
647  pLink->transactionType = uType;
648  }
649  else
650  {
651  TRACE("Adding Link with hConv %p\n", pConv);
652  WDML_AddLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
653  uType, pXAct->hszItem, pDdeAdvise->cfFormat);
654  }
655  break;
656  }
657 
658  GlobalUnlock(pXAct->hMem);
659  if (fAck)
660  {
661  GlobalFree(pXAct->hMem);
662  }
663  pXAct->hMem = 0;
664 
665  WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, fAck, pXAct->atom, pXAct->lParam, WM_DDE_ADVISE);
666 
667  WDML_DecHSZ(pConv->instance, pXAct->hszItem);
668 
669  return WDML_QS_HANDLED;
670 }
#define TRUE
Definition: types.h:120
#define CBF_FAIL_ADVISES
Definition: ddeml.h:105
unsigned short fDeferUpd
Definition: dde.h:66
HGLOBAL hMem
Definition: dde_private.h:120
void WDML_AddLink(WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, UINT wType, HSZ hszItem, UINT wFmt) DECLSPEC_HIDDEN
Definition: ddemisc.c:1755
Definition: dde.h:64
#define CBR_BLOCK
Definition: ddeml.h:117
uint32_t ULONG_PTR
Definition: typedefs.h:63
short cfFormat
Definition: dde.h:67
LPARAM lParam
Definition: dde_private.h:121
unsigned int BOOL
Definition: ntddk_ex.h:94
#define XTYP_ADVSTART
Definition: ddeml.h:183
BOOL WDML_PostAck(WDML_CONV *pConv, WDML_SIDE side, WORD appRetCode, BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg) DECLSPEC_HIDDEN
Definition: ddemisc.c:2275
unsigned short fAckReq
Definition: dde.h:66
smooth NULL
Definition: ftsmooth.c:416
BOOL WDML_DecHSZ(WDML_INSTANCE *pInstance, HSZ hsz) DECLSPEC_HIDDEN
Definition: ddemisc.c:380
WDML_LINK * WDML_FindLink(WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, HSZ hszItem, BOOL use_fmt, UINT uFmt) DECLSPEC_HIDDEN
Definition: ddemisc.c:1868
#define TRACE(s)
Definition: solgame.cpp:4
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define XTYPF_NODATA
Definition: ddeml.h:171
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
#define XTYPF_ACKREQ
Definition: ddeml.h:172
unsigned int UINT
Definition: ndis.h:50
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define WM_DDE_ADVISE
Definition: dde.h:39
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
Definition: ddemisc.c:1206

Referenced by WDML_ServerHandle().

◆ WDML_ServerHandleExecute()

static WDML_QUEUE_STATE WDML_ServerHandleExecute ( WDML_CONV pConv,
WDML_XACT pXAct 
)
static

Definition at line 802 of file ddeserver.c.

803 {
804  HDDEDATA hDdeData = DDE_FNOTPROCESSED;
805  BOOL fAck = FALSE, fBusy = FALSE;
806 
807  if (!(pConv->instance->CBFflags & CBF_FAIL_EXECUTES))
808  {
809  LPVOID ptr = GlobalLock(pXAct->hMem);
810  DWORD size = GlobalSize(pXAct->hMem);
811 
812  if (ptr)
813  {
814  if (pConv->instance->unicode) /* Unicode server, try to map A->W */
815  hDdeData = map_A_to_W( pConv->instance->instanceID, ptr, size );
816  else if (!IsWindowUnicode( pConv->hwndClient )) /* ASCII server and client, try to map W->A */
817  hDdeData = map_W_to_A( pConv->instance->instanceID, ptr, size );
818  else
819  hDdeData = DdeCreateDataHandle(pConv->instance->instanceID, ptr, size, 0, 0, CF_TEXT, 0);
820  GlobalUnlock(pXAct->hMem);
821  }
822  hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_EXECUTE, 0, (HCONV)pConv,
823  pConv->hszTopic, 0, hDdeData, 0L, 0L);
824  }
825 
826  switch ((ULONG_PTR)hDdeData)
827  {
828  case (ULONG_PTR)CBR_BLOCK:
829  return WDML_QS_BLOCK;
830 
831  case DDE_FACK:
832  fAck = TRUE;
833  break;
834  case DDE_FBUSY:
835  fBusy = TRUE;
836  break;
837  default:
838  FIXME("Unsupported returned value %p\n", hDdeData);
839  /* fall through */
840  case DDE_FNOTPROCESSED:
841  break;
842  }
843  WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, fBusy, fAck, (UINT_PTR)pXAct->hMem, 0, 0);
844 
845  return WDML_QS_HANDLED;
846 }
HDDEDATA WINAPI DdeCreateDataHandle(DWORD, LPBYTE, DWORD, DWORD, HSZ, UINT, UINT)
Definition: ddemisc.c:1275
static HDDEDATA map_W_to_A(DWORD instance, void *ptr, DWORD size)
Definition: ddeserver.c:778
#define TRUE
Definition: types.h:120
HGLOBAL hMem
Definition: dde_private.h:120
#define XTYP_EXECUTE
Definition: ddeml.h:185
#define DDE_FNOTPROCESSED
Definition: ddeml.h:223
#define CBR_BLOCK
Definition: ddeml.h:117
uint32_t ULONG_PTR
Definition: typedefs.h:63
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
BOOL WDML_PostAck(WDML_CONV *pConv, WDML_SIDE side, WORD appRetCode, BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg) DECLSPEC_HIDDEN
Definition: ddemisc.c:2275
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define CF_TEXT
Definition: constants.h:396
GLsizeiptr size
Definition: glext.h:5919
#define DDE_FACK
Definition: ddeml.h:216
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
static const WCHAR L[]
Definition: oid.c:1250
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define DDE_FBUSY
Definition: ddeml.h:217
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define CBF_FAIL_EXECUTES
Definition: ddeml.h:106
static HDDEDATA map_A_to_W(DWORD instance, void *ptr, DWORD size)
Definition: ddeserver.c:759
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
Definition: ddemisc.c:1206

Referenced by WDML_ServerHandle().

◆ WDML_ServerHandlePoke()

static WDML_QUEUE_STATE WDML_ServerHandlePoke ( WDML_CONV pConv,
WDML_XACT pXAct 
)
static

Definition at line 875 of file ddeserver.c.

876 {
877  DDEPOKE* pDdePoke;
878  HDDEDATA hDdeData;
879  BOOL fBusy = FALSE, fAck = FALSE;
880 
881  pDdePoke = GlobalLock(pXAct->hMem);
882  if (!pDdePoke)
883  {
884  return WDML_QS_ERROR;
885  }
886 
887  if (!(pConv->instance->CBFflags & CBF_FAIL_POKES))
888  {
889  hDdeData = DdeCreateDataHandle(pConv->instance->instanceID, pDdePoke->Value,
891  0, 0, pDdePoke->cfFormat, 0);
892  if (hDdeData)
893  {
894  HDDEDATA hDdeDataOut;
895 
896  hDdeDataOut = WDML_InvokeCallback(pConv->instance, XTYP_POKE, pDdePoke->cfFormat,
897  (HCONV)pConv, pConv->hszTopic, pXAct->hszItem,
898  hDdeData, 0, 0);
899  switch ((ULONG_PTR)hDdeDataOut)
900  {
901  case DDE_FACK:
902  fAck = TRUE;
903  break;
904  case DDE_FBUSY:
905  fBusy = TRUE;
906  break;
907  default:
908  FIXME("Unsupported returned value %p\n", hDdeDataOut);
909  /* fal through */
910  case DDE_FNOTPROCESSED:
911  break;
912  }
913  DdeFreeDataHandle(hDdeData);
914  }
915  }
916  GlobalUnlock(pXAct->hMem);
917 
918  if (!fAck)
919  {
920  GlobalFree(pXAct->hMem);
921  }
922  WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, fBusy, fAck, pXAct->atom, pXAct->lParam, WM_DDE_POKE);
923 
924  WDML_DecHSZ(pConv->instance, pXAct->hszItem);
925 
926  return WDML_QS_HANDLED;
927 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
HDDEDATA WINAPI DdeCreateDataHandle(DWORD, LPBYTE, DWORD, DWORD, HSZ, UINT, UINT)
Definition: ddemisc.c:1275
#define TRUE
Definition: types.h:120
HGLOBAL hMem
Definition: dde_private.h:120
Definition: dde.h:71
#define CBF_FAIL_POKES
Definition: ddeml.h:107
#define DDE_FNOTPROCESSED
Definition: ddeml.h:223
BOOL WINAPI DdeFreeDataHandle(HDDEDATA)
Definition: ddemisc.c:1461
short cfFormat
Definition: dde.h:74
uint32_t ULONG_PTR
Definition: typedefs.h:63
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
LPARAM lParam
Definition: dde_private.h:121
unsigned int BOOL
Definition: ntddk_ex.h:94
#define XTYP_POKE
Definition: ddeml.h:189
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL WDML_PostAck(WDML_CONV *pConv, WDML_SIDE side, WORD appRetCode, BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg) DECLSPEC_HIDDEN
Definition: ddemisc.c:2275
BOOL WDML_DecHSZ(WDML_INSTANCE *pInstance, HSZ hsz) DECLSPEC_HIDDEN
Definition: ddemisc.c:380
BYTE Value[1]
Definition: dde.h:75
#define DDE_FACK
Definition: ddeml.h:216
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define WM_DDE_POKE
Definition: dde.h:44
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define DDE_FBUSY
Definition: ddeml.h:217
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
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
Definition: ddemisc.c:1206

Referenced by WDML_ServerHandle().

◆ WDML_ServerHandleRequest()

static WDML_QUEUE_STATE WDML_ServerHandleRequest ( WDML_CONV pConv,
WDML_XACT pXAct 
)
static

Definition at line 534 of file ddeserver.c.

535 {
536  HDDEDATA hDdeData = 0;
537  BOOL fAck = TRUE;
538 
539  if (!(pConv->instance->CBFflags & CBF_FAIL_REQUESTS))
540  {
541 
542  hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_REQUEST, pXAct->wFmt, (HCONV)pConv,
543  pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
544  }
545 
546  switch ((ULONG_PTR)hDdeData)
547  {
548  case 0:
549  TRACE("No data returned from the Callback\n");
550  fAck = FALSE;
551  break;
552 
553  case (ULONG_PTR)CBR_BLOCK:
554  return WDML_QS_BLOCK;
555 
556  default:
557  {
558  HGLOBAL hMem = WDML_DataHandle2Global(hDdeData, TRUE, FALSE, FALSE, FALSE);
559  if (!PostMessageW(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
561  (UINT_PTR)hMem, (UINT_PTR)pXAct->atom)))
562  {
563  pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
564  DdeFreeDataHandle(hDdeData);
565  GlobalFree(hMem);
566  fAck = FALSE;
567  }
568  }
569  break;
570  }
571 
572  WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, fAck, pXAct->atom, pXAct->lParam, WM_DDE_REQUEST);
573 
574  WDML_DecHSZ(pConv->instance, pXAct->hszItem);
575 
576  return WDML_QS_HANDLED;
577 }
#define XTYP_REQUEST
Definition: ddeml.h:191
#define TRUE
Definition: types.h:120
UINT_PTR WPARAM
Definition: windef.h:207
#define DMLERR_POSTMSG_FAILED
Definition: ddeml.h:258
BOOL WINAPI DdeFreeDataHandle(HDDEDATA)
Definition: ddemisc.c:1461
#define WM_DDE_REQUEST
Definition: dde.h:43
#define CBR_BLOCK
Definition: ddeml.h:117
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define CBF_FAIL_REQUESTS
Definition: ddeml.h:108
LPARAM lParam
Definition: dde_private.h:121
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_DDE_DATA
Definition: dde.h:42
BOOL WDML_PostAck(WDML_CONV *pConv, WDML_SIDE side, WORD appRetCode, BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg) DECLSPEC_HIDDEN
Definition: ddemisc.c:2275
BOOL WDML_DecHSZ(WDML_INSTANCE *pInstance, HSZ hsz) DECLSPEC_HIDDEN
Definition: ddemisc.c:380
#define TRACE(s)
Definition: solgame.cpp:4
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
LPARAM WINAPI ReuseDDElParam(LPARAM, UINT, UINT, UINT_PTR, UINT_PTR)
Definition: ddemisc.c:171
HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease, BOOL fDeferUpd, BOOL dAckReq) DECLSPEC_HIDDEN
Definition: ddemisc.c:1563
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
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
Definition: ddemisc.c:1206

Referenced by WDML_ServerHandle().

◆ WDML_ServerHandleTerminate()

static WDML_QUEUE_STATE WDML_ServerHandleTerminate ( WDML_CONV pConv,
WDML_XACT pXAct 
)
static

Definition at line 947 of file ddeserver.c.

948 {
949  /* billx: two things to remove: the conv, and associated links.
950  * Respond with another WM_DDE_TERMINATE iMsg.
951  */
952  if (!(pConv->instance->CBFflags & CBF_SKIP_DISCONNECTS))
953  {
954  WDML_InvokeCallback(pConv->instance, XTYP_DISCONNECT, 0, (HCONV)pConv, 0, 0,
955  0, 0, (pConv->wStatus & ST_ISSELF) ? 1 : 0);
956  }
959 
960  return WDML_QS_HANDLED;
961 }
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_DDE_TERMINATE
Definition: dde.h:38
#define ST_ISSELF
Definition: ddeml.h:88
#define CBF_SKIP_DISCONNECTS
Definition: ddeml.h:114
#define XTYP_DISCONNECT
Definition: ddeml.h:192
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void WDML_RemoveConv(WDML_CONV *pConv, WDML_SIDE side) DECLSPEC_HIDDEN
Definition: ddemisc.c:2070
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
Definition: ddemisc.c:1206

Referenced by WDML_ServerConvProc(), and WDML_ServerHandle().

◆ WDML_ServerHandleUnadvise()

static WDML_QUEUE_STATE WDML_ServerHandleUnadvise ( WDML_CONV pConv,
WDML_XACT pXAct 
)
static

Definition at line 695 of file ddeserver.c.

696 {
697  WDML_LINK* pLink;
698 
699  if (pXAct->hszItem == NULL || pXAct->wFmt == 0)
700  {
701  ERR("Unsupported yet options (null item or clipboard format)\n");
702  return WDML_QS_ERROR;
703  }
704 
705  pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
706  pXAct->hszItem, TRUE, pXAct->wFmt);
707  if (pLink == NULL)
708  {
709  ERR("Couldn't find link for %p, dropping request\n", pXAct->hszItem);
711  return WDML_QS_ERROR;
712  }
713 
714  if (!(pConv->instance->CBFflags & CBF_FAIL_ADVISES))
715  {
716  WDML_InvokeCallback(pConv->instance, XTYP_ADVSTOP, pXAct->wFmt, (HCONV)pConv,
717  pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
718  }
719 
720  WDML_RemoveLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
721  pXAct->hszItem, pXAct->wFmt);
722 
723  /* send back ack */
724  WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, TRUE, pXAct->atom,
725  pXAct->lParam, WM_DDE_UNADVISE);
726 
727  WDML_DecHSZ(pConv->instance, pXAct->hszItem);
728 
729  return WDML_QS_HANDLED;
730 }
#define TRUE
Definition: types.h:120
#define CBF_FAIL_ADVISES
Definition: ddeml.h:105
#define WM_DDE_UNADVISE
Definition: dde.h:40
LPARAM lParam
Definition: dde_private.h:121
#define XTYP_ADVSTOP
Definition: ddeml.h:184
BOOL WDML_PostAck(WDML_CONV *pConv, WDML_SIDE side, WORD appRetCode, BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg) DECLSPEC_HIDDEN
Definition: ddemisc.c:2275
smooth NULL
Definition: ftsmooth.c:416
BOOL WDML_DecHSZ(WDML_INSTANCE *pInstance, HSZ hsz) DECLSPEC_HIDDEN
Definition: ddemisc.c:380
WDML_LINK * WDML_FindLink(WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, HSZ hszItem, BOOL use_fmt, UINT uFmt) DECLSPEC_HIDDEN
Definition: ddemisc.c:1868
BOOL WINAPI FreeDDElParam(UINT, LPARAM)
Definition: ddemisc.c:147
#define ERR(fmt,...)
Definition: debug.h:109
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
void WDML_RemoveLink(WDML_INSTANCE *pInstance, HCONV hConv, WDML_SIDE side, HSZ hszItem, UINT wFmt) DECLSPEC_HIDDEN
Definition: ddemisc.c:1780
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
Definition: ddemisc.c:1206

Referenced by WDML_ServerHandle().

◆ WDML_ServerNameProc()

static LRESULT CALLBACK WDML_ServerNameProc ( HWND  hwndServer,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 365 of file ddeserver.c.

366 {
367  HWND hwndClient;
368  HSZ hszApp, hszTop;
369  HDDEDATA hDdeData;
370  WDML_INSTANCE* pInstance;
371  UINT_PTR uiLo, uiHi;
372 
373  switch (iMsg)
374  {
375  case WM_DDE_INITIATE:
376 
377  /* wParam -- sending window handle
378  LOWORD(lParam) -- application atom
379  HIWORD(lParam) -- topic atom */
380 
381  TRACE("WM_DDE_INITIATE message received!\n");
382  hwndClient = (HWND)wParam;
383 
384  pInstance = WDML_GetInstanceFromWnd(hwndServer);
385  if (!pInstance) return 0;
386  TRACE("idInst=%d, threadID=0x%x\n", pInstance->instanceID, GetCurrentThreadId());
387 
388  /* don't free DDEParams, since this is a broadcast */
389  UnpackDDElParam(WM_DDE_INITIATE, lParam, &uiLo, &uiHi);
390 
391  hszApp = WDML_MakeHszFromAtom(pInstance, uiLo);
392  hszTop = WDML_MakeHszFromAtom(pInstance, uiHi);
393 
394  if (!(pInstance->CBFflags & CBF_FAIL_CONNECTIONS))
395  {
396  BOOL self = FALSE;
397  CONVCONTEXT cc;
398  CONVCONTEXT* pcc = NULL;
399  WDML_CONV* pConv;
400  char buf[256];
401 
402  if (GetWindowThreadProcessId(hwndClient, NULL) == GetWindowThreadProcessId(hwndServer, NULL) &&
403  WDML_GetInstanceFromWnd(hwndClient) == WDML_GetInstanceFromWnd(hwndServer))
404  {
405  self = TRUE;
406  }
407  /* FIXME: so far, we don't grab distant convcontext, so only check if remote is
408  * handled under DDEML, and if so build a default context
409  */
410  if ((GetClassNameA(hwndClient, buf, sizeof(buf)) &&
412  (GetClassNameW(hwndClient, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR)) &&
414  {
415  pcc = &cc;
416  memset(pcc, 0, sizeof(*pcc));
417  pcc->cb = sizeof(*pcc);
418  pcc->iCodePage = IsWindowUnicode(hwndClient) ? CP_WINUNICODE : CP_WINANSI;
419  }
420  if ((pInstance->CBFflags & CBF_FAIL_SELFCONNECTIONS) && self)
421  {
422  TRACE("Don't do self connection as requested\n");
423  }
424  else if (hszApp && hszTop)
425  {
426  WDML_SERVER* pServer = (WDML_SERVER*)GetWindowLongPtrW(hwndServer, GWL_WDML_SERVER);
427 
428  /* check filters for name service */
429  if (!pServer->filterOn || DdeCmpStringHandles(pServer->hszService, hszApp) == 0)
430  {
431  /* pass on to the callback */
432  hDdeData = WDML_InvokeCallback(pInstance, XTYP_CONNECT,
433  0, 0, hszTop, hszApp, 0, (ULONG_PTR)pcc, self);
434  if ((ULONG_PTR)hDdeData)
435  {
436  pConv = WDML_CreateServerConv(pInstance, hwndClient, hwndServer,
437  hszApp, hszTop);
438  if (pConv)
439  {
440  if (pcc) pConv->wStatus |= ST_ISLOCAL;
441  WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv,
442  hszTop, hszApp, 0, (ULONG_PTR)pcc, self);
443  }
444  }
445  }
446  }
447  else if (pInstance->servers)
448  {
449  /* pass on to the callback */
450  hDdeData = WDML_InvokeCallback(pInstance, XTYP_WILDCONNECT,
451  0, 0, hszTop, hszApp, 0, (ULONG_PTR)pcc, self);
452 
453  if (hDdeData == CBR_BLOCK)
454  {
455  /* MS doc is not consistent here */
456  FIXME("CBR_BLOCK returned for WILDCONNECT\n");
457  }
458  else if ((ULONG_PTR)hDdeData != 0)
459  {
460  HSZPAIR* hszp;
461 
462  hszp = (HSZPAIR*)DdeAccessData(hDdeData, NULL);
463  if (hszp)
464  {
465  int i;
466  for (i = 0; hszp[i].hszSvc && hszp[i].hszTopic; i++)
467  {
468  pConv = WDML_CreateServerConv(pInstance, hwndClient, hwndServer,
469  hszp[i].hszSvc, hszp[i].hszTopic);
470  if (pConv)
471  {
472  if (pcc) pConv->wStatus |= ST_ISLOCAL;
473  WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv,
474  hszp[i].hszTopic, hszp[i].hszSvc, 0, (ULONG_PTR)pcc, self);
475  }
476  }
477  DdeUnaccessData(hDdeData);
478  }
479  if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData);
480  }
481  }
482  }
483 
484  return 0;
485 
486  case WM_DDE_REQUEST:
487  FIXME("WM_DDE_REQUEST message received!\n");
488  return 0;
489  case WM_DDE_ADVISE:
490  FIXME("WM_DDE_ADVISE message received!\n");
491  return 0;
492  case WM_DDE_UNADVISE:
493  FIXME("WM_DDE_UNADVISE message received!\n");
494  return 0;
495  case WM_DDE_EXECUTE:
496  FIXME("WM_DDE_EXECUTE message received!\n");
497  return 0;
498  case WM_DDE_POKE:
499  FIXME("WM_DDE_POKE message received!\n");
500  return 0;
501  case WM_DDE_TERMINATE:
502  FIXME("WM_DDE_TERMINATE message received!\n");
503  return 0;
504  default:
505  break;
506  }
507 
508  return DefWindowProcW(hwndServer, iMsg, wParam, lParam);
509 }
#define ST_ISLOCAL
Definition: ddeml.h:82
#define TRUE
Definition: types.h:120
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
#define WM_DDE_UNADVISE
Definition: dde.h:40
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LPBYTE WINAPI DdeAccessData(HDDEDATA, LPDWORD)
Definition: ddemisc.c:1422
#define GWL_WDML_SERVER
Definition: dde_private.h:261
HANDLE HWND
Definition: compat.h:13
#define XTYP_CONNECT_CONFIRM
Definition: ddeml.h:187
#define GetWindowLongPtrW
Definition: winuser.h:4698
BOOL WINAPI DdeFreeDataHandle(HDDEDATA)
Definition: ddemisc.c:1461
#define WM_DDE_REQUEST
Definition: dde.h:43
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CBR_BLOCK
Definition: ddeml.h:117
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
WDML_INSTANCE * WDML_GetInstanceFromWnd(HWND hWnd) DECLSPEC_HIDDEN
Definition: ddemisc.c:1261
uint32_t ULONG_PTR
Definition: typedefs.h:63
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HSZ WDML_MakeHszFromAtom(const WDML_INSTANCE *pInstance, ATOM atom) DECLSPEC_HIDDEN
Definition: ddemisc.c:342
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_DDE_TERMINATE
Definition: dde.h:38
HSZ hszTopic
Definition: ddeml.h:302
const char WDML_szClientConvClassA[]
Definition: ddeclient.c:31
#define FIXME(fmt,...)
Definition: debug.h:110
INT iCodePage
Definition: ddeml.h:310
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
smooth NULL
Definition: ftsmooth.c:416
#define XTYP_WILDCONNECT
Definition: ddeml.h:194
BOOL WINAPI IsWindowUnicode(_In_ HWND)
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
INT WINAPI DdeCmpStringHandles(HSZ, HSZ)
Definition: ddemisc.c:685
#define XTYP_CONNECT
Definition: ddeml.h:186
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
HSZ hszSvc
Definition: ddeml.h:301
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
static WDML_CONV * WDML_CreateServerConv(WDML_INSTANCE *pInstance, HWND hwndClient, HWND hwndServerName, HSZ hszApp, HSZ hszTopic)
Definition: ddeserver.c:280
#define WM_DDE_POKE
Definition: dde.h:44
#define CBF_FAIL_CONNECTIONS
Definition: ddeml.h:104
static HSZ hszTopic
Definition: shlexec.c:155
#define CBF_FAIL_SELFCONNECTIONS
Definition: ddeml.h:103
BOOL WINAPI UnpackDDElParam(UINT, LPARAM, PUINT_PTR, PUINT_PTR)
Definition: ddemisc.c:105
uint32_t cc
Definition: isohybrid.c:75
#define CP_WINANSI
Definition: ddeml.h:32
BOOL WDML_IsAppOwned(HDDEDATA hDdeData) DECLSPEC_HIDDEN
Definition: ddemisc.c:1477
#define CP_WINUNICODE
Definition: ddeml.h:33
#define WM_DDE_INITIATE
Definition: dde.h:37
BOOL WINAPI DdeUnaccessData(HDDEDATA)
Definition: ddemisc.c:1447
const WCHAR WDML_szClientConvClassW[]
Definition: ddeclient.c:32
#define WM_DDE_ADVISE
Definition: dde.h:39
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define memset(x, y, z)
Definition: compat.h:39
WDML_SERVER * servers
Definition: dde_private.h:167
#define WM_DDE_EXECUTE
Definition: dde.h:45
LPARAM lParam
Definition: combotst.c:139
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
Definition: ddemisc.c:1206

Referenced by DdeNameService().

◆ WDML_ServerQueueAdvise()

static WDML_XACT* WDML_ServerQueueAdvise ( WDML_CONV pConv,
LPARAM  lParam 
)
static

Definition at line 584 of file ddeserver.c.

585 {
586  UINT_PTR uiLo, uiHi;
587  WDML_XACT* pXAct;
588 
589  /* XTYP_ADVSTART transaction:
590  establish link and save link info to InstanceInfoTable */
591 
592  if (!UnpackDDElParam(WM_DDE_ADVISE, lParam, &uiLo, &uiHi))
593  return NULL;
594 
596  0, WDML_MakeHszFromAtom(pConv->instance, uiHi));
597  if (pXAct)
598  {
599  pXAct->hMem = (HGLOBAL)uiLo;
600  pXAct->atom = uiHi;
601  }
602  return pXAct;
603 }
HANDLE HGLOBAL
Definition: windef.h:243
HGLOBAL hMem
Definition: dde_private.h:120
WDML_XACT * WDML_AllocTransaction(WDML_INSTANCE *pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem) DECLSPEC_HIDDEN
Definition: ddemisc.c:1900
HSZ WDML_MakeHszFromAtom(const WDML_INSTANCE *pInstance, ATOM atom) DECLSPEC_HIDDEN
Definition: ddemisc.c:342
smooth NULL
Definition: ftsmooth.c:416
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
BOOL WINAPI UnpackDDElParam(UINT, LPARAM, PUINT_PTR, PUINT_PTR)
Definition: ddemisc.c:105
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
#define WM_DDE_ADVISE
Definition: dde.h:39
LPARAM lParam
Definition: combotst.c:139

Referenced by WDML_ServerConvProc().

◆ WDML_ServerQueueExecute()

static WDML_XACT* WDML_ServerQueueExecute ( WDML_CONV pConv,
LPARAM  lParam 
)
static

Definition at line 737 of file ddeserver.c.

738 {
739  WDML_XACT* pXAct;
740 
741  pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_EXECUTE, 0, 0);
742  if (pXAct)
743  {
744  pXAct->hMem = (HGLOBAL)lParam;
745  }
746  return pXAct;
747 }
HANDLE HGLOBAL
Definition: windef.h:243
HGLOBAL hMem
Definition: dde_private.h:120
WDML_XACT * WDML_AllocTransaction(WDML_INSTANCE *pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem) DECLSPEC_HIDDEN
Definition: ddemisc.c:1900
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
#define WM_DDE_EXECUTE
Definition: dde.h:45
LPARAM lParam
Definition: combotst.c:139

Referenced by WDML_ServerConvProc().

◆ WDML_ServerQueuePoke()

static WDML_XACT* WDML_ServerQueuePoke ( WDML_CONV pConv,
LPARAM  lParam 
)
static

Definition at line 853 of file ddeserver.c.

854 {
855  UINT_PTR uiLo, uiHi;
856  WDML_XACT* pXAct;
857 
858  UnpackDDElParam(WM_DDE_POKE, lParam, &uiLo, &uiHi);
859 
861  0, WDML_MakeHszFromAtom(pConv->instance, uiHi));
862  if (pXAct)
863  {
864  pXAct->atom = uiHi;
865  pXAct->hMem = (HGLOBAL)uiLo;
866  }
867  return pXAct;
868 }
HANDLE HGLOBAL
Definition: windef.h:243
HGLOBAL hMem
Definition: dde_private.h:120
WDML_XACT * WDML_AllocTransaction(WDML_INSTANCE *pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem) DECLSPEC_HIDDEN
Definition: ddemisc.c:1900
HSZ WDML_MakeHszFromAtom(const WDML_INSTANCE *pInstance, ATOM atom) DECLSPEC_HIDDEN
Definition: ddemisc.c:342
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define WM_DDE_POKE
Definition: dde.h:44
BOOL WINAPI UnpackDDElParam(UINT, LPARAM, PUINT_PTR, PUINT_PTR)
Definition: ddemisc.c:105
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
LPARAM lParam
Definition: combotst.c:139

Referenced by WDML_ServerConvProc().

◆ WDML_ServerQueueRequest()

static WDML_XACT* WDML_ServerQueueRequest ( WDML_CONV pConv,
LPARAM  lParam 
)
static

Definition at line 516 of file ddeserver.c.

517 {
518  UINT_PTR uiLo, uiHi;
519  WDML_XACT* pXAct;
520 
521  UnpackDDElParam(WM_DDE_REQUEST, lParam, &uiLo, &uiHi);
522 
524  uiLo, WDML_MakeHszFromAtom(pConv->instance, uiHi));
525  if (pXAct) pXAct->atom = uiHi;
526  return pXAct;
527 }
WDML_XACT * WDML_AllocTransaction(WDML_INSTANCE *pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem) DECLSPEC_HIDDEN
Definition: ddemisc.c:1900
#define WM_DDE_REQUEST
Definition: dde.h:43
HSZ WDML_MakeHszFromAtom(const WDML_INSTANCE *pInstance, ATOM atom) DECLSPEC_HIDDEN
Definition: ddemisc.c:342
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
BOOL WINAPI UnpackDDElParam(UINT, LPARAM, PUINT_PTR, PUINT_PTR)
Definition: ddemisc.c:105
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
LPARAM lParam
Definition: combotst.c:139

Referenced by WDML_ServerConvProc().

◆ WDML_ServerQueueTerminate()

static WDML_XACT* WDML_ServerQueueTerminate ( WDML_CONV pConv,
LPARAM  lParam 
)
static

Definition at line 934 of file ddeserver.c.

935 {
936  WDML_XACT* pXAct;
937 
938  pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_TERMINATE, 0, 0);
939  return pXAct;
940 }
WDML_XACT * WDML_AllocTransaction(WDML_INSTANCE *pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem) DECLSPEC_HIDDEN
Definition: ddemisc.c:1900
#define WM_DDE_TERMINATE
Definition: dde.h:38
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127

Referenced by WDML_ServerConvProc().

◆ WDML_ServerQueueUnadvise()

static WDML_XACT* WDML_ServerQueueUnadvise ( WDML_CONV pConv,
LPARAM  lParam 
)
static

Definition at line 677 of file ddeserver.c.

678 {
679  UINT_PTR uiLo, uiHi;
680  WDML_XACT* pXAct;
681 
682  UnpackDDElParam(WM_DDE_UNADVISE, lParam, &uiLo, &uiHi);
683 
685  uiLo, WDML_MakeHszFromAtom(pConv->instance, uiHi));
686  if (pXAct) pXAct->atom = uiHi;
687  return pXAct;
688 }
#define WM_DDE_UNADVISE
Definition: dde.h:40
WDML_XACT * WDML_AllocTransaction(WDML_INSTANCE *pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem) DECLSPEC_HIDDEN
Definition: ddemisc.c:1900
HSZ WDML_MakeHszFromAtom(const WDML_INSTANCE *pInstance, ATOM atom) DECLSPEC_HIDDEN
Definition: ddemisc.c:342
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
BOOL WINAPI UnpackDDElParam(UINT, LPARAM, PUINT_PTR, PUINT_PTR)
Definition: ddemisc.c:105
struct tagWDML_INSTANCE * instance
Definition: dde_private.h:127
LPARAM lParam
Definition: combotst.c:139

Referenced by WDML_ServerConvProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ddeml  )

Variable Documentation

◆ szServerNameClass

const WCHAR szServerNameClass[] = L"DDEMLMom"
static

Definition at line 30 of file ddeserver.c.

Referenced by DdeNameService().

◆ WDML_szServerConvClassA

const char WDML_szServerConvClassA = "DDEMLAnsiServer"

Definition at line 31 of file ddeserver.c.

Referenced by WDML_ClientProc(), and WDML_CreateServerConv().

◆ WDML_szServerConvClassW

const WCHAR WDML_szServerConvClassW = L"DDEMLUnicodeServer"

Definition at line 32 of file ddeserver.c.

Referenced by WDML_ClientProc(), and WDML_CreateServerConv().