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.

175 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1994-1999 Microsoft Corporation
  3. Module Name :
  4. utcls.h
  5. Abstract:
  6. Some utility functions and classes.
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef _UTCLS_H_
  14. #define _UTCLS_H_
  15. //
  16. // CDialog parameters
  17. //
  18. #define USE_DEFAULT_CAPTION (0)
  19. //
  20. // Determine if the given server name refers to the local machine
  21. //
  22. BOOL
  23. COMDLL
  24. IsServerLocal(
  25. IN LPCTSTR lpszServer
  26. );
  27. //
  28. // Get volume information system flags for the given path
  29. //
  30. BOOL
  31. COMDLL
  32. GetVolumeInformationSystemFlags(
  33. IN LPCTSTR lpszPath,
  34. OUT DWORD * pdwSystemFlags
  35. );
  36. //
  37. // Build registry key name
  38. //
  39. LPCTSTR COMDLL GenerateRegistryKey(
  40. OUT CString & strBuffer,
  41. IN LPCTSTR lpszSubKey = NULL
  42. );
  43. class COMDLL CBlob
  44. /*++
  45. Class Description:
  46. Binary large object class, which owns its pointer
  47. Public Interface:
  48. CBlob : Constructors
  49. ~CBlob : Destructor
  50. SetValue : Assign the value
  51. GetSize : Get the byte size
  52. GetData : Get pointer to the byte stream
  53. --*/
  54. {
  55. //
  56. // Constructors/Destructor
  57. //
  58. public:
  59. //
  60. // Initialize empty blob
  61. //
  62. CBlob();
  63. //
  64. // Initialize with binary data
  65. //
  66. CBlob(
  67. IN DWORD dwSize,
  68. IN PBYTE pbItem,
  69. IN BOOL fMakeCopy = TRUE
  70. );
  71. //
  72. // Copy constructor
  73. //
  74. CBlob(IN const CBlob & blob);
  75. //
  76. // Destructor destroys the pointer
  77. //
  78. ~CBlob();
  79. //
  80. // Operators
  81. //
  82. public:
  83. CBlob & operator =(const CBlob & blob);
  84. BOOL operator ==(const CBlob & blob) const;
  85. BOOL operator !=(const CBlob & blob) const { return !operator ==(blob); }
  86. //
  87. // Access
  88. //
  89. public:
  90. //
  91. // Clean up internal data
  92. //
  93. void CleanUp();
  94. //
  95. // Set the current value of the blob
  96. //
  97. void SetValue(
  98. IN DWORD dwSize,
  99. IN PBYTE pbItem,
  100. IN BOOL fMakeCopy = TRUE
  101. );
  102. //
  103. // TRUE if the blob is currently empty
  104. //
  105. BOOL IsEmpty() const { return m_dwSize == 0L; }
  106. //
  107. // Return the size of the blob in bytes
  108. //
  109. DWORD GetSize() const { return m_dwSize; }
  110. //
  111. // Get a pointer to the byte stream
  112. //
  113. PBYTE GetData();
  114. private:
  115. DWORD m_dwSize;
  116. PBYTE m_pbItem;
  117. };
  118. //
  119. // Inline Expansion
  120. //
  121. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  122. inline CBlob::~CBlob()
  123. {
  124. CleanUp();
  125. }
  126. inline PBYTE CBlob::GetData()
  127. {
  128. return m_pbItem;
  129. }
  130. #endif // _UTCLS_H_