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.

117 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. splsvc.c
  5. Abstract:
  6. This is the main routine for the Spooler Service.
  7. Author:
  8. Krishna Ganugapati (KrishnaG) 17-October-1992
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. 17-Oct-1993 KrishnaG
  13. created
  14. --*/
  15. //
  16. // INCLUDES
  17. //
  18. #include <nt.h>
  19. #include <ntrtl.h>
  20. #include <nturtl.h>
  21. #include <windows.h>
  22. #include <winsvc.h>
  23. #include <lmcons.h>
  24. #include <lmerr.h>
  25. #include <lmsname.h>
  26. #include <rpc.h>
  27. #include "server.h"
  28. #include "splsvr.h"
  29. #include "splr.h"
  30. void __cdecl
  31. main (
  32. int argc,
  33. unsigned char * argv[]
  34. )
  35. /*++
  36. Routine Description:
  37. This is a main routine for the Windows NT Spooler Services.
  38. It basically sets up the ControlDispatcher and, on return, exits from
  39. this main thread. The call to NetServiceStartCtrlDispatcher does
  40. not return until all services have terminated, and this process can
  41. go away.
  42. It will be up to the ControlDispatcher thread to start/stop/pause/continue
  43. any services. If a service is to be started, it will create a thread
  44. and then call the main routine of that service.
  45. Arguments:
  46. Anything passed in from the "command line". Currently, NOTHING.
  47. Return Value:
  48. NONE
  49. Note:
  50. --*/
  51. {
  52. #if DBG
  53. //
  54. // Debugging: if started with "ns" then don't start as service.
  55. //
  56. if (argc == 2 && !lstrcmpiA("ns", argv[1])) {
  57. SpoolerStartRpcServer();
  58. InitializeRouter((SERVICE_STATUS_HANDLE)0);
  59. return;
  60. }
  61. #endif
  62. //
  63. // Call NetServiceStartCtrlDispatcher to set up the control interface.
  64. // The API won't return until all services have been terminated. At that
  65. // point, we just exit.
  66. //
  67. if (! StartServiceCtrlDispatcher (SpoolerServiceDispatchTable)) {
  68. //
  69. // It would be good to also log an Event here.
  70. //
  71. DBGMSG(DBG_ERROR, ("Fail to start control dispatcher %lu\n",GetLastError()));
  72. }
  73. ExitProcess(0);
  74. DBG_UNREFERENCED_PARAMETER( argc );
  75. DBG_UNREFERENCED_PARAMETER( argv );
  76. }