Int64 RarTime::GetRaw() { if (!IsSet()) return(0); #ifdef _WIN_32 FILETIME ft; GetWin32(&ft); return(int32to64(ft.dwHighDateTime,ft.dwLowDateTime)); #elif defined(_UNIX) || defined(_EMX) time_t ut=GetUnix(); return(int32to64(0,ut)*10000000+rlt.Reminder); #else return(0); #endif }
void RawRead::Get8(Int64 &Field) { uint Low,High; Get(Low); Get(High); Field=int32to64(High,Low); }
void RarTime::SetAgeText(char *TimeText) { uint Seconds=0,Value=0; for (int I=0;TimeText[I]!=0;I++) { int Ch=TimeText[I]; if (isdigit(Ch)) Value=Value*10+Ch-'0'; else { switch(toupper(Ch)) { case 'D': Seconds+=Value*24*3600; break; case 'H': Seconds+=Value*3600; break; case 'M': Seconds+=Value*60; break; case 'S': Seconds+=Value; break; } Value=0; } } SetCurrentTime(); Int64 RawTime=GetRaw(); SetRaw(RawTime-int32to64(0,Seconds)*10000000); }
uint SecondsToDosTime(uint Seconds) { #ifdef _WIN_32 FILETIME ft=SystemTime; Int64 f=int32to64(ft.dwHighDateTime,ft.dwLowDateTime),s=Seconds; f=f-s*10000000; ft.dwHighDateTime=int64to32(f>>32); ft.dwLowDateTime=int64to32(f); return(NTTimeToDos(&ft)); #endif #if defined(_UNIX) || defined(_EMX) return(UnixTimeToDos(SystemTime-Seconds)); #endif }
Int64 File::Tell() { #ifdef _WIN_32 LONG HighDist=0; uint LowDist=SetFilePointer(hFile,0,&HighDist,FILE_CURRENT); if (LowDist==0xffffffff && GetLastError()!=NO_ERROR) if (AllowExceptions) ErrHandler.SeekError(FileName); else return(-1); return(int32to64(HighDist,LowDist)); #else #ifdef _LARGEFILE_SOURCE return(ftello(hFile)); #else return(ftell(hFile)); #endif #endif }
HANDLE FindFile::Win32Find(HANDLE hFind,const char *Mask,const wchar *MaskW,struct FindData *fd) { #ifndef _WIN_CE if (WinNT()) #endif { wchar WideMask[NM]; if (MaskW!=NULL && *MaskW!=0) strcpyw(WideMask,MaskW); else CharToWide(Mask,WideMask); WIN32_FIND_DATAW FindData; if (hFind==INVALID_HANDLE_VALUE) { hFind=FindFirstFileW(WideMask,&FindData); if (hFind==INVALID_HANDLE_VALUE) { int SysErr=GetLastError(); fd->Error=(SysErr!=ERROR_FILE_NOT_FOUND && SysErr!=ERROR_PATH_NOT_FOUND && SysErr!=ERROR_NO_MORE_FILES); } } else if (!FindNextFileW(hFind,&FindData)) { hFind=INVALID_HANDLE_VALUE; fd->Error=GetLastError()!=ERROR_NO_MORE_FILES; } if (hFind!=INVALID_HANDLE_VALUE) { strcpyw(fd->NameW,WideMask); strcpyw(PointToName(fd->NameW),FindData.cFileName); WideToChar(fd->NameW,fd->Name); fd->Size=int32to64(FindData.nFileSizeHigh,FindData.nFileSizeLow); fd->FileAttr=FindData.dwFileAttributes; WideToChar(FindData.cAlternateFileName,fd->ShortName); fd->ftCreationTime=FindData.ftCreationTime; fd->ftLastAccessTime=FindData.ftLastAccessTime; fd->ftLastWriteTime=FindData.ftLastWriteTime; fd->mtime=FindData.ftLastWriteTime; fd->ctime=FindData.ftCreationTime; fd->atime=FindData.ftLastAccessTime; fd->FileTime=fd->mtime.GetDos(); #ifndef _WIN_CE if (LowAscii(fd->NameW)) *fd->NameW=0; #endif } } #ifndef _WIN_CE else { char CharMask[NM]; if (Mask!=NULL && *Mask!=0) strcpy(CharMask,Mask); else WideToChar(MaskW,CharMask); WIN32_FIND_DATA FindData; if (hFind==INVALID_HANDLE_VALUE) { hFind=FindFirstFile(CharMask,&FindData); if (hFind==INVALID_HANDLE_VALUE) { int SysErr=GetLastError(); fd->Error=SysErr!=ERROR_FILE_NOT_FOUND && SysErr!=ERROR_PATH_NOT_FOUND; } } else if (!FindNextFile(hFind,&FindData)) { hFind=INVALID_HANDLE_VALUE; fd->Error=GetLastError()!=ERROR_NO_MORE_FILES; } if (hFind!=INVALID_HANDLE_VALUE) { strcpy(fd->Name,CharMask); strcpy(PointToName(fd->Name),FindData.cFileName); CharToWide(fd->Name,fd->NameW); fd->Size=int32to64(FindData.nFileSizeHigh,FindData.nFileSizeLow); fd->FileAttr=FindData.dwFileAttributes; strcpy(fd->ShortName,FindData.cAlternateFileName); fd->ftCreationTime=FindData.ftCreationTime; fd->ftLastAccessTime=FindData.ftLastAccessTime; fd->ftLastWriteTime=FindData.ftLastWriteTime; fd->mtime=FindData.ftLastWriteTime; fd->ctime=FindData.ftCreationTime; fd->atime=FindData.ftLastAccessTime; fd->FileTime=fd->mtime.GetDos(); if (LowAscii(fd->Name)) *fd->NameW=0; } } #endif fd->Flags=0; return(hFind); }
int Archive::ReadHeader() { CurBlockPos=Tell(); #ifndef SFX_MODULE if (OldFormat) return(ReadOldHeader()); #endif RawRead Raw(this); bool Decrypt=Encrypted && CurBlockPos>=SFXSize+SIZEOF_MARKHEAD+SIZEOF_NEWMHD; if (Decrypt) { #if defined(SHELL_EXT) || defined(NOCRYPT) return(0); #else if (Read(HeadersSalt,SALT_SIZE)!=SALT_SIZE) return(0); if (*Cmd->Password==0) #ifdef RARDLL if (Cmd->Callback==NULL || Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)Cmd->Password,sizeof(Cmd->Password))==-1) { Close(); ErrHandler.Exit(USER_BREAK); } #else if (!GetPassword(PASSWORD_ARCHIVE,FileName,Cmd->Password,sizeof(Cmd->Password))) { Close(); ErrHandler.Exit(USER_BREAK); } #endif HeadersCrypt.SetCryptKeys(Cmd->Password,HeadersSalt,false,false,NewMhd.EncryptVer>=36); Raw.SetCrypt(&HeadersCrypt); #endif } Raw.Read(SIZEOF_SHORTBLOCKHEAD); if (Raw.Size()==0) { Int64 ArcSize=FileLength(); if (CurBlockPos>ArcSize || NextBlockPos>ArcSize) { #ifndef SHELL_EXT Log(FileName,St(MLogUnexpEOF)); #endif ErrHandler.SetErrorCode(WARNING); } return(0); } Raw.Get(ShortBlock.HeadCRC); byte HeadType; Raw.Get(HeadType); ShortBlock.HeadType=(HEADER_TYPE)HeadType; Raw.Get(ShortBlock.Flags); Raw.Get(ShortBlock.HeadSize); if (ShortBlock.HeadSize<SIZEOF_SHORTBLOCKHEAD) { #ifndef SHELL_EXT Log(FileName,St(MLogFileHead),"???"); #endif BrokenFileHeader=true; ErrHandler.SetErrorCode(CRC_ERROR); return(0); } if (ShortBlock.HeadType==COMM_HEAD) Raw.Read(SIZEOF_COMMHEAD-SIZEOF_SHORTBLOCKHEAD); else if (ShortBlock.HeadType==MAIN_HEAD && (ShortBlock.Flags & MHD_COMMENT)!=0) Raw.Read(SIZEOF_NEWMHD-SIZEOF_SHORTBLOCKHEAD); else Raw.Read(ShortBlock.HeadSize-SIZEOF_SHORTBLOCKHEAD); NextBlockPos=CurBlockPos+ShortBlock.HeadSize; switch(ShortBlock.HeadType) { case MAIN_HEAD: *(BaseBlock *)&NewMhd=ShortBlock; Raw.Get(NewMhd.HighPosAV); Raw.Get(NewMhd.PosAV); if (NewMhd.Flags & MHD_ENCRYPTVER) Raw.Get(NewMhd.EncryptVer); break; case ENDARC_HEAD: *(BaseBlock *)&EndArcHead=ShortBlock; if (EndArcHead.Flags & EARC_DATACRC) Raw.Get(EndArcHead.ArcDataCRC); if (EndArcHead.Flags & EARC_VOLNUMBER) Raw.Get(EndArcHead.VolNumber); break; case FILE_HEAD: case NEWSUB_HEAD: { FileHeader *hd=ShortBlock.HeadType==FILE_HEAD ? &NewLhd:&SubHead; *(BaseBlock *)hd=ShortBlock; Raw.Get(hd->PackSize); Raw.Get(hd->UnpSize); Raw.Get(hd->HostOS); Raw.Get(hd->FileCRC); Raw.Get(hd->FileTime); Raw.Get(hd->UnpVer); Raw.Get(hd->Method); Raw.Get(hd->NameSize); Raw.Get(hd->FileAttr); if (hd->Flags & LHD_LARGE) { Raw.Get(hd->HighPackSize); Raw.Get(hd->HighUnpSize); } else { hd->HighPackSize=hd->HighUnpSize=0; if (hd->UnpSize==0xffffffff) { hd->UnpSize=int64to32(INT64MAX); hd->HighUnpSize=int64to32(INT64MAX>>32); } } hd->FullPackSize=int32to64(hd->HighPackSize,hd->PackSize); hd->FullUnpSize=int32to64(hd->HighUnpSize,hd->UnpSize); char FileName[NM*4]; int NameSize=Min(hd->NameSize,sizeof(FileName)-1); Raw.Get((byte *)FileName,NameSize); FileName[NameSize]=0; strncpyz(hd->FileName,FileName,ASIZE(hd->FileName)); if (hd->HeadType==NEWSUB_HEAD) { int DataSize=hd->HeadSize-hd->NameSize-SIZEOF_NEWLHD; if (hd->Flags & LHD_SALT) DataSize-=SALT_SIZE; if (DataSize>0) { hd->SubData.Alloc(DataSize); Raw.Get(&hd->SubData[0],DataSize); if (hd->CmpName(SUBHEAD_TYPE_RR)) { byte *D=&hd->SubData[8]; RecoverySectors=D[0]+((uint)D[1]<<8)+((uint)D[2]<<16)+((uint)D[3]<<24); } } } else if (hd->HeadType==FILE_HEAD) { if (hd->Flags & LHD_UNICODE) { EncodeFileName NameCoder; int Length=strlen(FileName); if (Length==hd->NameSize) { UtfToWide(FileName,hd->FileNameW,sizeof(hd->FileNameW)/sizeof(hd->FileNameW[0])-1); WideToChar(hd->FileNameW,hd->FileName,sizeof(hd->FileName)/sizeof(hd->FileName[0])-1); ExtToInt(hd->FileName,hd->FileName); } else { Length++; NameCoder.Decode(FileName,(byte *)FileName+Length, hd->NameSize-Length,hd->FileNameW, sizeof(hd->FileNameW)/sizeof(hd->FileNameW[0])); } if (*hd->FileNameW==0) hd->Flags &= ~LHD_UNICODE; } else *hd->FileNameW=0; #ifndef SFX_MODULE ConvertNameCase(hd->FileName); ConvertNameCase(hd->FileNameW); #endif ConvertUnknownHeader(); } if (hd->Flags & LHD_SALT) Raw.Get(hd->Salt,SALT_SIZE); hd->mtime.SetDos(hd->FileTime); hd->ctime.Reset(); hd->atime.Reset(); hd->arctime.Reset(); if (hd->Flags & LHD_EXTTIME) { ushort Flags; Raw.Get(Flags); RarTime *tbl[4]; tbl[0]=&NewLhd.mtime; tbl[1]=&NewLhd.ctime; tbl[2]=&NewLhd.atime; tbl[3]=&NewLhd.arctime; for (int I=0;I<4;I++) { RarTime *CurTime=tbl[I]; uint rmode=Flags>>(3-I)*4; if ((rmode & 8)==0) continue; if (I!=0) { uint DosTime; Raw.Get(DosTime); CurTime->SetDos(DosTime); } RarLocalTime rlt; CurTime->GetLocal(&rlt); if (rmode & 4) rlt.Second++; rlt.Reminder=0; int count=rmode&3; for (int J=0;J<count;J++) { byte CurByte; Raw.Get(CurByte); rlt.Reminder|=(((uint)CurByte)<<((J+3-count)*8)); } CurTime->SetLocal(&rlt); } } NextBlockPos+=hd->FullPackSize; bool CRCProcessedOnly=(hd->Flags & LHD_COMMENT)!=0; HeaderCRC=~Raw.GetCRC(CRCProcessedOnly)&0xffff; if (hd->HeadCRC!=HeaderCRC) { if (hd->HeadType==NEWSUB_HEAD) strcat(hd->FileName,"- ???"); BrokenFileHeader=true; ErrHandler.SetErrorCode(WARNING); #ifndef SHELL_EXT Log(Archive::FileName,St(MLogFileHead),IntNameToExt(hd->FileName)); Alarm(); #endif } }
Int64 GetFreeDisk(const char *FileName) { #ifdef _WIN_32 char Root[NM]; GetPathRoot(FileName,Root); typedef BOOL (WINAPI *GETDISKFREESPACEEX)( LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER ); static GETDISKFREESPACEEX pGetDiskFreeSpaceEx=NULL; if (pGetDiskFreeSpaceEx==NULL) { HMODULE hKernel=GetModuleHandle("kernel32.dll"); if (hKernel!=NULL) pGetDiskFreeSpaceEx=(GETDISKFREESPACEEX)GetProcAddress(hKernel,"GetDiskFreeSpaceExA"); } if (pGetDiskFreeSpaceEx!=NULL) { GetFilePath(FileName,Root); ULARGE_INTEGER uiTotalSize,uiTotalFree,uiUserFree; uiUserFree.u.LowPart=uiUserFree.u.HighPart=0; if (pGetDiskFreeSpaceEx(*Root ? Root:NULL,&uiUserFree,&uiTotalSize,&uiTotalFree) && uiUserFree.u.HighPart<=uiTotalFree.u.HighPart) return(int32to64(uiUserFree.u.HighPart,uiUserFree.u.LowPart)); } DWORD SectorsPerCluster,BytesPerSector,FreeClusters,TotalClusters; if (!GetDiskFreeSpace(*Root ? Root:NULL,&SectorsPerCluster,&BytesPerSector,&FreeClusters,&TotalClusters)) return(1457664); Int64 FreeSize=SectorsPerCluster*BytesPerSector; FreeSize=FreeSize*FreeClusters; return(FreeSize); #elif defined(_BEOS) char Root[NM]; GetFilePath(FileName,Root); dev_t Dev=dev_for_path(*Root ? Root:"."); if (Dev<0) return(1457664); fs_info Info; if (fs_stat_dev(Dev,&Info)!=0) return(1457664); Int64 FreeSize=Info.block_size; FreeSize=FreeSize*Info.free_blocks; return(FreeSize); #elif defined(_UNIX) return(1457664); #elif defined(_EMX) int Drive=(!isalpha(FileName[0]) || FileName[1]!=':') ? 0:toupper(FileName[0])-'A'+1; if (_osmode == OS2_MODE) { FSALLOCATE fsa; if (DosQueryFSInfo(Drive,1,&fsa,sizeof(fsa))!=0) return(1457664); Int64 FreeSize=fsa.cSectorUnit*fsa.cbSector; FreeSize=FreeSize*fsa.cUnitAvail; return(FreeSize); } else { union REGS regs,outregs; memset(®s,0,sizeof(regs)); regs.h.ah=0x36; regs.h.dl=Drive; _int86 (0x21,®s,&outregs); if (outregs.x.ax==0xffff) return(1457664); Int64 FreeSize=outregs.x.ax*outregs.x.cx; FreeSize=FreeSize*outregs.x.bx; return(FreeSize); } #else #define DISABLEAUTODETECT return(1457664); #endif }
int Archive::ReadHeader() { CurBlockPos=Tell(); #ifndef SFX_MODULE if (OldFormat) return(ReadOldHeader()); #endif RawRead Raw(this); bool Decrypt=Encrypted && CurBlockPos>=SFXSize+SIZEOF_MARKHEAD+SIZEOF_NEWMHD; if (Decrypt) { #if defined(SHELL_EXT) || defined(NOCRYPT) return(0); #else if (Read(HeadersSalt,SALT_SIZE)!=SALT_SIZE) return(0); if (*Cmd->Password==0) #ifdef RARDLL if (Cmd->Callback==NULL || Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LONG)Cmd->Password,sizeof(Cmd->Password))==-1) { Close(); ErrHandler.Exit(USER_BREAK); } #else if (!GetPassword(PASSWORD_ARCHIVE,FileName,Cmd->Password,sizeof(Cmd->Password))) { Close(); ErrHandler.Exit(USER_BREAK); } #endif HeadersCrypt.SetCryptKeys(Cmd->Password,HeadersSalt,false); Raw.SetCrypt(&HeadersCrypt); #endif } Raw.Read(SIZEOF_SHORTBLOCKHEAD); if (Raw.Size()==0) { Int64 ArcSize=FileLength(); if (CurBlockPos>ArcSize || NextBlockPos>ArcSize) { #ifndef SHELL_EXT Log(FileName,St(MLogUnexpEOF)); #endif ErrHandler.SetErrorCode(WARNING); } return(0); } Raw.Get(ShortBlock.HeadCRC); unsigned char HeadType; Raw.Get(HeadType); ShortBlock.HeadType=(HEADER_TYPE)HeadType; Raw.Get(ShortBlock.Flags); Raw.Get(ShortBlock.HeadSize); if (ShortBlock.HeadSize<SIZEOF_SHORTBLOCKHEAD) { #ifndef SHELL_EXT Log(FileName,St(MLogFileHead),"???"); #endif BrokenFileHeader=true; ErrHandler.SetErrorCode(CRC_ERROR); return(0); } if (ShortBlock.HeadType==COMM_HEAD) Raw.Read(SIZEOF_COMMHEAD-SIZEOF_SHORTBLOCKHEAD); else if (ShortBlock.HeadType==MAIN_HEAD && (ShortBlock.Flags & MHD_COMMENT)!=0) Raw.Read(SIZEOF_NEWMHD-SIZEOF_SHORTBLOCKHEAD); else Raw.Read(ShortBlock.HeadSize-SIZEOF_SHORTBLOCKHEAD); NextBlockPos=CurBlockPos+ShortBlock.HeadSize; switch(ShortBlock.HeadType) { case MAIN_HEAD: *(BaseBlock *)&NewMhd=ShortBlock; Raw.Get(NewMhd.HighPosAV); Raw.Get(NewMhd.PosAV); break; case ENDARC_HEAD: *(BaseBlock *)&EndArcHead=ShortBlock; if (EndArcHead.Flags & EARC_DATACRC) Raw.Get(EndArcHead.ArcDataCRC); break; case FILE_HEAD: case NEWSUB_HEAD: { FileHeader *hd=ShortBlock.HeadType==FILE_HEAD ? &NewLhd:&SubHead; *(BaseBlock *)hd=ShortBlock; Raw.Get(hd->PackSize); Raw.Get(hd->UnpSize); Raw.Get(hd->HostOS); Raw.Get(hd->FileCRC); Raw.Get(hd->FileTime); Raw.Get(hd->UnpVer); Raw.Get(hd->Method); Raw.Get(hd->NameSize); Raw.Get(hd->FileAttr); if (hd->Flags & LHD_LARGE) { Raw.Get(hd->HighPackSize); Raw.Get(hd->HighUnpSize); } else hd->HighPackSize=hd->HighUnpSize=0; hd->FullPackSize=int32to64(hd->HighPackSize,hd->PackSize); hd->FullUnpSize=int32to64(hd->HighUnpSize,hd->UnpSize); char FileName[NM*4]; int NameSize=Min(hd->NameSize,sizeof(FileName)-1); Raw.Get((unsigned char *)FileName,NameSize); FileName[NameSize]=0; strncpy(hd->FileName,FileName,sizeof(hd->FileName)); hd->FileName[sizeof(hd->FileName)-1]=0; if (hd->HeadType==NEWSUB_HEAD) { int DataSize=hd->HeadSize-hd->NameSize-SIZEOF_NEWLHD; if (hd->Flags & LHD_SALT) DataSize-=SALT_SIZE; if (DataSize>0) { hd->SubData.Alloc(DataSize); Raw.Get(&hd->SubData[0],DataSize); if (hd->CmpName(SUBHEAD_TYPE_RR)) { unsigned char *D=&hd->SubData[8]; RecoverySectors=D[0]+((unsigned int)D[1]<<8)+((unsigned int)D[2]<<16)+((unsigned int)D[3]<<24); } } } else if (hd->HeadType==FILE_HEAD) { if (hd->Flags & LHD_UNICODE) { EncodeFileName NameCoder; int Length=strlen(FileName)+1; NameCoder.Decode(FileName,(unsigned char *)FileName+Length, hd->NameSize-Length,hd->FileNameW, sizeof(hd->FileNameW)/sizeof(hd->FileNameW[0])); if (*hd->FileNameW==0) hd->Flags &= ~LHD_UNICODE; } else *hd->FileNameW=0; #ifndef SFX_MODULE ConvertNameCase(hd->FileName); ConvertNameCase(hd->FileNameW); #endif ConvertUnknownHeader(); } if (hd->Flags & LHD_SALT) Raw.Get(hd->Salt,SALT_SIZE); hd->mtime.SetDos(hd->FileTime); hd->ctime.Reset(); hd->atime.Reset(); hd->arctime.Reset(); if (hd->Flags & LHD_EXTTIME) { unsigned short Flags; Raw.Get(Flags); RarTime *tbl[4]; tbl[0]=&NewLhd.mtime; tbl[1]=&NewLhd.ctime; tbl[2]=&NewLhd.atime; tbl[3]=&NewLhd.arctime; for (int I=0;I<4;I++) { RarTime *CurTime=tbl[I]; unsigned int rmode=Flags>>(3-I)*4; if ((rmode & 8)==0) continue; if (I!=0) { unsigned int DosTime; Raw.Get(DosTime); CurTime->SetDos(DosTime); } RarLocalTime rlt; CurTime->GetLocal(&rlt); if (rmode & 4) rlt.Second++; rlt.Reminder=0; int count=rmode&3; for (int J=0;J<count;J++) { unsigned char CurByte; Raw.Get(CurByte); rlt.Reminder|=(((unsigned int)CurByte)<<((J+3-count)*8)); } CurTime->SetLocal(&rlt); } } NextBlockPos+=hd->FullPackSize; bool CRCProcessedOnly=(hd->Flags & LHD_COMMENT)!=0; HeaderCRC=~Raw.GetCRC(CRCProcessedOnly)&0xffff; if (hd->HeadCRC!=HeaderCRC) { if (hd->HeadType==NEWSUB_HEAD) strcat(hd->FileName,"- ???"); BrokenFileHeader=true; ErrHandler.SetErrorCode(WARNING); #ifndef SHELL_EXT Log(Archive::FileName,St(MLogFileHead),IntNameToExt(hd->FileName)); Alarm(); #endif } } break; #ifndef SFX_MODULE case COMM_HEAD: *(BaseBlock *)&CommHead=ShortBlock; Raw.Get(CommHead.UnpSize); Raw.Get(CommHead.UnpVer); Raw.Get(CommHead.Method); Raw.Get(CommHead.CommCRC); break; case SIGN_HEAD: *(BaseBlock *)&SignHead=ShortBlock; Raw.Get(SignHead.CreationTime); Raw.Get(SignHead.ArcNameSize); Raw.Get(SignHead.UserNameSize); break; case AV_HEAD: *(BaseBlock *)&AVHead=ShortBlock; Raw.Get(AVHead.UnpVer); Raw.Get(AVHead.Method); Raw.Get(AVHead.AVVer); Raw.Get(AVHead.AVInfoCRC); break; case PROTECT_HEAD: *(BaseBlock *)&ProtectHead=ShortBlock; Raw.Get(ProtectHead.DataSize); Raw.Get(ProtectHead.Version); Raw.Get(ProtectHead.RecSectors); Raw.Get(ProtectHead.TotalBlocks); Raw.Get(ProtectHead.Mark,8); NextBlockPos+=ProtectHead.DataSize; RecoverySectors=ProtectHead.RecSectors; break; case SUB_HEAD: *(BaseBlock *)&SubBlockHead=ShortBlock; Raw.Get(SubBlockHead.DataSize); NextBlockPos+=SubBlockHead.DataSize; Raw.Get(SubBlockHead.SubType); Raw.Get(SubBlockHead.Level); switch(SubBlockHead.SubType) { case UO_HEAD: *(SubBlockHeader *)&UOHead=SubBlockHead; Raw.Get(UOHead.OwnerNameSize); Raw.Get(UOHead.GroupNameSize); Raw.Get((unsigned char *)UOHead.OwnerName,UOHead.OwnerNameSize); Raw.Get((unsigned char *)UOHead.GroupName,UOHead.GroupNameSize); if (UOHead.OwnerNameSize>NM-1) UOHead.OwnerNameSize=NM-1; if (UOHead.GroupNameSize>NM-1) UOHead.GroupNameSize=NM-1; UOHead.OwnerName[UOHead.OwnerNameSize]=0; UOHead.GroupName[UOHead.GroupNameSize]=0; break; case MAC_HEAD: *(SubBlockHeader *)&MACHead=SubBlockHead; Raw.Get(MACHead.fileType); Raw.Get(MACHead.fileCreator); break; case EA_HEAD: case BEEA_HEAD: case NTACL_HEAD: *(SubBlockHeader *)&EAHead=SubBlockHead; Raw.Get(EAHead.UnpSize); Raw.Get(EAHead.UnpVer); Raw.Get(EAHead.Method); Raw.Get(EAHead.EACRC); break; case STREAM_HEAD: *(SubBlockHeader *)&StreamHead=SubBlockHead; Raw.Get(StreamHead.UnpSize); Raw.Get(StreamHead.UnpVer); Raw.Get(StreamHead.Method); Raw.Get(StreamHead.StreamCRC); Raw.Get(StreamHead.StreamNameSize); if (StreamHead.StreamNameSize>NM-1) StreamHead.StreamNameSize=NM-1; Raw.Get((unsigned char *)StreamHead.StreamName,StreamHead.StreamNameSize); StreamHead.StreamName[StreamHead.StreamNameSize]=0; break; } break; #endif default: if (ShortBlock.Flags & LONG_BLOCK) { unsigned int DataSize; Raw.Get(DataSize); NextBlockPos+=DataSize; } break; }