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.

86 lines
2.7 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: getset.c
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * This module contains window manager information routines
  7. *
  8. * History:
  9. * 10-22-90 MikeHar Ported functions from Win 3.0 sources.
  10. * 13-Feb-1991 mikeke Added Revalidation code (None)
  11. * 08-Feb-1991 IanJa Unicode/ANSI aware and neutral
  12. \***************************************************************************/
  13. /***************************************************************************\
  14. * MapServerToClientPfn
  15. *
  16. * Returns the client wndproc representing the server wndproc passed in
  17. *
  18. * 01-13-92 ScottLu Created.
  19. \***************************************************************************/
  20. ULONG_PTR MapServerToClientPfn(
  21. KERNEL_ULONG_PTR dw,
  22. BOOL bAnsi)
  23. {
  24. int i;
  25. for (i = FNID_WNDPROCSTART; i <= FNID_WNDPROCEND; i++) {
  26. if ((WNDPROC_PWND)dw == STOCID(i)) {
  27. if (bAnsi) {
  28. return FNID_TO_CLIENT_PFNA_CLIENT(i);
  29. } else {
  30. return FNID_TO_CLIENT_PFNW_CLIENT(i);
  31. }
  32. }
  33. }
  34. return 0;
  35. }
  36. /***************************************************************************\
  37. * MapClientNeuterToClientPfn
  38. *
  39. * Maps client Neuter routines like editwndproc to Ansi or Unicode versions
  40. * and back again.
  41. *
  42. * 01-13-92 ScottLu Created.
  43. \***************************************************************************/
  44. ULONG_PTR MapClientNeuterToClientPfn(
  45. PCLS pcls,
  46. KERNEL_ULONG_PTR dw,
  47. BOOL bAnsi)
  48. {
  49. /*
  50. * Default to the class window proc.
  51. */
  52. if (dw == 0) {
  53. dw = (KERNEL_ULONG_PTR)pcls->lpfnWndProc;
  54. }
  55. /*
  56. * If this is one of our controls and it hasn't been subclassed, try
  57. * to return the correct ANSI/Unicode function.
  58. */
  59. if (pcls->fnid >= FNID_CONTROLSTART && pcls->fnid <= FNID_CONTROLEND) {
  60. if (!bAnsi) {
  61. if (FNID_TO_CLIENT_PFNA_KERNEL(pcls->fnid) == dw)
  62. return FNID_TO_CLIENT_PFNW_CLIENT(pcls->fnid);
  63. } else {
  64. if (FNID_TO_CLIENT_PFNW_KERNEL(pcls->fnid) == dw)
  65. return FNID_TO_CLIENT_PFNA_CLIENT(pcls->fnid);
  66. }
  67. #ifdef BUILD_WOW6432
  68. if (!bAnsi) {
  69. if (FNID_TO_CLIENT_PFNW_KERNEL(pcls->fnid) == dw)
  70. return FNID_TO_CLIENT_PFNW_CLIENT(pcls->fnid);
  71. } else {
  72. if (FNID_TO_CLIENT_PFNA_KERNEL(pcls->fnid) == dw)
  73. return FNID_TO_CLIENT_PFNA_CLIENT(pcls->fnid);
  74. }
  75. dw = (KERNEL_ULONG_PTR)MapKernelClientFnToClientFn((WNDPROC_PWND)dw);
  76. #endif
  77. }
  78. return (ULONG_PTR)dw;
  79. }