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.

88 lines
2.2 KiB

  1. /*
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. rcbdyctl.cpp
  5. Abstract:
  6. Implementation of DLL Exports and Registration
  7. Revision History:
  8. created steveshi 08/23/00
  9. */
  10. #include "stdafx.h"
  11. #include "resource.h"
  12. #include <initguid.h>
  13. #include "rcbdyctl.h"
  14. #include "rcbdyctl_i.c"
  15. #include "smapi.h"
  16. #include "setting.h"
  17. #include "imsession.h"
  18. #include "msgbox.h"
  19. CComModule _Module;
  20. HINSTANCE g_hInstance;
  21. BEGIN_OBJECT_MAP(ObjectMap)
  22. OBJECT_ENTRY(CLSID_smapi, Csmapi)
  23. OBJECT_ENTRY(CLSID_Setting, CSetting)
  24. OBJECT_ENTRY(CLSID_IMSession, CIMSession)
  25. OBJECT_ENTRY(CLSID_MsgBox, CMsgBox)
  26. END_OBJECT_MAP()
  27. /////////////////////////////////////////////////////////////////////////////
  28. // DLL Entry Point
  29. extern "C"
  30. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  31. {
  32. if (dwReason == DLL_PROCESS_ATTACH)
  33. {
  34. _Module.Init(ObjectMap, hInstance, &LIBID_RCBDYCTLLib);
  35. DisableThreadLibraryCalls(hInstance);
  36. g_hInstance = hInstance; // used for Dialog.
  37. }
  38. else if (dwReason == DLL_PROCESS_DETACH)
  39. {
  40. _Module.Term();
  41. }
  42. return TRUE; // ok
  43. }
  44. /////////////////////////////////////////////////////////////////////////////
  45. // Used to determine whether the DLL can be unloaded by OLE
  46. STDAPI DllCanUnloadNow(void)
  47. {
  48. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  49. }
  50. /////////////////////////////////////////////////////////////////////////////
  51. // Returns a class factory to create an object of the requested type
  52. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  53. {
  54. return _Module.GetClassObject(rclsid, riid, ppv);
  55. }
  56. /////////////////////////////////////////////////////////////////////////////
  57. // DllRegisterServer - Adds entries to the system registry
  58. STDAPI DllRegisterServer(void)
  59. {
  60. // registers object, typelib and all interfaces in typelib
  61. return _Module.RegisterServer(TRUE);
  62. }
  63. /////////////////////////////////////////////////////////////////////////////
  64. // DllUnregisterServer - Removes entries from the system registry
  65. STDAPI DllUnregisterServer(void)
  66. {
  67. return _Module.UnregisterServer(TRUE);
  68. }