.php lspc.html_a00089.html

Win32k: ddemlwp.c 文件参考
Win32k

/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */

var searchBox = new SearchBox("searchBox", "search",false,'搜索');

/* @license-end */

/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */

$(function() {

initMenu('',true,false,'search.php','搜索');

$(document).ready(function() { init_search(); });

});

/* @license-end */

class="ui-resizable-handle">

/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */

$(document).ready(function(){initNavTree('a00089.html',''); initResizable(); });

/* @license-end */

οnmοuseοver="return searchBox.OnSearchSelectShow()"

οnmοuseοut="return searchBox.OnSearchSelectHide()"

οnkeydοwn="return searchBox.OnSearchSelectKey(event)">

name="MSearchResults" id="MSearchResults">

ddemlwp.c 文件参考
#include "precomp.h"

浏览源代码.

函数

VOID ProcessDDEMLInitiate (PCL_INSTANCE_INFO pcii, HWND hwndClient, GATOM aServer, GATOM aTopic)
 
LRESULT DDEMLMotherWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
LRESULT DDEMLClientWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
LONG DDEMLServerWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
PCONV_INFO ProcessTerminateMsg (PCONV_INFO pcoi, HWND hwndFrom)
 
VOID ProcessAsyncDDEMsg (PCONV_INFO pcoi, UINT msg, HWND hwndFrom, LONG lParam)
 
BOOL CheckForQueuedMessages (PCONV_INFO pcoi)
 
VOID DumpDDEMessage (BOOL fFreeData, UINT msg, LONG lParam)
 
BOOL ProcessSyncDDEMessage (PCONV_INFO pcoi, UINT msg, LONG lParam)
 

函数说明

◆ CheckForQueuedMessages()

BOOL CheckForQueuedMessages (PCONV_INFO pcoi)

在文件 ddemlwp.c662 行定义.

664 {
665  PDDE_MESSAGE_QUEUE pdmq;
666  BOOL fRet = FALSE;
667  PCLIENTINFO pci;
668 
670 
671  if (pcoi-> state & ST_PROCESSING) { // recursion prevention
672  return(FALSE);
673  }
674 
675  UserAssert(pcoi-> cLocks);
676 
677  pci = GetClientInfo();
678 
679  pcoi-> state |= ST_PROCESSING;
680  while (!(pcoi-> state & ST_BLOCKED) &&
681  pcoi-> dmqOut != NULL &&
682  !pci-> cInDDEMLCallback) {
683  pci-> CI_flags |= CI_PROCESSING_QUEUE;
684  if ( ProcessSyncDDEMessage(pcoi, pcoi-> dmqOut-> msg, pcoi-> dmqOut-> lParam)) {
685  fRet = TRUE;
686  pdmq = pcoi-> dmqOut;
687  pcoi-> dmqOut = pcoi-> dmqOut-> next;
688  if (pcoi-> dmqOut == NULL) {
689  pcoi-> dmqIn = NULL;
690  }
691  DDEMLFree(pdmq);
692  }
693  pci-> CI_flags &= ~CI_PROCESSING_QUEUE;
694  }
695  pcoi-> state &= ~ST_PROCESSING;
696  return(fRet);
697 }

引用了 CheckDDECritIn, _CLIENTINFO::CI_flags, _CLIENTINFO::cInDDEMLCallback, tagCONV_INFO::cLocks, DDEMLFree, tagCONV_INFO::dmqIn, tagCONV_INFO::dmqOut, tagDDE_MESSAGE_QUEUE::lParam, tagDDE_MESSAGE_QUEUE::msg, tagDDE_MESSAGE_QUEUE::next, ProcessSyncDDEMessage(), tagCONV_INFO::state , 以及 UserAssert.

被这些函数引用 DdeEnableCallback(), ProcessAsyncDDEMsg() , 以及 SetEnableState().

◆ DDEMLClientWndProc()

LRESULT DDEMLClientWndProc (HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam 
)

在文件 ddemlwp.c376 行定义.

381 {
382  PCL_CONV_INFO pci, pciNew;
383  LONG lState;
384  LONG lRet = 0;
385  PWND pwnd;
386  PCLS pcls;
387 
388  EnterDDECrit;
389 
390  pci = ( PCL_CONV_INFO)GetWindowLong(hwnd, GWL_PCI);
391  UserAssert(pci == NULL || pci-> ci. hwndConv == hwnd);
392 
393  switch (message) {
394  case WM_DDE_ACK:
395  lState = GetWindowLong(hwnd, GWL_CONVSTATE);
396  if (lState != CLST_CONNECTED) {
397 
398  // Initiation mode
399 
400  pciNew = ( PCL_CONV_INFO) DDEMLAlloc( sizeof( CL_CONV_INFO));
401  if (pciNew == NULL ||
402  (pci != NULL && lState == CLST_SINGLE_INITIALIZING)) {
403  PostMessage((HWND)wParam, WM_DDE_TERMINATE, ( DWORD)hwnd, 0);
404  goto Exit;
405  }
406 
407  // PCL_CONV_INFO initialization
408 
409  pciNew-> ci. pcii = ValidateInstance((HANDLE)GetWindowLong(hwnd, GWL_CHINST));
410 
411  if (pciNew-> ci. pcii == NULL) {
412  DDEMLFree(pciNew);
413  goto Exit;
414  }
415 
416  pciNew-> ci. next = ( PCONV_INFO)pci; // pci may be NULL
417  //
418  // Seting GWL_PCI gives feedback to ConnectConv() which issued
419  // the WM_DDE_INITIATE message.
420  //
421  SetWindowLong(hwnd, GWL_PCI, (LONG)pciNew);
422  // pciNew->hUser = 0; // Zero init.
423 
424  // BUG: If this fails we can have some nasty problems
425  pciNew-> ci. hConv = (HCONV) CreateHandle(( DWORD)pciNew,
427 
428  pciNew-> ci. laService = GlobalToLocalAtom(LOWORD(lParam)); // pci copy
429  GlobalDeleteAtom(LOWORD(lParam));
430  pciNew-> ci. laTopic = GlobalToLocalAtom(HIWORD(lParam)); // pci copy
431  GlobalDeleteAtom(HIWORD(lParam));
432  pciNew-> ci. hwndPartner = (HWND)wParam;
433  pciNew-> ci. hwndConv = hwnd;
434  pciNew-> ci. state = (WORD)(ST_CONNECTED | ST_CLIENT |
435  pciNew-> ci. pcii-> ConvStartupState);
436  SetCommonStateFlags(hwnd, (HWND)wParam, &pciNew-> ci. state);
437 
438  pwnd = ValidateHwnd((HWND)wParam);
439 
440  if (pwnd == NULL) goto Exit;
441  pcls = ( PCLS)REBASEALWAYS(pwnd, pcls);
442 
443  if (!TestWF(pwnd, WFANSIPROC)) {
444  if (pcls-> atomClassName == gpsi-> atomSysClass[ICLS_DDEMLSERVERW]) {
445  pciNew-> ci. state |= ST_ISLOCAL;
446  }
447  } else {
448  if (pcls-> atomClassName == gpsi-> atomSysClass[ICLS_DDEMLSERVERA]) {
449  pciNew-> ci. state |= ST_ISLOCAL;
450  }
451  }
452 
453  // pciNew->ci.laServiceRequested = 0; // Set by InitiateEnumerationProc()
454  // pciNew->ci.pxiIn = 0;
455  // pciNew->ci.pxiOut = 0;
456  // pciNew->ci.dmqIn = 0;
457  // pciNew->ci.dmqOut = 0;
458  // pciNew->ci.aLinks = NULL;
459  // pciNew->ci.cLinks = 0;
460  // pciNew->ci.cLocks = 0;
461  goto Exit;
462  }
463  // fall through to handle posted messages here.
464 
465  case WM_DDE_DATA:
466  ProcessAsyncDDEMsg(( PCONV_INFO)pci, message, (HWND)wParam, lParam);
467  goto Exit;
468 
469  case WM_DDE_TERMINATE:
470  case WM_DESTROY:
471  ProcessTerminateMsg(( PCONV_INFO)pci, (HWND)wParam);
472  break;
473  }
474 
475  lRet = DefWindowProc(hwnd, message, wParam, lParam);
476 
477 Exit:
478  LeaveDDECrit;
479  return (lRet);
480 }

引用了 tagCLS::atomClassName, tagSERVERINFO::atomSysClass, tagCL_CONV_INFO::ci, CreateHandle(), DDEMLAlloc, DDEMLFree, DWORD, EnterDDECrit, GlobalToLocalAtom(), gpsi, HTYPE_CLIENT_CONVERSATION, tagCONV_INFO::hwndConv, InstFromHandle, LeaveDDECrit, tagCONV_INFO::next, tagCONV_INFO::pcii, PostMessage(), ProcessAsyncDDEMsg(), ProcessTerminateMsg(), SetCommonStateFlags(), UserAssert, ValidateHwnd , 以及 ValidateInstance().

被这些函数引用 RW_RegisterDDEMLClient().

◆ DDEMLMotherWndProc()

LRESULT DDEMLMotherWndProc (HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam 
)

在文件 ddemlwp.c25 行定义.

30 {
31  switch (message) {
32  case UM_REGISTER:
33  case UM_UNREGISTER:
34  return( ProcessRegistrationMessage(hwnd, message, wParam, lParam));
35 
36  case WM_DDE_INITIATE:
37  ProcessDDEMLInitiate(( PCL_INSTANCE_INFO)GetWindowLong(hwnd, GWL_PCI),
38  (HWND)wParam, (ATOM)LOWORD(lParam), (ATOM)HIWORD(lParam));
39  return(0);
40 
41  }
42  return(DefWindowProc(hwnd, message, wParam, lParam));
43 }

引用了 ProcessDDEMLInitiate() , 以及 ProcessRegistrationMessage().

被这些函数引用 RW_RegisterDDEMLMother().

◆ DDEMLServerWndProc()

LONG DDEMLServerWndProc (HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam 
)

在文件 ddemlwp.c494 行定义.

499 {
500  PSVR_CONV_INFO psi;
501  LONG lRet = 0;
502 
503  EnterDDECrit;
504 
505  psi = ( PSVR_CONV_INFO)GetWindowLong(hwnd, GWL_PSI);
506  UserAssert(psi == NULL || psi-> ci. hwndConv == hwnd);
507 
508  switch (message) {
509  case WM_DDE_REQUEST:
510  case WM_DDE_POKE:
511  case WM_DDE_ADVISE:
512  case WM_DDE_EXECUTE:
513  case WM_DDE_ACK:
514  case WM_DDE_UNADVISE:
515  ProcessAsyncDDEMsg(( PCONV_INFO)psi, message, (HWND)wParam, lParam);
516  goto Exit;
517 
518  case WM_DDE_TERMINATE:
519  case WM_DESTROY:
520  ProcessTerminateMsg(( PCONV_INFO)psi, (HWND)wParam);
521  break;
522  }
523  lRet = DefWindowProc(hwnd, message, wParam, lParam);
524 Exit:
525  LeaveDDECrit;
526  return (lRet);
527 }

引用了 tagSVR_CONV_INFO::ci, EnterDDECrit, tagCONV_INFO::hwndConv, LeaveDDECrit, ProcessAsyncDDEMsg(), ProcessTerminateMsg() , 以及 UserAssert.

被这些函数引用 RW_RegisterDDEMLServer().

◆ DumpDDEMessage()

VOID DumpDDEMessage (BOOL fFreeData,
UINT msg,
LONG lParam 
)

在文件 ddemlwp.c712 行定义.

716 {
717  UINT uiLo, uiHi;
718 
719  UserAssert(FALSE); // if we get here there could be a serious problem.
720 
721  switch (msg) {
722  case WM_DDE_ACK:
723  case WM_DDE_DATA:
724  case WM_DDE_POKE:
725  case WM_DDE_ADVISE:
726  UnpackDDElParam(msg, lParam, &uiLo, &uiHi);
727  switch (msg) {
728  case WM_DDE_DATA:
729  case WM_DDE_POKE:
730  if (uiLo) {
731  if (fFreeData) {
732  FreeDDEData((HANDLE)uiLo, FALSE, TRUE);
733  }
734  GlobalDeleteAtom((ATOM)uiHi);
735  }
736  break;
737 
738  case WM_DDE_ADVISE:
739  if (uiLo) {
740  if (fFreeData) {
741  FreeDDEData((HANDLE)uiLo, FALSE, TRUE);
742  }
743  GlobalDeleteAtom((ATOM)uiHi);
744  }
745  break;
746 
747  case WM_DDE_ACK:
748  // could be EXEC Ack - cant know what to do exactly.
749  break;
750  }
751  FreeDDElParam(msg, lParam);
752  break;
753 
754  case WM_DDE_EXECUTE:
755  if (fFreeData) {
756  WOWGLOBALFREE((HANDLE)lParam);
757  }
758  break;
759 
760  case WM_DDE_REQUEST:
761  case WM_DDE_UNADVISE:
762  GlobalDeleteAtom((ATOM)HIWORD(lParam));
763  break;
764  }
765 }

引用了 FreeDDEData(), FreeDDElParam(), UINT(), UnpackDDElParam() , 以及 UserAssert.

被这些函数引用 FreeConversationResources(), ProcessAsyncDDEMsg(), ProcessSyncDDEMessage(), SpontaneousClientMessage() , 以及 SpontaneousServerMessage().

◆ ProcessAsyncDDEMsg()

VOID ProcessAsyncDDEMsg (PCONV_INFO pcoi,
UINT msg,
HWND hwndFrom,
LONG lParam 
)

在文件 ddemlwp.c570 行定义.

575 {
576  PDDE_MESSAGE_QUEUE pdmq;
577  #ifdef DEBUG
578  HWND hwndT = pcoi-> hwndConv;
579  #endif // DEBUG
580 
581  while (pcoi != NULL && pcoi-> hwndPartner != hwndFrom) {
582  pcoi = pcoi-> next;
583  }
584  if (pcoi == NULL) {
586  "Bogus DDE message %x received from %x by %x. Dumping.",
587  msg, hwndFrom, hwndT);
588  DumpDDEMessage(FALSE, msg, lParam);
589  return ;
590  }
591  if (pcoi-> state & ST_CONNECTED) {
592 
593  if (pcoi-> dmqOut == NULL &&
594  !(pcoi-> state & ST_BLOCKED)
595  // && !PctiCurrent()->cInDDEMLCallback
596  ) {
597 
598  if ( ProcessSyncDDEMessage(pcoi, msg, lParam)) {
599  return; // not blocked, ok to return.
600  }
601  }
602 
603  // enter into queue
604 
605  pdmq = DDEMLAlloc( sizeof( DDE_MESSAGE_QUEUE));
606  if (pdmq == NULL) {
607 
608  // insufficient memory - we can't process this msg - we MUST
609  // terminate.
610 
611  if (pcoi-> state & ST_CONNECTED) {
612  PostMessage(pcoi-> hwndPartner, WM_DDE_TERMINATE,
613  ( DWORD)pcoi-> hwndConv, 0);
614  pcoi-> state &= ~ST_CONNECTED;
615  }
616  DumpDDEMessage(!(pcoi-> state & ST_INTRA_PROCESS), msg, lParam);
617  return ;
618  }
619  pdmq-> pcoi = pcoi;
620  pdmq-> msg = msg;
621  pdmq-> lParam = lParam;
622  pdmq-> next = NULL;
623 
624  // dmqOut->next->next->next->dmqIn->NULL
625 
626  if (pcoi-> dmqIn != NULL) {
627  pcoi-> dmqIn-> next = pdmq;
628  }
629  pcoi-> dmqIn = pdmq;
630  if (pcoi-> dmqOut == NULL) {
631  pcoi-> dmqOut = pcoi-> dmqIn;
632  }
633  pcoi-> cLocks++;
634  CheckForQueuedMessages(pcoi);
635  pcoi-> cLocks--;
636  if (pcoi-> cLocks == 0 && pcoi-> state & ST_FREE_CONV_RES_NOW) {
638  }
639  } else {
640  DumpDDEMessage(!(pcoi-> state & ST_INTRA_PROCESS), msg, lParam);
641  }
642 }

引用了 CheckForQueuedMessages(), tagCONV_INFO::cLocks, DDEMLAlloc, tagCONV_INFO::dmqIn, tagCONV_INFO::dmqOut, DumpDDEMessage(), DWORD, FreeConversationResources(), tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, tagDDE_MESSAGE_QUEUE::lParam, tagDDE_MESSAGE_QUEUE::msg, tagDDE_MESSAGE_QUEUE::next, tagCONV_INFO::next, tagDDE_MESSAGE_QUEUE::pcoi, PostMessage(), ProcessSyncDDEMessage(), RIP_WARNING, RIPMSG3 , 以及 tagCONV_INFO::state.

被这些函数引用 DDEMLClientWndProc() , 以及 DDEMLServerWndProc().

◆ ProcessDDEMLInitiate()

VOID ProcessDDEMLInitiate (PCL_INSTANCE_INFO pcii,
HWND hwndClient,
GATOM aServer,
GATOM aTopic 
)

在文件 ddemlwp.c57 行定义.

62 {
63  CONVCONTEXT cc = {
64  sizeof(CONVCONTEXT),
65  0,
66  0,
67  CP_WINANSI,
68  0L,
69  0L,
70  {
71  sizeof(SECURITY_QUALITY_OF_SERVICE),
72  SecurityImpersonation,
73  SECURITY_STATIC_TRACKING,
74  TRUE
75  }
76  };
77  BOOL flags = ST_INLIST;
78  BOOL fWild;
79  HDDEDATA hData;
80  HWND hwndServer;
81  PSERVER_LOOKUP psl;
82  PHSZPAIR php;
83  HSZPAIR hp[2];
84  LATOM laService, laFree1 = 0;
85  LATOM laTopic, laFree2 = 0;
86  PSVR_CONV_INFO psi;
87  LATOM *plaNameService;
88  PWND pwndClient;
89  PCLS pcls;
90 
91  if (pcii == NULL) {
92  return; // we aren't done being initiated yet.
93  }
94 
95  EnterDDECrit;
96 
97  if (pcii-> afCmd & CBF_FAIL_CONNECTIONS || ! IsWindow(hwndClient)) {
98  goto Exit;
99  }
100 
101  pwndClient = ValidateHwnd(hwndClient);
102  if (pwndClient == NULL) goto Exit;
103 
104  pcls = ( PCLS)REBASEALWAYS(pwndClient, pcls);
105  if (!TestWF(pwndClient, WFANSIPROC)) {
106  if (pcls-> atomClassName == gpsi-> atomSysClass[ICLS_DDEMLCLIENTW]) {
107  flags |= ST_ISLOCAL;
108  }
109  } else {
110  if (pcls-> atomClassName == gpsi-> atomSysClass[ICLS_DDEMLCLIENTA]) {
111  flags |= ST_ISLOCAL;
112  }
113  }
114 
115  if (flags & ST_ISLOCAL) {
116  /*
117  * Make sure other guy allows self-connections if that's what this is.
118  */
119  if (pcii-> hInstServer == (HANDLE)GetWindowLong(hwndClient, GWL_SHINST)) {
120  if (pcii-> afCmd & CBF_FAIL_SELFCONNECTIONS) {
121  goto Exit;
122  }
123  flags |= ST_ISSELF;
124  }
125 
126  GetConvContext(hwndClient, (LONG *)&cc);
127  if (GetWindowLong(hwndClient, GWL_CONVSTATE) & CLST_SINGLE_INITIALIZING) {
128  flags &= ~ST_INLIST;
129  }
130  } else {
131  NtUserDdeGetQualityOfService(hwndClient, NULL, &cc.qos);
132  }
133 
134 
153  laFree1 = laService = GlobalToLocalAtom(aServer);
154  laFree2 = laTopic = GlobalToLocalAtom(aTopic);
155 
156  plaNameService = pcii-> plaNameService;
157  if (!laService && pcii-> afCmd & APPCMD_FILTERINITS && *plaNameService == 0) {
158  /*
159  * no WILDCONNECTS to servers with no registered names while filtering.
160  */
161  goto Exit;
162  }
163  if ((pcii-> afCmd & APPCMD_FILTERINITS) && laService) {
164  /*
165  * if we can't find the aServer in this instance's service name
166  * list, don't bother the server.
167  */
168  while (*plaNameService != 0 && *plaNameService != laService) {
169  plaNameService++;
170  }
171  if (*plaNameService == 0) {
172  goto Exit;
173  }
174  }
175  hp[0].hszSvc = NORMAL_HSZ_FROM_LATOM(laService);
176  hp[0].hszTopic = NORMAL_HSZ_FROM_LATOM(laTopic);
177  hp[1].hszSvc = 0;
178  hp[1].hszTopic = 0;
179  fWild = !laService || !laTopic;
180 
181  hData = DoCallback(pcii,
182  (WORD)(fWild ? XTYP_WILDCONNECT : XTYP_CONNECT),
183  0,
184  (HCONV)0,
185  hp[0].hszTopic,
186  hp[0].hszSvc,
187  (HDDEDATA)0,
188  flags & ST_ISLOCAL ? ( DWORD)&cc : 0,
189  ( DWORD)(flags & ST_ISSELF) ? 1 : 0);
190 
191  if (!hData) {
192  goto Exit;
193  }
194 
195  if (fWild) {
196  php = (PHSZPAIR) DdeAccessData(hData, NULL);
197  if (php == NULL) {
198  goto Exit;
199  }
200  } else {
201  php = hp;
202  }
203 
204  while (php->hszSvc && php->hszTopic) {
205 
206  psi = ( PSVR_CONV_INFO) DDEMLAlloc( sizeof( SVR_CONV_INFO));
207  if (psi == NULL) {
208  break;
209  }
210 
211  laService = LATOM_FROM_HSZ(php->hszSvc);
212  laTopic = LATOM_FROM_HSZ(php->hszTopic);
213 
214  hwndServer = 0;
215  if (pcii-> cServerLookupAlloc) {
216  int i;
217  /*
218  * See if there already exists a server window for this
219  * aServer/aTopic pair
220  */
221  for (i = pcii-> cServerLookupAlloc; i; i--) {
222  if (pcii-> aServerLookup[i - 1]. laService == laService &&
223  pcii-> aServerLookup[i - 1]. laTopic == laTopic) {
224  PSVR_CONV_INFO psiT;
225  PCONV_INFO pcoi;
226 
227  hwndServer = pcii-> aServerLookup[i - 1]. hwndServer;
228  /*
229  * Now make sure this window isn't some bogus idiot
230  * trying to create a second conversation from the
231  * same client window that is already talking to
232  * our existing server window.
233  */
234  psiT = ( PSVR_CONV_INFO)GetWindowLong(hwndServer, GWL_PSI);
235  for (pcoi = &psiT-> ci; pcoi != NULL; pcoi = pcoi-> next) {
236  if (pcoi-> hwndPartner == hwndClient) {
237  hwndServer = NULL;
238  break;
239  }
240  }
241  break;
242  }
243  }
244  }
245 
246  if (hwndServer == 0) {
247 
248  // no server window exists - make one.
249 
250  LeaveDDECrit;
251  if (pcii-> flags & IIF_UNICODE) {
252  hwndServer = CreateWindowW((LPWSTR)( gpsi-> atomSysClass[ICLS_DDEMLSERVERW]),
253  L "",
254  WS_CHILD,
255  0, 0, 0, 0,
256  pcii-> hwndMother,
257  (HMENU)0,
258  0,
259  (LPVOID)NULL);
260  } else {
261  hwndServer = CreateWindowA((LPSTR)( gpsi-> atomSysClass[ICLS_DDEMLSERVERA]),
262  "",
263  WS_CHILD,
264  0, 0, 0, 0,
265  pcii-> hwndMother,
266  (HMENU)0,
267  0,
268  (LPVOID)NULL);
269  }
270  EnterDDECrit;
271 
272  if (hwndServer == 0) {
273  DDEMLFree(psi);
274  break;
275  }
276  // SetWindowLong(hwndServer, GWL_PSI, (LONG)NULL); // Zero init.
277 
278  // put the window into the lookup list
279 
280  if (pcii-> aServerLookup == NULL) {
281  psl = ( PSERVER_LOOKUP) DDEMLAlloc( sizeof( SERVER_LOOKUP));
282  } else {
283  psl = ( PSERVER_LOOKUP) DDEMLReAlloc(pcii-> aServerLookup,
284  sizeof( SERVER_LOOKUP) * (pcii-> cServerLookupAlloc + 1));
285  }
286  if (psl == NULL) {
287  RIPMSG1( RIP_WARNING, "ProcessDDEMLInitiate:hwndServer (%x) destroyed due to low memory.", hwndServer);
288  NtUserDestroyWindow(hwndServer);
289  DDEMLFree(psi);
290  break;
291  }
292 
293  IncLocalAtomCount(laService); // for SERVER_LOOKUP
294  psl[pcii-> cServerLookupAlloc]. laService = laService;
295  IncLocalAtomCount(laTopic); // for SERVER_LOOKUP
296  psl[pcii-> cServerLookupAlloc]. laTopic = laTopic;
297  psl[pcii-> cServerLookupAlloc]. hwndServer = hwndServer;
298  pcii-> aServerLookup = psl;
299  pcii-> cServerLookupAlloc++;
300  // DumpServerLookupTable("After addition:", hwndServer, psl, pcii->cServerLookupAlloc);
301  }
302 
303  psi-> ci. next = ( PCONV_INFO)GetWindowLong(hwndServer, GWL_PSI);
304  SetWindowLong(hwndServer, GWL_PSI, (LONG)psi);
305  psi-> ci. pcii = pcii;
306  // psi->ci.hUser = 0;
307  psi-> ci. hConv = (HCONV) CreateHandle(( DWORD)psi,
309  psi-> ci. laService = laService;
310  IncLocalAtomCount(laService); // for server window
311  psi-> ci. laTopic = laTopic;
312  IncLocalAtomCount(laTopic); // for server window
313  psi-> ci. hwndPartner = hwndClient;
314  psi-> ci. hwndConv = hwndServer;
315  psi-> ci. state = (WORD)(flags | ST_CONNECTED | pcii-> ConvStartupState);
316  SetCommonStateFlags(hwndClient, hwndServer, &psi-> ci. state);
317  psi-> ci. laServiceRequested = laFree1;
318  IncLocalAtomCount(psi-> ci. laServiceRequested); // for server window
319  // psi->ci.pxiIn = NULL;
320  // psi->ci.pxiOut = NULL;
321  // psi->ci.dmqIn = NULL;
322  // psi->ci.dmqOut = NULL;
323  // psi->ci.aLinks = NULL;
324  // psi->ci.cLinks = 0;
325  // psi->ci.cLocks = 0;
326 
327  LeaveDDECrit;
329  SendMessage(hwndClient, WM_DDE_ACK, ( DWORD)hwndServer,
330  MAKELONG( LocalToGlobalAtom(laService), LocalToGlobalAtom(laTopic)));
331  EnterDDECrit;
332 
333  if (!(pcii-> afCmd & CBF_SKIP_CONNECT_CONFIRMS)) {
334  DoCallback(pcii,
335  (WORD)XTYP_CONNECT_CONFIRM,
336  0,
337  psi-> ci. hConv,
338  (HSZ)laTopic,
339  (HSZ)laService,
340  (HDDEDATA)0,
341  0,
342  (flags & ST_ISSELF) ? 1L : 0L);
343  }
344 
345  MONCONV(( PCONV_INFO)psi, TRUE);
346 
347  if (!(flags & ST_INLIST)) {
348  break; // our partner's only gonna take the first one anyway.
349  }
350  php++;
351  }
352 
353  if (fWild) {
354  DdeUnaccessData(hData);
355  InternalFreeDataHandle(hData, FALSE);
356  }
357 
358 Exit:
359  DeleteAtom(laFree1);
360  DeleteAtom(laFree2);
361  LeaveDDECrit;
362  return;
363 }

引用了 tagCL_INSTANCE_INFO::afCmd, tagCL_INSTANCE_INFO::aServerLookup, tagCLS::atomClassName, tagSERVERINFO::atomSysClass, CheckDDECritOut, tagSVR_CONV_INFO::ci, tagCL_INSTANCE_INFO::ConvStartupState, CreateHandle(), tagCL_INSTANCE_INFO::cServerLookupAlloc, DdeAccessData(), DDEMLAlloc, DDEMLFree, DDEMLReAlloc, DdeUnaccessData(), DoCallback(), DWORD, EnterDDECrit, tagCL_INSTANCE_INFO::flags, GetConvContext(), GlobalToLocalAtom(), gpsi, tagCL_INSTANCE_INFO::hInstClient, tagCL_INSTANCE_INFO::hInstServer, HTYPE_SERVER_CONVERSATION, tagCL_INSTANCE_INFO::hwndMother, tagCONV_INFO::hwndPartner, tagSERVER_LOOKUP::hwndServer, IIF_UNICODE, IncLocalAtomCount(), InstFromHandle, InternalFreeDataHandle(), IsWindow(), tagSERVER_LOOKUP::laService, LATOM_FROM_HSZ, tagSERVER_LOOKUP::laTopic, LeaveDDECrit, LocalToGlobalAtom(), MONCONV, tagCONV_INFO::next, NORMAL_HSZ_FROM_LATOM, NtUserDdeGetQualityOfService(), NtUserDestroyWindow(), tagCL_INSTANCE_INFO::plaNameService, RIP_WARNING, RIPMSG1, SetCommonStateFlags() , 以及 ValidateHwnd.

被这些函数引用 DDEMLMotherWndProc().

◆ ProcessSyncDDEMessage()

BOOL ProcessSyncDDEMessage (PCONV_INFO pcoi,
UINT msg,
LONG lParam 
)

在文件 ddemlwp.c780 行定义.

784 {
785  BOOL fNotBlocked = TRUE;
786  PCL_INSTANCE_INFO pcii;
787  ENABLE_ENUM_STRUCT ees;
788  BOOL fRet;
789 
791 
792  /*
793  * lock the conversation so its resources don't go away till we are
794  * done with them. This function could generate a callback which could
795  * disconnect the conversation.
796  */
797  pcoi-> cLocks++;
798 
799  if (pcoi-> state & ST_BLOCKNEXT) {
800  pcoi-> state ^= ST_BLOCKNEXT | ST_BLOCKED;
801  }
802  if (pcoi-> state & ST_BLOCKALLNEXT) {
803  ees. pfRet = &fRet;
804  ees. wCmd = EC_DISABLE;
805  ees. wCmd2 = 0;
806  EnumChildWindows(pcoi-> pcii-> hwndMother, (WNDENUMPROC) EnableEnumProc,
807  (LONG)&ees);
808  }
809 
810  if (pcoi-> state & ST_CONNECTED) {
811  if (pcoi-> pxiOut == NULL) {
812  if (pcoi-> state & ST_CLIENT) {
813  fNotBlocked = SpontaneousClientMessage(( PCL_CONV_INFO)pcoi, msg, lParam);
814  } else {
815  fNotBlocked = SpontaneousServerMessage(( PSVR_CONV_INFO)pcoi, msg, lParam);
816  }
817  } else {
818  UserAssert(pcoi-> pxiOut-> hXact == (HANDLE)0 ||
820  HINST_ANY)
821  == ( DWORD)pcoi-> pxiOut);
822  fNotBlocked = (pcoi-> pxiOut-> pfnResponse)(pcoi-> pxiOut, msg, lParam);
823  }
824  } else {
825  DumpDDEMessage(!(pcoi-> state & ST_INTRA_PROCESS), msg, lParam);
826  }
827  if (!fNotBlocked) {
828  pcoi-> state |= ST_BLOCKED;
829  pcoi-> state &= ~ST_BLOCKNEXT;
830  }
831 
832  pcii = pcoi-> pcii; // save this incase unlocking makes pcoi go away.
833 
834  pcoi-> cLocks--;
835  if (pcoi-> cLocks == 0 && pcoi-> state & ST_FREE_CONV_RES_NOW) {
837  }
838 
839  /*
840  * Because callbacks are capable of blocking DdeUninitialize(), we check
841  * before exit to see if it needs to be called.
842  */
843  if (pcii-> afCmd & APPCMD_UNINIT_ASAP &&
844  !(pcii-> flags & IIF_IN_SYNC_XACT) &&
845  !pcii-> cInDDEMLCallback) {
846  DdeUninitialize(( DWORD)pcii-> hInstClient);
847  return(FALSE);
848  }
849  return (fNotBlocked);
850 }

引用了 tagCL_INSTANCE_INFO::afCmd, CheckDDECritIn, tagCL_INSTANCE_INFO::cInDDEMLCallback, tagCONV_INFO::cLocks, DdeUninitialize(), DumpDDEMessage(), DWORD, EnableEnumProc(), EnumChildWindows(), tagCL_INSTANCE_INFO::flags, FreeConversationResources(), HINST_ANY, tagCL_INSTANCE_INFO::hInstClient, HTYPE_TRANSACTION, tagCL_INSTANCE_INFO::hwndMother, tagXACT_INFO::hXact, IIF_IN_SYNC_XACT, tagCONV_INFO::pcii, tagXACT_INFO::pfnResponse, tagENABLE_ENUM_STRUCT::pfRet, tagCONV_INFO::pxiOut, SpontaneousClientMessage(), SpontaneousServerMessage(), tagCONV_INFO::state, UserAssert, ValidateCHandle(), tagENABLE_ENUM_STRUCT::wCmd , 以及 tagENABLE_ENUM_STRUCT::wCmd2.

被这些函数引用 CheckForQueuedMessages() , 以及 ProcessAsyncDDEMsg().

◆ ProcessTerminateMsg()

PCONV_INFO ProcessTerminateMsg (PCONV_INFO pcoi,
HWND hwndFrom 
)

在文件 ddemlwp.c541 行定义.

544 {
545  while (pcoi != NULL && pcoi-> hwndPartner != hwndFrom) {
546  pcoi = pcoi-> next;
547  }
548  if (pcoi != NULL) {
549  pcoi-> state |= ST_TERMINATE_RECEIVED;
550  ShutdownConversation(pcoi, TRUE);
551  }
552  return (pcoi);
553 }

引用了 tagCONV_INFO::hwndPartner, tagCONV_INFO::next, ShutdownConversation() , 以及 tagCONV_INFO::state.

被这些函数引用 DDEMLClientWndProc(), DDEMLServerWndProc() , 以及 WaitForZombieTerminate().

VOID ShutdownConversation(PCONV_INFO pcoi, BOOL fMakeCallback)
Definition: connect.c:1107
struct tagCLS * PCLS
WORD ConvStartupState
Definition: ddemlcli.h:191
VOID DumpDDEMessage(BOOL fFreeData, UINT msg, LONG lParam)
Definition: ddemlwp.c:712
LRESULT ProcessRegistrationMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: register.c:88
FNRESPONSE pfnResponse
Definition: ddemlcli.h:117
DWORD afCmd
Definition: ddemlcli.h:183
#define HTYPE_TRANSACTION
Definition: ddemlcli.h:99
BOOL * pfRet
Definition: ddemlcli.h:240
VOID FreeConversationResources(PCONV_INFO pcoi)
Definition: connect.c:1343
BOOL NtUserDestroyWindow(IN HWND hwnd)
Definition: kernel/ntstubs.c:2870
PCL_INSTANCE_INFO pcii
Definition: ddemlcli.h:204
struct tagCONV_INFO * next
Definition: ddemlcli.h:203
HANDLE hInstClient
Definition: ddemlcli.h:178
HDDEDATA DoCallback(PCL_INSTANCE_INFO pcii, WORD wType, WORD wFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dw1, DWORD dw2)
Definition: callback.c:22
int cInDDEMLCallback
Definition: user.h:385
VOID ProcessAsyncDDEMsg(PCONV_INFO pcoi, UINT msg, HWND hwndFrom, LONG lParam)
Definition: ddemlwp.c:570
BOOL CheckForQueuedMessages(PCONV_INFO pcoi)
Definition: ddemlwp.c:662
VOID GetConvContext(HWND hwnd, LONG *pl)
Definition: xact.c:366
BOOL SpontaneousClientMessage(PCL_CONV_INFO pci, UINT msg, LONG lParam)
Definition: stdptcl.c:1371
short cServerLookupAlloc
Definition: ddemlcli.h:190
#define InstFromHandle(h)
Definition: ddemlcli.h:87
VOID SetCommonStateFlags(HWND hwndUs, HWND hwndThem, PWORD pwFlags)
Definition: connect.c:874
HWND hwndServer
Definition: ddemlcli.h:162
BOOL ProcessSyncDDEMessage(PCONV_INFO pcoi, UINT msg, LONG lParam)
Definition: ddemlwp.c:780
#define HTYPE_SERVER_CONVERSATION
Definition: ddemlcli.h:96
#define CheckDDECritIn
Definition: ddemlcli.h:50
LATOM GlobalToLocalAtom(GATOM ga)
Definition: hsz.c:464
#define DDEMLAlloc(cb)
Definition: ddemlcli.h:12
CONV_INFO ci
Definition: ddemlcli.h:229
#define RIPMSG3(flags, szFmt, p1, p2, p3)
Definition: winerrp.h:134
LATOM laTopic
Definition: ddemlcli.h:161
BOOL IsWindow(HWND hwnd)
Definition: client/wow.c:421
#define UserAssert(exp)
Definition: usersrv.h:117
PXACT_INFO pxiOut
Definition: ddemlcli.h:214
PDDE_MESSAGE_QUEUE dmqIn
Definition: ddemlcli.h:215
BOOL NtUserDdeGetQualityOfService(IN HWND hwndClient, IN HWND hwndServer, IN PSECURITY_QUALITY_OF_SERVICE pqos)
Definition: kernel/ntstubs.c:3131
#define RIPMSG1(flags, szFmt, p1)
Definition: winerrp.h:132
PCL_INSTANCE_INFO ValidateInstance(HANDLE hInst)
Definition: instance.c:111
BOOL APIENTRY PostMessage(HWND hwnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: ntcftxt.h:471
#define IIF_UNICODE
Definition: ddemlcli.h:198
BOOL APIENTRY FreeDDElParam(UINT msg, LONG lParam)
Definition: client/ddetrack.c:622
#define DDEMLFree(p)
Definition: ddemlcli.h:14
DWORD CI_flags
Definition: user.h:373
#define IIF_IN_SYNC_XACT
Definition: ddemlcli.h:197
LATOM * plaNameService
Definition: ddemlcli.h:187
PSERVER_LOOKUP aServerLookup
Definition: ddemlcli.h:189
struct tagSERVER_LOOKUP * PSERVER_LOOKUP
HWND hwndMother
Definition: ddemlcli.h:180
VOID FreeDDEData(HANDLE hDDE, BOOL fIgnorefRelease, BOOL fFreeTruelyGlobalObjects)
Definition: hdata.c:481
struct tagSVR_CONV_INFO * PSVR_CONV_INFO
HWND hwndConv
Definition: ddemlcli.h:210
CONV_INFO ci
Definition: ddemlcli.h:223
#define NORMAL_HSZ_FROM_LATOM(a)
Definition: ddemlcli.h:62
ATOM LATOM
Definition: ddemlcli.h:18
ddeml v[i< inst >][t< type >][hObj|pObj] Dump DDEML state information ddeml lists all ddeml instances for this process n ddeml t< type > lists all ddeml objects of the given type n n assumes link is first DWORD
Definition: exts.h:175
HANDLE hInstServer
Definition: ddemlcli.h:177
BOOL WINAPI EnumChildWindows(HWND hwnd, WNDENUMPROC lpfn, LONG lParam)
Definition: clenum.c:52
PDDE_MESSAGE_QUEUE dmqOut
Definition: ddemlcli.h:216
LPBYTE DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize)
Definition: hdata.c:294
WORD state
Definition: ddemlcli.h:211
#define LATOM_FROM_HSZ(hsz)
Definition: ddemlcli.h:61
BOOL DdeUnaccessData(HDDEDATA hData)
Definition: hdata.c:335
#define HINST_ANY
Definition: ddemlcli.h:104
VOID ProcessDDEMLInitiate(PCL_INSTANCE_INFO pcii, HWND hwndClient, GATOM aServer, GATOM aTopic)
Definition: ddemlwp.c:57
ATOM atomSysClass[ICLS_MAX]
Definition: user.h:998
Definition: user.h:1388
ATOM atomClassName
Definition: user.h:1326
#define RIP_WARNING
Definition: winerrp.h:29
BOOL APIENTRY UnpackDDElParam(UINT msg, LONG lParam, PUINT puiLo, PUINT puiHi)
Definition: client/ddetrack.c:575
LATOM laService
Definition: ddemlcli.h:160
BOOL InternalFreeDataHandle(HDDEDATA hData, BOOL fIgnorefRelease)
Definition: hdata.c:406
HANDLE hXact
Definition: ddemlcli.h:116
#define LeaveDDECrit
Definition: ddemlcli.h:41
#define HTYPE_CLIENT_CONVERSATION
Definition: ddemlcli.h:97
struct tagCL_CONV_INFO * PCL_CONV_INFO
LATOM laServiceRequested
Definition: ddemlcli.h:212
DWORD ValidateCHandle(HANDLE h, DWORD ExpectedType, DWORD ExpectedInstance)
Definition: handles.c:204
#define ValidateHwnd(hwnd)
Definition: immcli.h:90
BOOL DdeUninitialize(DWORD idInst)
Definition: ddemlcli.c:192
short cInDDEMLCallback
Definition: ddemlcli.h:193
int cLocks
Definition: ddemlcli.h:219
struct tagDDE_MESSAGE_QUEUE * next
Definition: ddemlcli.h:151
HCONV hConv
Definition: ddemlcli.h:206
LATOM IncLocalAtomCount(LATOM la)
Definition: hsz.c:516
PCONV_INFO ProcessTerminateMsg(PCONV_INFO pcoi, HWND hwndFrom)
Definition: ddemlwp.c:541
typedef UINT(FAR WINAPI *MSGSOUNDPROC)()
LATOM laService
Definition: ddemlcli.h:207
LATOM laTopic
Definition: ddemlcli.h:208
#define EnterDDECrit
Definition: ddemlcli.h:40
BOOL EnableEnumProc(HWND hwnd, PENABLE_ENUM_STRUCT pees)
Definition: callback.c:289
HWND hwndPartner
Definition: ddemlcli.h:209
struct tagCONV_INFO * PCONV_INFO
Definition: user.h:372
#define DDEMLReAlloc(p, cb)
Definition: ddemlcli.h:13
GATOM LocalToGlobalAtom(LATOM la)
Definition: hsz.c:438
BOOL SpontaneousServerMessage(PSVR_CONV_INFO psi, UINT msg, LONG lParam)
Definition: stdptcl.c:1399
PSERVERINFO gpsi
Definition: clglobal.c:39
HANDLE CreateHandle(DWORD dwData, DWORD type, DWORD inst)
Definition: handles.c:75
struct tagCONV_INFO * pcoi
Definition: ddemlcli.h:152
#define CheckDDECritOut
Definition: ddemlcli.h:51
Definition: user.h:1323
#define MONCONV(pcoi, fConn)
Definition: ddemlcli.h:30

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值