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.4 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: winable.c
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * This module contains
  7. *
  8. * History:
  9. * 20-Feb-1992 DarrinM Pulled functions from user\server.
  10. \***************************************************************************/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. /***************************************************************************\
  14. *
  15. * GetWindowInfo()
  16. * PRIVATE
  17. *
  18. * Gets information about a window in one self-consistent big block.
  19. *
  20. \***************************************************************************/
  21. FUNCLOG2(LOG_GENERAL, BOOL, WINAPI, GetWindowInfo, HWND, hwnd, PWINDOWINFO, pwi)
  22. BOOL WINAPI
  23. GetWindowInfo(HWND hwnd, PWINDOWINFO pwi)
  24. {
  25. PWND pwnd;
  26. UINT cBorders;
  27. PCLS pclsT;
  28. if (pwi->cbSize != sizeof(WINDOWINFO)) {
  29. RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "WINDOWINFO.cbSize %d is wrong", pwi->cbSize);
  30. }
  31. /*
  32. * Validate the window
  33. */
  34. pwnd = ValidateHwnd(hwnd);
  35. if (pwnd == NULL) {
  36. return FALSE;
  37. }
  38. try {
  39. // Window rect
  40. pwi->rcWindow = pwnd->rcWindow;
  41. // Client rect
  42. pwi->rcClient = pwnd->rcClient;
  43. // Style
  44. pwi->dwStyle = pwnd->style;
  45. pwi->dwExStyle = pwnd->ExStyle;
  46. pwi->dwWindowStatus = 0;
  47. if (TestWF(pwnd, WFFRAMEON))
  48. pwi->dwWindowStatus |= WS_ACTIVECAPTION;
  49. // Borders
  50. cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE);
  51. pwi->cxWindowBorders = cBorders * SYSMET(CXBORDER);
  52. pwi->cyWindowBorders = cBorders * SYSMET(CYBORDER);
  53. // Type
  54. pclsT = (PCLS)REBASEALWAYS(pwnd, pcls);
  55. pwi->atomWindowType = pclsT->atomNVClassName;
  56. // Version
  57. if (TestWF(pwnd, WFWIN50COMPAT)) {
  58. pwi->wCreatorVersion = VER50;
  59. } else if (TestWF(pwnd, WFWIN40COMPAT)) {
  60. pwi->wCreatorVersion = VER40;
  61. } else if (TestWF(pwnd, WFWIN31COMPAT)) {
  62. pwi->wCreatorVersion = VER31;
  63. } else {
  64. pwi->wCreatorVersion = VER30;
  65. }
  66. } except (W32ExceptionHandler(FALSE, RIP_WARNING)) {
  67. RIPERR1(ERROR_INVALID_WINDOW_HANDLE,
  68. RIP_WARNING,
  69. "Window %x no longer valid",
  70. hwnd);
  71. return FALSE;
  72. }
  73. return TRUE;
  74. }