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.

112 lines
3.1 KiB

  1. // task.cpp : Implementation of DLL Exports.
  2. // You will need the NT SUR Beta 2 SDK or VC 4.2 in order to build this
  3. // project. This is because you will need MIDL 3.00.15 or higher and new
  4. // headers and libs. If you have VC 4.2 installed, then everything should
  5. // already be configured correctly.
  6. // Note: Proxy/Stub Information
  7. // To build a separate proxy/stub DLL,
  8. // run nmake -f taskps.mak in the project directory.
  9. #include "stdafx.h"
  10. #include "resource.h"
  11. #include "initguid.h"
  12. #include "wsb.h"
  13. #include "engine.h"
  14. #include "Task.h"
  15. #include "TskMgr.h"
  16. #include "metaint.h"
  17. #include "metalib.h"
  18. #include "segrec.h"
  19. #include "segdb.h"
  20. #include "baghole.h"
  21. #include "bagInfo.h"
  22. #include "medInfo.h"
  23. #include "VolAsgn.h"
  24. #include "hsmworkq.h"
  25. #include "hsmworki.h"
  26. #include "hsmreclq.h"
  27. #include "hsmrecli.h"
  28. CComModule _Module;
  29. BEGIN_OBJECT_MAP(ObjectMap)
  30. OBJECT_ENTRY(CLSID_CHsmTskMgr, CHsmTskMgr)
  31. OBJECT_ENTRY(CLSID_CHsmWorkQueue, CHsmWorkQueue)
  32. OBJECT_ENTRY(CLSID_CHsmWorkItem, CHsmWorkItem)
  33. OBJECT_ENTRY(CLSID_CHsmRecallQueue, CHsmRecallQueue)
  34. OBJECT_ENTRY(CLSID_CHsmRecallItem, CHsmRecallItem)
  35. OBJECT_ENTRY(CLSID_CSegRec, CSegRec)
  36. OBJECT_ENTRY(CLSID_CBagHole, CBagHole)
  37. OBJECT_ENTRY(CLSID_CBagInfo, CBagInfo)
  38. OBJECT_ENTRY(CLSID_CMediaInfo, CMediaInfo)
  39. OBJECT_ENTRY(CLSID_CVolAssign, CVolAssign)
  40. OBJECT_ENTRY(CLSID_CSegDb, CSegDb)
  41. END_OBJECT_MAP()
  42. /////////////////////////////////////////////////////////////////////////////
  43. // DLL Entry Point
  44. extern "C"
  45. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  46. {
  47. if (dwReason == DLL_PROCESS_ATTACH)
  48. {
  49. _Module.Init(ObjectMap, hInstance);
  50. DisableThreadLibraryCalls(hInstance);
  51. }
  52. else if (dwReason == DLL_PROCESS_DETACH)
  53. _Module.Term();
  54. return TRUE; // ok
  55. }
  56. /////////////////////////////////////////////////////////////////////////////
  57. // Used to determine whether the DLL can be unloaded by OLE
  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. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  65. {
  66. return _Module.GetClassObject(rclsid, riid, ppv);
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. // DllRegisterServer - Adds entries to the system registry
  70. STDAPI DllRegisterServer(void)
  71. {
  72. HRESULT hr;
  73. // registers object
  74. hr = CoInitialize( 0 );
  75. if (SUCCEEDED(hr)) {
  76. hr = _Module.RegisterServer( FALSE );
  77. CoUninitialize( );
  78. }
  79. return( hr );
  80. }
  81. /////////////////////////////////////////////////////////////////////////////
  82. // DllUnregisterServer - Removes entries from the system registry
  83. STDAPI DllUnregisterServer(void)
  84. {
  85. HRESULT hr;
  86. hr = CoInitialize(0);
  87. if (SUCCEEDED(hr)) {
  88. _Module.UnregisterServer();
  89. CoUninitialize( );
  90. hr = S_OK;
  91. }
  92. return hr;
  93. }