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.

109 lines
3.1 KiB

  1. //****************************************************************************
  2. //
  3. // Module: ULS.DLL
  4. // File: utils.h
  5. // Content: Declaration utiltity functions and classes
  6. //
  7. // Copyright (c) Microsoft Corporation 1996-1997
  8. //
  9. //****************************************************************************
  10. //****************************************************************************
  11. // Global Utilities
  12. //****************************************************************************
  13. //
  14. #ifdef _DEBUG
  15. extern LONG g_cCritSec;
  16. #endif
  17. inline VOID MyInitializeCriticalSection ( LPCRITICAL_SECTION pcs )
  18. {
  19. InitializeCriticalSection (pcs);
  20. #ifdef _DEBUG
  21. g_cCritSec++;
  22. #endif
  23. }
  24. inline VOID MyDeleteCriticalSection ( LPCRITICAL_SECTION pcs )
  25. {
  26. DeleteCriticalSection (pcs);
  27. #ifdef _DEBUG
  28. g_cCritSec--;
  29. #endif
  30. }
  31. HRESULT SetLPTSTR (LPTSTR *ppszName, LPCTSTR pszUserName);
  32. HRESULT SafeSetLPTSTR (LPTSTR *ppszName, LPCTSTR pszUserName);
  33. HRESULT SetOffsetString ( TCHAR **ppszDst, BYTE *pSrcBase, ULONG uSrcOffset );
  34. HRESULT LPTSTR_to_BSTR (BSTR *pbstr, LPCTSTR psz);
  35. HRESULT BSTR_to_LPTSTR (LPTSTR *ppsz, BSTR bstr);
  36. BOOL IsLegalEmailName ( TCHAR *pszName );
  37. //****************************************************************************
  38. // CList definition
  39. //****************************************************************************
  40. //
  41. typedef struct tagpNode {
  42. struct tagpNode *pNext;
  43. LPVOID pv;
  44. } NODE, *PNODE;
  45. class CList
  46. {
  47. private:
  48. PNODE pHead;
  49. PNODE pTail;
  50. public:
  51. CList(void);
  52. ~CList(void);
  53. HRESULT Insert (LPVOID pv);
  54. HRESULT Append (LPVOID pv);
  55. HRESULT Remove (LPVOID pv);
  56. HRESULT Find (LPVOID pv);
  57. HRESULT FindStorage (LPVOID *ppv, LPVOID pv);
  58. HRESULT Enumerate (HANDLE *phEnum);
  59. HRESULT Next (HANDLE *phEnum, LPVOID *ppv);
  60. HRESULT NextStorage (HANDLE *phEnum, LPVOID *ppv);
  61. HRESULT Flush (void);
  62. HRESULT Clone (CList *pList, HANDLE *phEnum);
  63. };
  64. //****************************************************************************
  65. // CEnumNames definition
  66. //****************************************************************************
  67. //
  68. class CEnumNames : public IEnumIlsNames
  69. {
  70. private:
  71. ULONG cRef;
  72. LPTSTR pNext;
  73. LPTSTR pszNames;
  74. ULONG cbSize;
  75. public:
  76. // Constructor and Initialization
  77. CEnumNames (void);
  78. ~CEnumNames (void);
  79. STDMETHODIMP Init (LPTSTR pList, ULONG cNames);
  80. // IUnknown
  81. STDMETHODIMP QueryInterface (REFIID iid, void **ppv);
  82. STDMETHODIMP_(ULONG) AddRef (void);
  83. STDMETHODIMP_(ULONG) Release (void);
  84. // IEnumIlsAttributes
  85. STDMETHODIMP Next(ULONG cNames, BSTR *rgpbstrName,
  86. ULONG *pcFetched);
  87. STDMETHODIMP Skip(ULONG cNames);
  88. STDMETHODIMP Reset();
  89. STDMETHODIMP Clone(IEnumIlsNames **ppEnum);
  90. };