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.

207 lines
4.9 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. STDPROV.H
  5. Abstract:
  6. Defines general purpose defines as well as some common
  7. objects that are generaly useful for all the different
  8. provider types.
  9. History:
  10. a-davj 27-Sep-97 Created.
  11. --*/
  12. #ifndef _SERVER2_H_
  13. #define _SERVER2_H_
  14. #define INC_OBJ 1
  15. #define INC_LOCK 2
  16. #define DEC_OBJ 3
  17. #define DEC_LOCK 4
  18. #define INIT_SIZE 20
  19. // Used to parse all provider strings
  20. #define MAIN_DELIM '|'
  21. // Used to parse substrings for the registry and
  22. // compound file providers
  23. #define SUB_DELIM '\\'
  24. // Used to parse substrings for the automation
  25. #define DOT '.'
  26. // Used to parse the PATH/CLASS token for the automation
  27. #define DQUOTE '\"'
  28. #define SEPARATOR ','
  29. // Used to parse ini strings.
  30. #define COMMA ','
  31. // Use in dde provider strings to delimit item names
  32. #define DELIMCHR '@'
  33. #define DELIMSTR "@"
  34. // Used to ignore any of the above!
  35. #define ESC '^'
  36. // Indicates that the dwUseOptArray value should
  37. // be substituted
  38. #define USE_ARRAY '#'
  39. #define ERROR_UNKNOWN 255
  40. #ifdef UNICODE
  41. #define CHARTYPE VT_LPWSTR
  42. #define CHARSIZE 2
  43. #else
  44. #define CHARTYPE VT_LPSTR
  45. #define CHARSIZE 1
  46. #endif
  47. SAFEARRAY * OMSSafeArrayCreate(VARTYPE vt,int iNumElements);
  48. HRESULT OMSVariantChangeType(VARIANTARG * pDest, VARIANTARG *pSrc,USHORT wFlags, VARTYPE vtNew);
  49. HRESULT OMSVariantClear(VARIANTARG * pClear);
  50. int iTypeSize(VARTYPE vtTest);
  51. char * WideToNarrow(LPCWSTR);
  52. char * WideToNarrowA(LPCWSTR); // uses new instead of CoTaskMemAlloc
  53. #define BUFF_SIZE 256
  54. extern long lObj;
  55. extern long lLock;
  56. //***************************************************************************
  57. //
  58. // CLASS NAME:
  59. //
  60. // CToken
  61. //
  62. // DESCRIPTION:
  63. //
  64. // The CToken holds a single token in the provider string
  65. //
  66. //***************************************************************************
  67. class CToken : public CObject {
  68. private:
  69. long int iOriginalLength;
  70. long int iOptArrayIndex;
  71. TString sData;
  72. TString sFullData;
  73. CFlexArray Expressions;
  74. public:
  75. friend class CProvObj;
  76. CToken(const TCHAR * cpStart,const OLECHAR cDelim, bool bUsesEscapes);
  77. ~CToken();
  78. TCHAR const * GetStringValue(void){return sData;};
  79. TCHAR const * GetFullStringValue(void){return sFullData;};
  80. long int GetOrigLength(void){return iOriginalLength;};
  81. long int GetIntExp(int iExp,int iArray);
  82. long int iConvOprand(const TCHAR * tpCurr, int iArray, long int & dwValue);
  83. TCHAR const * GetStringExp(int iExp);
  84. long int GetNumExp(void){return Expressions.Size();};
  85. BOOL IsExpString(int iExp);
  86. };
  87. //***************************************************************************
  88. //
  89. // CLASS NAME:
  90. //
  91. // CProvObj
  92. //
  93. // DESCRIPTION:
  94. //
  95. // The CProvObj class holds a an array of CTokens objects which together
  96. // contain the provider string.
  97. //
  98. //***************************************************************************
  99. class CProvObj : public CObject {
  100. private:
  101. CToken * GetTokenPointer(int iToken);
  102. CFlexArray myTokens;
  103. DWORD dwStatus;
  104. TCHAR m_cDelim;
  105. void Init(const TCHAR * ProviderString,const TCHAR cDelim);
  106. bool m_bUsesEscapes;
  107. public:
  108. DWORD dwGetStatus(int iMin);
  109. CProvObj(const WCHAR * ProviderString,const TCHAR cDelim, bool bUsesEscapes);
  110. #ifndef UNICODE
  111. CProvObj(const char * ProviderString,const TCHAR cDelim, bool bUsesEscapes);
  112. #endif
  113. const TCHAR * sGetToken(int iToken);
  114. const TCHAR * sGetFullToken(int iToken);
  115. const TCHAR * sGetStringExp(int iToken,int iExp);
  116. long int iGetIntExp(int iToken,int iExp, int iArray);
  117. BOOL IsExpString(int iToken,int iExp);
  118. long int iGetNumExp(int iToken);
  119. long int iGetNumTokens(void) {return myTokens.Size();};
  120. ~CProvObj(){Empty(); return;};
  121. void Empty();
  122. BOOL Update(WCHAR * pwcProvider);
  123. };
  124. //***************************************************************************
  125. //
  126. // CLASS NAME:
  127. //
  128. // CEntry and CHandleCache
  129. //
  130. // DESCRIPTION:
  131. //
  132. // The CEntry and CHandleCache objects provide an way
  133. // to cache handles and the path strings associated
  134. // with them.
  135. //
  136. //***************************************************************************
  137. class CEntry : public CObject {
  138. public:
  139. CEntry();
  140. ~CEntry();
  141. TString sPath;
  142. HANDLE hHandle;
  143. };
  144. class CHandleCache : public CObject {
  145. public:
  146. ~CHandleCache();
  147. BOOL IsRemote(void){return bRemote;};
  148. void SetRemote(BOOL bSet){bRemote = bSet;};
  149. long int lAddToList(const TCHAR * pAdd, HANDLE hAdd);
  150. long int lGetNumEntries(void){return List.Size();};
  151. long int lGetNumMatch(int iStart,int iTokenStart, CProvObj & Path);
  152. void Delete(long int lStart);
  153. HANDLE hGetHandle(long int lIndex);
  154. const TCHAR * sGetString(long int lIndex);
  155. private:
  156. CFlexArray List;
  157. BOOL bRemote;
  158. };
  159. #endif