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.

76 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. Acrobat5.cpp
  5. Abstract:
  6. Blow off calls to SetWindowPos() w/ bogus coordinates to
  7. prevent the app from erronously turning its window into a
  8. small sasauge in the upper left-hand corner of the screen.
  9. Notes:
  10. This is an app specific shim.
  11. History:
  12. 07/9/2001 reinerf Created
  13. --*/
  14. #include "precomp.h"
  15. IMPLEMENT_SHIM_BEGIN(Acrobat5)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_ENTRY(SetWindowPos)
  19. APIHOOK_ENUM_END
  20. BOOL
  21. APIHOOK(SetWindowPos)(
  22. HWND hWnd, // handle to window
  23. HWND hWndInsertAfter, // placement-order handle
  24. int X, // horizontal position
  25. int Y, // vertical position
  26. int cx, // width
  27. int cy, // height
  28. UINT uFlags // window-positioning options
  29. )
  30. {
  31. if (!(uFlags & (SWP_NOSIZE | SWP_NOMOVE)))
  32. {
  33. HWND hWndParent = GetParent(hWnd);
  34. if ((hWndParent == NULL) ||
  35. (hWndParent == GetDesktopWindow()))
  36. {
  37. if ((X < -3200) ||
  38. (Y < -3200))
  39. {
  40. // a toplevel window is being poorly positioned, ignore the call.
  41. DPFN( eDbgLevelInfo, "SetWindowPos passed bogus coordinates (X = %d, Y = %d), failing the call\n", X, Y);
  42. return FALSE;
  43. }
  44. }
  45. }
  46. return ORIGINAL_API(SetWindowPos)(hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
  47. }
  48. /*++
  49. Register hooked functions
  50. --*/
  51. HOOK_BEGIN
  52. APIHOOK_ENTRY(USER32.DLL, SetWindowPos)
  53. HOOK_END
  54. IMPLEMENT_SHIM_END