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.

1213 lines
30 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name :
  4. logscripting.cpp
  5. Abstract:
  6. LogScripting.cpp : Implementation of CLogScripting
  7. Automation compatible logging interface
  8. Author:
  9. Saurab Nog ( saurabn ) 01-Feb-1998
  10. Project:
  11. IIS Logging 5.0
  12. --*/
  13. #include "stdafx.h"
  14. #include "script.h"
  15. #include <initguid.h>
  16. #include <InetCom.h>
  17. #include <LogType.h>
  18. #include <ILogObj.hxx>
  19. #include <limits.h>
  20. #include <iadmw.h>
  21. #include <iiscnfg.h>
  22. #include <atlimpl.cpp>
  23. #include "LogScripting.h"
  24. const int MB_TIMEOUT = 5000;
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CLogScripting
  27. CLogScripting::CLogScripting(VOID)
  28. :
  29. m_iNumPlugins ( -1),
  30. m_iReadPlugin ( -1),
  31. m_iWritePlugin ( -1),
  32. m_pPluginInfo ( NULL),
  33. m_fDirectory ( false),
  34. m_fEndOfReadRecords ( true),
  35. m_StartDateTime ( LONG_MIN),
  36. m_EndDateTime ( LONG_MAX),
  37. m_hDirSearchHandle ( INVALID_HANDLE_VALUE)
  38. {
  39. m_wcsReadFileName[0] = 0;
  40. m_wcsReadDirectoryName[0] = 0;
  41. }
  42. /* ************************************************************************* */
  43. /* ************************************************************************* */
  44. HRESULT CLogScripting::FinalConstruct()
  45. {
  46. m_pMBCom = NULL;
  47. ::CoCreateInstance(GETAdminBaseCLSID(TRUE), NULL, CLSCTX_LOCAL_SERVER,
  48. IID_IMSAdminBase, (void **)(&m_pMBCom));
  49. if (m_pMBCom)
  50. {
  51. CreateAllPlugins();
  52. }
  53. return S_OK;
  54. }
  55. /* ************************************************************************* */
  56. /* ************************************************************************* */
  57. void CLogScripting::FinalRelease()
  58. {
  59. if ( m_pMBCom )
  60. {
  61. m_pMBCom->Release();
  62. m_pMBCom = NULL;
  63. }
  64. for(int i=0; i< m_iNumPlugins; i++)
  65. {
  66. if ( NULL != m_pPluginInfo[i].pILogScripting)
  67. {
  68. m_pPluginInfo[i].pILogScripting->CloseLogFiles(AllOpenFiles);
  69. m_pPluginInfo[i].pILogScripting->Release();
  70. m_pPluginInfo[i].pILogScripting = NULL;
  71. }
  72. }
  73. }
  74. /////////////////////////////////////////////////////////////////////////////
  75. /////////////////////////////////////////////////////////////////////////////
  76. //
  77. // Private Methods of CLogScripting
  78. //
  79. /////////////////////////////////////////////////////////////////////////////
  80. /////////////////////////////////////////////////////////////////////////////
  81. int CLogScripting:: CreateAllPlugins()
  82. {
  83. int i,j = 0;
  84. HRESULT hr;
  85. typedef ILogScripting *pILogScripting;
  86. m_iNumPlugins = 0;
  87. if (GetListOfAvailablePlugins() && (m_iNumPlugins > 0))
  88. {
  89. //
  90. // Load all the plugins
  91. //
  92. for (i=j=0; i<m_iNumPlugins; i++)
  93. {
  94. hr = ::CoCreateInstance(m_pPluginInfo[i].clsid, NULL, CLSCTX_INPROC_SERVER,
  95. IID_ILogScripting, (void **)(& m_pPluginInfo[i].pILogScripting));
  96. if (SUCCEEDED(hr))
  97. {
  98. j++;
  99. }
  100. else
  101. {
  102. m_pPluginInfo[i].pILogScripting = NULL;
  103. }
  104. }
  105. }
  106. return j; // Number of plugins successfully created.
  107. }
  108. /* ************************************************************************* */
  109. /* ************************************************************************* */
  110. bool CLogScripting::GetListOfAvailablePlugins()
  111. {
  112. USES_CONVERSION;
  113. m_pPluginInfo = new PLUGIN_INFO[4];
  114. if( m_pPluginInfo == NULL )
  115. {
  116. return false;
  117. }
  118. wcscpy(m_pPluginInfo[0].wcsFriendlyName, L"NCSA Common Log File Format");
  119. CLSIDFromString(A2W(NCSALOG_CLSID), &m_pPluginInfo[0].clsid);
  120. wcscpy(m_pPluginInfo[1].wcsFriendlyName, L"ODBC Logging");
  121. CLSIDFromString(A2W(ODBCLOG_CLSID), &m_pPluginInfo[1].clsid);
  122. wcscpy(m_pPluginInfo[2].wcsFriendlyName, L"Microsoft IIS Log File Format");
  123. CLSIDFromString(A2W(ASCLOG_CLSID), &m_pPluginInfo[2].clsid);
  124. wcscpy(m_pPluginInfo[3].wcsFriendlyName, L"W3C Extended Log File Format");
  125. CLSIDFromString(A2W(EXTLOG_CLSID), &m_pPluginInfo[3].clsid);
  126. m_iNumPlugins = 4;
  127. return true;
  128. }
  129. /* ************************************************************************* */
  130. /* ************************************************************************* */
  131. bool CLogScripting::GetNextFileName()
  132. {
  133. WIN32_FIND_DATAW stFindFileData;
  134. PFileListEntry pFileInfo;
  135. if (NULL == m_hDirSearchHandle)
  136. {
  137. return false;
  138. }
  139. if (INVALID_HANDLE_VALUE == m_hDirSearchHandle)
  140. {
  141. //
  142. // This is the first/new call. Clean up file Q by removing old file information.
  143. //
  144. while(! m_fQueue.empty())
  145. {
  146. pFileInfo = m_fQueue.top();
  147. m_fQueue.pop();
  148. delete pFileInfo;
  149. }
  150. //
  151. // Loop till we enumerate all files in this directory
  152. //
  153. WCHAR wcsSearchPath[MAX_PATH+1];
  154. wcscpy(wcsSearchPath, m_wcsReadDirectoryName);
  155. wcscat(wcsSearchPath, L"\\*");
  156. if (m_hDirSearchHandle)
  157. {
  158. FindClose(m_hDirSearchHandle);
  159. }
  160. m_hDirSearchHandle = FindFirstFileW(wcsSearchPath, &stFindFileData);
  161. do
  162. {
  163. if (! (stFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
  164. {
  165. pFileInfo = new FileListEntry;
  166. pFileInfo->Copy(stFindFileData);
  167. m_fQueue.push(pFileInfo);
  168. }
  169. }
  170. while ( FindNextFileW(m_hDirSearchHandle, &stFindFileData) );
  171. }
  172. //
  173. // Pop the lowest timestamp file
  174. //
  175. pFileInfo = NULL;
  176. if (! m_fQueue.empty())
  177. {
  178. pFileInfo = m_fQueue.top();
  179. m_fQueue.pop();
  180. }
  181. if (NULL == pFileInfo)
  182. {
  183. //
  184. // We have run out of files or some error occured. Prevent another search.
  185. //
  186. FindClose(m_hDirSearchHandle);
  187. m_hDirSearchHandle = NULL;
  188. m_wcsReadFileName[0] = 0;
  189. return false;
  190. }
  191. else
  192. {
  193. wcscpy(m_wcsReadFileName, m_wcsReadDirectoryName);
  194. wcscat(m_wcsReadFileName, L"\\");
  195. wcscat(m_wcsReadFileName, pFileInfo->wcsFileName);
  196. delete pFileInfo;
  197. return true;
  198. }
  199. }
  200. /* ************************************************************************* */
  201. /* ************************************************************************* */
  202. int CLogScripting::ParseLogFile()
  203. {
  204. if (m_wcsReadFileName[0] == 0)
  205. {
  206. return INVALID_PLUGIN;
  207. }
  208. //
  209. // Linear search thru all plugins
  210. //
  211. for(int i=0; i < m_iNumPlugins; i++)
  212. {
  213. if ( m_pPluginInfo[i].pILogScripting != NULL )
  214. {
  215. m_pPluginInfo[i].pILogScripting->OpenLogFile(
  216. W2BSTR(m_wcsReadFileName),
  217. ForReading,
  218. L"",
  219. 0,
  220. L""
  221. );
  222. if ( SUCCEEDED(m_pPluginInfo[i].pILogScripting->ReadLogRecord()) )
  223. {
  224. return i;
  225. }
  226. m_pPluginInfo[i].pILogScripting->CloseLogFiles(ForReading);
  227. }
  228. }
  229. //
  230. // None of the registered plugins knows how to read the log file. Sorry !!
  231. //
  232. return INVALID_PLUGIN;
  233. }
  234. /* ************************************************************************* */
  235. /* ************************************************************************* */
  236. HRESULT CLogScripting::InternalReadLogRecord()
  237. {
  238. DATE logDateTime = 0;
  239. HRESULT hr = HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS);
  240. if (!m_fDirectory)
  241. {
  242. //
  243. // Simple case. Not a directory.
  244. //
  245. if ( INVALID_PLUGIN == m_iReadPlugin )
  246. {
  247. //
  248. // First use. Find a plugin to read the file.
  249. //
  250. if ( (m_iReadPlugin = ParseLogFile()) != INVALID_PLUGIN)
  251. {
  252. hr = S_OK;
  253. }
  254. }
  255. else
  256. {
  257. //
  258. // Read next record
  259. //
  260. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->ReadLogRecord();
  261. }
  262. }
  263. else
  264. {
  265. //
  266. // Directory case
  267. //
  268. if (m_iReadPlugin != INVALID_PLUGIN)
  269. {
  270. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->ReadLogRecord();
  271. if (SUCCEEDED(hr))
  272. {
  273. goto returnlabel;
  274. }
  275. }
  276. //
  277. // Either this is the first use or the last read failed
  278. //
  279. while (GetNextFileName())
  280. {
  281. if ( (m_iReadPlugin = ParseLogFile()) != INVALID_PLUGIN)
  282. {
  283. hr = S_OK;
  284. break;
  285. }
  286. }
  287. }
  288. returnlabel:
  289. return hr;
  290. }
  291. /////////////////////////////////////////////////////////////////////////////
  292. /////////////////////////////////////////////////////////////////////////////
  293. //
  294. // Methods of ILogRead
  295. //
  296. /////////////////////////////////////////////////////////////////////////////
  297. /////////////////////////////////////////////////////////////////////////////
  298. STDMETHODIMP
  299. CLogScripting::OpenLogFile(
  300. BSTR szLogFileName,
  301. IOMode Mode,
  302. BSTR szServiceName,
  303. long iServiceInstance,
  304. BSTR szOutputLogFileFormat
  305. )
  306. {
  307. DWORD dwFileAttrib;
  308. HRESULT hr = E_INVALIDARG;
  309. WCHAR szFilePath[MAX_PATH+1];
  310. BOOL fHasFileName = (( NULL != szLogFileName) && ( 0 != szLogFileName[0]));
  311. BOOL fHasServiceName = (( NULL != szServiceName) && ( 0 != szServiceName[0]));
  312. BOOL fHasOutputFormatName = (( NULL != szOutputLogFileFormat) &&
  313. ( 0 != szOutputLogFileFormat[0]));
  314. CloseLogFiles(Mode);
  315. if (ForReading == Mode)
  316. {
  317. //
  318. // If the File Name isn't specified but Service Name & ID are, get
  319. // the appropriate log directory and use that as the log file name.
  320. //
  321. if ( (!fHasFileName) && fHasServiceName && ( 0 != iServiceInstance))
  322. {
  323. METADATA_HANDLE hMeta = NULL;
  324. METADATA_RECORD mdRecord;
  325. WCHAR szTemp[MAX_PATH+1] = L"/LM/";
  326. DWORD dwRequiredLen;
  327. if (m_pMBCom == NULL)
  328. {
  329. hr = E_FAIL;
  330. goto cleanup;
  331. }
  332. if (wcslen(szServiceName) > MAX_PATH+1 - sizeof("/LM//4294967296"))
  333. {
  334. hr = E_INVALIDARG;
  335. goto cleanup;
  336. }
  337. wcscat(szTemp, szServiceName);
  338. wcscat(szTemp, L"/");
  339. _ltow(iServiceInstance, szTemp+wcslen(szTemp),10);
  340. hr = m_pMBCom->OpenKey( METADATA_MASTER_ROOT_HANDLE, szTemp,
  341. METADATA_PERMISSION_READ, MB_TIMEOUT, &hMeta);
  342. if ( FAILED(hr))
  343. {
  344. goto cleanup;
  345. }
  346. //
  347. // prepare the metadata record for reading
  348. //
  349. mdRecord.dwMDIdentifier = MD_LOGFILE_DIRECTORY;
  350. mdRecord.dwMDAttributes = METADATA_INHERIT;
  351. mdRecord.dwMDUserType = IIS_MD_UT_SERVER;
  352. mdRecord.dwMDDataType = EXPANDSZ_METADATA;
  353. mdRecord.pbMDData = (PBYTE)szTemp;
  354. mdRecord.dwMDDataLen = MAX_PATH;
  355. hr = m_pMBCom->GetData(hMeta, L"", &mdRecord, &dwRequiredLen);
  356. m_pMBCom->CloseKey(hMeta);
  357. if ( FAILED(hr))
  358. {
  359. goto cleanup;
  360. }
  361. //
  362. // Expand system variables used in this path.
  363. //
  364. if (ExpandEnvironmentStringsW(szTemp, szFilePath, MAX_PATH+1) != 0)
  365. {
  366. if ( wcslen(szFilePath) > MAX_PATH-wcslen(szServiceName)-10 )
  367. {
  368. hr = E_OUTOFMEMORY;
  369. goto cleanup;
  370. }
  371. wcscat(szFilePath,L"\\");
  372. wcscat(szFilePath,szServiceName);
  373. _ltow(iServiceInstance, szFilePath+wcslen(szFilePath),10);
  374. wcscat(szFilePath,L"\\");
  375. szLogFileName = szFilePath;
  376. }
  377. }
  378. }
  379. //
  380. // At this point szLogFileName should be defined.
  381. //
  382. hr = E_INVALIDARG;
  383. if ( (NULL == szLogFileName ) || ( 0 == szLogFileName[0]) ||
  384. ((ForReading != Mode ) && (ForWriting != Mode))
  385. )
  386. {
  387. goto cleanup;
  388. }
  389. if (ForReading == Mode)
  390. {
  391. //
  392. // Reset EOF flag
  393. //
  394. m_fEndOfReadRecords = false;
  395. //
  396. // Check if this is a valid file and/or a directory
  397. //
  398. if ( 0xFFFFFFFF != (dwFileAttrib = GetFileAttributesW(szLogFileName)) )
  399. {
  400. if (dwFileAttrib & FILE_ATTRIBUTE_DIRECTORY)
  401. {
  402. // This is a directory
  403. m_fDirectory = true;
  404. wcscpy(m_wcsReadDirectoryName, szLogFileName);
  405. }
  406. else
  407. {
  408. wcscpy(m_wcsReadFileName, szLogFileName);
  409. }
  410. hr = S_OK;
  411. }
  412. else
  413. {
  414. // couldn't get file attributes. check for error code
  415. hr = HRESULT_FROM_WIN32(GetLastError());
  416. }
  417. }
  418. else
  419. {
  420. //
  421. // Find the correct plugin & set the value. If user didn't specify file format use W3C
  422. //
  423. if ( ( NULL == szOutputLogFileFormat) ||
  424. ( 0 == *szOutputLogFileFormat)
  425. )
  426. {
  427. //
  428. // Search based on the clsid of W3C Logging
  429. //
  430. for(int i=0; i< m_iNumPlugins; i++)
  431. {
  432. if ( (CLSID_EXTLOG == m_pPluginInfo[i].clsid) &&
  433. (NULL != m_pPluginInfo[i].pILogScripting)
  434. )
  435. {
  436. m_iWritePlugin = i;
  437. break;
  438. }
  439. }
  440. }
  441. else
  442. {
  443. //
  444. // Search based on format name provided by the user
  445. //
  446. for(int i=0; i< m_iNumPlugins; i++)
  447. {
  448. if ( (0 == _wcsicmp(m_pPluginInfo[i].wcsFriendlyName,
  449. szOutputLogFileFormat)) &&
  450. (NULL != m_pPluginInfo[i].pILogScripting)
  451. )
  452. {
  453. m_iWritePlugin = i;
  454. break;
  455. }
  456. }
  457. }
  458. if (0 <= m_iWritePlugin)
  459. {
  460. hr = m_pPluginInfo[m_iWritePlugin].pILogScripting->OpenLogFile(
  461. W2BSTR(szLogFileName),
  462. Mode,
  463. L"",
  464. 0,
  465. L"");
  466. }
  467. }
  468. cleanup:
  469. /*
  470. fix for bug 364649:
  471. No need to do that becuase oleaut does some thicks with mem allocation and free.
  472. That's true for both cscirtp and ASP, so I choose to remove these deltions. Even if
  473. I am wrong, and it necesasry to free somehow that string, it is better to leak ~20 bytes than
  474. AV or currupt memory while deleting what was not allocated by sysallocstring
  475. if (fHasFileName)
  476. {
  477. SysFreeString(szLogFileName);
  478. }
  479. if (fHasServiceName)
  480. {
  481. SysFreeString(szServiceName);
  482. }
  483. if (fHasOutputFormatName)
  484. {
  485. SysFreeString(szOutputLogFileFormat);
  486. }
  487. */
  488. return hr;
  489. }
  490. /* ************************************************************************* */
  491. /* ************************************************************************* */
  492. STDMETHODIMP
  493. CLogScripting::CloseLogFiles(IOMode Mode)
  494. {
  495. if ((ForReading == Mode) || (AllOpenFiles == Mode))
  496. {
  497. if (m_iReadPlugin != INVALID_PLUGIN)
  498. {
  499. m_pPluginInfo[m_iReadPlugin].pILogScripting->CloseLogFiles(ForReading);
  500. }
  501. m_iReadPlugin = INVALID_PLUGIN; // Reset Plugin in Use
  502. m_fDirectory = false;
  503. m_hDirSearchHandle = INVALID_HANDLE_VALUE; // Reset Search Handle
  504. m_wcsReadFileName[0] = 0;
  505. m_wcsReadDirectoryName[0] = 0;
  506. }
  507. if ((ForWriting == Mode) || (AllOpenFiles == Mode))
  508. {
  509. if (m_iWritePlugin != INVALID_PLUGIN)
  510. {
  511. m_pPluginInfo[m_iWritePlugin].pILogScripting->CloseLogFiles(ForWriting);
  512. }
  513. m_iWritePlugin = INVALID_PLUGIN; // Reset Plugin in Use
  514. }
  515. return S_OK;
  516. }
  517. /* ************************************************************************* */
  518. /* ************************************************************************* */
  519. STDMETHODIMP
  520. CLogScripting::ReadFilter( DATE startDateTime, DATE endDateTime)
  521. {
  522. m_StartDateTime = startDateTime;
  523. m_EndDateTime = endDateTime;
  524. return S_OK;
  525. }
  526. /* ************************************************************************* */
  527. /* ************************************************************************* */
  528. STDMETHODIMP
  529. CLogScripting::ReadLogRecord()
  530. {
  531. HRESULT hr = E_FAIL;
  532. VARIANT logDateTime = {0};
  533. if ( m_fEndOfReadRecords )
  534. {
  535. return S_OK;
  536. }
  537. //
  538. // Read the next record. Only return records between the start & end times.
  539. //
  540. while ( SUCCEEDED( hr = InternalReadLogRecord() ) )
  541. {
  542. if ( SUCCEEDED(m_pPluginInfo[m_iReadPlugin].pILogScripting->get_DateTime(&logDateTime)) )
  543. {
  544. if ( (m_StartDateTime > logDateTime.date) || (m_EndDateTime < logDateTime.date))
  545. {
  546. //
  547. // Read next record
  548. //
  549. continue;
  550. }
  551. }
  552. break;
  553. }
  554. if ( FAILED(hr))
  555. {
  556. m_fEndOfReadRecords = true;
  557. hr = S_OK;
  558. }
  559. return hr;
  560. }
  561. /* ************************************************************************* */
  562. /* ************************************************************************* */
  563. STDMETHODIMP
  564. CLogScripting::AtEndOfLog(VARIANT_BOOL *pfEndOfRead)
  565. {
  566. DBG_ASSERT( NULL != pfEndOfRead);
  567. *pfEndOfRead = m_fEndOfReadRecords;
  568. return S_OK;
  569. }
  570. /* ************************************************************************* */
  571. /* ************************************************************************* */
  572. STDMETHODIMP
  573. CLogScripting::WriteLogRecord(ILogScripting * pILogScripting)
  574. {
  575. HRESULT hr = E_FAIL;
  576. DBG_ASSERT( NULL != pILogScripting);
  577. if (m_iWritePlugin >= 0)
  578. {
  579. hr = m_pPluginInfo[m_iWritePlugin].pILogScripting->WriteLogRecord(pILogScripting);
  580. }
  581. return hr;
  582. }
  583. /* ************************************************************************* */
  584. /* ************************************************************************* */
  585. STDMETHODIMP
  586. CLogScripting::get_DateTime(VARIANT * pvarDateTime)
  587. {
  588. HRESULT hr = E_FAIL;
  589. DBG_ASSERT( NULL != pvarDateTime);
  590. if (m_fEndOfReadRecords)
  591. {
  592. pvarDateTime->vt = VT_NULL;
  593. return S_OK;
  594. }
  595. if (m_iReadPlugin >= 0)
  596. {
  597. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_DateTime(pvarDateTime);
  598. }
  599. return hr;
  600. }
  601. /* ************************************************************************* */
  602. /* ************************************************************************* */
  603. STDMETHODIMP
  604. CLogScripting::get_ServiceName(VARIANT * pvarServiceName)
  605. {
  606. HRESULT hr = E_FAIL;
  607. DBG_ASSERT( NULL != pvarServiceName);
  608. if (m_fEndOfReadRecords)
  609. {
  610. pvarServiceName->vt = VT_NULL;
  611. return S_OK;
  612. }
  613. if (m_iReadPlugin >= 0)
  614. {
  615. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_ServiceName(pvarServiceName);
  616. }
  617. return hr;
  618. }
  619. /* ************************************************************************* */
  620. /* ************************************************************************* */
  621. STDMETHODIMP
  622. CLogScripting::get_ServerName(VARIANT * pvarServerName)
  623. {
  624. HRESULT hr = E_FAIL;
  625. DBG_ASSERT( NULL != pvarServerName);
  626. if (m_fEndOfReadRecords)
  627. {
  628. pvarServerName->vt = VT_NULL;
  629. return S_OK;
  630. }
  631. if (m_iReadPlugin >= 0)
  632. {
  633. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_ServerName(pvarServerName);
  634. }
  635. return hr;
  636. }
  637. /* ************************************************************************* */
  638. /* ************************************************************************* */
  639. STDMETHODIMP
  640. CLogScripting::get_ClientIP(VARIANT * pvarClientIP)
  641. {
  642. HRESULT hr = E_FAIL;
  643. DBG_ASSERT( NULL != pvarClientIP);
  644. if (m_fEndOfReadRecords)
  645. {
  646. pvarClientIP->vt = VT_NULL;
  647. return S_OK;
  648. }
  649. if (m_iReadPlugin >= 0)
  650. {
  651. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_ClientIP(pvarClientIP);
  652. }
  653. return hr;
  654. }
  655. /* ************************************************************************* */
  656. /* ************************************************************************* */
  657. STDMETHODIMP
  658. CLogScripting::get_UserName(VARIANT * pvarUserName)
  659. {
  660. HRESULT hr = E_FAIL;
  661. DBG_ASSERT( NULL != pvarUserName);
  662. if (m_fEndOfReadRecords)
  663. {
  664. pvarUserName->vt = VT_NULL;
  665. return S_OK;
  666. }
  667. if (m_iReadPlugin >= 0)
  668. {
  669. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_UserName(pvarUserName);
  670. }
  671. return hr;
  672. }
  673. /* ************************************************************************* */
  674. /* ************************************************************************* */
  675. STDMETHODIMP
  676. CLogScripting::get_ServerIP(VARIANT * pvarServerIP)
  677. {
  678. HRESULT hr = E_FAIL;
  679. DBG_ASSERT( NULL != pvarServerIP);
  680. if (m_fEndOfReadRecords)
  681. {
  682. pvarServerIP->vt = VT_NULL;
  683. return S_OK;
  684. }
  685. if (m_iReadPlugin >= 0)
  686. {
  687. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_ServerIP(pvarServerIP);
  688. }
  689. return hr;
  690. }
  691. /* ************************************************************************* */
  692. /* ************************************************************************* */
  693. STDMETHODIMP
  694. CLogScripting::get_Method(VARIANT * pvarMethod)
  695. {
  696. HRESULT hr = E_FAIL;
  697. DBG_ASSERT( NULL != pvarMethod);
  698. if (m_fEndOfReadRecords)
  699. {
  700. pvarMethod->vt = VT_NULL;
  701. return S_OK;
  702. }
  703. if (m_iReadPlugin >= 0)
  704. {
  705. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_Method(pvarMethod);
  706. }
  707. return hr;
  708. }
  709. /* ************************************************************************* */
  710. /* ************************************************************************* */
  711. STDMETHODIMP
  712. CLogScripting::get_URIStem(VARIANT * pvarURIStem)
  713. {
  714. HRESULT hr = E_FAIL;
  715. DBG_ASSERT( NULL != pvarURIStem);
  716. if (m_fEndOfReadRecords)
  717. {
  718. pvarURIStem->vt = VT_NULL;
  719. return S_OK;
  720. }
  721. if (m_iReadPlugin >= 0)
  722. {
  723. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_URIStem(pvarURIStem);
  724. }
  725. return hr;
  726. }
  727. /* ************************************************************************* */
  728. /* ************************************************************************* */
  729. STDMETHODIMP
  730. CLogScripting::get_URIQuery(VARIANT * pvarURIQuery)
  731. {
  732. HRESULT hr = E_FAIL;
  733. DBG_ASSERT( NULL != pvarURIQuery);
  734. if (m_fEndOfReadRecords)
  735. {
  736. pvarURIQuery->vt = VT_NULL;
  737. return S_OK;
  738. }
  739. if (m_iReadPlugin >= 0)
  740. {
  741. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_URIQuery(pvarURIQuery);
  742. }
  743. return hr;
  744. }
  745. /* ************************************************************************* */
  746. /* ************************************************************************* */
  747. STDMETHODIMP
  748. CLogScripting::get_TimeTaken(VARIANT * pvarTimeTaken)
  749. {
  750. HRESULT hr = E_FAIL;
  751. DBG_ASSERT( NULL != pvarTimeTaken);
  752. if (m_fEndOfReadRecords)
  753. {
  754. pvarTimeTaken->vt = VT_NULL;
  755. return S_OK;
  756. }
  757. if (m_iReadPlugin >= 0)
  758. {
  759. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_TimeTaken(pvarTimeTaken);
  760. }
  761. return hr;
  762. }
  763. /* ************************************************************************* */
  764. /* ************************************************************************* */
  765. STDMETHODIMP
  766. CLogScripting::get_BytesSent(VARIANT * pvarBytesSent)
  767. {
  768. HRESULT hr = E_FAIL;
  769. DBG_ASSERT( NULL != pvarBytesSent);
  770. if (m_fEndOfReadRecords)
  771. {
  772. pvarBytesSent->vt = VT_NULL;
  773. return S_OK;
  774. }
  775. if (m_iReadPlugin >= 0)
  776. {
  777. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_BytesSent(pvarBytesSent);
  778. }
  779. return hr;
  780. }
  781. /* ************************************************************************* */
  782. /* ************************************************************************* */
  783. STDMETHODIMP
  784. CLogScripting::get_BytesReceived(VARIANT * pvarBytesReceived)
  785. {
  786. HRESULT hr = E_FAIL;
  787. DBG_ASSERT( NULL != pvarBytesReceived);
  788. if (m_fEndOfReadRecords)
  789. {
  790. pvarBytesReceived->vt = VT_NULL;
  791. return S_OK;
  792. }
  793. if (m_iReadPlugin >= 0)
  794. {
  795. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_BytesReceived(pvarBytesReceived);
  796. }
  797. return hr;
  798. }
  799. /* ************************************************************************* */
  800. /* ************************************************************************* */
  801. STDMETHODIMP
  802. CLogScripting::get_Win32Status(VARIANT * pvarWin32Status)
  803. {
  804. HRESULT hr = E_FAIL;
  805. DBG_ASSERT( NULL != pvarWin32Status);
  806. if (m_fEndOfReadRecords)
  807. {
  808. pvarWin32Status->vt = VT_NULL;
  809. return S_OK;
  810. }
  811. if (m_iReadPlugin >= 0)
  812. {
  813. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_Win32Status(pvarWin32Status);
  814. }
  815. return hr;
  816. }
  817. /* ************************************************************************* */
  818. /* ************************************************************************* */
  819. STDMETHODIMP
  820. CLogScripting::get_ProtocolStatus(VARIANT * pvarProtocolStatus)
  821. {
  822. HRESULT hr = E_FAIL;
  823. DBG_ASSERT( NULL != pvarProtocolStatus);
  824. if (m_fEndOfReadRecords)
  825. {
  826. pvarProtocolStatus->vt = VT_NULL;
  827. return S_OK;
  828. }
  829. if (m_iReadPlugin >= 0)
  830. {
  831. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_ProtocolStatus(pvarProtocolStatus);
  832. }
  833. return hr;
  834. }
  835. /* ************************************************************************* */
  836. /* ************************************************************************* */
  837. STDMETHODIMP
  838. CLogScripting::get_ServerPort(VARIANT * pvarServerPort)
  839. {
  840. HRESULT hr = E_FAIL;
  841. DBG_ASSERT( NULL != pvarServerPort);
  842. if (m_fEndOfReadRecords)
  843. {
  844. pvarServerPort->vt = VT_NULL;
  845. return S_OK;
  846. }
  847. if (m_iReadPlugin >= 0)
  848. {
  849. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_ServerPort(pvarServerPort);
  850. }
  851. return hr;
  852. }
  853. /* ************************************************************************* */
  854. /* ************************************************************************* */
  855. STDMETHODIMP
  856. CLogScripting::get_ProtocolVersion(VARIANT * pvarProtocolVersion)
  857. {
  858. HRESULT hr = E_FAIL;
  859. DBG_ASSERT( NULL != pvarProtocolVersion);
  860. if (m_fEndOfReadRecords)
  861. {
  862. pvarProtocolVersion->vt = VT_NULL;
  863. return S_OK;
  864. }
  865. if (m_iReadPlugin >= 0)
  866. {
  867. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_ProtocolVersion(pvarProtocolVersion);
  868. }
  869. return hr;
  870. }
  871. /* ************************************************************************* */
  872. /* ************************************************************************* */
  873. STDMETHODIMP
  874. CLogScripting::get_UserAgent(VARIANT * pvarUserAgent)
  875. {
  876. HRESULT hr = E_FAIL;
  877. DBG_ASSERT( NULL != pvarUserAgent);
  878. if (m_fEndOfReadRecords)
  879. {
  880. pvarUserAgent->vt = VT_NULL;
  881. return S_OK;
  882. }
  883. if (m_iReadPlugin >= 0)
  884. {
  885. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_UserAgent(pvarUserAgent);
  886. }
  887. return hr;
  888. }
  889. /* ************************************************************************* */
  890. /* ************************************************************************* */
  891. STDMETHODIMP
  892. CLogScripting::get_Cookie(VARIANT * pvarCookie)
  893. {
  894. HRESULT hr = E_FAIL;
  895. DBG_ASSERT( NULL != pvarCookie);
  896. if (m_fEndOfReadRecords)
  897. {
  898. pvarCookie->vt = VT_NULL;
  899. return S_OK;
  900. }
  901. if (m_iReadPlugin >= 0)
  902. {
  903. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_Cookie(pvarCookie);
  904. }
  905. return hr;
  906. }
  907. /* ************************************************************************* */
  908. /* ************************************************************************* */
  909. STDMETHODIMP
  910. CLogScripting::get_Referer(VARIANT * pvarReferer)
  911. {
  912. HRESULT hr = E_FAIL;
  913. DBG_ASSERT( NULL != pvarReferer);
  914. if (m_fEndOfReadRecords)
  915. {
  916. pvarReferer->vt = VT_NULL;
  917. return S_OK;
  918. }
  919. if (m_iReadPlugin >= 0)
  920. {
  921. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_Referer(pvarReferer);
  922. }
  923. return hr;
  924. }
  925. /* ************************************************************************* */
  926. /* ************************************************************************* */
  927. STDMETHODIMP
  928. CLogScripting::get_CustomFields(VARIANT * pvarCustomFieldsArray)
  929. {
  930. HRESULT hr = E_FAIL;
  931. DBG_ASSERT( NULL != pvarCustomFieldsArray);
  932. if (m_fEndOfReadRecords)
  933. {
  934. pvarCustomFieldsArray->vt = VT_NULL;
  935. return S_OK;
  936. }
  937. if (m_iReadPlugin >= 0)
  938. {
  939. hr = m_pPluginInfo[m_iReadPlugin].pILogScripting->get_CustomFields(pvarCustomFieldsArray);
  940. }
  941. return hr;
  942. }
  943. /* ************************************************************************* */
  944. /* ************************************************************************* */