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.

1005 lines
26 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ActiveScriptSite.cpp
  7. //
  8. // Description:
  9. // CActiveScript class implementation.
  10. //
  11. // Maintained By:
  12. // Ozan Ozhan (OzanO) 27-MAR-2002
  13. // Geoff Pease (GPease) 08-FEB-2000
  14. //
  15. //////////////////////////////////////////////////////////////////////////////
  16. #include "Pch.h"
  17. #include "ResourceObject.h"
  18. #include "ActiveScriptSite.h"
  19. DEFINE_THISCLASS( "CActiveScriptSite" );
  20. //////////////////////////////////////////////////////////////////////
  21. //
  22. // Constructor
  23. //
  24. //////////////////////////////////////////////////////////////////////
  25. CActiveScriptSite::CActiveScriptSite(
  26. RESOURCE_HANDLE hResourceIn
  27. , PLOG_EVENT_ROUTINE plerIn
  28. , HKEY hkeyIn
  29. , LPCWSTR pszNameIn
  30. )
  31. : m_cRef( 1 )
  32. , m_hResource( hResourceIn )
  33. , m_pler( plerIn )
  34. , m_hkey( hkeyIn )
  35. , m_pszName( pszNameIn )
  36. {
  37. TraceFunc( "" );
  38. Assert( m_punkResource == 0 );
  39. TraceFuncExit();
  40. } //*** CActiveScriptSite::CActiveScriptSite
  41. //////////////////////////////////////////////////////////////////////
  42. //
  43. // Destructor
  44. //
  45. //////////////////////////////////////////////////////////////////////
  46. CActiveScriptSite::~CActiveScriptSite( void )
  47. {
  48. TraceFunc( "" );
  49. // Don't close m_hkey.
  50. // Don't free m_pszName
  51. if ( m_punkResource != NULL )
  52. {
  53. m_punkResource->Release();
  54. }
  55. TraceFuncExit();
  56. } //*** CActiveScriptSite::~CActiveScriptSite
  57. //****************************************************************************
  58. //
  59. // IUnknown
  60. //
  61. //****************************************************************************
  62. //////////////////////////////////////////////////////////////////////////////
  63. //
  64. // STDMETHODIMP
  65. // CScriptResource::[IUnknown] QueryInterface(
  66. // REFIID riid,
  67. // LPVOID * ppv
  68. // )
  69. //
  70. //////////////////////////////////////////////////////////////////////////////
  71. STDMETHODIMP
  72. CActiveScriptSite::QueryInterface(
  73. REFIID riidIn
  74. , void ** ppvOut
  75. )
  76. {
  77. TraceQIFunc( riidIn, ppvOut );
  78. HRESULT hr = S_OK;
  79. if ( riidIn == IID_IUnknown )
  80. {
  81. *ppvOut = TraceInterface( __THISCLASS__, IUnknown, (IActiveScriptSite*) this, 0 );
  82. }
  83. else if ( riidIn == IID_IActiveScriptSite )
  84. {
  85. *ppvOut = TraceInterface( __THISCLASS__, IActiveScriptSite, (IActiveScriptSite*) this, 0 );
  86. }
  87. else if ( riidIn == IID_IActiveScriptSiteInterruptPoll )
  88. {
  89. *ppvOut = TraceInterface( __THISCLASS__, IActiveScriptSiteInterruptPoll, (IActiveScriptSiteInterruptPoll*) this, 0 );
  90. }
  91. else if ( riidIn == IID_IActiveScriptSiteWindow )
  92. {
  93. *ppvOut = TraceInterface( __THISCLASS__, IActiveScriptSiteWindow, (IActiveScriptSiteWindow*) this, 0 );
  94. }
  95. else if ( riidIn == IID_IDispatchEx )
  96. {
  97. *ppvOut = TraceInterface( __THISCLASS__, IDispatchEx, (IDispatchEx*) this, 0 );
  98. }
  99. else if ( riidIn == IID_IDispatch )
  100. {
  101. *ppvOut = TraceInterface( __THISCLASS__, IDispatch, (IDispatchEx*) this, 0 );
  102. }
  103. else
  104. {
  105. *ppvOut = NULL;
  106. hr = E_NOINTERFACE;
  107. }
  108. if ( SUCCEEDED( hr ) )
  109. {
  110. ((IUnknown *) *ppvOut)->AddRef();
  111. }
  112. QIRETURN2( hr, riidIn, IID_IActiveScriptSiteDebug32, IID_IActiveScriptSiteDebug64 );
  113. } //*** CActiveScriptSite::QueryInterface
  114. //////////////////////////////////////////////////////////////////////////////
  115. //
  116. // STDMETHODIMP_( ULONG )
  117. // CScriptResource::[IUnknown] AddRef( void )
  118. //
  119. //////////////////////////////////////////////////////////////////////////////
  120. STDMETHODIMP_( ULONG )
  121. CActiveScriptSite::AddRef( void )
  122. {
  123. TraceFunc( "[IUnknown]" );
  124. InterlockedIncrement( &m_cRef );
  125. CRETURN( m_cRef );
  126. } //*** CActiveScriptSite::AddRef
  127. //////////////////////////////////////////////////////////////////////////////
  128. //
  129. // STDMETHODIMP_( ULONG )
  130. // CScriptResource::[IUnknown] Release( void )
  131. //
  132. //////////////////////////////////////////////////////////////////////////////
  133. STDMETHODIMP_( ULONG )
  134. CActiveScriptSite::Release( void )
  135. {
  136. TraceFunc( "[IUnknown]" );
  137. LONG cRef;
  138. cRef = InterlockedDecrement( &m_cRef );
  139. if ( cRef == 0 )
  140. {
  141. TraceDo( delete this );
  142. }
  143. CRETURN( cRef );
  144. } //*** CActiveScriptSite::Release
  145. //****************************************************************************
  146. //
  147. // IActiveScriptSite
  148. //
  149. //****************************************************************************
  150. //////////////////////////////////////////////////////////////////////////////
  151. //
  152. // STDMETHODIMP
  153. // CActiveScriptSite::GetLCID(
  154. // LCID *plcid // out
  155. // )
  156. //
  157. //////////////////////////////////////////////////////////////////////////////
  158. STDMETHODIMP
  159. CActiveScriptSite::GetLCID(
  160. LCID * plcid // out
  161. )
  162. {
  163. TraceFunc( "[IActiveScriptSite]" );
  164. HRESULT hr = S_FALSE;
  165. if ( plcid == NULL )
  166. {
  167. hr = THR( E_POINTER );
  168. goto Cleanup;
  169. }
  170. Cleanup:
  171. HRETURN( hr ); // use system-defined locale
  172. } //*** CActiveScriptSite::GetLCID
  173. //////////////////////////////////////////////////////////////////////////////
  174. //
  175. // STDMETHODIMP
  176. // CActiveScriptSite::GetItemInfo(
  177. // LPCOLESTR pstrName, // in
  178. // DWORD dwReturnMask, // in
  179. // IUnknown **ppiunkItem, // out
  180. // ITypeInfo **ppti // out
  181. // )
  182. //
  183. //////////////////////////////////////////////////////////////////////////////
  184. STDMETHODIMP
  185. CActiveScriptSite::GetItemInfo(
  186. LPCOLESTR pstrName // in
  187. , DWORD dwReturnMask // in
  188. , IUnknown ** ppiunkItem // out
  189. , ITypeInfo ** ppti // out
  190. )
  191. {
  192. TraceFunc( "[IActiveScriptSite]" );
  193. HRESULT hr;
  194. if ( ( dwReturnMask & SCRIPTINFO_IUNKNOWN ) && ( ppiunkItem == NULL ) )
  195. {
  196. hr = THR( E_POINTER );
  197. goto Cleanup;
  198. }
  199. if ( ( dwReturnMask & SCRIPTINFO_ITYPEINFO ) && ( ppti == NULL ) )
  200. {
  201. hr = THR( E_POINTER );
  202. goto Cleanup;
  203. }
  204. if ( pstrName == NULL )
  205. {
  206. hr = THR( E_INVALIDARG );
  207. goto Cleanup;
  208. }
  209. hr = TYPE_E_ELEMENTNOTFOUND;
  210. if ( ClRtlStrICmp( pstrName, L"Resource" ) == 0 )
  211. {
  212. if ( dwReturnMask & SCRIPTINFO_IUNKNOWN )
  213. {
  214. if ( m_punkResource == NULL )
  215. {
  216. m_punkResource = new CResourceObject( m_hResource, m_pler, m_hkey, m_pszName );
  217. if ( m_punkResource == NULL )
  218. {
  219. hr = THR( E_OUTOFMEMORY );
  220. goto Cleanup;
  221. }
  222. //
  223. // No need to AddRef() as the constructor does that for us.
  224. //
  225. }
  226. hr = m_punkResource->TypeSafeQI( IUnknown, ppiunkItem );
  227. }
  228. if ( SUCCEEDED( hr ) && ( dwReturnMask & SCRIPTINFO_ITYPEINFO ) )
  229. {
  230. *ppti = NULL;
  231. hr = THR( E_FAIL );
  232. }
  233. }
  234. Cleanup:
  235. HRETURN( hr );
  236. } //*** CActiveScriptSite::GetItemInfo
  237. //////////////////////////////////////////////////////////////////////////////
  238. //
  239. // STDMETHODIMP
  240. // CActiveScriptSite::GetDocVersionString(
  241. // BSTR *pbstrVersion // out
  242. // )
  243. //
  244. //////////////////////////////////////////////////////////////////////////////
  245. STDMETHODIMP
  246. CActiveScriptSite::GetDocVersionString(
  247. BSTR * pbstrVersion // out
  248. )
  249. {
  250. TraceFunc( "[IActiveScriptSite]" );
  251. HRESULT hr = S_OK;
  252. if ( pbstrVersion == NULL )
  253. {
  254. hr = THR( E_POINTER );
  255. goto Cleanup;
  256. }
  257. *pbstrVersion = SysAllocString( L"Cluster Scripting Host Version 1.0" );
  258. if ( *pbstrVersion == NULL )
  259. {
  260. hr = THR( E_OUTOFMEMORY );
  261. goto Cleanup;
  262. }
  263. Cleanup:
  264. HRETURN( hr );
  265. } //*** CActiveScriptSite::GetDocVersionString
  266. //////////////////////////////////////////////////////////////////////////////
  267. //
  268. // STDMETHODIMP
  269. // CActiveScriptSite::OnScriptTerminate(
  270. // const VARIANT *pvarResult, // in
  271. // const EXCEPINFO *pexcepinfo // in
  272. // )
  273. //
  274. //////////////////////////////////////////////////////////////////////////////
  275. STDMETHODIMP
  276. CActiveScriptSite::OnScriptTerminate(
  277. const VARIANT * pvarResult // in
  278. , const EXCEPINFO * pexcepinfo // in
  279. )
  280. {
  281. TraceFunc( "[IActiveScriptSite]" );
  282. HRETURN( S_OK ); // nothing to do
  283. } //*** CActiveScriptSite::OnScriptTerminate
  284. //////////////////////////////////////////////////////////////////////////////
  285. //
  286. // STDMETHODIMP
  287. // CActiveScriptSite::OnStateChange(
  288. // SCRIPTSTATE ssScriptState // in
  289. // )
  290. //
  291. //////////////////////////////////////////////////////////////////////////////
  292. STDMETHODIMP
  293. CActiveScriptSite::OnStateChange(
  294. SCRIPTSTATE ssScriptState // in
  295. )
  296. {
  297. TraceFunc( "[IActiveScriptSite]" );
  298. #if defined(DEBUG)
  299. //
  300. // We don't really care.
  301. //
  302. switch ( ssScriptState )
  303. {
  304. case SCRIPTSTATE_UNINITIALIZED:
  305. TraceMsg( mtfCALLS, "OnStateChange: Uninitialized\n" );
  306. break;
  307. case SCRIPTSTATE_INITIALIZED:
  308. TraceMsg( mtfCALLS, "OnStateChange: Initialized\n" );
  309. break;
  310. case SCRIPTSTATE_STARTED:
  311. TraceMsg( mtfCALLS, "OnStateChange: Started\n" );
  312. break;
  313. case SCRIPTSTATE_CONNECTED:
  314. TraceMsg( mtfCALLS, "OnStateChange: Connected\n" );
  315. break;
  316. case SCRIPTSTATE_DISCONNECTED:
  317. TraceMsg( mtfCALLS, "OnStateChange: Disconnected\n" );
  318. break;
  319. case SCRIPTSTATE_CLOSED:
  320. TraceMsg( mtfCALLS, "OnStateChange: Closed\n" );
  321. break;
  322. default:
  323. TraceMsg( mtfCALLS, "OnStateChange: Unknown value\n" );
  324. break;
  325. }
  326. #endif // defined(DEBUG)
  327. HRETURN( S_OK );
  328. } //*** CActiveScriptSite::OnStateChange
  329. //////////////////////////////////////////////////////////////////////////////
  330. //
  331. // STDMETHODIMP
  332. // CActiveScriptSite::OnScriptError(
  333. // IActiveScriptError *pscripterror // in
  334. // )
  335. //
  336. //////////////////////////////////////////////////////////////////////////////
  337. STDMETHODIMP
  338. CActiveScriptSite::OnScriptError(
  339. IActiveScriptError * pscripterror // in
  340. )
  341. {
  342. TraceFunc( "[IActiveScriptSite]" );
  343. HRESULT hr;
  344. BSTR bstrSourceLine = NULL;
  345. DWORD dwSourceContext;
  346. ULONG ulLineNumber;
  347. LONG lCharacterPosition;
  348. EXCEPINFO excepinfo;
  349. hr = THR( pscripterror->GetSourcePosition( &dwSourceContext, &ulLineNumber, &lCharacterPosition ) );
  350. // Should this be handled?
  351. hr = THR( pscripterror->GetSourceLineText( &bstrSourceLine ) );
  352. if (SUCCEEDED( hr ))
  353. {
  354. TraceMsg( mtfCALLS, "Script Error: Line=%u, Character=%u: %s\n", ulLineNumber, lCharacterPosition, bstrSourceLine );
  355. (ClusResLogEvent)( m_hResource,
  356. LOG_ERROR,
  357. L"Script Error: Line=%1!u!, Character=%2!u!: %3\n",
  358. ulLineNumber,
  359. lCharacterPosition,
  360. bstrSourceLine
  361. );
  362. SysFreeString( bstrSourceLine );
  363. }
  364. else
  365. {
  366. TraceMsg( mtfCALLS, "Script Error: ulLineNumber = %u, lCharacter = %u\n", ulLineNumber, lCharacterPosition );
  367. (ClusResLogEvent)( m_hResource,
  368. LOG_ERROR,
  369. L"Script Error: Line=%1!u!, Character = %2!u!\n",
  370. ulLineNumber,
  371. lCharacterPosition
  372. );
  373. }
  374. hr = THR( pscripterror->GetExceptionInfo( &excepinfo ) );
  375. if (SUCCEEDED( hr ))
  376. {
  377. if ( excepinfo.bstrSource )
  378. {
  379. TraceMsg( mtfCALLS, "Source: %s\n", excepinfo.bstrSource );
  380. (ClusResLogEvent)( m_hResource, LOG_ERROR, L"Source: %1\n", excepinfo.bstrSource );
  381. }
  382. if ( excepinfo.bstrDescription )
  383. {
  384. TraceMsg( mtfCALLS, "Description: %s\n", excepinfo.bstrDescription );
  385. (ClusResLogEvent)( m_hResource, LOG_ERROR, L"Description: %1\n", excepinfo.bstrDescription );
  386. }
  387. if ( excepinfo.bstrHelpFile )
  388. {
  389. TraceMsg( mtfCALLS, "Help File: %s\n", excepinfo.bstrHelpFile );
  390. (ClusResLogEvent)( m_hResource, LOG_ERROR, L"Help File: %1\n", excepinfo.bstrHelpFile );
  391. }
  392. hr = THR( excepinfo.scode );
  393. }
  394. HRETURN( S_FALSE );
  395. } //*** CActiveScriptSite::OnScriptError
  396. //////////////////////////////////////////////////////////////////////////////
  397. //
  398. // STDMETHODIMP
  399. // CActiveScriptSite::OnEnterScript( void )
  400. //
  401. //////////////////////////////////////////////////////////////////////////////
  402. STDMETHODIMP
  403. CActiveScriptSite::OnEnterScript( void )
  404. {
  405. TraceFunc( "[IActiveScriptSite]" );
  406. HRETURN( S_OK );
  407. } //*** CActiveScriptSite::OnEnterScript
  408. //////////////////////////////////////////////////////////////////////////////
  409. //
  410. // STDMETHODIMP
  411. // CActiveScriptSite::OnLeaveScript( void )
  412. //
  413. //////////////////////////////////////////////////////////////////////////////
  414. STDMETHODIMP
  415. CActiveScriptSite::OnLeaveScript( void )
  416. {
  417. TraceFunc( "[IActiveScriptSite]" );
  418. HRETURN( S_OK );
  419. } //*** CActiveScript::OnLeaveScript
  420. //****************************************************************************
  421. //
  422. // IActiveScriptSiteInterruptPoll
  423. //
  424. //****************************************************************************
  425. //////////////////////////////////////////////////////////////////////////////
  426. //
  427. // STDMETHODIMP
  428. // CActiveScriptSite::QueryContinue( void )
  429. //
  430. //////////////////////////////////////////////////////////////////////////////
  431. STDMETHODIMP
  432. CActiveScriptSite::QueryContinue( void )
  433. {
  434. TraceFunc( "[IActiveScriptSiteInterruptPoll]" );
  435. HRETURN( S_OK );
  436. } //*** CActiveScriptSite::QueryContinue
  437. //****************************************************************************
  438. //
  439. // IActiveScriptSiteWindow
  440. //
  441. //****************************************************************************
  442. //////////////////////////////////////////////////////////////////////////////
  443. //
  444. // STDMETHODIMP
  445. // CActiveScriptSite::GetWindow(
  446. // HWND *phwnd // out
  447. // )
  448. //
  449. //////////////////////////////////////////////////////////////////////////////
  450. STDMETHODIMP
  451. CActiveScriptSite::GetWindow(
  452. HWND * phwnd // out
  453. )
  454. {
  455. TraceFunc( "[IActiveScriptSiteInterruptPoll]" );
  456. HRESULT hr = S_OK;
  457. if ( phwnd == NULL )
  458. {
  459. hr = THR( E_POINTER );
  460. goto Cleanup;
  461. }
  462. *phwnd = NULL; // desktop;
  463. Cleanup:
  464. HRETURN( S_OK );
  465. } //*** CActiveScriptSite::GetWindow
  466. //////////////////////////////////////////////////////////////////////////////
  467. //
  468. // STDMETHODIMP
  469. // CActiveScriptSite::EnableModeless(
  470. // BOOL fEnable // in
  471. // )
  472. //
  473. //////////////////////////////////////////////////////////////////////////////
  474. STDMETHODIMP
  475. CActiveScriptSite::EnableModeless(
  476. BOOL fEnable // in
  477. )
  478. {
  479. TraceFunc( "[IActiveScriptSiteInterruptPoll]" );
  480. HRETURN( S_OK );
  481. } //*** CActiveScriptSite::EnableModeless
  482. //****************************************************************************
  483. //
  484. // IDispatch
  485. //
  486. //****************************************************************************
  487. //////////////////////////////////////////////////////////////////////////////
  488. //
  489. // STDMETHODIMP
  490. // CActiveScriptSite::GetTypeInfoCount(
  491. // UINT * pctinfo // out
  492. // )
  493. //
  494. //////////////////////////////////////////////////////////////////////////////
  495. STDMETHODIMP
  496. CActiveScriptSite::GetTypeInfoCount(
  497. UINT * pctinfo // out
  498. )
  499. {
  500. TraceFunc( "[Dispatch]" );
  501. HRESULT hr = E_NOTIMPL;
  502. if ( pctinfo == NULL )
  503. {
  504. hr = THR( E_POINTER );
  505. goto Cleanup;
  506. }
  507. *pctinfo = 0;
  508. Cleanup:
  509. HRETURN( hr );
  510. } //*** CActiveScriptSite::GetTypeInfoCount
  511. //////////////////////////////////////////////////////////////////////////////
  512. //
  513. // STDMETHODIMP
  514. // CActiveScriptSite::GetTypeInfo(
  515. // UINT iTInfo, // in
  516. // LCID lcid, // in
  517. // ITypeInfo * * ppTInfo // out
  518. // )
  519. //
  520. //////////////////////////////////////////////////////////////////////////////
  521. STDMETHODIMP
  522. CActiveScriptSite::GetTypeInfo(
  523. UINT iTInfo // in
  524. , LCID lcid // in
  525. , ITypeInfo ** ppTInfo // out
  526. )
  527. {
  528. TraceFunc( "[Dispatch]" );
  529. HRESULT hr = E_NOTIMPL;
  530. if ( ppTInfo == NULL )
  531. {
  532. hr = THR( E_POINTER );
  533. goto Cleanup;
  534. }
  535. *ppTInfo = NULL;
  536. Cleanup:
  537. HRETURN( hr );
  538. } //*** CActiveScriptSite::GetTypeInfo
  539. //////////////////////////////////////////////////////////////////////////////
  540. //
  541. // STDMETHODIMP
  542. // CActiveScriptSite::GetIDsOfNames(
  543. // REFIID riid, // in
  544. // LPOLESTR * rgszNames, // in
  545. // UINT cNames, // in
  546. // LCID lcid, // in
  547. // DISPID * rgDispId // out
  548. // )
  549. //
  550. //////////////////////////////////////////////////////////////////////////////
  551. STDMETHODIMP
  552. CActiveScriptSite::GetIDsOfNames(
  553. REFIID riid // in
  554. , LPOLESTR * rgszNames // in
  555. , UINT cNames // in
  556. , LCID lcid // in
  557. , DISPID * rgDispId // out
  558. )
  559. {
  560. TraceFunc( "[Dispatch]" );
  561. HRESULT hr = E_NOTIMPL;
  562. ZeroMemory( rgDispId, cNames * sizeof(DISPID) );
  563. HRETURN( hr );
  564. } //*** CActiveScriptSite::GetIDsOfNames
  565. //////////////////////////////////////////////////////////////////////////////
  566. //
  567. // STDMETHODIMP
  568. // CActiveScriptSite::Invoke(
  569. // DISPID dispIdMember, // in
  570. // REFIID riid, // in
  571. // LCID lcid, // in
  572. // WORD wFlags, // in
  573. // DISPPARAMS *pDispParams, // out in
  574. // VARIANT *pVarResult, // out
  575. // EXCEPINFO *pExcepInfo, // out
  576. // UINT *puArgErr // out
  577. // )
  578. //
  579. //////////////////////////////////////////////////////////////////////////////
  580. STDMETHODIMP
  581. CActiveScriptSite::Invoke(
  582. DISPID dispIdMember // in
  583. , REFIID riid // in
  584. , LCID lcid // in
  585. , WORD wFlags // in
  586. , DISPPARAMS * pDispParams // out in
  587. , VARIANT * pVarResult // out
  588. , EXCEPINFO * pExcepInfo // out
  589. , UINT * puArgErr // out
  590. )
  591. {
  592. TraceFunc( "[Dispatch]" );
  593. HRESULT hr = E_NOTIMPL;
  594. HRETURN( hr );
  595. } //*** CActiveScript::Invoke
  596. //****************************************************************************
  597. //
  598. // IDispatchEx
  599. //
  600. //****************************************************************************
  601. //////////////////////////////////////////////////////////////////////////////
  602. //
  603. // STDMETHODIMP
  604. // CActiveScriptSite::GetDispID(
  605. // BSTR bstrName, // in
  606. // DWORD grfdex, //in
  607. // DISPID *pid //out
  608. // )
  609. //
  610. //////////////////////////////////////////////////////////////////////////////
  611. STDMETHODIMP
  612. CActiveScriptSite::GetDispID(
  613. BSTR bstrName // in
  614. , DWORD grfdex // in
  615. , DISPID * pid // out
  616. )
  617. {
  618. TraceFunc( "[DispatchEx]" );
  619. HRESULT hr = S_OK;
  620. if ( pid == NULL )
  621. {
  622. hr = THR( E_POINTER );
  623. goto Cleanup;
  624. }
  625. if ( ClRtlStrICmp( bstrName, L"Resource" ) == 0 )
  626. {
  627. *pid = 0;
  628. }
  629. else
  630. {
  631. hr = DISP_E_UNKNOWNNAME;
  632. }
  633. Cleanup:
  634. HRETURN( hr );
  635. } //*** CActiveScript::GetDiskID
  636. //////////////////////////////////////////////////////////////////////////////
  637. //
  638. // STDMETHODIMP
  639. // CActiveScriptSite::InvokeEx(
  640. // DISPID id, // in
  641. // LCID lcid, // in
  642. // WORD wFlags, // in
  643. // DISPPARAMS *pdp, // in
  644. // VARIANT *pvarRes, // out
  645. // EXCEPINFO *pei, // out
  646. // IServiceProvider *pspCaller // in
  647. // )
  648. //
  649. //////////////////////////////////////////////////////////////////////////////
  650. STDMETHODIMP
  651. CActiveScriptSite::InvokeEx(
  652. DISPID id // in
  653. , LCID lcid // in
  654. , WORD wFlags // in
  655. , DISPPARAMS * pdp // in
  656. , VARIANT * pvarRes // out
  657. , EXCEPINFO * pei // out
  658. , IServiceProvider * pspCaller // in
  659. )
  660. {
  661. TraceFunc2( "[DispatchEx] id = %u, ..., wFlags = 0x%08x, ...", id, wFlags );
  662. HRESULT hr = S_OK;
  663. switch ( id )
  664. {
  665. case 0:
  666. pvarRes->vt = VT_DISPATCH;
  667. hr = THR( QueryInterface( IID_IDispatch, (void **) &pvarRes->pdispVal ) );
  668. break;
  669. default:
  670. hr = THR( DISP_E_MEMBERNOTFOUND );
  671. break;
  672. }
  673. HRETURN( hr );
  674. } //*** CActiveScriptSite::InvokeEx
  675. //////////////////////////////////////////////////////////////////////////////
  676. //
  677. // STDMETHODIMP
  678. // CActiveScriptSite::DeleteMemberByName(
  679. // BSTR bstr, // in
  680. // DWORD grfdex // in
  681. // )
  682. //
  683. //////////////////////////////////////////////////////////////////////////////
  684. STDMETHODIMP
  685. CActiveScriptSite::DeleteMemberByName(
  686. BSTR bstr // in
  687. , DWORD grfdex // in
  688. )
  689. {
  690. TraceFunc( "[DispatchEx]" );
  691. HRESULT hr = E_NOTIMPL;
  692. HRETURN( hr );
  693. } //*** CActiveScriptSite::DeleteMemberByName
  694. //////////////////////////////////////////////////////////////////////////////
  695. //
  696. // STDMETHODIMP
  697. // CActiveScriptSite::DeleteMemberByDispID(
  698. // DISPID id // in
  699. // )
  700. //
  701. //////////////////////////////////////////////////////////////////////////////
  702. STDMETHODIMP
  703. CActiveScriptSite::DeleteMemberByDispID(
  704. DISPID id // in
  705. )
  706. {
  707. TraceFunc1( "[DispatchEx] id = %u", id );
  708. HRESULT hr = E_NOTIMPL;
  709. HRETURN( hr );
  710. } //*** CActiveScriptSite::DeleteMemberByDiskID
  711. //////////////////////////////////////////////////////////////////////////////
  712. //
  713. // STDMETHODIMP
  714. // CActiveScriptSite::GetMemberProperties(
  715. // DISPID id, // in
  716. // DWORD grfdexFetch, // in
  717. // DWORD * pgrfdex // out
  718. // )
  719. //
  720. //////////////////////////////////////////////////////////////////////////////
  721. STDMETHODIMP
  722. CActiveScriptSite::GetMemberProperties(
  723. DISPID id // in
  724. , DWORD grfdexFetch // in
  725. , DWORD * pgrfdex // out
  726. )
  727. {
  728. TraceFunc2( "[DispatchEx] id = %u, grfdexFetch = 0x%08x", id, grfdexFetch );
  729. HRESULT hr = E_NOTIMPL;
  730. HRETURN( hr );
  731. } //*** CActiveScriptSite::GetMemberProperties
  732. //////////////////////////////////////////////////////////////////////////////
  733. //
  734. // STDMETHODIMP
  735. // CActiveScriptSite::GetMemberName(
  736. // DISPID id, // in
  737. // BSTR * pbstrName // out
  738. // )
  739. //
  740. //////////////////////////////////////////////////////////////////////////////
  741. STDMETHODIMP
  742. CActiveScriptSite::GetMemberName(
  743. DISPID id // in
  744. , BSTR * pbstrName // out
  745. )
  746. {
  747. TraceFunc1( "[DispatchEx] id = %u", id );
  748. HRESULT hr = E_NOTIMPL;
  749. HRETURN( hr );
  750. } //*** CActiveScriptSite::GetMemberName
  751. //////////////////////////////////////////////////////////////////////////////
  752. //
  753. // STDMETHODIMP
  754. // CActiveScriptSite::GetNextDispID(
  755. // DWORD grfdex, // in
  756. // DISPID id, // in
  757. // DISPID * pid // out
  758. // )
  759. //
  760. //////////////////////////////////////////////////////////////////////////////
  761. STDMETHODIMP
  762. CActiveScriptSite::GetNextDispID(
  763. DWORD grfdex // in
  764. , DISPID id // in
  765. , DISPID * pid // out
  766. )
  767. {
  768. TraceFunc2( "[DispatchEx] grfdex = 0x%08x, id = %u, ...", grfdex, id );
  769. HRESULT hr = E_NOTIMPL;
  770. HRETURN( hr );
  771. } //*** CActiveScriptSite::GetNextDiskID
  772. //////////////////////////////////////////////////////////////////////////////
  773. //
  774. // STDMETHODIMP
  775. // CActiveScriptSite::GetNameSpaceParent(
  776. // IUnknown * * ppunk // out
  777. // )
  778. //
  779. //////////////////////////////////////////////////////////////////////////////
  780. STDMETHODIMP
  781. CActiveScriptSite::GetNameSpaceParent(
  782. IUnknown ** ppunk // out
  783. )
  784. {
  785. TraceFunc( "[DispatchEx]" );
  786. HRESULT hr = E_NOTIMPL;
  787. if ( ppunk == NULL )
  788. {
  789. hr = THR( E_POINTER );
  790. goto Cleanup;
  791. }
  792. *ppunk = NULL;
  793. Cleanup:
  794. HRETURN( hr );
  795. } //*** CActiveScriptSite::GetNameSpaceParent
  796. //****************************************************************************
  797. //
  798. // Private Methods
  799. //
  800. //****************************************************************************
  801. //////////////////////////////////////////////////////////////////////////////
  802. //
  803. // STDMETHODIMP
  804. // CActiveScriptSite::LogError(
  805. // HRESULT hrIn
  806. // )
  807. //
  808. //////////////////////////////////////////////////////////////////////////////
  809. STDMETHODIMP
  810. CActiveScriptSite::LogError(
  811. HRESULT hrIn
  812. )
  813. {
  814. TraceFunc1( "hrIn = 0x%08x", hrIn );
  815. HRESULT hr = S_OK;
  816. TraceMsg( mtfCALLS, "HRESULT: 0x%08x\n", hrIn );
  817. (ClusResLogEvent)( m_hResource, LOG_ERROR, L"HRESULT: 0x%1!08x!.\n", hrIn );
  818. HRETURN( hr );
  819. } //*** CActiveScriptSite::LogError
  820. //****************************************************************************
  821. //
  822. // Automation Methods
  823. //
  824. //****************************************************************************