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.

92 lines
2.3 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1997 Microsoft Corporation. All Rights Reserved.
  5. Component: MetaUtil object
  6. File: MetaUtil.cpp
  7. Owner: t-BrianM
  8. This file contains the DLL interface. Generated by the ATL wizard.
  9. I just added the debugging stuff.
  10. ===================================================================*/
  11. #include "stdafx.h"
  12. #include "resource.h"
  13. #include "initguid.h"
  14. #include "MetaUtil.h"
  15. #include "MetaUtil_i.c"
  16. #include "MUtilObj.h"
  17. #include "propcol.h"
  18. #include "ChkError.h"
  19. #include "MetaSchm.h"
  20. #ifdef _NO_TRACING_
  21. DECLARE_DEBUG_PRINTS_OBJECT();
  22. #endif
  23. CComModule _Module;
  24. BEGIN_OBJECT_MAP(ObjectMap)
  25. OBJECT_ENTRY(CLSID_MetaUtil, CMetaUtil)
  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);
  35. DisableThreadLibraryCalls(hInstance);
  36. IRTL_DEBUG_INIT();
  37. }
  38. else if (dwReason == DLL_PROCESS_DETACH)
  39. {
  40. IRTL_DEBUG_TERM();
  41. _Module.Term();
  42. }
  43. return TRUE; // ok
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // Used to determine whether the DLL can be unloaded by OLE
  47. STDAPI DllCanUnloadNow(void)
  48. {
  49. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  50. }
  51. /////////////////////////////////////////////////////////////////////////////
  52. // Returns a class factory to create an object of the requested type
  53. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  54. {
  55. return _Module.GetClassObject(rclsid, riid, ppv);
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // DllRegisterServer - Adds entries to the system registry
  59. STDAPI DllRegisterServer(void)
  60. {
  61. // registers object, typelib and all interfaces in typelib
  62. return _Module.RegisterServer(TRUE);
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // DllUnregisterServer - Removes entries from the system registry
  66. STDAPI DllUnregisterServer(void)
  67. {
  68. _Module.UnregisterServer();
  69. return S_OK;
  70. }