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.

120 lines
3.4 KiB

  1. // Copyright (c) 1997 Microsoft Corporation. All Rights Reserved.
  2. // strmobjs.cpp : Implementation of DLL Exports.
  3. // Note: Proxy/Stub Information
  4. // To build a separate proxy/stub DLL,
  5. // run nmake -f strmobjsps.mk in the project directory.
  6. #define CPP_FUNCTIONS
  7. #include "stdafx.h"
  8. #include <ddraw.h>
  9. #include "resource.h"
  10. #include "strmobjs.h"
  11. //#include "strmobjs_i.c"
  12. #include <strmif.h>
  13. #include <control.h>
  14. #include <uuids.h>
  15. #include <vfwmsgs.h>
  16. #include <amutil.h>
  17. #include "stream.h"
  18. #include "ddstrm.h"
  19. #include "sample.h"
  20. #include "util.h"
  21. #include "bytestrm.h"
  22. #include "austrm.h"
  23. #include <initguid.h>
  24. #include "ddrawex.h"
  25. #include "amguids.h"
  26. #include "SFilter.h"
  27. #include "ammstrm.h"
  28. #include "mss.h"
  29. #include "medsampl.h"
  30. CComModule _Module;
  31. // Debugging
  32. #ifdef DEBUG
  33. BOOL bDbgTraceFunctions;
  34. BOOL bDbgTraceInterfaces;
  35. BOOL bDbgTraceTimes;
  36. #endif
  37. BEGIN_OBJECT_MAP(ObjectMap)
  38. OBJECT_ENTRY(CLSID_MediaStreamFilter, CMediaStreamFilter)
  39. OBJECT_ENTRY(CLSID_AMMultiMediaStream, CMMStream)
  40. OBJECT_ENTRY(CLSID_AMDirectDrawStream, CDDStream)
  41. OBJECT_ENTRY(CLSID_AMAudioStream, CAudioStream)
  42. OBJECT_ENTRY(CLSID_AMAudioData, CAudioData)
  43. OBJECT_ENTRY(CLSID_AMMediaTypeStream, CAMMediaTypeStream)
  44. END_OBJECT_MAP()
  45. /////////////////////////////////////////////////////////////////////////////
  46. // DLL Entry Point
  47. extern "C"
  48. BOOL WINAPI DllEntryPoint(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  49. {
  50. if (dwReason == DLL_PROCESS_ATTACH)
  51. {
  52. #ifdef DEBUG
  53. bDbgTraceFunctions = GetProfileInt(_T("AMSTREAM"), _T("Functions"), 0);
  54. bDbgTraceInterfaces = GetProfileInt(_T("AMSTREAM"), _T("Interfaces"), 0);
  55. bDbgTraceTimes = GetProfileInt(_T("AMSTREAM"), _T("TimeStamps"), 0);
  56. #endif
  57. _Module.Init(ObjectMap, hInstance);
  58. DisableThreadLibraryCalls(hInstance);
  59. }
  60. else if (dwReason == DLL_PROCESS_DETACH)
  61. _Module.Term();
  62. TRACEFUNC(_T("DllEntryPoint(0x%8.8X, %d, 0x%8.8X\n)"),
  63. hInstance, dwReason, 0);
  64. return TRUE; // ok
  65. }
  66. /////////////////////////////////////////////////////////////////////////////
  67. // Used to determine whether the DLL can be unloaded by OLE
  68. STDAPI DllCanUnloadNow(void)
  69. {
  70. TRACEFUNC(_T("DllCanUnloadNow\n"));
  71. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  72. }
  73. /////////////////////////////////////////////////////////////////////////////
  74. // Returns a class factory to create an object of the requested type
  75. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  76. {
  77. TRACEFUNC(_T("DllGetClassObject(%s, %s, 0x%8.8X)\n"),
  78. TextFromGUID(rclsid), TextFromGUID(riid), ppv);
  79. return _Module.GetClassObject(rclsid, riid, ppv);
  80. }
  81. /////////////////////////////////////////////////////////////////////////////
  82. // DllRegisterServer - Adds entries to the system registry
  83. STDAPI DllRegisterServer(void)
  84. {
  85. TRACEFUNC(_T("DllRegisterServer\n"));
  86. // registers object, typelib and all interfaces in typelib
  87. HRESULT hr = _Module.RegisterServer(TRUE);
  88. // Don't care if the typelib doesn't load on win95 gold
  89. if (hr == TYPE_E_INVDATAREAD || hr == TYPE_E_CANTLOADLIBRARY) {
  90. hr = S_OK;
  91. }
  92. return hr;
  93. }
  94. /////////////////////////////////////////////////////////////////////////////
  95. // DllUnregisterServer - Removes entries from the system registry
  96. STDAPI DllUnregisterServer(void)
  97. {
  98. TRACEFUNC(_T("DllUnregisterServer\n"));
  99. _Module.UnregisterServer();
  100. return S_OK;
  101. }