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.

85 lines
2.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: U P N P H O S T . C P P
  7. //
  8. // Contents: DLL initialization for UPnP Device Host
  9. //
  10. // Notes:
  11. //
  12. // Author: danielwe 10 Jul 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. #include "hostinc.h"
  18. #include "exetst.h"
  19. CComModule _Module;
  20. BEGIN_OBJECT_MAP(ObjectMap)
  21. END_OBJECT_MAP()
  22. /////////////////////////////////////////////////////////////////////////////
  23. // DLL Entry Point
  24. extern "C"
  25. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  26. {
  27. BOOL bRet = TRUE;
  28. if (dwReason == DLL_PROCESS_ATTACH)
  29. {
  30. InitializeDebugging();
  31. _Module.Init(ObjectMap, hInstance, &LIBID_UPNPLib);
  32. DisableThreadLibraryCalls(hInstance);
  33. }
  34. else if (dwReason == DLL_PROCESS_DETACH)
  35. {
  36. _Module.Term();
  37. UnInitializeDebugging();
  38. }
  39. return bRet;
  40. }
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Used to determine whether the DLL can be unloaded by OLE
  43. STDAPI DllCanUnloadNow(void)
  44. {
  45. return(_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  46. }
  47. /////////////////////////////////////////////////////////////////////////////
  48. // Returns a class factory to create an object of the requested type
  49. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  50. {
  51. return _Module.GetClassObject(rclsid, riid, ppv);
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. // DllRegisterServer - Adds entries to the system registry
  55. STDAPI DllRegisterServer(void)
  56. {
  57. // registers object, typelib and all interfaces in typelib
  58. return _Module.RegisterServer(TRUE);
  59. }
  60. /////////////////////////////////////////////////////////////////////////////
  61. // DllUnregisterServer - Removes entries from the system registry
  62. STDAPI DllUnregisterServer(void)
  63. {
  64. return _Module.UnregisterServer(TRUE);
  65. }