HRESULT __stdcall CArchiveOpenVolumeCallback::GetStream(const wchar_t *name, IInStream **inStream) { // if ( m_uOpenedVolumes == m_pArchive->GetNumberOfVolumes() ) // return S_FALSE; string strFullName; string strFileName; #ifdef UNICODE strFileName = name; #else strFileName.SetData(name, CP_OEMCP); #endif strFullName = m_pArchive->GetFileName(); CutTo(strFullName, _T('\\'), false); strFullName += strFileName; //bool bResult = false; //CInFile* file = nullptr; CInFile* file = new CInFile(strFullName); bool bResult = file->Open(); /* while ( true ) { file = new CInFile(strFullName); if ( file->Open() ) { m_uOpenedVolumes++; bResult = true; break; } else { TCHAR cBuffer[512]; if ( m_pArchive->OnNeedVolume(strFullName, 512, (TCHAR*)&cBuffer) ) { strFullName = (const TCHAR*)&cBuffer; delete file; } else { bResult = false; break; } } } */ *inStream = file; m_pVolumeFile = file; return bResult?S_OK:S_FALSE; }
/****************************************************************************** * Function: PIC_SRCHOSTtoDSTHOST_read_int * * Description: Read SRC_HOST to DST_HOST interrupt bit. * * Inputs: src_host-- source host (PIC_CPU0== 0, PIC_CPU1 == 1, PIC_PCIE== 2) * dst_host-- destination host * Outputs: none * * Return: interrupt status bit *******************************************************************************/ UNSG32 PIC_SRCHOSTtoDSTHOST_read_int(UNSG32 src_host, UNSG32 dst_host) { UNSG32 status; UNSG32 base_addr=MEMMAP_PIC_REG_BASE+PIC_int_interhost[dst_host][src_host]; GA_REG_WORD32_READ(base_addr, &status); status = CutTo(status, bPIC_int_CPU1toCPU0_int); return status; }
int __stdcall SevenZipArchive::pGetArchiveItem ( ArchiveItemInfo *pItem ) { if ( (int)m_nItemsNumber == -1) return E_EOF; int nResult = E_BROKEN; CPropVariant value; if ( m_pArchive->GetProperty (m_nItemsNumber, kpidPath, &value) == S_OK ) { if ( value.vt == VT_BSTR ) WideCharToMultiByte (CP_OEMCP, 0, value.bstrVal, -1, pItem->pi.FindData.cFileName, sizeof (pItem->pi.FindData.cFileName), NULL, NULL); else { strcpy (pItem->pi.FindData.cFileName, FSF.PointToName (m_lpFileName)); CutTo (pItem->pi.FindData.cFileName, '.', true); } if ( m_pArchive->GetProperty (m_nItemsNumber, kpidAttrib, &value) == S_OK ) { if ( value.vt == VT_UI4 ) pItem->pi.FindData.dwFileAttributes = value.ulVal; } if ( m_pArchive->GetProperty (m_nItemsNumber, kpidIsDir, &value) == S_OK ) { if ( value.vt == VT_BOOL ) { if ( value.boolVal == VARIANT_TRUE ) pItem->pi.FindData.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY; } } if ( m_pArchive->GetProperty (m_nItemsNumber, kpidSize, &value) == S_OK ) { unsigned __int64 size = VariantToInt64 (&value); pItem->pi.FindData.nFileSizeLow = (DWORD)size; pItem->pi.FindData.nFileSizeHigh = (DWORD)(size >> 32); } if ( m_pArchive->GetProperty (m_nItemsNumber, kpidPackSize, &value) == S_OK ) { unsigned __int64 size = VariantToInt64 (&value); pItem->pi.PackSize = (DWORD)size; pItem->pi.PackSizeHigh = (DWORD)(size >> 32); }
int ArchivePanel::pPutFiles( const PluginPanelItem *PanelItem, int ItemsNumber, int Move, #ifdef UNICODE const wchar_t* SrcPath, #endif int OpMode ) { bool bResult = false; FarPanelInfo info; ArchiveItemArray items; m_bPasswordSet = false; if ( m_pArchive == NULL ) { CreateArchiveParams params; if ( dlgModifyCreateArchive( this, ¶ms ) ) { m_bPasswordSet = true; m_strPassword = params.strPassword; int nSelectedCount = info.GetSelectedItemsCount(); bool bSeparately = params.bSeparateArchives && (nSelectedCount > 1); int nCount = (bSeparately)?nSelectedCount:1; string strArchiveName; for (int el = 0; el < nCount; el++) { if ( bSeparately ) { PluginPanelItem Item; info.GetSelectedItem(el, &Item); items.reset(); //??? GetPanelItemsToProcess(&Item, 1, items); #ifdef UNICODE strArchiveName = FSF.PointToName(Item.FindData.lpwszFileName); #else strArchiveName = FSF.PointToName(Item.FindData.cFileName); #endif if ( (Item.FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY ) CutTo(strArchiveName, _T('.'), true); info.FreePanelItem(&Item); } else { strArchiveName = params.strFileName; PluginPanelItem* pItems = new PluginPanelItem[nSelectedCount]; for (int i = 0; i < nSelectedCount; i++) info.GetSelectedItem(i, &pItems[i]); GetPanelItemsToProcess(pItems, nSelectedCount, items); for (int i = 0; i < nSelectedCount; i++) info.FreePanelItem(&pItems[i]); delete pItems; } if ( !params.bExactName ) { strArchiveName += _T("."); strArchiveName += params.pFormat->GetDefaultExtention(); } string strFullArchiveName = info.GetCurrentDirectory(); AddEndSlash(strFullArchiveName); strFullArchiveName += strArchiveName; //Archive* pArchive = pManager->OpenCreateArchive(params.pFormat, strFullArchiveName, this, Callback, true); //BADBAD, надо убедиться, что отсюда сразу в ClosePlugin попадаем m_pArchive = pManager->OpenCreateArchive(params.pFormat, strFullArchiveName, this, Callback, true); if ( m_pArchive ) bResult = AddFiles(items, info.GetCurrentDirectory(), params.strConfig); } } } else { GetPanelItemsToProcess(PanelItem, ItemsNumber, items); #ifdef UNICODE bResult = AddFiles(items, SrcPath ? SrcPath : info.GetCurrentDirectory(), nullptr); #else bResult = AddFiles(items, info.GetCurrentDirectory(), nullptr); #endif } return bResult; }