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.

56 lines
1.5 KiB

  1. #ifndef _PING_H_
  2. #define _PING_H_
  3. #include <ipexport.h>
  4. #include <icmpapi.h>
  5. // Function prototypes equivalent to those in icmpapi.h
  6. // these are required in order to use GetProcAddress()
  7. typedef HANDLE (WINAPI * PFNIcmpCreateFile) (VOID);
  8. typedef BOOL (WINAPI * PFNIcmpCloseHandle) (HANDLE IcmpHandle);
  9. typedef DWORD (WINAPI * PFNIcmpSendEcho) (
  10. HANDLE IcmpHandle,
  11. IPAddr DestinationAddress,
  12. LPVOID RequestData,
  13. WORD RequestSize,
  14. PIP_OPTION_INFORMATION RequestOptions,
  15. LPVOID ReplyBuffer,
  16. DWORD ReplySize,
  17. DWORD Timeout);
  18. enum { AUTODIAL_UNKNOWN = -1, PLATFORM_UNKNOWN = -2 };
  19. class CPing
  20. {
  21. protected:
  22. HINSTANCE m_hICMPDLL;
  23. PFNIcmpCreateFile m_pfnCreateFile;
  24. PFNIcmpCloseHandle m_pfnCloseHandle;
  25. PFNIcmpSendEcho m_pfnSendEcho;
  26. BOOL m_fWinNTAutodialEnabled;
  27. DWORD m_dwPlatformId;
  28. public:
  29. CPing() :
  30. m_hICMPDLL (NULL),
  31. m_pfnCreateFile (NULL),
  32. m_pfnCloseHandle (NULL),
  33. m_pfnSendEcho (NULL),
  34. m_fWinNTAutodialEnabled (AUTODIAL_UNKNOWN),
  35. m_dwPlatformId (PLATFORM_UNKNOWN)
  36. { };
  37. ~CPing() { if (m_hICMPDLL) ::FreeLibrary(m_hICMPDLL); };
  38. HRESULT Ping(DWORD dwAddr, DWORD dwTimeout, DWORD dwRetries);
  39. BOOL IsWin95AutodialEnabled ( VOID );
  40. BOOL IsWinNTAutodialEnabled ( VOID );
  41. BOOL IsAutodialEnabled ( VOID ); // call either one above
  42. };
  43. #endif // _PING_H_