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.

104 lines
2.8 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. /*********************************************************************************************
  3. *
  4. *
  5. * Module Name:
  6. *
  7. * CfgBkEnd.cpp
  8. *
  9. * Abstract:
  10. * This Module is generated by the ATL Wizard. This has the
  11. * the exported functiond DllGetClassObject,DllRegisterServer
  12. * DllUnRegisterServer, DllCanUnloadNow
  13. *
  14. *
  15. * Author:
  16. *
  17. *
  18. * Revision:
  19. *
  20. *
  21. ************************************************************************************************/
  22. // Note: Proxy/Stub Information
  23. // To build a separate proxy/stub DLL,
  24. // run nmake -f CfgBkEndps.mk in the project directory.
  25. #include "stdafx.h"
  26. #include "resource.h"
  27. #include "initguid.h"
  28. #include "CfgBkEnd.h"
  29. #include "CfgBkEnd_i.c"
  30. #include "PtrArray.h"
  31. #include <winsta.h>
  32. #include <regapi.h>
  33. #include "Defines.h"
  34. #include "CfgComp.h"
  35. CComModule _Module;
  36. HINSTANCE g_hInstance;
  37. BEGIN_OBJECT_MAP(ObjectMap)
  38. OBJECT_ENTRY(CLSID_CfgComp, CCfgComp)
  39. END_OBJECT_MAP()
  40. /**************************************************************************************/
  41. // DLL Entry Point
  42. extern "C"
  43. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  44. {
  45. if (dwReason == DLL_PROCESS_ATTACH)
  46. {
  47. _Module.Init(ObjectMap, hInstance);
  48. DisableThreadLibraryCalls(hInstance);
  49. g_hInstance = hInstance;
  50. }
  51. else if (dwReason == DLL_PROCESS_DETACH)
  52. _Module.Term();
  53. return TRUE; // ok
  54. }
  55. /////////////////////////////////////////////////////////////////////////////
  56. // Used to determine whether the DLL can be unloaded by OLE
  57. extern "C"
  58. STDAPI DllCanUnloadNow(void)
  59. {
  60. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  61. }
  62. /////////////////////////////////////////////////////////////////////////////
  63. // Returns a class factory to create an object of the requested type
  64. extern "C"
  65. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  66. {
  67. return _Module.GetClassObject(rclsid, riid, ppv);
  68. }
  69. /////////////////////////////////////////////////////////////////////////////
  70. // DllRegisterServer - Adds entries to the system registry
  71. STDAPI DllRegisterServer(void)
  72. {
  73. // registers object, typelib and all interfaces in typelib
  74. // except we don't need to register a typelib pass in false
  75. // alhen
  76. return _Module.RegisterServer( FALSE );
  77. }
  78. /////////////////////////////////////////////////////////////////////////////
  79. // DllUnregisterServer - Removes entries from the system registry
  80. STDAPI DllUnregisterServer(void)
  81. {
  82. _Module.UnregisterServer();
  83. return S_OK;
  84. }