亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? udfin.cpp

?? 壓縮解壓工具7-zip源代碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// Archive/UdfIn.cpp

#include "StdAfx.h"

#include "UdfIn.h"

#include "../../Common/StreamUtils.h"

extern "C"
{
  #include "../../../../C/CpuArch.h"
}

#define Get16(p) GetUi16(p)
#define Get32(p) GetUi32(p)
#define Get64(p) GetUi64(p)

namespace NArchive {
namespace NUdf {

const int kNumPartitionsMax = 64;
const int kNumLogVolumesMax = 64;
const int kNumRecureseLevelsMax = 1 << 10;
const int kNumItemsMax = 1 << 27;
const int kNumFilesMax = 1 << 28;
const int kNumRefsMax = 1 << 28;
const UInt32 kNumExtentsMax = (UInt32)1 << 30;
const UInt64 kFileNameLengthTotalMax = (UInt64)1 << 33;
const UInt64 kInlineExtentsSizeMax = (UInt64)1 << 33;

void MY_FAST_CALL Crc16GenerateTable(void);

#define CRC16_INIT_VAL 0
#define CRC16_GET_DIGEST(crc) (crc)
#define CRC16_UPDATE_BYTE(crc, b) (g_Crc16Table[(((crc) >> 8) ^ (b)) & 0xFF] ^ ((crc) << 8))

#define kCrc16Poly 0x1021
UInt16 g_Crc16Table[256];

void MY_FAST_CALL Crc16GenerateTable(void)
{
  UInt32 i;
  for (i = 0; i < 256; i++)
  {
    UInt32 r = (i << 8);
    for (int j = 8; j > 0; j--)
      r = ((r & 0x8000) ? ((r << 1) ^ kCrc16Poly) : (r << 1)) & 0xFFFF;
    g_Crc16Table[i] = (UInt16)r;
  }
}

UInt16 MY_FAST_CALL Crc16_Update(UInt16 v, const void *data, size_t size)
{
  const Byte *p = (const Byte *)data;
  for (; size > 0 ; size--, p++)
    v = CRC16_UPDATE_BYTE(v, *p);
  return v;
}

UInt16 MY_FAST_CALL Crc16Calc(const void *data, size_t size)
{
  return Crc16_Update(CRC16_INIT_VAL, data, size);
}

struct CCrc16TableInit { CCrc16TableInit() { Crc16GenerateTable(); } } g_Crc16TableInit;

void CDString128::Parse(const Byte *buf) { memcpy(Data, buf, sizeof(Data)); }

void CDString::Parse(const Byte *p, unsigned size)
{
  Data.SetCapacity(size);
  memcpy(Data, p, size);
}

static UString ParseDString(const Byte *data, int size)
{
  UString res;
  wchar_t *p;
  if (size > 0)
  {
    Byte type = data[0];
    if (type == 8)
    {
      p = res.GetBuffer((int)size + 1);
      for (int i = 1; i < size; i++)
      {
        wchar_t c = data[i];
        if (c == 0)
          break;
        *p++ = c;
      }
    }
    else if (type == 16)
    {
      p = res.GetBuffer((int)size / 2 + 1);
      for (int i = 1; i + 2 <= size; i += 2)
      {
        wchar_t c = ((wchar_t)data[i] << 8) | data[i + 1];
        if (c == 0)
          break;
        *p++ = c;
      }
    }
    else
      return L"[unknow]";
    *p++ = 0;
    res.ReleaseBuffer();
  }
  return res;
}

UString CDString::   GetString() const { return ParseDString(Data, (int)Data.GetCapacity()); }
UString CDString128::GetString() const
{
  int size = Data[sizeof(Data) - 1];
  return ParseDString(Data, MyMin(size, (int)(sizeof(Data) - 1)));
}

void CTime::Parse(const Byte *buf) { memcpy(Data, buf, sizeof(Data)); }

/*
void CRegId::Parse(const Byte *buf)
{
  Flags = buf[0];
  memcpy(Id, buf + 1, sizeof(Id));
  memcpy(Suffix, buf + 24, sizeof(Suffix));
}
*/

// ECMA 3/7.1

struct CExtent
{
  UInt32 Len;
  UInt32 Pos;

  void Parse(const Byte *buf);
};

void CExtent::Parse(const Byte *buf)
{
  Len = Get32(buf);
  Pos = Get32(buf + 4);
}

// ECMA 3/7.2

struct CTag
{
  UInt16 Id;
  UInt16 Version;
  // Byte Checksum;
  // UInt16 SerialNumber;
  // UInt16 Crc;
  // UInt16 CrcLen;
  // UInt32 TagLocation;
  
  HRESULT Parse(const Byte *buf, size_t size);
};

HRESULT CTag::Parse(const Byte *buf, size_t size)
{
  if (size < 16)
    return S_FALSE;
  Byte sum = 0;
  int i;
  for (i = 0; i <  4; i++) sum = sum + buf[i];
  for (i = 5; i < 16; i++) sum = sum + buf[i];
  if (sum != buf[4] || buf[5] != 0) return S_FALSE;

  Id = Get16(buf);
  Version = Get16(buf + 2);
  // SerialNumber = Get16(buf + 6);
  UInt16 crc = Get16(buf + 8);
  UInt16 crcLen = Get16(buf + 10);
  // TagLocation = Get32(buf + 12);

  if (size >= 16 + (size_t)crcLen)
    if (crc == Crc16Calc(buf + 16, crcLen))
      return S_OK;
  return S_FALSE;
}

// ECMA 3/7.2.1

enum EDescriptorType
{
  DESC_TYPE_SpoaringTable = 0, // UDF
  DESC_TYPE_PrimVol = 1,
  DESC_TYPE_AnchorVolPtr = 2,
  DESC_TYPE_VolPtr = 3,
  DESC_TYPE_ImplUseVol = 4,
  DESC_TYPE_Partition = 5,
  DESC_TYPE_LogicalVol = 6,
  DESC_TYPE_UnallocSpace = 7,
  DESC_TYPE_Terminating = 8,
  DESC_TYPE_LogicalVolIntegrity = 9,
  DESC_TYPE_FileSet = 256,
  DESC_TYPE_FileId  = 257,
  DESC_TYPE_AllocationExtent = 258,
  DESC_TYPE_Indirect = 259,
  DESC_TYPE_Terminal = 260,
  DESC_TYPE_File = 261,
  DESC_TYPE_ExtendedAttrHeader = 262,
  DESC_TYPE_UnallocatedSpace = 263,
  DESC_TYPE_SpaceBitmap = 264,
  DESC_TYPE_PartitionIntegrity = 265,
  DESC_TYPE_ExtendedFile = 266,
};


void CLogBlockAddr::Parse(const Byte *buf)
{
  Pos = Get32(buf);
  PartitionRef = Get16(buf + 4);
}

void CShortAllocDesc::Parse(const Byte *buf)
{
  Len = Get32(buf);
  Pos = Get32(buf + 4);
}

/*
void CADImpUse::Parse(const Byte *buf)
{
  Flags = Get16(buf);
  UdfUniqueId = Get32(buf + 2);
}
*/

void CLongAllocDesc::Parse(const Byte *buf)
{
  Len = Get32(buf);
  Location.Parse(buf + 4);
  // memcpy(ImplUse, buf + 10, sizeof(ImplUse));
  // adImpUse.Parse(ImplUse);
}

bool CInArchive::CheckExtent(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len) const
{
  const CLogVol &vol = LogVols[volIndex];
  const CPartition &partition = Partitions[vol.PartitionMaps[partitionRef].PartitionIndex];
  UInt64 offset = ((UInt64)partition.Pos << SecLogSize) + (UInt64)blockPos * vol.BlockSize;
  return (offset + len) <= (((UInt64)partition.Pos + partition.Len) << SecLogSize);
}

bool CInArchive::CheckItemExtents(int volIndex, const CItem &item) const
{
  for (int i = 0; i < item.Extents.Size(); i++)
  {
    const CMyExtent &e = item.Extents[i];
    if (!CheckExtent(volIndex, e.PartitionRef, e.Pos, e.GetLen()))
      return false;
  }
  return true;
}

HRESULT CInArchive::Read(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len, Byte *buf)
{
  if (!CheckExtent(volIndex, partitionRef, blockPos, len))
    return S_FALSE;
  const CLogVol &vol = LogVols[volIndex];
  const CPartition &partition = Partitions[vol.PartitionMaps[partitionRef].PartitionIndex];
  RINOK(_stream->Seek(((UInt64)partition.Pos << SecLogSize) +
      (UInt64)blockPos * vol.BlockSize, STREAM_SEEK_SET, NULL));
  return ReadStream_FALSE(_stream, buf, len);
}

HRESULT CInArchive::Read(int volIndex, const CLongAllocDesc &lad, Byte *buf)
{
  return Read(volIndex, lad.Location.PartitionRef, lad.Location.Pos, lad.GetLen(), (Byte *)buf);
}

HRESULT CInArchive::ReadFromFile(int volIndex, const CItem &item, CByteBuffer &buf)
{
  if (item.Size >= (UInt32)1 << 30)
    return S_FALSE;
  if (item.IsInline)
  {
    buf = item.InlineData;
    return S_OK;
  }
  buf.SetCapacity((size_t)item.Size);
  size_t pos = 0;
  for (int i = 0; i < item.Extents.Size(); i++)
  {
    const CMyExtent &e = item.Extents[i];
    UInt32 len = e.GetLen();
    RINOK(Read(volIndex, e.PartitionRef, e.Pos, len, (Byte *)buf + pos));
    pos += len;
  }
  return S_OK;
}


void CIcbTag::Parse(const Byte *p)
{
  // PriorDirectNum = Get32(p);
  // StrategyType = Get16(p + 4);
  // StrategyParam = Get16(p + 6);
  // MaxNumOfEntries = Get16(p + 8);
  FileType = p[11];
  // ParentIcb.Parse(p + 12);
  Flags = Get16(p + 18);
}

void CItem::Parse(const Byte *p)
{
  // Uid = Get32(p + 36);
  // Gid = Get32(p + 40);
  // Permissions = Get32(p + 44);
  // FileLinkCount = Get16(p + 48);
  // RecordFormat = p[50];
  // RecordDisplayAttr = p[51];
  // RecordLen = Get32(p + 52);
  Size = Get64(p + 56);
  NumLogBlockRecorded = Get64(p + 64);
  ATime.Parse(p + 72);
  MTime.Parse(p + 84);
  // AttrtTime.Parse(p + 96);
  // CheckPoint = Get32(p + 108);
  // ExtendedAttrIcb.Parse(p + 112);
  // ImplId.Parse(p + 128);
  // UniqueId = Get64(p + 160);
}

// 4/14.4
struct CFileId
{
  // UInt16 FileVersion;
  Byte FileCharacteristics;
  // CByteBuffer ImplUse;
  CDString Id;
  CLongAllocDesc Icb;

  bool IsItLinkParent() const { return (FileCharacteristics & FILEID_CHARACS_Parent) != 0; }
  HRESULT Parse(const Byte *p, size_t size, size_t &processed);
};

HRESULT CFileId::Parse(const Byte *p, size_t size, size_t &processed)
{
  processed = 0;
  if (size < 38)
    return S_FALSE;
  CTag tag;
  RINOK(tag.Parse(p, size));
  if (tag.Id != DESC_TYPE_FileId)
    return S_FALSE;
  // FileVersion = Get16(p + 16);
  FileCharacteristics = p[18];
  unsigned idLen = p[19];
  Icb.Parse(p + 20);
  unsigned impLen = Get16(p + 36);
  if (size < 38 + idLen + impLen)
    return S_FALSE;
  // ImplUse.SetCapacity(impLen);
  processed = 38;
  // memcpy(ImplUse, p + processed, impLen);
  processed += impLen;
  Id.Parse(p + processed, idLen);
  processed += idLen;
  for (;(processed & 3) != 0; processed++)
    if (p[processed] != 0)
      return S_FALSE;
  return (processed <= size) ? S_OK : S_FALSE;
}

HRESULT CInArchive::ReadFileItem(int volIndex, int fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed)
{
  if (Files.Size() % 100 == 0)
    RINOK(_progress->SetCompleted(Files.Size(), _processedProgressBytes));
  if (numRecurseAllowed-- == 0)
    return S_FALSE;
  CFile &file = Files.Back();
  const CLogVol &vol = LogVols[volIndex];
  CPartition &partition = Partitions[vol.PartitionMaps[lad.Location.PartitionRef].PartitionIndex];

  UInt32 key = lad.Location.Pos;
  UInt32 value;
  const UInt32 kRecursedErrorValue = (UInt32)(Int32)-1;
  if (partition.Map.Find(key, value))
  {
    if (value == kRecursedErrorValue)
      return S_FALSE;
    file.ItemIndex = value;
  }
  else
  {
    value = Items.Size();
    file.ItemIndex = (int)value;
    if (partition.Map.Set(key, kRecursedErrorValue))
      return S_FALSE;
    RINOK(ReadItem(volIndex, fsIndex, lad, numRecurseAllowed));
    if (!partition.Map.Set(key, value))
      return S_FALSE;
  }
  return S_OK;
}

HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed)
{
  if (Items.Size() > kNumItemsMax)
    return S_FALSE;
  Items.Add(CItem());
  CItem &item = Items.Back();
  
  const CLogVol &vol = LogVols[volIndex];
 
  if (lad.GetLen() != vol.BlockSize)
    return S_FALSE;

  CByteBuffer buf;
  size_t size = lad.GetLen();
  buf.SetCapacity(size);
  RINOK(Read(volIndex, lad, buf));

  CTag tag;
  const Byte *p = buf;
  RINOK(tag.Parse(p, size));
  if (tag.Id != DESC_TYPE_File)
    return S_FALSE;

  item.IcbTag.Parse(p + 16);
  if (item.IcbTag.FileType != ICB_FILE_TYPE_DIR &&
      item.IcbTag.FileType != ICB_FILE_TYPE_FILE)
    return S_FALSE;

  item.Parse(p);

  _processedProgressBytes += (UInt64)item.NumLogBlockRecorded * vol.BlockSize + size;

  UInt32 extendedAttrLen = Get32(p + 168);
  UInt32 allocDescriptorsLen = Get32(p + 172);

  if ((extendedAttrLen & 3) != 0)
    return S_FALSE;
  int pos = 176;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产午夜亚洲精品不卡| 亚洲精品国产a| 综合久久综合久久| 久久精品国产亚洲a| 不卡欧美aaaaa| 精品福利一二区| 亚洲国产一区二区三区| 国产精品中文字幕欧美| 3d成人h动漫网站入口| 1000部国产精品成人观看| 国产麻豆精品在线| 制服.丝袜.亚洲.中文.综合| **性色生活片久久毛片| 国产成人免费在线观看不卡| 51精品视频一区二区三区| 亚洲一区成人在线| 成人国产在线观看| 久久精品夜色噜噜亚洲a∨| 日韩不卡手机在线v区| 在线免费av一区| 91视视频在线观看入口直接观看www | 同产精品九九九| av中文字幕不卡| 日本一区二区三区国色天香| 国产一区二区视频在线| 欧美精品一区二区三区蜜桃| 欧美aaaaaa午夜精品| 欧美日韩精品一二三区| 亚洲午夜电影网| 欧美午夜影院一区| 曰韩精品一区二区| 在线精品视频一区二区| 亚洲猫色日本管| 91老司机福利 在线| 亚洲欧美激情插| 日本韩国一区二区三区视频| 亚洲精品国产品国语在线app| 不卡欧美aaaaa| 亚洲人妖av一区二区| 99re热视频这里只精品| 一区二区三区色| 欧美午夜电影在线播放| 天天操天天色综合| 3d成人动漫网站| 国内久久精品视频| 欧美高清在线精品一区| av高清久久久| 亚洲综合在线观看视频| 欧美日本免费一区二区三区| 三级在线观看一区二区| 精品国产乱码久久久久久影片| 国产一区二区视频在线播放| 欧美激情中文字幕一区二区| 91美女在线看| 日本不卡不码高清免费观看| 久久嫩草精品久久久久| 亚洲va欧美va人人爽| 久久一二三国产| 久久日韩精品一区二区五区| 久久精品理论片| 国产视频一区二区在线观看| 99久久99久久综合| 亚洲成年人影院| 国产亚洲欧美日韩日本| 欧美亚洲禁片免费| 久久av老司机精品网站导航| 中文字幕一区二区在线播放| 欧美日本一区二区在线观看| 国产一区二区不卡在线| 依依成人精品视频| 日韩免费电影一区| 一本高清dvd不卡在线观看| 青娱乐精品视频| 亚洲欧洲精品一区二区三区| 欧美一区二区日韩| 99r国产精品| 老司机午夜精品| 亚洲线精品一区二区三区| 精品国偷自产国产一区| 国产精品一区二区久激情瑜伽 | 玉米视频成人免费看| 精品美女一区二区| 欧美三区在线观看| 国产盗摄一区二区| 日韩在线观看一区二区| 最新日韩av在线| 精品国产乱码久久久久久夜甘婷婷| 91精彩视频在线| 丰满放荡岳乱妇91ww| 日韩不卡一区二区三区| 一区二区三区欧美日韩| 中文字幕乱码亚洲精品一区| 日韩视频一区二区在线观看| 精品1区2区3区| caoporen国产精品视频| 国产精品69毛片高清亚洲| 日本欧美久久久久免费播放网| 亚洲品质自拍视频| 中文字幕乱码亚洲精品一区| 亚洲精品一区二区三区香蕉 | 寂寞少妇一区二区三区| 舔着乳尖日韩一区| 亚洲二区在线观看| 一区二区三区四区不卡在线 | 4438x成人网最大色成网站| 色综合激情久久| 成人免费视频免费观看| 国产精品一二三四五| 美日韩一区二区| 日本欧美在线观看| 视频一区中文字幕国产| 亚洲国产精品尤物yw在线观看| 亚洲免费色视频| 亚洲美女偷拍久久| 亚洲精品视频在线观看网站| 最新日韩av在线| 亚洲免费资源在线播放| 亚洲综合激情小说| 亚洲国产精品一区二区久久恐怖片 | 久久久www成人免费无遮挡大片 | 成人av在线资源网站| 成人精品电影在线观看| www.日韩av| 欧美伊人久久大香线蕉综合69| 91高清视频在线| 欧美日韩在线精品一区二区三区激情| 91成人在线精品| 欧美卡1卡2卡| 日韩欧美一级在线播放| 久久精品人人做人人爽人人| 国产精品全国免费观看高清| 亚洲桃色在线一区| 久久久国产精华| 欧美日韩免费高清一区色橹橹 | 亚洲一区二区三区三| 亚洲美女区一区| 婷婷成人综合网| 国产美女一区二区| av在线综合网| 欧美另类z0zxhd电影| 欧美大片拔萝卜| 国产精品国产三级国产aⅴ中文| 成人免费在线播放视频| 日韩—二三区免费观看av| 国产一区二区视频在线播放| 91黄色免费观看| 日韩欧美国产三级电影视频| 国产精品乱人伦中文| 亚洲一二三区视频在线观看| 激情伊人五月天久久综合| 成人av网址在线观看| 欧美浪妇xxxx高跟鞋交| 国产精品视频免费看| 丝袜脚交一区二区| 国产成人啪午夜精品网站男同| 欧美伊人久久久久久久久影院| 91女神在线视频| 不卡一二三区首页| www..com久久爱| 日韩一级二级三级精品视频| 国产精品久久久久一区二区三区 | 91色|porny| 日韩精品一区二区三区在线 | 亚洲精品乱码久久久久| 久久99精品国产| 欧美日免费三级在线| 国产亚洲成av人在线观看导航 | 久久九九影视网| 亚洲国产精品尤物yw在线观看| 国产精品系列在线播放| 欧美精选在线播放| 国产精品理伦片| 韩国视频一区二区| 欧美一区二区精品| 一级中文字幕一区二区| 国产在线精品不卡| 91精品国产综合久久国产大片| 欧美一卡二卡三卡| 中文字幕亚洲成人| 国产一区二区三区视频在线播放 | 美国三级日本三级久久99| 色婷婷久久久久swag精品| 欧美激情一区二区三区全黄| 久久99精品久久久久久| 91精品国产欧美一区二区18 | 欧美情侣在线播放| 亚洲三级视频在线观看| 成人免费不卡视频| 久久久久久久久久久久久女国产乱| 日韩成人伦理电影在线观看| 欧美在线高清视频| 亚洲色图一区二区| 91网站最新地址| 国产精品成人免费在线| 不卡大黄网站免费看| 中文字幕av资源一区| 成人夜色视频网站在线观看| 国产视频一区在线播放| 成人av电影在线| 亚洲欧洲精品成人久久奇米网|