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.

947 lines
25 KiB

  1. /*++
  2. Copyright (c) 1995-1996 Microsoft Corporation
  3. Module Name :
  4. wamxinfo.hxx (formerly seinfo.hxx)
  5. Abstract:
  6. Declaration of WAM_EXEC_INFO Object
  7. Author:
  8. Murali R. Krishnan ( MuraliK ) 17-July-1996
  9. Environment:
  10. User Mode - Win32
  11. Project:
  12. W3 Services DLL
  13. Revision History:
  14. --*/
  15. # ifndef _WAMXINFO_HXX_
  16. # define _WAMXINFO_HXX_
  17. /************************************************************
  18. * Include Headers
  19. ************************************************************/
  20. # include "isapip.hxx"
  21. # include "wamxbase.hxx"
  22. # include "iisext.h"
  23. # include "string.hxx"
  24. # include "WReqCore.hxx"
  25. # include "wamobj.hxx"
  26. # include "acache.hxx"
  27. # include <reftrace.h>
  28. //
  29. // This is private hack for us done by COM team
  30. //
  31. const IID IID_IComDispatchInfo =
  32. {0x000001d9,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
  33. MIDL_INTERFACE("000001d9-0000-0000-C000-000000000046")
  34. IComDispatchInfo : public IUnknown
  35. {
  36. public:
  37. virtual HRESULT STDMETHODCALLTYPE EnableComInits(
  38. /* [out] */ void __RPC_FAR *__RPC_FAR *ppvCookie) = 0;
  39. virtual HRESULT STDMETHODCALLTYPE DisableComInits(
  40. /* [in] */ void __RPC_FAR *pvCookie) = 0;
  41. };
  42. //
  43. // (Un)DoRevertHack
  44. //
  45. // To prevent RPC token cache from growing without limit (and aging), we
  46. // need to revert to self before calling back to inetinfo.exe.
  47. //
  48. // Now there is a new need to do this. As it turns out the performance
  49. // hit we take from RPC caching these tokens is very significant.
  50. // Ultimately we might want to implement a caching scheme ourselves so
  51. // that the token we use is always the same for the same user identity,
  52. // but that is a big change and this (although ugly) works
  53. // and has been tested for months.
  54. //
  55. inline VOID DoRevertHack( HANDLE * phToken )
  56. {
  57. NTSTATUS Status;
  58. HANDLE NewToken = NULL;
  59. if ( !*phToken )
  60. {
  61. return;
  62. }
  63. *phToken = INVALID_HANDLE_VALUE;
  64. Status = NtOpenThreadToken( NtCurrentThread(),
  65. TOKEN_IMPERSONATE,
  66. TRUE,
  67. phToken );
  68. if ( NT_SUCCESS( Status ) )
  69. {
  70. NtSetInformationThread( NtCurrentThread(),
  71. ThreadImpersonationToken,
  72. (PVOID)&NewToken,
  73. (ULONG)sizeof(HANDLE) );
  74. }
  75. else
  76. {
  77. *phToken = INVALID_HANDLE_VALUE;
  78. }
  79. }
  80. inline VOID UndoRevertHack( HANDLE * phToken )
  81. {
  82. if ( !*phToken || ( *phToken == INVALID_HANDLE_VALUE ) )
  83. {
  84. return;
  85. }
  86. NtSetInformationThread( NtCurrentThread(),
  87. ThreadImpersonationToken,
  88. (PVOID) phToken,
  89. (ULONG) sizeof( HANDLE ) );
  90. NtClose( *phToken );
  91. *phToken = INVALID_HANDLE_VALUE;
  92. }
  93. /************************************************************
  94. * Forward References
  95. ************************************************************/
  96. interface IWamRequest;
  97. /************************************************************
  98. * Useful shorthand
  99. ************************************************************/
  100. #define WRC_GET_SZ pWamExecInfo->_WamReqCore.GetSz
  101. #define WRC_GET_CCH pWamExecInfo->_WamReqCore.GetCch
  102. #define WRC_GET_FIX pWamExecInfo->_WamReqCore.m_WamReqCoreFixed
  103. //
  104. // WAM_EXEC_INFO from ECB
  105. //
  106. inline
  107. WAM_EXEC_INFO *
  108. QueryPWAM_EXEC_INFOfromPECB( EXTENSION_CONTROL_BLOCK *pECB )
  109. {
  110. return ( (WAM_EXEC_INFO *) ( pECB->ConnID ) );
  111. }
  112. /************************************************************
  113. * Type Definitions
  114. ************************************************************/
  115. class HTTP_REQUEST; // Forward reference
  116. class HSE_BASE; // Forward reference
  117. struct EXEC_DESCRIPTOR; // Forward reference
  118. #define WAM_EXEC_INFO_SIGNATURE (DWORD )'NIXW' // "WXIN" in debug
  119. #define WAM_EXEC_INFO_SIGNATURE_FREE (DWORD )'fIXW' // "WXIf" in debug
  120. /*++
  121. class WAM_EXEC_INFO
  122. o defines the Server Extension Information object.
  123. It contains all the information related to server extension
  124. calls made for a request.
  125. --*/
  126. class WAM_EXEC_INFO : public WAM_EXEC_BASE
  127. {
  128. public:
  129. WAM_REQ_CORE _WamReqCore;
  130. private:
  131. static ALLOC_CACHE_HANDLER * sm_pachExecInfo;
  132. public:
  133. // Init during DoGlobalInitializations
  134. static SV_CACHE_MAP * sm_pSVCacheMap;
  135. private:
  136. BOOL m_fCoInitSucceded;
  137. // Flag indicates that we are doing a disconnected cleanup, ie that
  138. // SendEntireResponseAndCleanup has been called, so the WAM_REQUEST
  139. // is no longer valid. Only AddRefs and Releases of the WAM_REQUEST
  140. // should be done once this flag is set.
  141. BOOL m_fDisconnected;
  142. // DEBUG ONLY MEMBERS - Don't add any member variables after this point
  143. // or you will be a biscuit head!
  144. #if DBG
  145. PTRACE_LOG m_pDbgRefTraceLog;
  146. static PTRACE_LOG sm_pDbgRefTraceLog;
  147. #endif
  148. public:
  149. // Constructor/Destructor
  150. WAM_EXEC_INFO
  151. (
  152. PWAM pWam
  153. );
  154. ~WAM_EXEC_INFO();
  155. HRESULT InitWamExecInfo
  156. (
  157. IWamRequest * pIWamRequest,
  158. DWORD cbWrcStrings,
  159. OOP_CORE_STATE * pOopCoreState
  160. );
  161. HRESULT GetInfoForName
  162. (
  163. IWamRequest * pIWamRequest,
  164. const unsigned char * szVarName,
  165. unsigned char * pchBuffer,
  166. DWORD cchBuffer,
  167. DWORD * pcchRequired
  168. );
  169. VOID Reset( );
  170. BOOL TransmitFile( LPHSE_TF_INFO pHseTf);
  171. BOOL AsyncReadClient( IN OUT PVOID pvBuff,
  172. IN DWORD * pcbBytes,
  173. IN DWORD dwFlags );
  174. BOOL ProcessAsyncReadOop( DWORD dwStatus,
  175. DWORD cbRead,
  176. unsigned char * lpDataRead
  177. );
  178. BOOL ProcessAsyncIO( DWORD dwStatus, DWORD cbWritten );
  179. VOID InitAsyncIO( DWORD dwIOType );
  180. VOID UninitAsyncIO();
  181. PWAM QueryPWam() const;
  182. BOOL IsValid();
  183. BOOL IsChild() const;
  184. BOOL NoHeaders() const;
  185. ULONG AddRef( );
  186. void CleanupAndRelease( BOOL fFullCleanup );
  187. ULONG Release( );
  188. // IWamRequest OOP caching per thread
  189. dllexp
  190. HRESULT ISAThreadNotify( BOOL fStart );
  191. // Access to ECB and its members
  192. inline EXTENSION_CONTROL_BLOCK *QueryPECB();
  193. inline DWORD QueryDwHttpStatusCode();
  194. inline VOID SetDwHttpStatusCode(DWORD);
  195. inline LPSTR QueryPszLogData();
  196. inline LPSTR QueryPszMethod();
  197. inline DWORD QueryCchMethod();
  198. inline LPSTR QueryPszQueryString();
  199. inline DWORD QueryCchQueryString();
  200. inline LPSTR QueryPszPathInfo();
  201. inline DWORD QueryCchPathInfo();
  202. inline LPSTR QueryPszPathTranslated();
  203. inline DWORD QueryCchPathTranslated();
  204. inline DWORD QueryCbTotalBytes();
  205. inline DWORD QueryCbAvailable();
  206. inline LPBYTE QueryPbData();
  207. inline LPSTR QueryPszContentType();
  208. inline DWORD QueryCchContentType();
  209. // Access to additional frequently used members not
  210. // in the original ECB
  211. inline HANDLE QueryImpersonationToken();
  212. inline LPSTR QueryPszApplnMDPath();
  213. inline DWORD QueryCchApplnMDPath();
  214. inline DWORD QueryHttpVersionMajor();
  215. inline DWORD QueryHttpVersionMinor();
  216. inline LPSTR QueryPszUserAgent();
  217. inline DWORD QueryCchUserAgent();
  218. inline LPSTR QueryPszCookie();
  219. inline DWORD QueryCchCookie();
  220. inline LPSTR QueryPszExpires();
  221. inline DWORD QueryCchExpires();
  222. inline DWORD QueryInstanceId();
  223. // Smart caching ISAPI (ASP) can use the following methods:
  224. // (requires cached m_pIWamReqSmartISA to be always available)
  225. inline BOOL GetServerVariable( LPSTR szVarName,
  226. LPVOID pvBuffer,
  227. LPDWORD pdwSize );
  228. inline BOOL SyncWriteClient( LPVOID pvBuffer, LPDWORD pdwBytes );
  229. inline BOOL SyncReadClient( LPVOID pvBuffer, LPDWORD pdwBytes );
  230. // Some SSF requests isolated into separate inlines
  231. inline BOOL SendHeader( LPVOID pvStatus,
  232. DWORD cchStatus,
  233. LPVOID pvHeader,
  234. DWORD cchHeader,
  235. BOOL fIsaKeepConn );
  236. inline BOOL SendEntireResponseOop(
  237. IN HSE_SEND_ENTIRE_RESPONSE_INFO * pHseResponseInfo
  238. );
  239. inline BOOL FDisconnected() { return m_fDisconnected; }
  240. inline BOOL SendEntireResponse(
  241. HSE_SEND_ENTIRE_RESPONSE_INFO * pHseResponseInfo
  242. );
  243. inline BOOL MapUrlToPath( LPVOID pvBuffer, LPDWORD pdwBytes );
  244. inline BOOL AppendLogParameter( LPVOID pvBuffer );
  245. // Loop-back for SSF requests not supported explicitely
  246. inline BOOL ServerSupportFunction( DWORD dwHSERequest,
  247. LPVOID pvData,
  248. LPDWORD pdwSize,
  249. LPDWORD pdwDataType );
  250. inline HRESULT GetAspMDData(
  251. IN unsigned char * pszMDPath
  252. , IN DWORD dwMDIdentifier
  253. , IN DWORD dwMDAttributes
  254. , IN DWORD dwMDUserType
  255. , IN DWORD dwMDDataType
  256. , IN DWORD dwMDDataLen
  257. , IN DWORD dwMDDataTag
  258. , OUT unsigned char * pbMDData
  259. , OUT DWORD * pdwRequiredBufferSize
  260. );
  261. inline HRESULT GetAspMDAllData(
  262. IN LPVOID pszMDPath
  263. , IN DWORD dwMDUserType
  264. , IN DWORD dwDefaultBufferSize
  265. , OUT LPVOID pvBuffer
  266. , OUT DWORD * pdwRequiredBufferSize
  267. , OUT DWORD * pdwNumDataEntries
  268. );
  269. inline BOOL GetCustomError(
  270. DWORD dwError,
  271. DWORD dwSubError,
  272. DWORD dwBufferSize,
  273. void *pvBuffer,
  274. DWORD *pdwRequiredBufferSize,
  275. BOOL *pfIsFileError
  276. );
  277. inline BOOL TestConnection(
  278. BOOL *pfIsConnected
  279. );
  280. inline BOOL LogEvent(
  281. DWORD dwEventId,
  282. unsigned char * szText
  283. );
  284. #if DBG
  285. ULONG DbgRefCount(VOID) const { return _cRefs; }
  286. #endif // DBG
  287. VOID Print( VOID) const;
  288. public:
  289. static void * operator new (size_t s);
  290. static void operator delete(void * psi);
  291. static BOOL InitClass( VOID);
  292. static VOID CleanupClass( VOID);
  293. VOID CleanupWamExecInfo( );
  294. }; // class WAM_EXEC_INFO
  295. //
  296. // WAM_EXEC_INFO inlines
  297. //
  298. inline PWAM WAM_EXEC_INFO::QueryPWam() const {
  299. return ( m_pWam );
  300. }
  301. inline BOOL WAM_EXEC_INFO::IsChild() const {
  302. return ( _dwChildExecFlags != 0 );
  303. }
  304. inline BOOL WAM_EXEC_INFO::NoHeaders() const {
  305. return (( _dwChildExecFlags & HSE_EXEC_NO_HEADERS ) != 0);
  306. }
  307. inline EXTENSION_CONTROL_BLOCK *WAM_EXEC_INFO::QueryPECB() {
  308. return ( &ecb );
  309. }
  310. // inlines to get to ECB members
  311. //
  312. inline DWORD WAM_EXEC_INFO::QueryDwHttpStatusCode() {
  313. return ( ecb.dwHttpStatusCode );
  314. }
  315. inline VOID WAM_EXEC_INFO::SetDwHttpStatusCode(DWORD dwStatus) {
  316. ecb.dwHttpStatusCode = dwStatus;
  317. }
  318. inline LPSTR WAM_EXEC_INFO::QueryPszLogData() {
  319. return ( ecb.lpszLogData );
  320. }
  321. inline LPSTR WAM_EXEC_INFO::QueryPszMethod() {
  322. return ( ecb.lpszMethod );
  323. }
  324. inline DWORD WAM_EXEC_INFO::QueryCchMethod() {
  325. return ( _WamReqCore.GetCch( WRC_I_METHOD ) );
  326. }
  327. inline LPSTR WAM_EXEC_INFO::QueryPszQueryString() {
  328. return ( ecb.lpszQueryString );
  329. }
  330. inline DWORD WAM_EXEC_INFO::QueryCchQueryString() {
  331. return ( _WamReqCore.GetCch( WRC_I_QUERY ) );
  332. }
  333. inline LPSTR WAM_EXEC_INFO::QueryPszPathInfo() {
  334. return ( ecb.lpszPathInfo );
  335. }
  336. inline DWORD WAM_EXEC_INFO::QueryCchPathInfo() {
  337. return ( _WamReqCore.GetCch( WRC_I_PATHINFO ) );
  338. }
  339. inline LPSTR WAM_EXEC_INFO::QueryPszPathTranslated() {
  340. return ( ecb.lpszPathTranslated );
  341. }
  342. inline DWORD WAM_EXEC_INFO::QueryCchPathTranslated() {
  343. return ( _WamReqCore.GetCch( WRC_I_PATHTRANS ) );
  344. }
  345. inline DWORD WAM_EXEC_INFO::QueryCbTotalBytes() {
  346. return ( ecb.cbTotalBytes );
  347. }
  348. inline DWORD WAM_EXEC_INFO::QueryCbAvailable() {
  349. return ( ecb.cbAvailable );
  350. }
  351. inline LPBYTE WAM_EXEC_INFO::QueryPbData() {
  352. return ( ecb.lpbData );
  353. }
  354. inline LPSTR WAM_EXEC_INFO::QueryPszContentType() {
  355. return ( ecb.lpszContentType );
  356. }
  357. inline DWORD WAM_EXEC_INFO::QueryCchContentType() {
  358. return ( _WamReqCore.GetCch( WRC_I_CONTENTTYPE ) );
  359. }
  360. // inlines to bypass ISPLOCAL logic for caching ISAPIs
  361. //
  362. inline HANDLE WAM_EXEC_INFO::QueryImpersonationToken() {
  363. return ( _WamReqCore.m_WamReqCoreFixed.m_hUserToken );
  364. }
  365. inline LPSTR WAM_EXEC_INFO::QueryPszApplnMDPath() {
  366. return ( _WamReqCore.GetSz( WRC_I_APPLMDPATH ) );
  367. }
  368. inline DWORD WAM_EXEC_INFO::QueryCchApplnMDPath() {
  369. return ( _WamReqCore.GetCch( WRC_I_APPLMDPATH ) );
  370. }
  371. inline DWORD WAM_EXEC_INFO::QueryHttpVersionMajor() {
  372. return ( ( _WamReqCore.m_WamReqCoreFixed.m_dwHttpVersion >> 16 ) & 0xFFFF );
  373. }
  374. inline DWORD WAM_EXEC_INFO::QueryHttpVersionMinor() {
  375. return ( _WamReqCore.m_WamReqCoreFixed.m_dwHttpVersion & 0xFFFF );
  376. }
  377. inline LPSTR WAM_EXEC_INFO::QueryPszUserAgent() {
  378. return ( _WamReqCore.GetSz( WRC_I_USERAGENT ) );
  379. }
  380. inline DWORD WAM_EXEC_INFO::QueryCchUserAgent() {
  381. return ( _WamReqCore.GetCch( WRC_I_USERAGENT ) );
  382. }
  383. inline LPSTR WAM_EXEC_INFO::QueryPszCookie() {
  384. return ( _WamReqCore.GetSz( WRC_I_COOKIE ) );
  385. }
  386. inline DWORD WAM_EXEC_INFO::QueryCchCookie() {
  387. return ( _WamReqCore.GetCch( WRC_I_COOKIE ) );
  388. }
  389. inline LPSTR WAM_EXEC_INFO::QueryPszExpires() {
  390. return ( _WamReqCore.GetSz( WRC_I_EXPIRES ) );
  391. }
  392. inline DWORD WAM_EXEC_INFO::QueryCchExpires() {
  393. return ( _WamReqCore.GetCch( WRC_I_EXPIRES ) );
  394. }
  395. inline DWORD WAM_EXEC_INFO::QueryInstanceId() {
  396. return ( _WamReqCore.m_WamReqCoreFixed.m_dwInstanceId );
  397. }
  398. inline BOOL WAM_EXEC_INFO::GetServerVariable(
  399. LPSTR szVarName,
  400. LPVOID pvBuffer,
  401. LPDWORD pdwSize
  402. )
  403. {
  404. BOOL bRet;
  405. // Needed to remove the "smart isa" optimization
  406. bRet = ecb.GetServerVariable( (HCONN)this,
  407. szVarName,
  408. pvBuffer,
  409. pdwSize
  410. );
  411. return bRet;
  412. }
  413. inline BOOL WAM_EXEC_INFO::SyncWriteClient(
  414. LPVOID pvBuffer,
  415. LPDWORD pdwBytes
  416. ) {
  417. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  418. if ( *pdwBytes == 0 ) {
  419. return TRUE;
  420. }
  421. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  422. DoRevertHack( &hCurrentUser );
  423. HRESULT hr = m_pIWamReqSmartISA->SyncWriteClient(
  424. *pdwBytes,
  425. (unsigned char *) pvBuffer,
  426. pdwBytes,
  427. HSE_IO_SYNC);
  428. UndoRevertHack( &hCurrentUser );
  429. return ( BoolFromHresult( hr ) );
  430. }
  431. inline BOOL WAM_EXEC_INFO::SyncReadClient(
  432. LPVOID pvBuffer,
  433. LPDWORD pdwBytes
  434. ) {
  435. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  436. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  437. DoRevertHack( &hCurrentUser );
  438. HRESULT hr = m_pIWamReqSmartISA->SyncReadClient(
  439. (unsigned char *) pvBuffer,
  440. *pdwBytes,
  441. pdwBytes );
  442. UndoRevertHack( &hCurrentUser );
  443. return ( BoolFromHresult( hr ) );
  444. }
  445. inline BOOL WAM_EXEC_INFO::SendHeader(
  446. LPVOID pvStatus,
  447. DWORD cchStatus,
  448. LPVOID pvHeader,
  449. DWORD cchHeader,
  450. BOOL fIsaKeepConn
  451. ) {
  452. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  453. DBG_ASSERT( cchStatus == (DWORD) lstrlen( (const char*) pvStatus) + 1 );
  454. DBG_ASSERT( cchHeader == (DWORD) lstrlen( (const char*) pvHeader) + 1 );
  455. HRESULT hr = NOERROR;
  456. if ( NoHeaders() ) {
  457. return TRUE;
  458. }
  459. if ( fIsaKeepConn ) {
  460. _dwIsaKeepConn = KEEPCONN_TRUE;
  461. } else {
  462. _dwIsaKeepConn = KEEPCONN_FALSE;
  463. }
  464. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  465. DoRevertHack( &hCurrentUser );
  466. hr = m_pIWamReqSmartISA->SendHeader(
  467. (unsigned char *) pvStatus,
  468. cchStatus,
  469. (unsigned char *) pvHeader,
  470. cchHeader,
  471. _dwIsaKeepConn );
  472. UndoRevertHack( &hCurrentUser );
  473. return ( BoolFromHresult( hr ) );
  474. }
  475. inline BOOL WAM_EXEC_INFO::SendEntireResponse(
  476. HSE_SEND_ENTIRE_RESPONSE_INFO * pHseResponseInfo
  477. ) {
  478. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  479. HRESULT hr = NOERROR;
  480. if ( !m_fInProcess ) {
  481. //
  482. // CONSIDER oop support
  483. //
  484. SetLastError( ERROR_INVALID_FUNCTION );
  485. return FALSE;
  486. }
  487. if ( pHseResponseInfo->HeaderInfo.fKeepConn ) {
  488. _dwIsaKeepConn = KEEPCONN_TRUE;
  489. } else {
  490. _dwIsaKeepConn = KEEPCONN_FALSE;
  491. }
  492. hr = m_pIWamReqSmartISA->SendEntireResponse(
  493. (unsigned char *) pHseResponseInfo
  494. );
  495. return ( BoolFromHresult( hr ) );
  496. }
  497. inline
  498. BOOL
  499. WAM_EXEC_INFO::SendEntireResponseOop(
  500. IN HSE_SEND_ENTIRE_RESPONSE_INFO * pHseResponseInfo
  501. )
  502. {
  503. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  504. DBG_ASSERT( m_fDisconnected == FALSE );
  505. DBG_ASSERT( pHseResponseInfo );
  506. DBG_ASSERT( !m_fInProcess );
  507. _dwIsaKeepConn = (pHseResponseInfo->HeaderInfo.fKeepConn)
  508. ? KEEPCONN_TRUE : KEEPCONN_FALSE;
  509. OOP_RESPONSE_INFO oopResponseInfo;
  510. DWORD cBuffersToSend = pHseResponseInfo->cWsaBuf - 1;
  511. // Init response info
  512. oopResponseInfo.cBuffers = cBuffersToSend;
  513. oopResponseInfo.rgBuffers =
  514. (OOP_RESPONSE_BUFFER *)(_alloca( cBuffersToSend * sizeof(OOP_RESPONSE_BUFFER) ));
  515. for( DWORD i = 0; i < cBuffersToSend; ++i )
  516. {
  517. oopResponseInfo.rgBuffers[i].cbBuffer = pHseResponseInfo->rgWsaBuf[i+1].len;
  518. oopResponseInfo.rgBuffers[i].pbBuffer = (LPBYTE)pHseResponseInfo->rgWsaBuf[i+1].buf;
  519. }
  520. HANDLE hCurrentUser = INVALID_HANDLE_VALUE;
  521. DoRevertHack( &hCurrentUser );
  522. HRESULT hr =
  523. m_pIWamReqSmartISA->SendEntireResponseAndCleanup(
  524. (LPBYTE)pHseResponseInfo->HeaderInfo.pszStatus,
  525. pHseResponseInfo->HeaderInfo.cchStatus,
  526. (LPBYTE)pHseResponseInfo->HeaderInfo.pszHeader,
  527. pHseResponseInfo->HeaderInfo.cchHeader,
  528. &oopResponseInfo,
  529. (unsigned char *)ecb.lpszLogData,
  530. strlen(ecb.lpszLogData) + 1,
  531. _dwIsaKeepConn,
  532. &m_fDisconnected
  533. );
  534. UndoRevertHack( &hCurrentUser );
  535. DBG_CODE(
  536. if( SUCCEEDED(hr) )
  537. {
  538. DBG_ASSERT( m_fDisconnected );
  539. }
  540. else
  541. {
  542. DBGPRINTF(( DBG_CONTEXT,
  543. "WAM_EXEC_INFO[%p]::SendEntireResponseAndCleanup() "
  544. "Failed hr=%08x, m_fDisconnected(%x)\n",
  545. this,
  546. hr,
  547. m_fDisconnected
  548. ));
  549. DBG_ASSERT( !m_fDisconnected );
  550. }
  551. );
  552. return BoolFromHresult( hr );
  553. }
  554. inline BOOL WAM_EXEC_INFO::MapUrlToPath(
  555. LPVOID pvBuffer,
  556. LPDWORD pdwBytes
  557. ) {
  558. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  559. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  560. DoRevertHack( &hCurrentUser );
  561. HRESULT hr = m_pIWamReqSmartISA->LookupVirtualRoot(
  562. (unsigned char *) pvBuffer,
  563. *pdwBytes,
  564. pdwBytes );
  565. UndoRevertHack( &hCurrentUser );
  566. return ( BoolFromHresult( hr ) );
  567. }
  568. inline BOOL WAM_EXEC_INFO::AppendLogParameter(
  569. LPVOID pvBuffer
  570. ) {
  571. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  572. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  573. DoRevertHack( &hCurrentUser );
  574. HRESULT hr = m_pIWamReqSmartISA->AppendLogParameter(
  575. (unsigned char *) pvBuffer );
  576. UndoRevertHack( &hCurrentUser );
  577. return ( BoolFromHresult( hr ) );
  578. }
  579. // SSF for requests not supported explicitely
  580. inline BOOL WAM_EXEC_INFO::ServerSupportFunction(
  581. DWORD dwHSERequest,
  582. LPVOID pvData,
  583. LPDWORD pdwSize,
  584. LPDWORD pdwDataType
  585. ) {
  586. BOOL bRet;
  587. // Some of the SSF requests are supported individually as
  588. // separate methods above. This is a catch-all for the
  589. // remaining methods. Please note that because this is
  590. // an inline, it is not any slower than calling the ECB's SSF
  591. bRet = ( ecb.ServerSupportFunction(
  592. (HCONN)this,
  593. dwHSERequest,
  594. pvData,
  595. pdwSize,
  596. pdwDataType ) );
  597. return bRet;
  598. }
  599. inline HRESULT WAM_EXEC_INFO::GetAspMDData(
  600. IN unsigned char * pszMDPath
  601. , IN DWORD dwMDIdentifier
  602. , IN DWORD dwMDAttributes
  603. , IN DWORD dwMDUserType
  604. , IN DWORD dwMDDataType
  605. , IN DWORD dwMDDataLen
  606. , IN DWORD dwMDDataTag
  607. , OUT unsigned char * pbMDData
  608. , OUT DWORD * pdwRequiredBufferSize
  609. )
  610. {
  611. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  612. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  613. DoRevertHack( &hCurrentUser );
  614. HRESULT hr = m_pIWamReqSmartISA->GetAspMDData(
  615. (unsigned char *) pszMDPath
  616. , dwMDIdentifier
  617. , dwMDAttributes
  618. , dwMDUserType
  619. , dwMDDataType
  620. , dwMDDataLen
  621. , dwMDDataTag
  622. , pbMDData
  623. , pdwRequiredBufferSize
  624. );
  625. UndoRevertHack( &hCurrentUser );
  626. return ( hr );
  627. }
  628. inline HRESULT WAM_EXEC_INFO::GetAspMDAllData(
  629. IN LPVOID pszMDPath
  630. , IN DWORD dwMDUserType
  631. , IN DWORD dwDefaultBufferSize
  632. , OUT LPVOID pvBuffer
  633. , OUT DWORD * pdwRequiredBufferSize
  634. , OUT DWORD * pdwNumDataEntries
  635. )
  636. {
  637. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  638. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  639. DoRevertHack( &hCurrentUser );
  640. HRESULT hr = m_pIWamReqSmartISA->GetAspMDAllData(
  641. (unsigned char *) pszMDPath
  642. , dwMDUserType
  643. , dwDefaultBufferSize
  644. , (unsigned char *) pvBuffer
  645. , pdwRequiredBufferSize
  646. , pdwNumDataEntries
  647. );
  648. UndoRevertHack( &hCurrentUser );
  649. return ( hr );
  650. }
  651. inline BOOL WAM_EXEC_INFO::GetCustomError(
  652. DWORD dwError,
  653. DWORD dwSubError,
  654. DWORD dwBufferSize,
  655. void *pvBuffer,
  656. DWORD *pdwRequiredBufferSize,
  657. BOOL *pfIsFileError
  658. )
  659. {
  660. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  661. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  662. DoRevertHack( &hCurrentUser );
  663. HRESULT hr = m_pIWamReqSmartISA->GetCustomError(
  664. dwError,
  665. dwSubError,
  666. dwBufferSize,
  667. (unsigned char *)pvBuffer,
  668. pdwRequiredBufferSize,
  669. pfIsFileError
  670. );
  671. UndoRevertHack( &hCurrentUser );
  672. return ( BoolFromHresult( hr ) );
  673. }
  674. inline BOOL WAM_EXEC_INFO::TestConnection(
  675. BOOL *pfIsConnected
  676. )
  677. {
  678. DBG_ASSERT( m_pIWamReqSmartISA != NULL );
  679. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  680. DoRevertHack( &hCurrentUser );
  681. HRESULT hr = m_pIWamReqSmartISA->TestConnection( pfIsConnected );
  682. UndoRevertHack( &hCurrentUser );
  683. return ( BoolFromHresult( hr ) );
  684. }
  685. inline BOOL WAM_EXEC_INFO::LogEvent(
  686. DWORD dwEventId,
  687. unsigned char * szText
  688. )
  689. {
  690. // Normally only asp has access to these methods, but LogEvent
  691. // is called when an exception is thrown from any extension
  692. // proc, so we need to make sure it has a valid IWamRequest
  693. HRESULT hr = NOERROR;
  694. IWamRequest * pIWamRequest = 0;
  695. hr = GetIWamRequest( &pIWamRequest );
  696. if( SUCCEEDED(hr) && pIWamRequest )
  697. {
  698. HANDLE hCurrentUser = m_fInProcess ? NULL : INVALID_HANDLE_VALUE;
  699. DoRevertHack( &hCurrentUser );
  700. hr = pIWamRequest->LogEvent( dwEventId, szText );
  701. ReleaseIWamRequest( pIWamRequest );
  702. UndoRevertHack( &hCurrentUser );
  703. }
  704. return ( BoolFromHresult( hr ) );
  705. }
  706. #if DBG
  707. # define DBG_WAMREQ_REFCOUNTS( args ) DbgWamreqRefcounts args
  708. void
  709. DbgWamreqRefcounts
  710. (
  711. char* szPrefix,
  712. WAM_EXEC_INFO * pWamExecInfo,
  713. long cRefsWamRequest = -1, // pass -1 to not assert
  714. long cRefsWamReqContext = -1 // pass -1 to not assert
  715. );
  716. #else // DBG
  717. # define DBG_WAMREQ_REFCOUNTS( args ) /* Nothing */
  718. #endif // DBG
  719. DWORD WAMExceptionFilter(
  720. EXCEPTION_POINTERS *xp,
  721. DWORD dwEventId,
  722. WAM_EXEC_INFO *p
  723. );
  724. # endif // _WAMXINFO_HXX_
  725. /************************ End of File ***********************/