Leaked source code of windows server 2003
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.

80 lines
1.9 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation
  6. //
  7. // File: ktconsole.cxx
  8. //
  9. // Contents: Kerberos Tunneller, console entrypoint
  10. //
  11. // History: 28-Jun-2001 t-ryanj Created
  12. //
  13. //------------------------------------------------------------------------
  14. #include <windows.h>
  15. #include <tchar.h>
  16. #include "ktdebug.h"
  17. #include "ktcontrol.h"
  18. //
  19. // Import the servicename (defined in ktcontrol.cxx) so we can give good
  20. // instructions on how to add/remove the service using sc.exe.
  21. //
  22. extern LPTSTR KtServiceName;
  23. //+-------------------------------------------------------------------------
  24. //
  25. // Function: wmain
  26. //
  27. // Synopsis: Main console entry point.
  28. //
  29. // Effects:
  30. //
  31. // Arguments:
  32. //
  33. // Requires:
  34. //
  35. // Returns:
  36. //
  37. // Notes: Use wmain rather than main to get an LPTSTR[] of args.
  38. //
  39. //--------------------------------------------------------------------------
  40. int __cdecl
  41. wmain(
  42. DWORD argc,
  43. LPTSTR argv[]
  44. )
  45. {
  46. //
  47. // Initialize debugging routines.
  48. //
  49. KtInitDebug();
  50. //
  51. // if we have no arguments, attempt to run as a service,
  52. // otherwise explain how to install and remove using sc.exe.
  53. //
  54. if( argc == 1 )
  55. {
  56. if( KtStartServiceCtrlDispatcher() )
  57. {
  58. DebugLog( DEB_TRACE, "%s(%d): Started service control dispatcher.\n", __FILE__, __LINE__ );
  59. }
  60. else
  61. {
  62. /* TODO: Log Event */
  63. DebugLog( DEB_ERROR, "%s(%d): Error starting service control dispatcher: 0x%x.\n", __FILE__, __LINE__, GetLastError() );
  64. }
  65. }
  66. else
  67. {
  68. _tprintf( TEXT("Kerberos Http Tunneller Client Service\n")
  69. TEXT("Installation: sc create %s binPath= [path to this file]\n")
  70. TEXT("Removal: sc delete %s\n"), KtServiceName, KtServiceName );
  71. }
  72. return 0;
  73. }