Source code of Windows XP (NT5)
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.

95 lines
1.6 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. IgnoreTAPIDisconnect.cpp
  5. Abstract:
  6. NT4 does not send a disconnect message to the line callback. It's not clear
  7. why this is the case.
  8. The current behaviour seems to be correct, so this shim simply removes the
  9. disconnect message from the queue.
  10. Notes:
  11. This is a general purpose shim.
  12. History:
  13. 05/09/2001 linstev Created
  14. --*/
  15. #include "precomp.h"
  16. IMPLEMENT_SHIM_BEGIN(IgnoreTAPIDisconnect)
  17. #include "ShimHookMacro.h"
  18. APIHOOK_ENUM_BEGIN
  19. APIHOOK_ENUM_ENTRY(lineInitialize)
  20. APIHOOK_ENUM_END
  21. /*++
  22. Ignore disconnect state.
  23. --*/
  24. VOID FAR PASCAL LineCallback(
  25. LINECALLBACK pfnOld,
  26. DWORD hDevice,
  27. DWORD dwMsg,
  28. DWORD dwCallbackInstance,
  29. DWORD dwParam1,
  30. DWORD dwParam2,
  31. DWORD dwParam3
  32. )
  33. {
  34. if ((dwMsg == LINEAGENTSTATUS_STATE) && (dwParam1 & LINECALLSTATE_DISCONNECTED)) {
  35. //
  36. // Ignore disconnect message
  37. //
  38. return;
  39. }
  40. return (*pfnOld)(hDevice, dwMsg, dwCallbackInstance, dwParam1, dwParam2, dwParam3);
  41. }
  42. /*++
  43. Hook the callback.
  44. --*/
  45. LONG
  46. APIHOOK(lineInitialize)(
  47. LPHLINEAPP lphLineApp,
  48. HINSTANCE hInstance,
  49. LINECALLBACK lpfnCallback,
  50. LPCSTR lpszAppName,
  51. LPDWORD lpdwNumDevs
  52. )
  53. {
  54. return ORIGINAL_API(lineInitialize)(lphLineApp, hInstance,
  55. (LINECALLBACK) HookCallback(lpfnCallback, LineCallback), lpszAppName,
  56. lpdwNumDevs);
  57. }
  58. /*++
  59. Register hooked functions
  60. --*/
  61. HOOK_BEGIN
  62. APIHOOK_ENTRY(TAPI32.DLL, lineInitialize)
  63. HOOK_END
  64. IMPLEMENT_SHIM_END