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.

61 lines
2.1 KiB

  1. // txfac.cpp -- Class factory for LZX transform instances
  2. #include "stdafx.h"
  3. STDMETHODIMP CLZX_TransformFactory::Create(IUnknown *punkOuter, REFIID riid, PVOID *ppv)
  4. {
  5. PCLZX_TransformFactory pTxFac = New CLZX_TransformFactory(punkOuter);
  6. if (pTxFac == NULL)
  7. return STG_E_INSUFFICIENTMEMORY;
  8. HRESULT hr = pTxFac->m_ImpITXFactory.Init();
  9. if (hr == S_OK)
  10. hr = pTxFac->QueryInterface(riid, ppv);
  11. if (hr != S_OK)
  12. delete pTxFac;
  13. return hr;
  14. }
  15. HRESULT STDMETHODCALLTYPE CLZX_TransformFactory::CImpITransformFactory::DefaultControlData
  16. (XformControlData **ppXFCD)
  17. {
  18. LZX_Control_Data *pXFCD = PLZX_Control_Data(OLEHeap()->Alloc(sizeof(LZX_Control_Data)));
  19. if (!pXFCD)
  20. return E_OUTOFMEMORY;
  21. pXFCD->cdwControlData = 6;
  22. pXFCD->dwLZXMagic = LZX_MAGIC;
  23. pXFCD->dwVersion = LZX_Current_Version;
  24. pXFCD->dwMulResetBlock = RESET_BLOCK_SIZE;
  25. pXFCD->dwMulWindowSize = WINDOW_SIZE;
  26. pXFCD->dwMulSecondPartition = SECOND_PARTITION_SIZE;
  27. pXFCD->dwOptions = LXZ_DEF_OPT_FLAGS;
  28. *ppXFCD = PXformControlData(pXFCD);
  29. return NO_ERROR;
  30. }
  31. HRESULT STDMETHODCALLTYPE CLZX_TransformFactory::CImpITransformFactory::CreateTransformInstance
  32. (ITransformInstance *pITxInstMedium, // Container data span for transformed data
  33. ULARGE_INTEGER cbUntransformedSize, // Untransformed size of data
  34. PXformControlData pXFCD, // Control data for this instance
  35. const CLSID *rclsidXForm, // Transform Class ID
  36. const WCHAR *pwszDataSpaceName, // Data space name for this instance
  37. ITransformServices *pXformServices, // Utility routines
  38. IKeyInstance *pKeyManager, // Interface to get enciphering keys
  39. ITransformInstance **ppTransformInstance // Out: Instance transform interface
  40. )
  41. {
  42. return CTransformInstance::Create
  43. (pITxInstMedium, cbUntransformedSize, pXFCD,
  44. rclsidXForm, pwszDataSpaceName,
  45. pXformServices, pKeyManager, ppTransformInstance
  46. );
  47. }