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.

119 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name :
  4. AppPool.cxx
  5. Abstract:
  6. Defines the functions used to access the data channel.
  7. Author:
  8. Murali R. Krishnan ( MuraliK ) 20-Oct-1998
  9. Lei Jin ( leijin ) 13-Apr-1999 Porting
  10. Project:
  11. IIS Worker Process
  12. --*/
  13. #include "precomp.hxx"
  14. #include "AppPool.hxx"
  15. UL_APP_POOL::UL_APP_POOL(
  16. VOID
  17. ) : _hAppPool( NULL )
  18. {
  19. }
  20. UL_APP_POOL::~UL_APP_POOL(
  21. VOID
  22. )
  23. {
  24. Cleanup();
  25. }
  26. HRESULT
  27. UL_APP_POOL::Initialize(
  28. LPCWSTR pwszAppPoolName
  29. )
  30. /*++
  31. Routine Description:
  32. Initialize UL AppPool
  33. Arguments:
  34. pwszAppPoolName - AppPool Name
  35. Return Value:
  36. HRESULT
  37. --*/
  38. {
  39. ULONG rc;
  40. if ( _hAppPool != NULL )
  41. {
  42. DBGPRINTF(( DBG_CONTEXT,
  43. "AppPool already open!\n" ));
  44. return HRESULT_FROM_WIN32( ERROR_DUP_NAME );
  45. }
  46. rc = HttpOpenAppPool( &_hAppPool,
  47. pwszAppPoolName,
  48. HTTP_OPTION_OVERLAPPED );
  49. if ( rc != NO_ERROR )
  50. {
  51. DBGPRINTF(( DBG_CONTEXT,
  52. "Failed to open AppPool '%ws'. rc = %d\n",
  53. pwszAppPoolName,
  54. rc ));
  55. return HRESULT_FROM_WIN32( rc );
  56. }
  57. return NO_ERROR;
  58. }
  59. HRESULT
  60. UL_APP_POOL::Cleanup(
  61. VOID
  62. )
  63. /*++
  64. Routine Description:
  65. Close data channel
  66. Arguments:
  67. None
  68. Return Value:
  69. HRESULT
  70. --*/
  71. {
  72. HRESULT hr = NO_ERROR;
  73. if ( _hAppPool != NULL )
  74. {
  75. if ( !CloseHandle( _hAppPool ) )
  76. {
  77. hr = HRESULT_FROM_WIN32( GetLastError() );
  78. }
  79. else
  80. {
  81. _hAppPool = NULL;
  82. }
  83. }
  84. return hr;
  85. }