コード例 #1
0
ファイル: RootFolder.cpp プロジェクト: bks/qz7
STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
  if (index == ROOT_INDEX_COMPUTER)
  {
    CFSDrives *fsDrivesSpec = new CFSDrives;
    CMyComPtr<IFolderFolder> subFolder = fsDrivesSpec;
    fsDrivesSpec->Init();
    *resultFolder = subFolder.Detach();
  }
  else if (index == ROOT_INDEX_NETWORK)
  {
    CNetFolder *netFolderSpec = new CNetFolder;
    CMyComPtr<IFolderFolder> subFolder = netFolderSpec;
    netFolderSpec->Init(0, 0, _names[ROOT_INDEX_NETWORK] + WCHAR_PATH_SEPARATOR);
    *resultFolder = subFolder.Detach();
  }
  else if (index == ROOT_INDEX_DOCUMENTS)
  {
    UString s = GetMyDocsPath();
    if (!s.IsEmpty())
    {
      NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
      CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
      RINOK(fsFolderSpec->Init(s, NULL));
      *resultFolder = subFolder.Detach();
    }
  }
  else
    return E_INVALIDARG;
  return S_OK;
}
コード例 #2
0
ファイル: NetFolder.cpp プロジェクト: Dabil/puNES
STDMETHODIMP CNetFolder::BindToParentFolder(IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  if (_parentFolder)
  {
    CMyComPtr<IFolderFolder> parentFolder = _parentFolder;
    *resultFolder = parentFolder.Detach();
    return S_OK;
  }
  if (_netResourcePointer != 0)
  {
    CResourceW resourceParent;
    DWORD result = GetResourceParent(_netResource, resourceParent);
    if (result != NO_ERROR)
      return result;
    if (!_netResource.RemoteNameIsDefined)
      return S_OK;

    CNetFolder *netFolder = new CNetFolder;
    CMyComPtr<IFolderFolder> subFolder = netFolder;
    netFolder->Init(&resourceParent, 0, WCHAR_PATH_SEPARATOR);
    *resultFolder = subFolder.Detach();
  }
  return S_OK;
}
コード例 #3
0
STDAPI CreateObject(
    const GUID *classID, 
    const GUID *interfaceID, 
    void **outObject)
{
  COM_TRY_BEGIN
  *outObject = 0;
  if (*classID != CLSID_CBZip2Handler)
    return CLASS_E_CLASSNOTAVAILABLE;
  int needIn = *interfaceID == IID_IInArchive;
  int needOut = *interfaceID == IID_IOutArchive;
  if (needIn || needOut)
  {
    NArchive::NBZip2::CHandler *temp = new NArchive::NBZip2::CHandler;
    if (needIn)
    {
      CMyComPtr<IInArchive> inArchive = (IInArchive *)temp;
      *outObject = inArchive.Detach();
    }
    else
    {
      CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp;
      *outObject = outArchive.Detach();
    }
  }
  else
    return E_NOINTERFACE;
  COM_TRY_END
  return S_OK;
}
コード例 #4
0
ファイル: FSFolder.cpp プロジェクト: 0vermind/NeoLoader
STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  if (_parentFolder)
  {
    CMyComPtr<IFolderFolder> parentFolder = _parentFolder;
    *resultFolder = parentFolder.Detach();
    return S_OK;
  }
  if (_path.IsEmpty())
    return E_INVALIDARG;
  int pos = _path.ReverseFind(WCHAR_PATH_SEPARATOR);
  if (pos < 0 || pos != _path.Length() - 1)
    return E_FAIL;
  UString parentPath = _path.Left(pos);
  pos = parentPath.ReverseFind(WCHAR_PATH_SEPARATOR);
  if (pos < 0)
  {
    #ifdef UNDER_CE
    *resultFolder = 0;
    #else
    CFSDrives *drivesFolderSpec = new CFSDrives;
    CMyComPtr<IFolderFolder> drivesFolder = drivesFolderSpec;
    drivesFolderSpec->Init();
    *resultFolder = drivesFolder.Detach();
    #endif
    return S_OK;
  }
  UString parentPathReduced = parentPath.Left(pos);
  parentPath = parentPath.Left(pos + 1);
  #ifndef UNDER_CE
  pos = parentPathReduced.ReverseFind(WCHAR_PATH_SEPARATOR);
  if (pos == 1)
  {
    if (parentPath[0] != WCHAR_PATH_SEPARATOR)
      return E_FAIL;
    CNetFolder *netFolderSpec = new CNetFolder;
    CMyComPtr<IFolderFolder> netFolder = netFolderSpec;
    netFolderSpec->Init(parentPath);
    *resultFolder = netFolder.Detach();
    return S_OK;
  }
  #endif
  CFSFolder *parentFolderSpec = new CFSFolder;
  CMyComPtr<IFolderFolder> parentFolder = parentFolderSpec;
  RINOK(parentFolderSpec->Init(parentPath, 0));
  *resultFolder = parentFolder.Detach();
  return S_OK;
}
コード例 #5
0
ファイル: CoderMixer2ST.cpp プロジェクト: BIAINC/7Zip
HRESULT CCoderMixer2ST::GetOutStream(
    ISequentialOutStream **outStreams, const UInt64 **outSizes,
    UInt32 streamIndex, ISequentialOutStream **outStreamRes)
{
  CMyComPtr<ISequentialOutStream> seqOutStream;
  int i;
  for(i = 0; i < _bindInfo.OutStreams.Size(); i++)
    if (_bindInfo.OutStreams[i] == streamIndex)
    {
      seqOutStream = outStreams[i];
      *outStreamRes = seqOutStream.Detach();
      return  S_OK;
    }
  int binderIndex = _bindInfo.FindBinderForOutStream(streamIndex);
  if (binderIndex < 0)
    return E_INVALIDARG;

  UInt32 coderIndex, coderStreamIndex;
  _bindInfo.FindInStream(_bindInfo.BindPairs[binderIndex].InIndex,
      coderIndex, coderStreamIndex);

  CCoderInfo &coder = _coders[coderIndex];
  if (!coder.Coder)
    return E_NOTIMPL;
  coder.Coder.QueryInterface(IID_ISequentialOutStream, &seqOutStream);
  if (!seqOutStream)
    return E_NOTIMPL;

  UInt32 startIndex = _bindInfo.GetCoderOutStreamIndex(coderIndex);

  CMyComPtr<ICompressSetOutStream> setOutStream;
  if (!coder.Coder)
    return E_NOTIMPL;
  coder.Coder.QueryInterface(IID_ICompressSetOutStream, &setOutStream);
  if (!setOutStream)
    return E_NOTIMPL;

  if (coder.NumOutStreams > 1)
    return E_NOTIMPL;
  for (i = 0; i < (int)coder.NumOutStreams; i++)
  {
    CMyComPtr<ISequentialOutStream> seqOutStream2;
    RINOK(GetOutStream(outStreams, outSizes, startIndex + i, &seqOutStream2));
    RINOK(setOutStream->SetOutStream(seqOutStream2));
  }
  *outStreamRes = seqOutStream.Detach();
  return S_OK;
}
コード例 #6
0
STDMETHODIMP CPPToJavaArchiveExtractCallback::GetStream(UInt32 index,
                                                        ISequentialOutStream **outStream,
                                                        Int32 askExtractMode) {
    TRACE_OBJECT_CALL("GetStream");

    JNIEnvInstance jniEnvInstance(_jbindingSession);

    if (outStream) {
        *outStream = NULL;
    }

    jobject askExtractModeObject = jni::ExtractAskMode::getExtractAskModeByIndex(jniEnvInstance,
            (jint) askExtractMode);
    if (jniEnvInstance.exceptionCheck()) {
        return S_FALSE;
    }

    // public SequentialOutStream getStream(int index, ExtractAskMode extractAskMode);
    jobject result = _iArchiveExtractCallback->getStream(jniEnvInstance, _javaImplementation,
            (jint) index, askExtractModeObject);
    if (jniEnvInstance.exceptionCheck()) {
        return S_FALSE;
    }

    if (result == NULL) {
        *outStream = NULL;
        return S_OK;
    }

    CMyComPtr<ISequentialOutStream> outStreamComPtr = new CPPToJavaSequentialOutStream(
            _jbindingSession, jniEnvInstance, result);
    *outStream = outStreamComPtr.Detach();

    return S_OK;
}
コード例 #7
0
STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
{
  COM_TRY_BEGIN
  *outObject = 0;

  int correctInterface = (*iid == IID_ICompressCoder);
  CMyComPtr<ICompressCoder> coder;
  if (*clsid == CLSID_CCompressRar15Decoder)
  {
    if (!correctInterface)
      return E_NOINTERFACE;
    coder = (ICompressCoder *)new NCompress::NRar15::CDecoder;
  }
  else if (*clsid == CLSID_CCompressRar20Decoder)
  {
    if (!correctInterface)
      return E_NOINTERFACE;
    coder = (ICompressCoder *)new NCompress::NRar20::CDecoder;
  }
  else if (*clsid == CLSID_CCompressRar29Decoder)
  {
    if (!correctInterface)
      return E_NOINTERFACE;
    coder = (ICompressCoder *)new NCompress::NRar29::CDecoder;
  }
  else
    return CLASS_E_CLASSNOTAVAILABLE;
  *outObject = coder.Detach();
  COM_TRY_END
  return S_OK;
}
コード例 #8
0
STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
{
  // NCompress::NRangeCoder::g_PriceTables.Init();
  // CCRC::InitTable();
  COM_TRY_BEGIN
  *outObject = 0;
  int correctInterface = (*iid == IID_ICompressCoder);
  CMyComPtr<ICompressCoder> coder;
  if (*clsid == CLSID_CLZMADecoder)
  {
    if (!correctInterface)
      return E_NOINTERFACE;
    coder = (ICompressCoder *)new NCompress::NLZMA::CDecoder();
  }
  else if (*clsid == CLSID_CLZMAEncoder)
  {
    if (!correctInterface)
      return E_NOINTERFACE;
    coder = (ICompressCoder *)new NCompress::NLZMA::CEncoder();
  }
  else
    return CLASS_E_CLASSNOTAVAILABLE;
  *outObject = coder.Detach();
  COM_TRY_END
  return S_OK;
}
コード例 #9
0
STDMETHODIMP CAltStreamsFolder::Clone(IFolderFolder **resultFolder)
{
  CAltStreamsFolder *folderSpec = new CAltStreamsFolder;
  CMyComPtr<IFolderFolder> folderNew = folderSpec;
  folderSpec->Init(_pathPrefix);
  *resultFolder = folderNew.Detach();
  return S_OK;
}
コード例 #10
0
ファイル: Agent.cpp プロジェクト: f059074251/interested
STDMETHODIMP CAgentFolder::BindToParentFolder(IFolderFolder **resultFolder)
{
  COM_TRY_BEGIN
  CMyComPtr<IFolderFolder> parentFolder = _parentFolder;
  *resultFolder = parentFolder.Detach();
  return S_OK;
  COM_TRY_END
}
コード例 #11
0
ファイル: FSFolder.cpp プロジェクト: bks/qz7
STDMETHODIMP CFSFolder::Clone(IFolderFolder **resultFolder)
{
  CFSFolder *fsFolderSpec = new CFSFolder;
  CMyComPtr<IFolderFolder> folderNew = fsFolderSpec;
  fsFolderSpec->Init(_path, 0);
  *resultFolder = folderNew.Detach();
  return S_OK;
}
コード例 #12
0
ファイル: PhysDriveFolder.cpp プロジェクト: BIAINC/7Zip
STDMETHODIMP CPhysDriveFolder::Clone(IFolderFolder **resultFolder)
{
  CPhysDriveFolder *folderSpec = new CPhysDriveFolder;
  CMyComPtr<IFolderFolder> folderNew = folderSpec;
  folderSpec->Init(_path);
  *resultFolder = folderNew.Detach();
  return S_OK;
}
コード例 #13
0
ファイル: IsoHandler.cpp プロジェクト: w17/7-Zip-zstd
STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
{
  COM_TRY_BEGIN
  *stream = 0;
  UInt64 blockIndex;
  UInt64 currentItemSize;
  
  if (index < _archive.Refs.Size())
  {
    const CRef &ref = _archive.Refs[index];
    const CDir &item = ref.Dir->_subItems[ref.Index];
    if (item.IsDir())
      return S_FALSE;

    if (ref.NumExtents > 1)
    {
      CExtentsStream *extentStreamSpec = new CExtentsStream();
      CMyComPtr<ISequentialInStream> extentStream = extentStreamSpec;
      
      extentStreamSpec->Stream = _stream;
      
      UInt64 virtOffset = 0;
      for (UInt32 i = 0; i < ref.NumExtents; i++)
      {
        const CDir &item2 = ref.Dir->_subItems[ref.Index + i];
        if (item2.Size == 0)
          continue;
        CSeekExtent se;
        se.Phy = (UInt64)item2.ExtentLocation * kBlockSize;
        se.Virt = virtOffset;
        extentStreamSpec->Extents.Add(se);
        virtOffset += item2.Size;
      }
      if (virtOffset != ref.TotalSize)
        return S_FALSE;
      CSeekExtent se;
      se.Phy = 0;
      se.Virt = virtOffset;
      extentStreamSpec->Extents.Add(se);
      extentStreamSpec->Init();
      *stream = extentStream.Detach();
      return S_OK;
    }
    
    currentItemSize = item.Size;
    blockIndex = item.ExtentLocation;
  }
  else
  {
    unsigned bootIndex = index - _archive.Refs.Size();
    const CBootInitialEntry &be = _archive.BootEntries[bootIndex];
    currentItemSize = _archive.GetBootItemSize(bootIndex);
    blockIndex = be.LoadRBA;
  }
  
  return CreateLimitedInStream(_stream, (UInt64)blockIndex * kBlockSize, currentItemSize, stream);
  COM_TRY_END
}
コード例 #14
0
ファイル: FSFolder.cpp プロジェクト: bks/qz7
HRESULT CFSFolder::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  CFSFolder *folderSpec = new CFSFolder;
  CMyComPtr<IFolderFolder> subFolder = folderSpec;
  RINOK(folderSpec->Init(_path + name + UString(WCHAR_PATH_SEPARATOR), 0));
  *resultFolder = subFolder.Detach();
  return S_OK;
}
コード例 #15
0
ファイル: FSFolder.cpp プロジェクト: cube-soft/7z
HRESULT CFSFolder::BindToFolderSpec(CFSTR name, IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  CFSFolder *folderSpec = new CFSFolder;
  CMyComPtr<IFolderFolder> subFolder = folderSpec;
  RINOK(folderSpec->Init(_path + name + FCHAR_PATH_SEPARATOR));
  *resultFolder = subFolder.Detach();
  return S_OK;
}
コード例 #16
0
ファイル: FSDrives.cpp プロジェクト: 0vermind/NeoLoader
HRESULT CFSDrives::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  if (_volumeMode)
    return S_OK;
  NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
  CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
  RINOK(fsFolderSpec->Init(name, 0));
  *resultFolder = subFolder.Detach();
  return S_OK;
}
コード例 #17
0
ファイル: LimitedStreams.cpp プロジェクト: Alexander-r/physfs
HRESULT CreateLimitedInStream(IInStream *inStream, UInt64 pos, UInt64 size, ISequentialInStream **resStream)
{
  *resStream = 0;
  CLimitedInStream *streamSpec = new CLimitedInStream;
  CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
  streamSpec->SetStream(inStream);
  RINOK(streamSpec->InitAndSeek(pos, size));
  streamSpec->SeekToStart();
  *resStream = streamTemp.Detach();
  return S_OK;
}
コード例 #18
0
ファイル: NetFolder.cpp プロジェクト: Dabil/puNES
STDMETHODIMP CNetFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
  *resultFolder = 0;
  const CResourceEx &resource = _items[index];
  if (resource.Usage == RESOURCEUSAGE_CONNECTABLE ||
      resource.DisplayType == RESOURCEDISPLAYTYPE_SHARE)
  {
    NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
    CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
    RINOK(fsFolderSpec->Init(us2fs(resource.RemoteName + WCHAR_PATH_SEPARATOR), this));
    *resultFolder = subFolder.Detach();
  }
  else
  {
    CNetFolder *netFolder = new CNetFolder;
    CMyComPtr<IFolderFolder> subFolder = netFolder;
    netFolder->Init(&resource, this, resource.Name + WCHAR_PATH_SEPARATOR);
    *resultFolder = subFolder.Detach();
  }
  return S_OK;
}
コード例 #19
0
STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
{
    COM_TRY_BEGIN
    *stream = 0;
    const CItem &item = _db.Items[_db.Refs[index].Did];
    CClusterInStream *streamSpec = new CClusterInStream;
    CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
    streamSpec->Stream = _stream;
    streamSpec->StartOffset = 0;

    bool isLargeStream = _db.IsLargeStream(item.Size);
    int bsLog = isLargeStream ? _db.SectorSizeBits : _db.MiniSectorSizeBits;
    streamSpec->BlockSizeLog = bsLog;
    streamSpec->Size = item.Size;

    UInt32 clusterSize = (UInt32)1 << bsLog;
    UInt64 numClusters64 = (item.Size + clusterSize - 1) >> bsLog;
    if (numClusters64 >= ((UInt32)1 << 31))
        return E_NOTIMPL;
    streamSpec->Vector.Reserve((int)numClusters64);
    UInt32 sid = item.Sid;
    UInt64 size = item.Size;

    if (size != 0)
    {
        for (;; size -= clusterSize)
        {
            if (isLargeStream)
            {
                if (sid >= _db.FatSize)
                    return S_FALSE;
                streamSpec->Vector.Add(sid + 1);
                sid = _db.Fat[sid];
            }
            else
            {
                UInt64 val;
                if (sid >= _db.MatSize || !_db.GetMiniCluster(sid, val) || val >= (UInt64)1 << 32)
                    return S_FALSE;
                streamSpec->Vector.Add((UInt32)val);
                sid = _db.Mat[sid];
            }
            if (size <= clusterSize)
                break;
        }
    }
    if (sid != NFatID::kEndOfChain)
        return S_FALSE;
    RINOK(streamSpec->InitAndSeek());
    *stream = streamTemp.Detach();
    return S_OK;
    COM_TRY_END
}
コード例 #20
0
ファイル: Agent.cpp プロジェクト: f059074251/interested
HRESULT CAgentFolder::BindToFolder(CProxyFolder *folder, IFolderFolder **resultFolder)
{
  CMyComPtr<IFolderFolder> parentFolder;
  if (folder->Parent != _proxyFolderItem)
  {
    RINOK(BindToFolder(folder->Parent, &parentFolder));
  }
  else
    parentFolder = this;
  CAgentFolder *folderSpec = new CAgentFolder;
  CMyComPtr<IFolderFolder> agentFolder = folderSpec;
  folderSpec->Init(_proxyArchive, folder, parentFolder, _agentSpec);
  *resultFolder = agentFolder.Detach();
  return S_OK;
}
コード例 #21
0
ファイル: DllExports.cpp プロジェクト: OPSF/uClinux
STDAPI CreateObject(
    const GUID *classID, 
    const GUID *interfaceID, 
    void **outObject)
{
  COM_TRY_BEGIN
  *outObject = 0;
  if (*classID != CLSID_CCabHandler)
    return CLASS_E_CLASSNOTAVAILABLE;
  if (*interfaceID != IID_IInArchive)
    return E_NOINTERFACE;
  CMyComPtr<IInArchive> inArchive = (IInArchive *)new NArchive::NCab::CHandler;
  *outObject = inArchive.Detach();
  COM_TRY_END
  return S_OK;
}
コード例 #22
0
STDAPI CreateObject(
    const GUID *clsid, 
    const GUID *interfaceID, 
    void **outObject)
{
  COM_TRY_BEGIN
  *outObject = 0;
  int correctInterface = (*interfaceID == IID_ICompressFilter);
  CMyComPtr<ICompressFilter> filter;
  MY_CreateClass0(BCJ_x86)
  else
  MY_CreateClass0(BC_ARM)
  else
  MY_CreateClass0(BC_PPC_B)
  else
  MY_CreateClass0(BC_IA64)
  else
  MY_CreateClass0(BC_ARMThumb)
  else
  MY_CreateClass0(BC_SPARC)
  else
  {
    CMyComPtr<ICompressCoder2> coder2;
    correctInterface = (*interfaceID == IID_ICompressCoder2);
    if (*clsid == CLSID_CCompressConvertBCJ2_x86_Encoder)
    {
      if (!correctInterface)
        return E_NOINTERFACE;
      coder2 = (ICompressCoder2 *)new CBCJ2_x86_Encoder();
    }
    else if (*clsid == CLSID_CCompressConvertBCJ2_x86_Decoder)
    {
      if (!correctInterface)
        return E_NOINTERFACE;
      coder2 = (ICompressCoder2 *)new CBCJ2_x86_Decoder();
    }
    else
      return CLASS_E_CLASSNOTAVAILABLE;
    *outObject = coder2.Detach();
    return S_OK;
  }
  *outObject = filter.Detach();
  return S_OK;

  COM_TRY_END
}
コード例 #23
0
void CPPToJavaArchiveExtractCallback::Init(JNIEnv * initEnv)
{
    TRACE_OBJECT_CALL("Init")

    _cryptoGetTextPasswordImpl = NULL;

    jclass cryptoGetTextPasswordClass = initEnv->FindClass(CRYPTOGETTEXTPASSWORD_CLASS);
    FATALIF(cryptoGetTextPasswordClass == NULL,
            "Can't find class " CRYPTOGETTEXTPASSWORD_CLASS);

    if (initEnv->IsInstanceOf(_javaImplementation, cryptoGetTextPasswordClass))
    {
        CMyComPtr<ICryptoGetTextPassword> cryptoGetTextPasswordComPtr =
            new CPPToJavaCryptoGetTextPassword(_nativeMethodContext, initEnv, _javaImplementation);
        _cryptoGetTextPasswordImpl = cryptoGetTextPasswordComPtr.Detach();
    }


	// public SequentialOutStream getStream(int index, ExtractAskMode extractAskMode);
	_getStreamMethodID = GetMethodId(initEnv, "getStream",
			"(I" EXTRACTASKMODE_CLASS_T ")" SEQUENTIALOUTSTREAM_CLASS_T);

	// public void prepareOperation(ExtractAskMode extractAskMode);
	_prepareOperationMethodID = GetMethodId(initEnv, "prepareOperation",
			"(" EXTRACTASKMODE_CLASS_T ")V");

	// public void setOperationResult(ExtractOperationResult extractOperationResult);
	_setOperationResultMethodID = GetMethodId(initEnv, "setOperationResult",
			"(" EXTRACTOPERATIONRESULT_CLASS_T ")V");

	_extractOperationResultClass = GetClass(initEnv, EXTRACTOPERATIONRESULT_CLASS);

	// public static ExtractOperationResult getOperationResult(int index)
	_extractOperationResultGetOperationResultMethodID =
			GetStaticMethodId(initEnv, _extractOperationResultClass,
			        "getOperationResult", "(I)" EXTRACTOPERATIONRESULT_CLASS_T);

	_extractAskModeClass = GetClass(initEnv, EXTRACTASKMODE_CLASS);

	// public static ExtractAskMode getExtractAskModeByIndex(int index)
	_extractAskModeGetExtractAskModeByIndexMethodID =
			GetStaticMethodId(initEnv, _extractAskModeClass, "getExtractAskModeByIndex",
			        "(I)" EXTRACTASKMODE_CLASS_T);
}
コード例 #24
0
ファイル: RootFolder.cpp プロジェクト: ArchangelSDY/Qt7z
STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
  *resultFolder = NULL;
  CMyComPtr<IFolderFolder> subFolder;

  #ifdef USE_WIN_PATHS
  if (index == ROOT_INDEX_COMPUTER || index == ROOT_INDEX_VOLUMES)
  {
    CFSDrives *fsDrivesSpec = new CFSDrives;
    subFolder = fsDrivesSpec;
    fsDrivesSpec->Init(index == ROOT_INDEX_VOLUMES);
  }
  else if (index == ROOT_INDEX_NETWORK)
  {
    CNetFolder *netFolderSpec = new CNetFolder;
    subFolder = netFolderSpec;
    netFolderSpec->Init(0, 0, _names[ROOT_INDEX_NETWORK] + WCHAR_PATH_SEPARATOR);
  }
  else if (index == ROOT_INDEX_DOCUMENTS)
  {
    UString s = GetMyDocsPath();
    if (!s.IsEmpty())
    {
      NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
      subFolder = fsFolderSpec;
      RINOK(fsFolderSpec->Init(us2fs(s)));
    }
  }
  #else
  if (index == ROOT_INDEX_COMPUTER)
  {
    NFsFolder::CFSFolder *fsFolder = new NFsFolder::CFSFolder;
    subFolder = fsFolder;
    fsFolder->InitToRoot();
  }
  #endif
  else
    return E_INVALIDARG;

  *resultFolder = subFolder.Detach();
  return S_OK;
}
コード例 #25
0
ファイル: DllExports.cpp プロジェクト: BIAINC/7Zip
STDAPI CreateObject(
    const GUID *classID,
    const GUID *interfaceID,
    void **outObject)
{
  LoadLangOneTime();
  COM_TRY_BEGIN
  *outObject = 0;
  if (*classID == CLSID_CSevenZipOptions)
  {
    if (*interfaceID == IID_IPluginOptions)
    {
      CMyComPtr<IPluginOptions> options = new CSevenZipOptions;
      *outObject = options.Detach();
      return S_OK;
    }
    return E_NOINTERFACE;
  }
  return CLASS_E_CLASSNOTAVAILABLE;
  COM_TRY_END
}
コード例 #26
0
STDMETHODIMP CPPToJavaArchiveOpenVolumeCallback::GetStream(const wchar_t *name,
		IInStream **inStream) {
	TRACE_OBJECT_CALL("GetStream");

	JNIInstance jniInstance(_nativeMethodContext);
	JNIEnv * env = jniInstance.GetEnv();

	if (inStream) {
		*inStream = NULL;
	}

	jstring nameString = env->NewString(UnicodeHelper(name), (jsize) wcslen(
			name));

	jniInstance.PrepareCall();
	jobject inStreamImpl = env->CallObjectMethod(_javaImplementation,
			_getStreamMethodID, nameString);
	if (jniInstance.IsExceptionOccurs()) {
		return S_FALSE;
	}

	if (inStream) {
		if (inStreamImpl) {
			CPPToJavaInStream * newInStream = new CPPToJavaInStream(
					_nativeMethodContext, env, inStreamImpl);
			lastVolume->AddInStream(newInStream);
			lastVolume = newInStream;

			CMyComPtr<IInStream> inStreamComPtr = newInStream;
			*inStream = inStreamComPtr.Detach();
		} else {
//			jniInstance.ThrowSevenZipException(
//					"IArchiveOpenVolumeCallback.GetStream() returns stream=null. "
//						"Use non-zero return value if requested volume doesn't exists");
			return S_FALSE;
		}
	}

	return S_OK;
}
コード例 #27
0
STDMETHODIMP CPPToJavaArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream,
		Int32 askExtractMode)
{
    TRACE_OBJECT_CALL("GetStream");
    JNIInstance jniInstance(_nativeMethodContext);
    JNIEnv * env = jniInstance.GetEnv();

    if (outStream) {
    	*outStream = NULL;
    }

	jniInstance.PrepareCall();
	jobject askExtractModeObject = env->CallStaticObjectMethod(_extractAskModeClass, _extractAskModeGetExtractAskModeByIndexMethodID,
			(jint)askExtractMode);
	if (jniInstance.IsExceptionOccurs())
	{
		return S_FALSE;
	}

	// public SequentialOutStream getStream(int index, ExtractAskMode extractAskMode);
	jniInstance.PrepareCall();
	jobject result = env->CallObjectMethod(_javaImplementation, _getStreamMethodID, (jint)index, askExtractModeObject);
	if (jniInstance.IsExceptionOccurs())
	{
		return S_FALSE;
	}

	if (result == NULL)
	{
		*outStream = NULL;

        EndCPPToJavaCall();
		return S_OK;
	}

	CMyComPtr<ISequentialOutStream> outStreamComPtr = new CPPToJavaSequentialOutStream(_nativeMethodContext, env, result);
	*outStream = outStreamComPtr.Detach();

	return S_OK;
}
コード例 #28
0
ファイル: OpenCallback.cpp プロジェクト: OwenTan/AndroidP7zip
STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name, IInStream **inStream)
{
  COM_TRY_BEGIN
  *inStream = NULL;
  if (_subArchiveMode)
    return S_FALSE;

  FString fullPath;
  if (!NFile::NName::GetFullPath(_folderPrefix, us2fs(name), fullPath))
    return S_FALSE;
  if (!_fileInfo.Find(fullPath))
    return S_FALSE;
  if (_fileInfo.IsDir())
    return S_FALSE;
  CInFileStream *inFile = new CInFileStream;
  CMyComPtr<IInStream> inStreamTemp = inFile;
  if (!inFile->Open(fullPath))
    return ::GetLastError();
  *inStream = inStreamTemp.Detach();
  return S_OK;
  COM_TRY_END
}
コード例 #29
0
ファイル: OpenCallback.cpp プロジェクト: Bernieboy/nds4ios
STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name,
    IInStream **inStream)
{
  *inStream = NULL;
  if (_subArchiveMode)
    return S_FALSE;

  NWindows::NFile::NFind::CFileInfoW fileInfo;

  UString fullPath = _folderPrefix + name;
  if (!NWindows::NFile::NFind::FindFile(fullPath, fileInfo))
    return S_FALSE;
  _fileInfo = fileInfo;
  if (_fileInfo.IsDir())
    return S_FALSE;
  CInFileStream *inFile = new CInFileStream;
  CMyComPtr<IInStream> inStreamTemp = inFile;
  if (!inFile->Open(fullPath))
    return ::GetLastError();
  *inStream = inStreamTemp.Detach();
  return S_OK;
}
コード例 #30
0
ファイル: ArchiveOpenCallback.cpp プロジェクト: naroya/fdm
STDMETHODIMP COpenCallbackImp::GetStream(const wchar_t *name, 
    IInStream **inStream)
{
  if (_subArchiveMode)
    return S_FALSE;
  RINOK(Callback->CheckBreak());
  *inStream = NULL;
  UString fullPath = _folderPrefix + name;
  if (!NFile::NFind::FindFile(fullPath, _fileInfo))
    return S_FALSE;
  if (_fileInfo.IsDirectory())
    return S_FALSE;
  CInFileStreamVol *inFile = new CInFileStreamVol;
  CMyComPtr<IInStream> inStreamTemp = inFile;
  if (!inFile->Open(fullPath))
    return ::GetLastError();
  *inStream = inStreamTemp.Detach();
  inFile->Name = name;
  inFile->OpenCallbackImp = this;
  inFile->OpenCallbackRef = this;
  FileNames.Add(name);
  return S_OK;
}