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.

136 lines
3.9 KiB

  1. /*++
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * WMSGSBM.C
  8. * WOW32 16-bit message thunks for SCROLLBARs
  9. *
  10. * History:
  11. * Created 10-Jun-1992 by Bob Day (bobday)
  12. --*/
  13. #include "precomp.h"
  14. #pragma hdrstop
  15. MODNAME(wmsgbm.c);
  16. #ifdef DEBUG
  17. MSGINFO amiSBM[] = {
  18. {OLDSBM_SETPOS, "SBM_SETPOS"}, // 0x0400
  19. {OLDSBM_GETPOS, "SBM_GETPOS"}, // 0x0401
  20. {OLDSBM_SETRANGE, "SBM_SETRANGE"}, // 0x0402
  21. {OLDSBM_GETRANGE, "SBM_GETRANGE"}, // 0x0403
  22. {OLDSBM_ENABLEARROWS,"SBM_ENABLE_ARROWS"}, // 0x0404
  23. };
  24. PSZ GetSBMMsgName(WORD wMsg)
  25. {
  26. INT i;
  27. register PMSGINFO pmi;
  28. for (pmi=amiSBM,i=NUMEL(amiSBM); i>0; i--,pmi++)
  29. if ((WORD)pmi->uMsg == wMsg)
  30. return pmi->pszMsgName;
  31. return GetWMMsgName(wMsg);
  32. }
  33. #endif
  34. BOOL FASTCALL ThunkSBMMsg16(LPMSGPARAMEX lpmpex)
  35. {
  36. WORD wMsg = lpmpex->Parm16.WndProc.wMsg;
  37. LOGDEBUG(7,(" Thunking 16-bit scrollbar message %s(%04x)\n", (LPSZ)GetSBMMsgName(wMsg), wMsg));
  38. wMsg -= WM_USER;
  39. //
  40. // For app defined (control) messages that are out of range
  41. // return TRUE.
  42. //
  43. // ChandanC Sept-15-1992
  44. //
  45. if (wMsg < (SBM_ENABLE_ARROWS - SBM_SETPOS + 1)) {
  46. switch(lpmpex->uMsg = wMsg + SBM_SETPOS) {
  47. // The following messages should not require thunking, because
  48. // they contain no pointers, handles, or rearranged message parameters,
  49. // so consequently they are not documented in great detail here:
  50. //
  51. // SBM_SETPOS (requires minimal thunking)
  52. // SBM_GETPOS
  53. // SBM_ENABLE_ARROWS
  54. //
  55. case SBM_GETRANGE:
  56. //
  57. // Changed semantics for this message to support 32-bit
  58. // scroll bar ranges (vs. 16-bit).
  59. //
  60. // Win16:
  61. // posMin = LOWORD(SendMessage(hwnd, SBM_GETRANGE, 0, 0));
  62. // posMax = HIWORD(SendMessage(hwnd, SBM_GETRANGE, 0, 0));
  63. //
  64. // Win32:
  65. // SendMessage(hwnd, SBM_GETRANGE,
  66. // (WPARAM) &posMin, (LPARAM) &posMax);
  67. //
  68. // Allocate buffers for 32-bit scrollbar proc to put
  69. // posMin and posMax in.
  70. lpmpex->uParam = (UINT)lpmpex->MsgBuffer;
  71. lpmpex->lParam = (LONG)((UINT *)lpmpex->uParam + 1);
  72. break;
  73. case SBM_SETRANGE:
  74. //
  75. // Changed semantics to support 32-bit scroll bar range:
  76. //
  77. // Win16:
  78. // SendMessage(hwnd, SBM_SETRANGE, fRedraw, MAKELONG(posMin, posMax);
  79. //
  80. // Win32:
  81. // SendMessage(hwnd, fRedraw ? SBM_SETRANGE : SBM_SETRANGEREDRAW,
  82. // posMin, posMax);
  83. //
  84. if (lpmpex->Parm16.WndProc.wParam)
  85. lpmpex->uMsg = SBM_SETRANGEREDRAW;
  86. lpmpex->uParam = INT32(LOWORD(lpmpex->Parm16.WndProc.lParam));
  87. lpmpex->lParam = INT32(HIWORD(lpmpex->Parm16.WndProc.lParam));
  88. break;
  89. case SBM_SETPOS:
  90. lpmpex->uParam = INT32(lpmpex->Parm16.WndProc.wParam); // sign-extend the position
  91. break;
  92. }
  93. }
  94. return TRUE;
  95. }
  96. VOID FASTCALL UnThunkSBMMsg16(LPMSGPARAMEX lpmpex)
  97. {
  98. switch (lpmpex->uMsg) {
  99. case SBM_GETRANGE:
  100. if (lpmpex->uParam && lpmpex->lParam) {
  101. lpmpex->lReturn = MAKELONG(*(UINT *)lpmpex->uParam,
  102. *(UINT *)lpmpex->lParam);
  103. }
  104. break;
  105. }
  106. }