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.

84 lines
2.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: cisvc.cxx
  7. //
  8. // Contents: CI service
  9. //
  10. // History: 17-Sep-96 dlee Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #include <pch.cxx>
  14. #pragma hdrstop
  15. #include <cievtmsg.h>
  16. #include <cisvcex.hxx>
  17. #include <ciregkey.hxx>
  18. #include <regacc.hxx>
  19. DECLARE_INFOLEVEL(ci)
  20. //+-------------------------------------------------------------------------
  21. //
  22. // Function: main, public
  23. //
  24. // Purpose: Call into CI to start the service
  25. //
  26. // Arguments: [argc] - number of arguments passed
  27. // [argv] - arguments
  28. //
  29. // History: 05-Jan-97 dlee Created
  30. //
  31. //--------------------------------------------------------------------------
  32. extern "C" int __cdecl wmain( int argc, WCHAR *argv[] )
  33. {
  34. #if CIDBG == 1
  35. ciInfoLevel = DEB_ERROR | DEB_WARN | DEB_IWARN | DEB_IERROR;
  36. #endif
  37. static SERVICE_TABLE_ENTRY _aServiceTableEntry[2] =
  38. {
  39. { wcsCiSvcName, CiSvcMain },
  40. { NULL, NULL }
  41. };
  42. ciDebugOut( (DEB_ITRACE, "Ci Service: Attempting to start Ci service\n" ));
  43. // Turn off system popups
  44. CNoErrorMode noErrors;
  45. // Translate system exceptions into C++ exceptions
  46. CTranslateSystemExceptions translate;
  47. TRY
  48. {
  49. //
  50. // Inform the service control dispatcher the address of our start
  51. // routine. This routine will not return if it is successful,
  52. // until service shutdown.
  53. //
  54. if ( !StartServiceCtrlDispatcher( _aServiceTableEntry ) )
  55. {
  56. ciDebugOut( (DEB_ITRACE, "Ci Service: Failed to start service, rc=0x%x\n", GetLastError() ));
  57. THROW( CException() );
  58. }
  59. }
  60. CATCH (CException, e)
  61. {
  62. ciDebugOut(( DEB_ERROR,
  63. "Ci Service exception in main(): 0x%x\n",
  64. e.GetErrorCode() ));
  65. }
  66. END_CATCH
  67. ciDebugOut( (DEB_ITRACE, "Ci Service: Leaving CIServiceMain()\n" ));
  68. return 0;
  69. } //main