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.

90 lines
2.6 KiB

  1. /*---------------------------------------------------------------------------
  2. File: McsADsClassProp.cpp
  3. Comments: Implementation of DLL Exports.
  4. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  5. Proprietary and confidential to Mission Critical Software, Inc.
  6. REVISION LOG ENTRY
  7. Revision By: Sham Chauthani
  8. Revised on 07/02/99 12:40:00
  9. ---------------------------------------------------------------------------
  10. */
  11. // Note: Proxy/Stub Information
  12. // To build a separate proxy/stub DLL,
  13. // run nmake -f McsADsClassPropps.mk in the project directory.
  14. #include "stdafx.h"
  15. #include "resource.h"
  16. #include <initguid.h>
  17. #include "ADsProp.h"
  18. #include "ADsProp_i.c"
  19. #include "ObjProp.h"
  20. CComModule _Module;
  21. BEGIN_OBJECT_MAP(ObjectMap)
  22. OBJECT_ENTRY(CLSID_ObjPropBuilder, CObjPropBuilder)
  23. END_OBJECT_MAP()
  24. /////////////////////////////////////////////////////////////////////////////
  25. // DLL Entry Point
  26. extern "C"
  27. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  28. {
  29. if (dwReason == DLL_PROCESS_ATTACH)
  30. {
  31. ATLTRACE(_T("{McsADsClassProp.dll}DllMain(hInstance=0x%08lX, dwReason=DLL_PROCESS_ATTACH,...)\n"), hInstance);
  32. _Module.Init(ObjectMap, hInstance, &LIBID_MCSADSCLASSPROPLib);
  33. DisableThreadLibraryCalls(hInstance);
  34. _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
  35. }
  36. else if (dwReason == DLL_PROCESS_DETACH)
  37. {
  38. ATLTRACE(_T("{McsADsClassProp.dll}DllMain(hInstance=0x%08lX, dwReason=DLL_PROCESS_DETACH,...)\n"), hInstance);
  39. _Module.Term();
  40. }
  41. return TRUE; // ok
  42. }
  43. /////////////////////////////////////////////////////////////////////////////
  44. // Used to determine whether the DLL can be unloaded by OLE
  45. STDAPI DllCanUnloadNow(void)
  46. {
  47. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  48. }
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Returns a class factory to create an object of the requested type
  51. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  52. {
  53. return _Module.GetClassObject(rclsid, riid, ppv);
  54. }
  55. /////////////////////////////////////////////////////////////////////////////
  56. // DllRegisterServer - Adds entries to the system registry
  57. STDAPI DllRegisterServer(void)
  58. {
  59. // registers object, typelib and all interfaces in typelib
  60. return _Module.RegisterServer(TRUE);
  61. }
  62. /////////////////////////////////////////////////////////////////////////////
  63. // DllUnregisterServer - Removes entries from the system registry
  64. STDAPI DllUnregisterServer(void)
  65. {
  66. return _Module.UnregisterServer(TRUE);
  67. }