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.

127 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. Chollian2000Plus.cpp
  5. Abstract:
  6. The app has a binary logon.ocx which uses sub-classed editbox as password
  7. editbox. It does not hook all messages (whistler seems has more message
  8. than win2k's), so when the mouse drags through it, the password typed will
  9. be shown as plain text, the fix is to apply ES_PASSWORD to this specific
  10. EditBox.
  11. Notes:
  12. This is an app specific shim.
  13. History:
  14. 05/15/2001 xiaoz Created
  15. --*/
  16. #include "precomp.h"
  17. #include "psapi.h"
  18. IMPLEMENT_SHIM_BEGIN(Chollian2000Plus)
  19. #include "ShimHookMacro.h"
  20. APIHOOK_ENUM_BEGIN
  21. APIHOOK_ENUM_ENTRY(CreateWindowExA)
  22. APIHOOK_ENUM_END
  23. /*++
  24. Correct Window Style if Necessary
  25. --*/
  26. HWND
  27. APIHOOK(CreateWindowExA)(
  28. DWORD dwExStyle,
  29. LPCSTR lpClassName,
  30. LPCSTR lpWindowName,
  31. DWORD dwStyle,
  32. int x,
  33. int y,
  34. int nWidth,
  35. int nHeight,
  36. HWND hWndParent,
  37. HMENU hMenu,
  38. HINSTANCE hInstance,
  39. LPVOID lpParam
  40. )
  41. {
  42. WCHAR szBaseName[MAX_PATH];
  43. CString cstrClassname;
  44. CString cstrBaseName;
  45. // If dwExStyle is not zero, goto original call
  46. if (dwExStyle)
  47. {
  48. goto Original;
  49. }
  50. // If dwStyle is not 0x50010000, goto original call
  51. if (0x50010000 != dwStyle)
  52. {
  53. goto Original;
  54. }
  55. if (!GetModuleBaseName(GetCurrentProcess(), hInstance, szBaseName, MAX_PATH))
  56. {
  57. goto Original;
  58. }
  59. // If the call is not from login.ocx ,goto original call
  60. cstrBaseName = szBaseName;
  61. if (cstrBaseName.CompareNoCase(L"login.ocx"))
  62. {
  63. goto Original;
  64. }
  65. // If it's not an EditBox , goto original call
  66. cstrClassname = lpClassName;
  67. if (cstrClassname.CompareNoCase(L"Edit"))
  68. {
  69. goto Original;
  70. }
  71. // If it has window's name , goto original call
  72. if (lpWindowName)
  73. {
  74. goto Original;
  75. }
  76. LOGN(eDbgLevelWarning, "Window style corrected");
  77. dwStyle = dwStyle | 0x0020;
  78. Original:
  79. return ORIGINAL_API(CreateWindowExA)(dwExStyle, lpClassName, lpWindowName,
  80. dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
  81. }
  82. /*++
  83. Register hooked functions
  84. --*/
  85. HOOK_BEGIN
  86. APIHOOK_ENTRY(USER32.DLL, CreateWindowExA)
  87. HOOK_END
  88. IMPLEMENT_SHIM_END