Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

198 lines
6.4 KiB

  1. /*++
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * WMSGCB.C
  8. * WOW32 16-bit message thunks
  9. *
  10. * History:
  11. * Created 11-Mar-1991 by Jeff Parsons (jeffpar)
  12. --*/
  13. #include "precomp.h"
  14. #pragma hdrstop
  15. MODNAME(wmsgcb.c);
  16. #ifdef DEBUG
  17. MSGINFO amiCB[] = {
  18. {OLDCB_GETEDITSEL, "CB_GETEDITSEL"}, // 0x0400
  19. {OLDCB_LIMITTEXT, "CB_LIMITTEXT"}, // 0x0401
  20. {OLDCB_SETEDITSEL, "CB_SETEDITSEL"}, // 0x0402
  21. {OLDCB_ADDSTRING, "CB_ADDSTRING"}, // 0x0403
  22. {OLDCB_DELETESTRING, "CB_DELETESTRING"}, // 0x0404
  23. {OLDCB_DIR, "CB_DIR"}, // 0x0405
  24. {OLDCB_GETCOUNT, "CB_GETCOUNT"}, // 0x0406
  25. {OLDCB_GETCURSEL, "CB_GETCURSEL"}, // 0x0407
  26. {OLDCB_GETLBTEXT, "CB_GETLBTEXT"}, // 0x0408
  27. {OLDCB_GETLBTEXTLEN, "CB_GETLBTEXTLEN"}, // 0x0409
  28. {OLDCB_INSERTSTRING, "CB_INSERTSTRING"}, // 0x040A
  29. {OLDCB_RESETCONTENT, "CB_RESETCONTENT"}, // 0x040B
  30. {OLDCB_FINDSTRING, "CB_FINDSTRING"}, // 0x040C
  31. {OLDCB_SELECTSTRING, "CB_SELECTSTRING"}, // 0x040D
  32. {OLDCB_SETCURSEL, "CB_SETCURSEL"}, // 0x040E
  33. {OLDCB_SHOWDROPDOWN, "CB_SHOWDROPDOWN"}, // 0x040F
  34. {OLDCB_GETITEMDATA, "CB_GETITEMDATA"}, // 0x0410
  35. {OLDCB_SETITEMDATA, "CB_SETITEMDATA"}, // 0x0411
  36. {OLDCB_GETDROPPEDCONTROLRECT,"CB_GETDROPPEDCONTROLRECT"}, // 0x0412
  37. {OLDCB_SETITEMHEIGHT, "CB_SETITEMHEIGHT"}, // 0x0413
  38. {OLDCB_GETITEMHEIGHT, "CB_GETITEMHEIGHT"}, // 0x0414
  39. {OLDCB_SETEXTENDEDUI, "CB_SETEXTENDEDUI"}, // 0x0415
  40. {OLDCB_GETEXTENDEDUI, "CB_GETEXTENDEDUI"}, // 0x0416
  41. {OLDCB_GETDROPPEDSTATE, "CB_GETDROPPEDSTATE"}, // 0x0417
  42. {OLDCB_FINDSTRINGEXACT, "CB_FINDSTRINGEXACT"}, // 0x0418
  43. };
  44. PSZ GetCBMsgName(WORD wMsg)
  45. {
  46. INT i;
  47. register PMSGINFO pmi;
  48. for (pmi=amiCB,i=NUMEL(amiCB); i>0; i--,pmi++)
  49. if ((WORD)pmi->uMsg == wMsg)
  50. return pmi->pszMsgName;
  51. return GetWMMsgName(wMsg);
  52. }
  53. #endif
  54. BOOL FASTCALL ThunkCBMsg16(LPMSGPARAMEX lpmpex)
  55. {
  56. register PWW pww;
  57. WORD wMsg = lpmpex->Parm16.WndProc.wMsg;
  58. LOGDEBUG(7,(" Thunking 16-bit combo box message %s(%04x)\n", (LPSZ)GetCBMsgName(wMsg), wMsg));
  59. // Sudeepb - 04-Mar-1996
  60. // Fix the broken thunking for CBEC_SETCOMBOFOCUS and CBEC_KILLCOMBOFOCUS.
  61. // It was broken when NT user merged with Win95 where CB_MAX has changed.
  62. // the following code is written in such a manner that the only dependency
  63. // we have is that CBEC_SETCOMBOFOCUS precedes CBEC_KILLCOMBOFOCUS which
  64. // will always be true.
  65. if (wMsg == OLDCBEC_SETCOMBOFOCUS || wMsg == OLDCBEC_KILLCOMBOFOCUS) {
  66. lpmpex->uMsg = (WORD)(wMsg - OLDCBEC_SETCOMBOFOCUS + CBEC_SETCOMBOFOCUS);
  67. return TRUE;
  68. }
  69. wMsg -= WM_USER;
  70. //
  71. // For app defined (control) messages that are out of range
  72. // return TRUE.
  73. //
  74. // ChandanC Sept-15-1992
  75. //
  76. if (wMsg < (CB_FINDSTRINGEXACT - CB_GETEDITSEL + 4)) {
  77. switch(lpmpex->uMsg = wMsg + CB_GETEDITSEL) {
  78. case CB_SELECTSTRING:
  79. case CB_FINDSTRINGEXACT:
  80. case CB_FINDSTRING:
  81. case CB_INSERTSTRING:
  82. case CB_ADDSTRING:
  83. if (!(pww = lpmpex->pww))
  84. return FALSE;
  85. if (!(pww->style & (CBS_OWNERDRAWFIXED|CBS_OWNERDRAWVARIABLE)) ||
  86. (pww->style & (CBS_HASSTRINGS))) {
  87. GETPSZPTR(lpmpex->Parm16.WndProc.lParam, (LPSZ)lpmpex->lParam);
  88. }
  89. break;
  90. case CB_GETLBTEXT:
  91. if (NULL != (pww = lpmpex->pww)) {
  92. register PTHUNKTEXTDWORD pthkdword = (PTHUNKTEXTDWORD)lpmpex->MsgBuffer;
  93. // see comments in the file wmsglb.c
  94. //
  95. pthkdword->fDWORD = (pww->style & (CBS_OWNERDRAWFIXED|CBS_OWNERDRAWVARIABLE)) &&
  96. !(pww->style & (CBS_HASSTRINGS));
  97. if (pthkdword->fDWORD) {
  98. lpmpex->lParam = (LPARAM)(LPVOID)&pthkdword->dwDataItem;
  99. break;
  100. }
  101. }
  102. else {
  103. register PTHUNKTEXTDWORD pthkdword = (PTHUNKTEXTDWORD)lpmpex->MsgBuffer;
  104. pthkdword->fDWORD = FALSE;
  105. }
  106. GETPSZPTR(lpmpex->Parm16.WndProc.lParam, (LPSZ)lpmpex->lParam);
  107. break;
  108. case CB_DIR:
  109. GETPSZPTR(lpmpex->Parm16.WndProc.lParam, (LPSZ)lpmpex->lParam);
  110. if (W32CheckThunkParamFlag()) {
  111. AddParamMap(lpmpex->lParam, lpmpex->Parm16.WndProc.lParam);
  112. }
  113. break;
  114. case CB_GETDROPPEDCONTROLRECT:
  115. lpmpex->lParam = (LONG)lpmpex->MsgBuffer;
  116. break;
  117. }
  118. }
  119. return TRUE;
  120. }
  121. VOID FASTCALL UnThunkCBMsg16(LPMSGPARAMEX lpmpex)
  122. {
  123. switch(lpmpex->uMsg) {
  124. case CB_GETLBTEXT:
  125. {
  126. register PTHUNKTEXTDWORD pthkdword = (PTHUNKTEXTDWORD)lpmpex->MsgBuffer;
  127. if ((pthkdword->fDWORD) && (lpmpex->lReturn != CB_ERR)) {
  128. // this is a dword, not a string
  129. // assign the dword as unaligned
  130. UNALIGNED DWORD *lpdwDataItem;
  131. GETVDMPTR((lpmpex->Parm16.WndProc.lParam), sizeof(DWORD), lpdwDataItem);
  132. *lpdwDataItem = pthkdword->dwDataItem;
  133. FREEVDMPTR(lpdwDataItem);
  134. break;
  135. }
  136. }
  137. // fall through to the common code
  138. case CB_ADDSTRING:
  139. case CB_FINDSTRING:
  140. case CB_FINDSTRINGEXACT:
  141. case CB_INSERTSTRING:
  142. case CB_SELECTSTRING:
  143. FREEPSZPTR((LPSZ)lpmpex->lParam);
  144. break;
  145. case CB_DIR:
  146. if (W32CheckThunkParamFlag()) {
  147. DeleteParamMap(lpmpex->lParam, PARAM_32, NULL);
  148. }
  149. FREEPSZPTR((LPSZ)lpmpex->lParam);
  150. break;
  151. case CB_GETDROPPEDCONTROLRECT:
  152. if (lpmpex->lParam) {
  153. putrect16((VPRECT16)lpmpex->Parm16.WndProc.lParam, (LPRECT)lpmpex->lParam);
  154. }
  155. break;
  156. }
  157. }