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.

125 lines
3.4 KiB

  1. //++
  2. //
  3. // Copyright (C) Microsoft Corporation, 1987 - 1999
  4. //
  5. // Module Name:
  6. //
  7. // iploopbk.c
  8. //
  9. // Abstract:
  10. //
  11. // Queries into network drivers
  12. //
  13. // Author:
  14. //
  15. // Anilth - 4-20-1998
  16. //
  17. // Environment:
  18. //
  19. // User mode only.
  20. // Contains NT-specific code.
  21. //
  22. // Revision History:
  23. //
  24. //--
  25. #include "precomp.h"
  26. //-------------------------------------------------------------------------//
  27. //###### I p L o o p B k T e s t () #####################################//
  28. //-------------------------------------------------------------------------//
  29. // Abstract: //
  30. // Pings the IP loopback address. If this succeeds then the IP stack //
  31. // is most probably in a working state. //
  32. // Arguments: //
  33. // none //
  34. // Return value: //
  35. // TRUE - test passed //
  36. // FALSE - test failed //
  37. // Global variables used: //
  38. // none //
  39. //-------------------------------------------------------------------------//
  40. HRESULT IpLoopBkTest( NETDIAG_PARAMS* pParams, NETDIAG_RESULT* pResults)
  41. {
  42. BOOL RetVal = TRUE;
  43. HRESULT hr = hrOK;
  44. if (!pResults->IpConfig.fEnabled)
  45. return hrOK;
  46. PrintStatusMessage(pParams,0, IDS_IPLOOPBK_STATUS_MSG);
  47. RetVal = IsIcmpResponse( _T("127.0.0.1") );
  48. if ( RetVal == FALSE )
  49. {
  50. PrintStatusMessage(pParams,0, IDS_GLOBAL_FAIL_NL);
  51. hr = S_FALSE;
  52. pResults->LoopBack.hr = S_FALSE;
  53. SetMessage(&pResults->LoopBack.msgLoopBack,
  54. Nd_Quiet,
  55. IDS_IPLOOPBK_FAIL);
  56. }
  57. else
  58. {
  59. PrintStatusMessage(pParams,0, IDS_GLOBAL_PASS_NL);
  60. hr = S_OK;
  61. pResults->LoopBack.hr = S_OK;
  62. SetMessage(&pResults->LoopBack.msgLoopBack,
  63. Nd_ReallyVerbose,
  64. IDS_IPLOOPBK_PASS);
  65. }
  66. return hr;
  67. } /* END OF IpLoopBkTest() */
  68. /*!--------------------------------------------------------------------------
  69. IpLoopBkGlobalPrint
  70. -
  71. Author: KennT
  72. ---------------------------------------------------------------------------*/
  73. void IpLoopBkGlobalPrint( NETDIAG_PARAMS* pParams,
  74. NETDIAG_RESULT* pResults)
  75. {
  76. if (!pResults->IpConfig.fEnabled)
  77. {
  78. return;
  79. }
  80. if (pParams->fVerbose || !FHrOK(pResults->LoopBack.hr))
  81. {
  82. PrintNewLine(pParams, 2);
  83. PrintTestTitleResult(pParams, IDS_IPLOOPBK_LONG, IDS_IPLOOPBK_SHORT, TRUE, pResults->LoopBack.hr, 0);
  84. PrintNdMessage(pParams, &pResults->LoopBack.msgLoopBack);
  85. }
  86. }
  87. /*!--------------------------------------------------------------------------
  88. IpLoopBkPerInterfacePrint
  89. -
  90. Author: KennT
  91. ---------------------------------------------------------------------------*/
  92. void IpLoopBkPerInterfacePrint( NETDIAG_PARAMS* pParams,
  93. NETDIAG_RESULT* pResults,
  94. INTERFACE_RESULT *pInterfaceResults)
  95. {
  96. // no per-interface results
  97. }
  98. /*!--------------------------------------------------------------------------
  99. IpLoopBkCleanup
  100. -
  101. Author: KennT
  102. ---------------------------------------------------------------------------*/
  103. void IpLoopBkCleanup( NETDIAG_PARAMS* pParams, NETDIAG_RESULT* pResults)
  104. {
  105. ClearMessage(&pResults->LoopBack.msgLoopBack);
  106. }