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.

143 lines
2.2 KiB

  1. /*++
  2. Copyright (C) 2001 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. util.hxx
  6. Abstract:
  7. Contains several utility functions.
  8. Author:
  9. Albert Ting (AlbertT) 25-Sept-1996 pAllocRead()
  10. Felix Maxa (AMaxa) 11-Sept-2001 Moved pAllocRead() from alloc.*xx to util.*xx and
  11. added the rest of the functions.
  12. --*/
  13. #ifndef _SPL_UTIL_HXX_
  14. #define _SPL_UTIL_HXX_
  15. enum
  16. {
  17. kBufferAllocHint = 1024
  18. };
  19. typedef struct _ALLOC_DATA ALLOC_DATA, *PALLOC_DATA;
  20. typedef BOOL (*ALLOC_FUNC)( PVOID pvUserData, PALLOC_DATA pAllocDatac);
  21. struct _ALLOC_DATA
  22. {
  23. PBYTE pBuffer;
  24. DWORD cbBuffer;
  25. };
  26. PBYTE
  27. pAllocRead(
  28. HANDLE hUserData,
  29. ALLOC_FUNC AllocFunc,
  30. DWORD dwLenHint,
  31. PDWORD pdwLen
  32. );
  33. DWORD
  34. WINAPIV
  35. StrNCatBuff(
  36. IN PWSTR pszBuffer,
  37. IN UINT cchBuffer,
  38. ...
  39. );
  40. DWORD
  41. DelDirRecursively(
  42. IN PCWSTR pszDir
  43. );
  44. LONG
  45. DeleteKeyRecursive(
  46. IN HKEY hKey,
  47. IN PCWSTR pszSubkey
  48. );
  49. BOOL
  50. IsGUIDString(
  51. IN PCWSTR pszString
  52. );
  53. HRESULT
  54. GetLastErrorAsHResult(
  55. VOID
  56. );
  57. HRESULT
  58. ClusResControl(
  59. IN HRESOURCE hResource,
  60. IN DWORD ControlCode,
  61. OUT BYTE **ppBuffer,
  62. IN DWORD *pcBytesReturned OPTIONAL
  63. );
  64. DWORD
  65. GetCurrentNodeName(
  66. OUT PWSTR *ppOut
  67. );
  68. LONG
  69. GetSubkeyBuffer(
  70. IN HKEY hKey,
  71. IN PWSTR *ppBuffer,
  72. IN DWORD *pnSize
  73. );
  74. HRESULT
  75. GetSpoolerResourceGUID(
  76. IN HCLUSTER hCluster,
  77. IN PCWSTR pszResource,
  78. OUT BYTE **ppGUID
  79. );
  80. class TStringArray
  81. {
  82. public:
  83. TStringArray(
  84. VOID
  85. );
  86. ~TStringArray(
  87. VOID
  88. );
  89. DWORD
  90. AddString(
  91. IN PCWSTR pszString
  92. );
  93. DWORD
  94. Count(
  95. VOID
  96. ) const;
  97. PCWSTR
  98. StringAt(
  99. IN DWORD Position
  100. ) const;
  101. DWORD
  102. Exclude(
  103. IN PCWSTR pszString
  104. );
  105. private:
  106. DWORD m_Count;
  107. PWSTR *m_pArray;
  108. };
  109. #endif // ifdef _SPL_UTIL_HXX_