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.

138 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name :
  4. ulw3.cxx
  5. Abstract:
  6. W3 Handler Driver
  7. Author:
  8. Bilal Alam (balam) 13-Dec-1999
  9. Environment:
  10. Win32 - User Mode
  11. Project:
  12. ULW3.DLL
  13. --*/
  14. /************************************************************
  15. * Include Headers
  16. ************************************************************/
  17. #include "precomp.hxx"
  18. /************************************************************
  19. * Declarations
  20. ************************************************************/
  21. // BUGBUG
  22. #undef INET_INFO_KEY
  23. #undef INET_INFO_PARAMETERS_KEY
  24. //
  25. // Configuration parameters registry key.
  26. //
  27. #define INET_INFO_KEY \
  28. "System\\CurrentControlSet\\Services\\w3svc"
  29. #define INET_INFO_PARAMETERS_KEY \
  30. INET_INFO_KEY "\\Parameters"
  31. const CHAR g_pszWpRegLocation[] =
  32. INET_INFO_PARAMETERS_KEY "\\w3core";
  33. DECLARE_DEBUG_PRINTS_OBJECT();
  34. DECLARE_DEBUG_VARIABLE();
  35. DECLARE_PLATFORM_TYPE();
  36. /************************************************************
  37. * Type Definitions
  38. ************************************************************/
  39. W3_SERVER * g_pW3Server = NULL;
  40. HRESULT
  41. UlW3Start(
  42. INT argc,
  43. LPWSTR argv[],
  44. BOOL fCompatibilityMode
  45. )
  46. /*++
  47. Description:
  48. Perform one time initialization, including ULATQ setup.
  49. Wait on shutdown. Then clean up.
  50. Assumes that this startup thread is CoInitialized MTA.
  51. --*/
  52. {
  53. HRESULT hr = NO_ERROR;
  54. CREATE_DEBUG_PRINT_OBJECT("w3core");
  55. if (!VALID_DEBUG_PRINT_OBJECT())
  56. {
  57. return E_FAIL;
  58. }
  59. LOAD_DEBUG_FLAGS_FROM_REG_STR( g_pszWpRegLocation, DEBUG_ERROR );
  60. INITIALIZE_PLATFORM_TYPE();
  61. DBG_ASSERT( g_pW3Server == NULL );
  62. //
  63. // Create the global W3_SERVER object
  64. //
  65. g_pW3Server = new W3_SERVER( fCompatibilityMode );
  66. if ( g_pW3Server == NULL )
  67. {
  68. hr = HRESULT_FROM_WIN32( ERROR_NOT_ENOUGH_MEMORY );
  69. goto Finished;
  70. }
  71. //
  72. // Do global initialization (but no listen)
  73. //
  74. hr = g_pW3Server->Initialize( argc, argv );
  75. if ( FAILED( hr ) )
  76. {
  77. goto Finished;
  78. }
  79. //
  80. // Start listening
  81. //
  82. hr = g_pW3Server->StartListen();
  83. if ( FAILED( hr ) )
  84. {
  85. goto Finished;
  86. }
  87. Finished:
  88. //
  89. // Cleanup
  90. //
  91. if ( g_pW3Server != NULL )
  92. {
  93. g_pW3Server->Terminate( hr );
  94. delete g_pW3Server;
  95. g_pW3Server = NULL;
  96. }
  97. DELETE_DEBUG_PRINT_OBJECT();
  98. return hr;
  99. }