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.

162 lines
2.7 KiB

  1. /* - - - - - - - - */
  2. /*
  3. ** Copyright (C) Microsoft Corporation 1993. All rights reserved.
  4. */
  5. /* - - - - - - - - */
  6. #include <windows.h>
  7. #include <windowsx.h>
  8. #include <string.h>
  9. #include <mmsystem.h>
  10. #include <compobj.h>
  11. #include "aviview.h"
  12. #include <ole2.h>
  13. #include <vfw.h>
  14. #include "regobjs.h"
  15. /*
  16. ** The usage counter keeps track of the overall usage of objects based on
  17. ** implementations provided by the component. This allows one to determine
  18. ** when the implementation is no longer in use.
  19. */
  20. UINT uUseCount;
  21. BOOL fLocked;
  22. IClassFactory FAR * gpCF;
  23. DWORD gdwRegistered;
  24. extern "C" BOOL RegisterObjects(void);
  25. extern "C" void RevokeObjects(void);
  26. BOOL RegisterObjects(void)
  27. {
  28. #if 0
  29. HRESULT hresult;
  30. #endif
  31. // OleInitialize(NULL);
  32. #if 0
  33. CAppCF::MakeInst(CLSID_ACMCmprsStream, IID_IClassFactory,
  34. (void FAR * FAR *) &gpCF);
  35. hresult = CoRegisterClassObject(CLSID_ACMCmprsStream,
  36. gpCF,
  37. CLSCTX_INPROC_SERVER,
  38. REGCLS_MULTIPLEUSE,
  39. &gdwRegistered);
  40. if (FAILED(GetScode(hresult))) {
  41. delete gpCF;
  42. gpCF = NULL;
  43. return FALSE;
  44. }
  45. #endif
  46. return TRUE;
  47. }
  48. void RevokeObjects(void)
  49. {
  50. #if 0
  51. CoRevokeClassObject(gdwRegistered);
  52. #endif
  53. // OleUninitialize();
  54. }
  55. /* - - - - - - - - */
  56. HRESULT CAppCF::MakeInst(
  57. const CLSID FAR& rclsid,
  58. const IID FAR& riid,
  59. void FAR* FAR* ppv)
  60. {
  61. CAppCF FAR* pAppCF;
  62. IUnknown FAR* pUnknown;
  63. HRESULT hresult;
  64. pAppCF = new FAR CAppCF(rclsid, &pUnknown);
  65. if (pAppCF == NULL)
  66. return ResultFromScode(E_OUTOFMEMORY);
  67. hresult = pUnknown->QueryInterface(riid, ppv);
  68. if (FAILED(GetScode(hresult)))
  69. delete pAppCF;
  70. return hresult;
  71. }
  72. /* - - - - - - - - */
  73. CAppCF::CAppCF(
  74. const CLSID FAR& rclsid,
  75. IUnknown FAR* FAR* ppUnknown)
  76. {
  77. m_clsid = rclsid;
  78. m_refs = 0;
  79. *ppUnknown = this;
  80. }
  81. /* - - - - - - - - */
  82. STDMETHODIMP CAppCF::QueryInterface(
  83. const IID FAR& iid,
  84. void FAR* FAR* ppv)
  85. {
  86. if (iid == IID_IUnknown)
  87. *ppv = this;
  88. else if (iid == IID_IClassFactory)
  89. *ppv = this;
  90. else
  91. return ResultFromScode(E_NOINTERFACE);
  92. AddRef();
  93. return NULL;
  94. }
  95. /* - - - - - - - - */
  96. STDMETHODIMP_(ULONG) CAppCF::AddRef()
  97. {
  98. return ++m_refs;
  99. }
  100. /* - - - - - - - - */
  101. STDMETHODIMP_(ULONG) CAppCF::Release()
  102. {
  103. if (!--m_refs) {
  104. delete this;
  105. return 0;
  106. }
  107. return m_refs;
  108. }
  109. /* - - - - - - - - */
  110. STDMETHODIMP CAppCF::CreateInstance(
  111. IUnknown FAR* pUnknownOuter,
  112. const IID FAR& riid,
  113. void FAR* FAR* ppv)
  114. {
  115. #if 0
  116. if (IsEqualCLSID(m_clsid, CLSID_ACMCmprsStream)) {
  117. return CACMCmpStream::MakeInst(pUnknownOuter, riid, ppv);
  118. }
  119. else
  120. #endif
  121. {
  122. return ResultFromScode(CO_E_CANTDETERMINECLASS); // !!!
  123. }
  124. }
  125. /* - - - - - - - - */
  126. STDMETHODIMP CAppCF::LockServer(
  127. BOOL fLock)
  128. {
  129. fLocked = fLock;
  130. return NULL;
  131. }
  132. /* - - - - - - - - */