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.

129 lines
3.6 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. snaputil.h
  7. various utility routines
  8. FILE HISTORY:
  9. */
  10. #ifndef _SNAPUTIL_H
  11. #define _SNAPUTIL_H
  12. #ifdef __cplusplus
  13. typedef CArray<GUID, const GUID&> CTFSGUIDArrayBase;
  14. class CGUIDArray : public CTFSGUIDArrayBase
  15. {
  16. public:
  17. void AddUnique(const GUID& guid)
  18. {
  19. for (INT_PTR i = GetUpperBound(); i >= 0; --i)
  20. {
  21. if (GetAt(i) == guid)
  22. break;
  23. }
  24. if (i < 0)
  25. Add(guid);
  26. }
  27. BOOL IsInList(GUID & guid)
  28. {
  29. for (int i = 0; i < GetSize(); i++)
  30. {
  31. if (GetAt(i) == guid)
  32. return TRUE;
  33. }
  34. return FALSE;
  35. }
  36. };
  37. #endif // __cplusplus
  38. #ifdef __cplusplus
  39. extern "C"
  40. {
  41. #endif
  42. /*!--------------------------------------------------------------------------
  43. IsLocalMachine
  44. Returns TRUE if the machine name passed in is the local machine,
  45. or if pszMachineName is NULL.
  46. Returns FALSE otherwise.
  47. Author: KennT
  48. ---------------------------------------------------------------------------*/
  49. BOOL IsLocalMachine(LPCTSTR pszMachineName);
  50. /*!--------------------------------------------------------------------------
  51. FUseTaskpadsByDefault
  52. Returns TRUE if we are to use taskpads by default.
  53. We check the
  54. HKLM\Software\Microsoft\MMC
  55. TFSCore_StopTheInsanity : REG_DWORD :
  56. = 1, don't use taskpads by default
  57. = 0 (or not there), use taskpads by default
  58. Author: KennT
  59. ---------------------------------------------------------------------------*/
  60. BOOL FUseTaskpadsByDefault(LPCTSTR pszMachineName);
  61. #ifdef __cplusplus
  62. };
  63. #endif
  64. UINT CalculateStringWidth(HWND hWndParent, LPCTSTR pszString);
  65. /*---------------------------------------------------------------------------
  66. IP address validation function
  67. This will return 0 (for success) or a string constant if the input
  68. is bogus.
  69. ipAddress and ipMask are assumed to be in host order.
  70. ---------------------------------------------------------------------------*/
  71. UINT CheckIPAddressAndMask(DWORD ipAddress, DWORD ipMask, DWORD dwFlags);
  72. #define IPADDRESS_TEST_ALL (0xFFFFFFFF)
  73. // This test is to test the address only. Tests involving the masks
  74. // are not performed.
  75. #define IPADDRESS_TEST_ADDRESS_ONLY \
  76. (IPADDRESS_TEST_NORMAL_RANGE | \
  77. IPADDRESS_TEST_NOT_127 )
  78. // Tests to see that the mask is non-contiguous
  79. // if this fail, function returns IDS_COMMON_ERR_IPADDRESS_NONCONTIGUOUS_MASK
  80. #define IPADDRESS_TEST_NONCONTIGUOUS_MASK 0x00000001
  81. // Tests to see that the address is not longer than the mask
  82. // e.g. 172.31.248.1 / 255.255.255.0
  83. // Returns IDS_COMMON_ERR_IPADDRESS_TOO_SPECIFIC
  84. #define IPADDRESS_TEST_TOO_SPECIFIC 0x00000002
  85. // Tests to to see that the ipaddress falls into the normal range
  86. // 1.0.0.0 <= ipaddress < 224.0.0.0
  87. // Returns IDS_COMMON_ERR_IPADDRESS_NORMAL_RANGE
  88. #define IPADDRESS_TEST_NORMAL_RANGE 0x00000004
  89. // Tests that ths is not a 127.x.x.x address
  90. // Returns IDS_COMMON_ERR_IPADDRESS_127
  91. #define IPADDRESS_TEST_NOT_127 0x00000008
  92. // Tests that the ipaddress is not the same as the mask
  93. // Retursn IDS_COMMOON_ERR_IPADDRESS_NOT_EQ_MASK
  94. #define IPADDRESS_TEST_ADDR_NOT_EQ_MASK 0x00000010
  95. #endif _SNAPUTIL_H