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.

87 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: D L L M A I N . C P P
  7. //
  8. // Contents: DLL entry points for upnpcont.dll
  9. //
  10. // Notes:
  11. //
  12. // Author: mbend 8 Aug 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. #include "ucres.h"
  18. #include "ucbase.h"
  19. #include "hostp.h"
  20. #include "hostp_i.c"
  21. // Headers of COM objects
  22. #include "Container.h"
  23. CServerAppModule _Module;
  24. BEGIN_OBJECT_MAP(ObjectMap)
  25. OBJECT_ENTRY(CLSID_UPnPContainer, CContainer)
  26. END_OBJECT_MAP()
  27. /////////////////////////////////////////////////////////////////////////////
  28. //
  29. extern "C"
  30. int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/)
  31. {
  32. lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
  33. HRESULT hr = S_OK;
  34. hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  35. TraceHr(ttidError, FAL, hr, FALSE, "WinMain - CoInitializeEx failed!");
  36. if(SUCCEEDED(hr))
  37. {
  38. hr = CoInitializeSecurity(
  39. NULL,
  40. -1,
  41. NULL,
  42. NULL,
  43. RPC_C_AUTHN_LEVEL_CONNECT,
  44. RPC_C_IMP_LEVEL_IMPERSONATE,
  45. NULL,
  46. 0,
  47. NULL);
  48. }
  49. _Module.Init(ObjectMap, hInstance);
  50. BOOL bRun = _Module.ParseCommandLine(lpCmdLine, L"{4F0AC159-5804-4aa7-AE91-117D6E67BB9B}", &hr);
  51. if (bRun)
  52. {
  53. _Module.StartMonitor();
  54. hr = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
  55. REGCLS_SINGLEUSE | REGCLS_SUSPENDED);
  56. TraceHr(ttidError, FAL, hr, FALSE, "_Module.RegisterClassObjects failed!");
  57. hr = CoResumeClassObjects();
  58. TraceHr(ttidError, FAL, hr, FALSE, "CoResumeClassObjects failed");
  59. MSG msg;
  60. while (GetMessage(&msg, 0, 0, 0))
  61. DispatchMessage(&msg);
  62. _Module.RevokeClassObjects();
  63. // Terminate the shutdown thread
  64. CContainer::DoNormalShutdown();
  65. }
  66. _Module.Term();
  67. CoUninitialize();
  68. return hr;
  69. }