Source code of Windows XP (NT5)
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.

332 lines
9.2 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1996 Microsoft Corporation. All Rights Reserved.
  5. Component: CIsapiReqInfo Object
  6. File: IsapiReq.h
  7. Owner: AndyMorr
  8. ===================================================================*/
  9. #ifndef ISAPIREQ_H
  10. #define ISAPIREQ_H
  11. #include <iadmw.h>
  12. #if _IIS_5_1
  13. #include <wamxinfo.hxx>
  14. #else
  15. #include <string.hxx>
  16. #endif
  17. #include "memcls.h"
  18. /*
  19. Mappings of CIsapiReqInfo methods to the proper routines based
  20. on the UNICODE setting
  21. */
  22. #ifdef UNICODE
  23. #define QueryPszPathInfo QueryPszPathInfoW
  24. #define QueryCchPathInfo QueryCchPathInfoW
  25. #define QueryPszPathTranslated QueryPszPathTranslatedW
  26. #define QueryCchPathTranslated QueryCchPathTranslatedW
  27. #define QueryPszApplnMDPath QueryPszApplnMDPathW
  28. #define QueryCchApplnMDPath QueryCchApplnMDPathW
  29. #define MapUrlToPath MapUrlToPathW
  30. #define GetCustomError GetCustomErrorW
  31. #define GetAspMDData GetAspMDDataW
  32. #define GetAspMDAllData GetAspMDAllDataW
  33. #define GetServerVariable GetServerVariableW
  34. #else
  35. #define QueryPszPathInfo QueryPszPathInfoA
  36. #define QueryCchPathInfo QueryCchPathInfoA
  37. #define QueryPszPathTranslated QueryPszPathTranslatedA
  38. #define QueryCchPathTranslated QueryCchPathTranslatedA
  39. #define QueryPszApplnMDPath QueryPszApplnMDPathA
  40. #define QueryCchApplnMDPath QueryCchApplnMDPathA
  41. #define MapUrlToPath MapUrlToPathA
  42. #define GetCustomError GetCustomErrorA
  43. #define GetAspMDData GetAspMDDataA
  44. #define GetAspMDAllData GetAspMDAllDataA
  45. #define GetServerVariable GetServerVariableA
  46. #endif
  47. /*===================================================================
  48. C I s a p i R e q I n f o
  49. Class which encapsulates Request info we need from the ISAPI interface.
  50. Information either comes from the public ISAPI interfaces (SSE and
  51. ServerVariables) or from the private WAM_EXEC_INFO.
  52. ===================================================================*/
  53. class CIsapiReqInfo {
  54. private:
  55. LONG m_cRefs;
  56. #if _IIS_5_1
  57. // Associated WAM_EXEC_INFO (for browser requests)
  58. WAM_EXEC_INFO *m_pWXI;
  59. #endif
  60. EXTENSION_CONTROL_BLOCK *m_pECB;
  61. int m_cchQueryString;
  62. int m_cchApplnMDPathA;
  63. int m_cchPathTranslatedA;
  64. int m_cchPathInfoA;
  65. int m_cchApplnMDPathW;
  66. int m_cchPathTranslatedW;
  67. int m_cchPathInfoW;
  68. DWORD m_fApplnMDPathAInited : 1;
  69. DWORD m_fApplnMDPathWInited : 1;
  70. DWORD m_fPathInfoWInited : 1;
  71. DWORD m_fPathTranslatedWInited : 1;
  72. DWORD m_fCookieInited : 1;
  73. DWORD m_fUserAgentInited : 1;
  74. DWORD m_fInstanceIDInited : 1;
  75. DWORD m_fVersionInited : 1;
  76. DWORD m_fFKeepConnInited : 1;
  77. DWORD m_dwInstanceID;
  78. DWORD m_dwVersionMajor;
  79. DWORD m_dwVersionMinor;
  80. BOOL m_fKeepConn;
  81. BUFFER m_ApplnMDPathA;
  82. BUFFER m_ApplnMDPathW;
  83. BUFFER m_PathInfoW;
  84. BUFFER m_PathTranslatedW;
  85. BUFFER m_Cookie;
  86. BUFFER m_UserAgent;
  87. IMSAdminBase *m_pIAdminBase;
  88. public:
  89. CIsapiReqInfo(EXTENSION_CONTROL_BLOCK *pECB) {
  90. m_cRefs = 1;
  91. m_fApplnMDPathAInited = 0;
  92. m_fApplnMDPathWInited = 0;
  93. m_fPathInfoWInited = 0;
  94. m_fPathTranslatedWInited = 0;
  95. m_fCookieInited = 0;
  96. m_fUserAgentInited = 0;
  97. m_fInstanceIDInited = 0;
  98. m_fVersionInited = 0;
  99. m_fFKeepConnInited = 0;
  100. m_dwInstanceID = 0;
  101. m_dwVersionMajor = 1;
  102. m_dwVersionMinor = 0;
  103. m_cchQueryString = -1;
  104. m_cchApplnMDPathA = -1;
  105. m_cchPathTranslatedA = -1;
  106. m_cchPathInfoA = -1;
  107. m_cchApplnMDPathW = -1;
  108. m_cchPathTranslatedW = -1;
  109. m_cchPathInfoW = -1;
  110. m_fKeepConn = FALSE;
  111. m_pIAdminBase = NULL;
  112. #if _IIS_5_1
  113. m_pWXI = QueryPWAM_EXEC_INFOfromPECB(pECB);
  114. #endif
  115. m_pECB = pECB;
  116. }
  117. ~CIsapiReqInfo() {
  118. if (m_pIAdminBase != NULL) {
  119. m_pIAdminBase->Release();
  120. m_pIAdminBase = NULL;
  121. }
  122. }
  123. LONG AddRef() {
  124. return InterlockedIncrement(&m_cRefs);
  125. }
  126. LONG Release() {
  127. LONG cRefs = InterlockedDecrement(&m_cRefs);
  128. if (cRefs == 0) {
  129. delete this;
  130. }
  131. return cRefs;
  132. }
  133. #if _IIS_5_1
  134. EXTENSION_CONTROL_BLOCK *ECB() { return &m_pWXI->ecb; }
  135. #else
  136. EXTENSION_CONTROL_BLOCK *ECB() { return m_pECB; }
  137. #endif
  138. LPSTR QueryPszQueryString();
  139. DWORD QueryCchQueryString();
  140. LPSTR QueryPszApplnMDPathA();
  141. DWORD QueryCchApplnMDPathA();
  142. LPWSTR QueryPszApplnMDPathW();
  143. DWORD QueryCchApplnMDPathW();
  144. LPSTR QueryPszPathInfoA();
  145. DWORD QueryCchPathInfoA();
  146. LPWSTR QueryPszPathInfoW();
  147. DWORD QueryCchPathInfoW();
  148. LPSTR QueryPszPathTranslatedA();
  149. DWORD QueryCchPathTranslatedA();
  150. LPWSTR QueryPszPathTranslatedW();
  151. DWORD QueryCchPathTranslatedW();
  152. LPSTR QueryPszCookie();
  153. VOID SetDwHttpStatusCode( DWORD dwStatus );
  154. LPBYTE QueryPbData();
  155. DWORD QueryCbAvailable();
  156. DWORD QueryCbTotalBytes();
  157. LPSTR QueryPszContentType();
  158. LPSTR QueryPszMethod();
  159. LPSTR QueryPszUserAgent();
  160. DWORD QueryInstanceId();
  161. BOOL IsChild();
  162. BOOL FInPool();
  163. DWORD QueryHttpVersionMajor();
  164. DWORD QueryHttpVersionMinor();
  165. HRESULT ISAThreadNotify( BOOL fStart );
  166. HRESULT GetAspMDDataA(CHAR * pszMDPath,
  167. DWORD dwMDIdentifier,
  168. DWORD dwMDAttributes,
  169. DWORD dwMDUserType,
  170. DWORD dwMDDataType,
  171. DWORD dwMDDataLen,
  172. DWORD dwMDDataTag,
  173. unsigned char * pbMDData,
  174. DWORD * pdwRequiredBufferSize);
  175. HRESULT GetAspMDDataW(WCHAR * pszMDPath,
  176. DWORD dwMDIdentifier,
  177. DWORD dwMDAttributes,
  178. DWORD dwMDUserType,
  179. DWORD dwMDDataType,
  180. DWORD dwMDDataLen,
  181. DWORD dwMDDataTag,
  182. unsigned char * pbMDData,
  183. DWORD * pdwRequiredBufferSize);
  184. HRESULT GetAspMDAllDataA(CHAR * pszMDPath,
  185. DWORD dwMDUserType,
  186. DWORD dwDefaultBufferSize,
  187. LPVOID pvBuffer,
  188. DWORD * pdwRequiredBufferSize,
  189. DWORD * pdwNumDataEntries);
  190. HRESULT GetAspMDAllDataW(WCHAR * pszMDPath,
  191. DWORD dwMDUserType,
  192. DWORD dwDefaultBufferSize,
  193. LPVOID pvBuffer,
  194. DWORD * pdwRequiredBufferSize,
  195. DWORD * pdwNumDataEntries);
  196. BOOL GetCustomErrorA(DWORD dwError,
  197. DWORD dwSubError,
  198. DWORD dwBufferSize,
  199. CHAR *pvBuffer,
  200. DWORD *pdwRequiredBufferSize,
  201. BOOL *pfIsFileError);
  202. BOOL GetCustomErrorW(DWORD dwError,
  203. DWORD dwSubError,
  204. DWORD dwBufferSize,
  205. WCHAR *pvBuffer,
  206. DWORD *pdwRequiredBufferSize,
  207. BOOL *pfIsFileError);
  208. HANDLE QueryImpersonationToken();
  209. HRESULT AppendLogParameter( LPSTR szExtraParam );
  210. BOOL SendHeader(LPVOID pvStatus,
  211. DWORD cchStatus,
  212. LPVOID pvHeader,
  213. DWORD cchHeader,
  214. BOOL fIsaKeepConn);
  215. BOOL GetServerVariableA(LPSTR szVarName,
  216. LPSTR pBuffer,
  217. LPDWORD pdwSize );
  218. BOOL GetServerVariableW(LPSTR szVarName,
  219. LPWSTR pBuffer,
  220. LPDWORD pdwSize);
  221. BOOL ServerSupportFunction(DWORD dwHSERequest,
  222. LPVOID pvData,
  223. LPDWORD pdwSize,
  224. LPDWORD pdwDataType);
  225. BOOL SendEntireResponseOop(IN HSE_SEND_ENTIRE_RESPONSE_INFO * pHseResponseInfo);
  226. BOOL SendEntireResponse(IN HSE_SEND_ENTIRE_RESPONSE_INFO * pHseResponseInfo);
  227. BOOL TestConnection(BOOL *pfIsConnected);
  228. BOOL MapUrlToPathA(LPSTR pBuffer, LPDWORD pdwBytes);
  229. BOOL MapUrlToPathW(LPWSTR pBuffer, LPDWORD pdwBytes);
  230. BOOL SyncReadClient(LPVOID pvBuffer, LPDWORD pdwBytes );
  231. BOOL SyncWriteClient(LPVOID pvBuffer, LPDWORD pdwBytes);
  232. private:
  233. void InitVersionInfo();
  234. IMSAdminBase *GetMetabaseIF();
  235. BOOL InternalGetServerVariable(LPSTR pszVar, BUFFER *pBuffer);
  236. BOOL FKeepConn();
  237. // Cache on per-class basis
  238. ACACHE_INCLASS_DEFINITIONS()
  239. };
  240. #endif