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.

825 lines
22 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. iisw3.cxx
  5. Abstract:
  6. This module defines the W3_IIS_SERVICE class
  7. Author:
  8. Johnson Apacible (JohnsonA) June-04-1996
  9. --*/
  10. #include "w3p.hxx"
  11. #include <issched.hxx>
  12. #include "wamexec.hxx"
  13. #include "httpxpc.h"
  14. #define ADJUST_FOR_MINMAX(a,b,c) ((a)<(b) ? (b) : ((a)>(c) ? (c) : (a)))
  15. VOID WINAPI
  16. NotifyCert11Touched(
  17. VOID
  18. )
  19. /*++
  20. Routine Description:
  21. Notification function called when any Cert11 mapper modified in metabase
  22. Arguments:
  23. None
  24. Returns:
  25. TRUE on success, FALSE on failure
  26. --*/
  27. {
  28. //
  29. // If someone has asked to be notified for SSL events, forward notification
  30. //
  31. if ( g_pSslKeysNotify )
  32. {
  33. (g_pSslKeysNotify)( SF_NOTIFY_MAPPER_CERT11_TOUCHED, NULL );
  34. }
  35. }
  36. BOOL
  37. W3_IIS_SERVICE::AddInstanceInfo(
  38. IN DWORD dwInstance,
  39. IN BOOL fMigrateRoots
  40. )
  41. {
  42. PW3_SERVER_INSTANCE pInstance;
  43. IF_DEBUG(INSTANCE) {
  44. DBGPRINTF(( DBG_CONTEXT,
  45. "AddInstanceInfo: instance %d reg %s\n", dwInstance, QueryRegParamKey() ));
  46. }
  47. //
  48. // Create the new instance
  49. //
  50. pInstance = new W3_SERVER_INSTANCE(
  51. this,
  52. dwInstance,
  53. IPPORT_W3,
  54. QueryRegParamKey(),
  55. W3_ANONYMOUS_SECRET_W,
  56. W3_ROOT_SECRET_W,
  57. fMigrateRoots
  58. );
  59. return AddInstanceInfoHelper( pInstance );
  60. } // W3_IIS_SERVICE::AddInstanceInfo
  61. DWORD
  62. W3_IIS_SERVICE::DisconnectUsersByInstance(
  63. IN IIS_SERVER_INSTANCE * pInstance
  64. )
  65. /*++
  66. Virtual callback invoked by IIS_SERVER_INSTANCE::StopInstance() to
  67. disconnect all users associated with the given instance.
  68. Arguments:
  69. pInstance - All users associated with this instance will be
  70. forcibly disconnected.
  71. --*/
  72. {
  73. CLIENT_CONN::DisconnectAllUsers( pInstance );
  74. return NO_ERROR;
  75. } // W3_IIS_SERVICE::DisconnectUsersByInstance
  76. VOID
  77. W3_IIS_SERVICE::StopInstanceProcs(
  78. IN IIS_SERVER_INSTANCE * pInstance
  79. )
  80. {
  81. KillCGIInstanceProcs( (W3_SERVER_INSTANCE *)pInstance );
  82. DBG_ASSERT(g_pWamDictator != NULL);
  83. if (!g_pWamDictator)
  84. {
  85. return;
  86. }
  87. DWORD dwScheduledId;
  88. dwScheduledId = ScheduleWorkItem
  89. (
  90. WAM_DICTATOR::StopApplicationsByInstance,
  91. (PVOID) pInstance,
  92. 0,
  93. FALSE
  94. );
  95. DBG_ASSERT(dwScheduledId != NULL);
  96. }
  97. DWORD
  98. W3_IIS_SERVICE::GetServiceConfigInfoSize(
  99. IN DWORD dwLevel
  100. )
  101. {
  102. switch (dwLevel) {
  103. case 1:
  104. return sizeof(W3_CONFIG_INFO);
  105. }
  106. return 0;
  107. } // W3_IIS_SERVICE::GetServerConfigInfoSize
  108. W3_IIS_SERVICE::W3_IIS_SERVICE(
  109. IN LPCSTR pszServiceName,
  110. IN LPCSTR pszModuleName,
  111. IN LPCSTR pszRegParamKey,
  112. IN DWORD dwServiceId,
  113. IN ULONGLONG SvcLocId,
  114. IN BOOL MultipleInstanceSupport,
  115. IN DWORD cbAcceptExRecvBuffer,
  116. IN ATQ_CONNECT_CALLBACK pfnConnect,
  117. IN ATQ_COMPLETION pfnConnectEx,
  118. IN ATQ_COMPLETION pfnIoCompletion
  119. ) : IIS_SERVICE( pszServiceName,
  120. pszModuleName,
  121. pszRegParamKey,
  122. dwServiceId,
  123. SvcLocId,
  124. MultipleInstanceSupport,
  125. cbAcceptExRecvBuffer,
  126. pfnConnect,
  127. pfnConnectEx,
  128. pfnIoCompletion
  129. ),
  130. m_pGlobalFilterList( NULL ),
  131. m_cInProcISAPI ( 0 ),
  132. m_astrInProcISAPI ( NULL ),
  133. m_afISAPIDllName (NULL),
  134. m_hinstDav (NULL),
  135. m_cReferences( 1 )
  136. {
  137. DWORD err;
  138. m_pGlobalFilterList = InitializeFilters( &fAnySecureFilters, this );
  139. //
  140. // Set the notification function in NSEP for mapping ( NSEPM )
  141. //
  142. if ( QueryMDNseObject() != NULL ) {
  143. MB mbx( (IMDCOM*)QueryMDNseObject() );
  144. if ( mbx.Open( "", METADATA_PERMISSION_WRITE ) )
  145. {
  146. PVOID CallbackAddress = ::NotifyCert11Touched;
  147. mbx.SetData(
  148. "",
  149. MD_NOTIFY_CERT11_TOUCHED,
  150. IIS_MD_UT_SERVER,
  151. BINARY_METADATA,
  152. (PVOID) &CallbackAddress,
  153. sizeof(PVOID)
  154. );
  155. mbx.Close();
  156. }
  157. }
  158. MB mb( (IMDCOM*)QueryMDObject() );
  159. DWORD dw;
  160. #if defined(CAL_ENABLED)
  161. m_CalVcPerLicense = DEFAULT_W3_CAL_VC_PER_CONNECT;
  162. m_CalW3Error = DEFAULT_W3_CAL_W3_ERROR;
  163. m_CalAuthReserveTimeout = DEFAULT_W3_CAL_AUTH_RESERVE_TIMEOUT;
  164. m_CalSslReserveTimeout = DEFAULT_W3_CAL_SSL_RESERVE_TIMEOUT;
  165. m_CalMode = DEFAULT_W3_CAL_MODE;
  166. if ( mb.Open( QueryMDPath(), METADATA_PERMISSION_READ ) )
  167. {
  168. if ( mb.GetDword( "",
  169. MD_CAL_VC_PER_CONNECT,
  170. IIS_MD_UT_SERVER,
  171. &dw ) &&
  172. dw >= MIN_W3_CAL_VC_PER_CONNECT &&
  173. dw <= MAX_W3_CAL_VC_PER_CONNECT )
  174. {
  175. m_CalVcPerLicense = dw;
  176. }
  177. if ( mb.GetDword( "",
  178. MD_CAL_W3_ERROR,
  179. IIS_MD_UT_SERVER,
  180. &dw ) )
  181. {
  182. m_CalW3Error = dw;
  183. }
  184. if ( mb.GetDword( "",
  185. MD_CAL_AUTH_RESERVE_TIMEOUT,
  186. IIS_MD_UT_SERVER,
  187. &dw ) )
  188. {
  189. m_CalAuthReserveTimeout = ADJUST_FOR_MINMAX( dw,
  190. MIN_CAL_RESERVE_TIMEOUT,
  191. MAX_CAL_RESERVE_TIMEOUT);
  192. }
  193. if ( mb.GetDword( "",
  194. MD_CAL_SSL_RESERVE_TIMEOUT,
  195. IIS_MD_UT_SERVER,
  196. &dw ) )
  197. {
  198. m_CalSslReserveTimeout = ADJUST_FOR_MINMAX( dw,
  199. MIN_CAL_RESERVE_TIMEOUT,
  200. MAX_CAL_RESERVE_TIMEOUT);
  201. }
  202. mb.Close();
  203. }
  204. #endif
  205. ReadInProcISAPIList();
  206. GetDavDll();
  207. //
  208. // Iinit Dav performance data
  209. //
  210. W3OpenDavPerformanceData();
  211. } // W3_IIS_SERVICE::W3_IIS_SERVICE
  212. W3_IIS_SERVICE::~W3_IIS_SERVICE()
  213. {
  214. //
  215. // Deinit Dav performance data
  216. //
  217. W3CloseDavPerformanceData();
  218. if ( m_pGlobalFilterList )
  219. {
  220. FILTER_LIST::Dereference( m_pGlobalFilterList );
  221. }
  222. //
  223. // Reset the notification function in NSEP for mapping ( NSEPM )
  224. //
  225. if ( QueryMDNseObject() != NULL ) {
  226. MB mbx( (IMDCOM*)QueryMDNseObject() );
  227. if ( mbx.Open( "", METADATA_PERMISSION_WRITE ) )
  228. {
  229. PVOID CallbackAddress = NULL;
  230. mbx.SetData(
  231. "",
  232. MD_NOTIFY_CERT11_TOUCHED,
  233. IIS_MD_UT_SERVER,
  234. BINARY_METADATA,
  235. (PVOID) &CallbackAddress,
  236. sizeof(PVOID)
  237. );
  238. mbx.Close();
  239. }
  240. }
  241. //
  242. // Free the in-process ISAPI Applications data
  243. //
  244. delete [] m_astrInProcISAPI;
  245. delete [] m_afISAPIDllName;
  246. if (m_hinstDav != NULL)
  247. {
  248. FreeLibrary(m_hinstDav);
  249. m_hinstDav = NULL;
  250. }
  251. }
  252. VOID
  253. W3_IIS_SERVICE::MDChangeNotify(
  254. MD_CHANGE_OBJECT * pcoChangeList
  255. )
  256. /*++
  257. This method handles the metabase change notification for this service
  258. Arguments:
  259. pcoChangeList - path and id that has changed
  260. --*/
  261. {
  262. DWORD i;
  263. BOOL fSslModified = FALSE;
  264. if ( g_pInetSvc == NULL )
  265. {
  266. return;
  267. }
  268. AcquireServiceLock();
  269. IIS_SERVICE::MDChangeNotify( pcoChangeList );
  270. for ( i = 0; i < pcoChangeList->dwMDNumDataIDs; i++ )
  271. {
  272. switch ( pcoChangeList->pdwMDDataIDs[i] )
  273. {
  274. #if 0 // Unused in IIS 5
  275. case MD_SSL_PUBLIC_KEY:
  276. case MD_SSL_PRIVATE_KEY:
  277. case MD_SSL_KEY_PASSWORD:
  278. #endif
  279. //
  280. // Server cert properties
  281. //
  282. case MD_SSL_CERT_HASH:
  283. case MD_SSL_CERT_CONTAINER:
  284. case MD_SSL_CERT_PROVIDER:
  285. case MD_SSL_CERT_OPEN_FLAGS:
  286. case MD_SSL_CERT_STORE_NAME:
  287. //
  288. // Fortezza-specific properties
  289. //
  290. case MD_SSL_CERT_IS_FORTEZZA:
  291. case MD_SSL_CERT_FORTEZZA_PIN:
  292. case MD_SSL_CERT_FORTEZZA_SERIAL_NUMBER:
  293. case MD_SSL_CERT_FORTEZZA_PERSONALITY:
  294. case MD_SSL_CERT_FORTEZZA_PROG_PIN:
  295. //
  296. // Server CTL properties
  297. //
  298. case MD_SSL_CTL_IDENTIFIER:
  299. case MD_SSL_CTL_CONTAINER:
  300. case MD_SSL_CTL_PROVIDER:
  301. case MD_SSL_CTL_PROVIDER_TYPE:
  302. case MD_SSL_CTL_OPEN_FLAGS:
  303. case MD_SSL_CTL_STORE_NAME:
  304. case MD_SSL_CTL_SIGNER_HASH:
  305. case MD_SSL_USE_DS_MAPPER:
  306. fSslModified = TRUE;
  307. break;
  308. case MD_IN_PROCESS_ISAPI_APPS:
  309. ReadInProcISAPIList();
  310. break;
  311. case MD_CPU_APP_ENABLED:
  312. case MD_CPU_LOGGING_MASK:
  313. case MD_CPU_LIMITS_ENABLED:
  314. DWORD dwPathBufferLen;
  315. VOID *pvPath;
  316. dwPathBufferLen = strlen((LPSTR)pcoChangeList->pszMDPath) + 1;
  317. pvPath = new BYTE[dwPathBufferLen];
  318. if (pvPath != NULL)
  319. {
  320. memcpy(pvPath, pcoChangeList->pszMDPath, dwPathBufferLen);
  321. if (W3_JOB_QUEUE::QueueWorkItem( JQA_RESTART_ALL_APPS,
  322. NULL,
  323. pvPath ) != ERROR_SUCCESS)
  324. {
  325. delete pvPath;
  326. }
  327. }
  328. break;
  329. default:
  330. break;
  331. }
  332. }
  333. ReleaseServiceLock();
  334. if ( fSslModified && g_pSslKeysNotify )
  335. {
  336. (g_pSslKeysNotify)( SF_NOTIFY_MAPPER_SSLKEYS_CHANGED, this );
  337. }
  338. }
  339. BOOL
  340. W3_IIS_SERVICE::GetGlobalStatistics(
  341. IN DWORD dwLevel,
  342. OUT PCHAR *pBuffer
  343. )
  344. {
  345. APIERR err = NO_ERROR;
  346. switch( dwLevel )
  347. {
  348. case 0 :
  349. {
  350. LPW3_STATISTICS_1 pstats1;
  351. pstats1 = (W3_STATISTICS_1 *) MIDL_user_allocate( sizeof(W3_STATISTICS_1) );
  352. if( pstats1 == NULL )
  353. {
  354. err = ERROR_NOT_ENOUGH_MEMORY;
  355. }
  356. else
  357. {
  358. g_pW3Stats->CopyToStatsBuffer( pstats1 );
  359. *pBuffer = (PCHAR)pstats1;
  360. }
  361. }
  362. break;
  363. default :
  364. err = ERROR_INVALID_LEVEL;
  365. break;
  366. }
  367. SetLastError(err);
  368. return(err == NO_ERROR);
  369. } // IIS_SERVICE::GetGlobalStatistics
  370. BOOL
  371. W3_IIS_SERVICE::AggregateStatistics(
  372. IN PCHAR pDestination,
  373. IN PCHAR pSource
  374. )
  375. {
  376. LPW3_STATISTICS_1 pStatDest = (LPW3_STATISTICS_1) pDestination;
  377. LPW3_STATISTICS_1 pStatSrc = (LPW3_STATISTICS_1) pSource;
  378. if ((NULL == pDestination) || (NULL == pSource))
  379. {
  380. return FALSE;
  381. }
  382. pStatDest->TotalBytesSent.QuadPart += pStatSrc->TotalBytesSent.QuadPart;
  383. pStatDest->TotalBytesReceived.QuadPart += pStatSrc->TotalBytesReceived.QuadPart;
  384. pStatDest->TotalFilesSent += pStatSrc->TotalFilesSent;
  385. pStatDest->TotalFilesReceived += pStatSrc->TotalFilesReceived;
  386. pStatDest->CurrentAnonymousUsers += pStatSrc->CurrentAnonymousUsers;
  387. pStatDest->CurrentNonAnonymousUsers += pStatSrc->CurrentNonAnonymousUsers;
  388. pStatDest->TotalAnonymousUsers += pStatSrc->TotalAnonymousUsers;
  389. pStatDest->TotalNonAnonymousUsers += pStatSrc->TotalNonAnonymousUsers;
  390. pStatDest->MaxAnonymousUsers += pStatSrc->MaxAnonymousUsers;
  391. pStatDest->MaxNonAnonymousUsers += pStatSrc->MaxNonAnonymousUsers;
  392. //
  393. // Global values. do not add
  394. //
  395. pStatDest->CurrentConnections = pStatSrc->CurrentConnections;
  396. pStatDest->MaxConnections = pStatSrc->MaxConnections;
  397. pStatDest->ConnectionAttempts = pStatSrc->ConnectionAttempts;
  398. pStatDest->LogonAttempts += pStatSrc->LogonAttempts;
  399. pStatDest->TotalOptions += pStatSrc->TotalOptions;
  400. pStatDest->TotalGets += pStatSrc->TotalGets;
  401. pStatDest->TotalPosts += pStatSrc->TotalPosts;
  402. pStatDest->TotalHeads += pStatSrc->TotalHeads;
  403. pStatDest->TotalPuts += pStatSrc->TotalPuts;
  404. pStatDest->TotalDeletes += pStatSrc->TotalDeletes;
  405. pStatDest->TotalTraces += pStatSrc->TotalTraces;
  406. pStatDest->TotalMove += pStatSrc->TotalMove;
  407. pStatDest->TotalCopy += pStatSrc->TotalCopy;
  408. pStatDest->TotalMkcol += pStatSrc->TotalMkcol;
  409. pStatDest->TotalPropfind += pStatSrc->TotalPropfind;
  410. pStatDest->TotalProppatch += pStatSrc->TotalProppatch;
  411. pStatDest->TotalSearch += pStatSrc->TotalSearch;
  412. pStatDest->TotalLock += pStatSrc->TotalLock;
  413. pStatDest->TotalUnlock += pStatSrc->TotalUnlock;
  414. pStatDest->TotalOthers += pStatSrc->TotalOthers;
  415. pStatDest->TotalCGIRequests += pStatSrc->TotalCGIRequests;
  416. pStatDest->TotalBGIRequests += pStatSrc->TotalBGIRequests;
  417. pStatDest->TotalNotFoundErrors += pStatSrc->TotalNotFoundErrors;
  418. #if defined(CAL_ENABLED)
  419. pStatDest->CurrentCalAuth += pStatSrc->CurrentCalAuth;
  420. pStatDest->MaxCalAuth += pStatSrc->MaxCalAuth;
  421. pStatDest->TotalFailedCalAuth += pStatSrc->TotalFailedCalAuth;
  422. pStatDest->CurrentCalSsl += pStatSrc->CurrentCalSsl;
  423. pStatDest->MaxCalSsl += pStatSrc->MaxCalSsl;
  424. pStatDest->TotalFailedCalSsl += pStatSrc->TotalFailedCalSsl;
  425. #endif
  426. pStatDest->CurrentCGIRequests += pStatSrc->CurrentCGIRequests;
  427. pStatDest->CurrentBGIRequests += pStatSrc->CurrentBGIRequests;
  428. pStatDest->MaxCGIRequests += pStatSrc->MaxCGIRequests;
  429. pStatDest->MaxBGIRequests += pStatSrc->MaxBGIRequests;
  430. // bandwidth throttling info
  431. pStatDest->CurrentBlockedRequests += pStatSrc->CurrentBlockedRequests;
  432. pStatDest->TotalBlockedRequests += pStatSrc->TotalBlockedRequests;
  433. pStatDest->TotalAllowedRequests += pStatSrc->TotalAllowedRequests;
  434. pStatDest->TotalRejectedRequests += pStatSrc->TotalRejectedRequests;
  435. pStatDest->MeasuredBw += pStatSrc->MeasuredBw;
  436. return TRUE;
  437. }
  438. inline BOOL
  439. IsISAPIRelativePath( LPCSTR pszPath)
  440. /*++
  441. Description:
  442. This function checks to see if the path specified contains
  443. no path-separators. If there are no path separators, then
  444. the given string refers to relative path.
  445. Arguments:
  446. pszPath - pointer to string containing the path for check
  447. Returns:
  448. TRUE - if this is a relative path
  449. FALSE - if the specified path is an absolute path
  450. --*/
  451. {
  452. LPCSTR pszPathSeparator;
  453. DBG_ASSERT( NULL != pszPath);
  454. pszPathSeparator = strchr( pszPath, '\\');
  455. //
  456. // if there is no path-separator => pszPathSeparator == NULL
  457. // ==> return TRUE
  458. // if there is a path-separator => pszPathSeparator != NULL
  459. // ==> return FALSE
  460. //
  461. return ( pszPathSeparator == NULL);
  462. } // IsISAPIRelativePath()
  463. static
  464. VOID
  465. AddFiltersToMultiSz(
  466. IN const MB & mb,
  467. IN const char * szFilterPath,
  468. IN OUT MULTISZ * pmsz
  469. )
  470. /*++
  471. Description:
  472. Add the ISAPI filters at the specified metabase path to pmsz.
  473. Called by AddAllFiltersToMultiSz.
  474. Arguments:
  475. mb metabase key open to /LM/W3SVC
  476. szFilterPath path of /Filters key relative to /LM/W3SVC
  477. pmsz multisz containing the in proc dlls
  478. Return:
  479. Nothing - failure cases ignored.
  480. --*/
  481. {
  482. CHAR szKeyName[MAX_PATH + 1];
  483. STR strFilterPath;
  484. STR strFullKeyName( szFilterPath );
  485. INT pchFilterPath = ::strlen( szFilterPath );
  486. DWORD i = 0;
  487. if( strFullKeyName.Append( "/", 1 ) )
  488. {
  489. while ( const_cast<MB &>(mb).EnumObjects( szFilterPath,
  490. szKeyName,
  491. i++ ) )
  492. {
  493. if( strFullKeyName.Append( szKeyName ) )
  494. {
  495. if( const_cast<MB &>(mb).GetStr( strFullKeyName.QueryStr(),
  496. MD_FILTER_IMAGE_PATH,
  497. IIS_MD_UT_SERVER,
  498. &strFilterPath ) )
  499. {
  500. pmsz->Append( strFilterPath );
  501. }
  502. }
  503. strFullKeyName.SetLen( pchFilterPath + 1 );
  504. }
  505. }
  506. }
  507. static
  508. VOID
  509. AddAllFiltersToMultiSz(
  510. IN const MB & mb,
  511. IN OUT MULTISZ * pmsz
  512. )
  513. /*++
  514. Description:
  515. This is designed to prevent ISAPI extension/filter
  516. combination dlls from running out of process.
  517. Add the base set of filters defined for the service to pmsz.
  518. Iterate through the sites and add the filters defined for
  519. each site.
  520. Arguments:
  521. mb metabase key open to /LM/W3SVC
  522. pmsz multisz containing the in proc dlls
  523. Return:
  524. Nothing - failure cases ignored.
  525. --*/
  526. {
  527. CHAR szKeyName[MAX_PATH + 1];
  528. STR strFullKeyName("/");
  529. DWORD i = 0;
  530. DWORD dwInstanceId = 0;
  531. AddFiltersToMultiSz( mb, IIS_MD_ISAPI_FILTERS, pmsz );
  532. while ( const_cast<MB &>(mb).EnumObjects( "",
  533. szKeyName,
  534. i++ ) )
  535. {
  536. dwInstanceId = ::atoi( szKeyName );
  537. if( 0 != dwInstanceId )
  538. {
  539. // This is a site.
  540. if( strFullKeyName.Append( szKeyName ) &&
  541. strFullKeyName.Append( IIS_MD_ISAPI_FILTERS ) )
  542. {
  543. AddFiltersToMultiSz( mb, strFullKeyName.QueryStr(), pmsz );
  544. }
  545. strFullKeyName.SetLen( 1 );
  546. }
  547. }
  548. }
  549. BOOL
  550. W3_IIS_SERVICE::ReadInProcISAPIList(
  551. VOID
  552. )
  553. /*++
  554. This method reads the list of ISAPI dlls that must be run in process
  555. Arguments:
  556. --*/
  557. {
  558. MB mb( (IMDCOM*)QueryMDObject() );
  559. MULTISZ msz;
  560. BOOL fReturn = TRUE;
  561. if ( mb.Open( QueryMDPath(), METADATA_PERMISSION_READ ) &&
  562. mb.GetMultisz( "",
  563. MD_IN_PROCESS_ISAPI_APPS,
  564. IIS_MD_UT_SERVER,
  565. &msz ))
  566. {
  567. m_InProcLock.Lock( TSRES_LOCK_WRITE );
  568. //
  569. // Free the existing list
  570. //
  571. delete [] m_astrInProcISAPI;
  572. delete [] m_afISAPIDllName;
  573. m_InProcISAPItable.Clear();
  574. m_astrInProcISAPI = NULL;
  575. m_afISAPIDllName = NULL;
  576. m_cInProcISAPI = 0;
  577. //
  578. // Merge all the ISAPI filters into the in-proc list.
  579. //
  580. AddAllFiltersToMultiSz( mb, &msz );
  581. if ( msz.QueryStringCount() )
  582. {
  583. DWORD i;
  584. const CHAR * psz;
  585. const DWORD cIsapis = msz.QueryStringCount();
  586. m_astrInProcISAPI = new STR[cIsapis];
  587. m_afISAPIDllName = new BOOL[cIsapis];
  588. //
  589. // Initialize the relative paths
  590. //
  591. if (m_astrInProcISAPI != NULL && m_afISAPIDllName != NULL)
  592. {
  593. for ( i = 0, psz = msz.First();
  594. psz != NULL;
  595. i++, psz = msz.Next( psz ) )
  596. {
  597. if ( !m_astrInProcISAPI[i].Copy( psz ))
  598. {
  599. fReturn = FALSE;
  600. break;
  601. }
  602. m_afISAPIDllName[i] = ( IsISAPIRelativePath( psz));
  603. m_InProcISAPItable.InsertRecord(&m_astrInProcISAPI[i]);
  604. m_cInProcISAPI++;
  605. }
  606. } else {
  607. fReturn = FALSE;
  608. }
  609. DBG_ASSERT(m_cInProcISAPI == cIsapis);
  610. }
  611. m_InProcLock.Unlock();
  612. }
  613. return fReturn;
  614. }
  615. VOID
  616. W3_IIS_SERVICE::GetDavDll()
  617. {
  618. LONG lReg = 0;
  619. HKEY hKey = NULL;
  620. HRESULT hr = NOERROR;
  621. DBG_ASSERT(m_hinstDav == NULL);
  622. lReg = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
  623. "Software\\Microsoft\\InetStp",
  624. 0,
  625. KEY_READ,
  626. &hKey);
  627. if (lReg == ERROR_SUCCESS)
  628. {
  629. DWORD dwType;
  630. CHAR szDavDllPath[255];
  631. DWORD cbName = sizeof(szDavDllPath);
  632. lReg = RegQueryValueExA(hKey,
  633. "InstallPath",
  634. 0,
  635. &dwType,
  636. (LPBYTE) szDavDllPath,
  637. &cbName);
  638. if (lReg == ERROR_SUCCESS && dwType == REG_SZ)
  639. {
  640. m_strDav.Copy(szDavDllPath);
  641. m_strDav.Append("\\httpext.dll");
  642. m_hinstDav = LoadLibrary(m_strDav.QueryStr());
  643. if (m_hinstDav == NULL)
  644. m_strDav.Reset();
  645. }
  646. RegCloseKey(hKey);
  647. }
  648. }