9.04 beta

This commit is contained in:
Igor Pavlov
2009-06-02 00:00:00 +00:00
committed by Kornel Lesiński
parent 8874e4fbc9
commit 829409452d
440 changed files with 19803 additions and 9941 deletions

View File

@@ -13,9 +13,6 @@
#include "../../Common/LimitedStreams.h"
#include "../../Common/ProgressUtils.h"
#include "../../Compress/CopyCoder.h"
#include "../Common/DummyOutStream.h"
#include "../Common/ItemNameUtils.h"
#include "TarHandler.h"
@@ -33,22 +30,35 @@ STATPROPSTG kProps[] =
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidPackSize, VT_UI8},
{ NULL, kpidMTime, VT_FILETIME},
{ NULL, kpidPosixAttrib, VT_UI4},
{ NULL, kpidUser, VT_BSTR},
{ NULL, kpidGroup, VT_BSTR}
{ NULL, kpidGroup, VT_BSTR},
{ NULL, kpidLink, VT_BSTR}
};
IMP_IInArchive_Props
IMP_IInArchive_ArcProps_NO
IMP_IInArchive_ArcProps_NO_Table
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
switch(propID)
{
case kpidPhySize: if (_phySizeDefined) prop = _phySize; break;
}
prop.Detach(value);
return S_OK;
}
HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
{
UInt64 endPos = 0;
if (callback != NULL)
{
RINOK(stream->Seek(0, STREAM_SEEK_END, &endPos));
RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
}
_isGood = true;
UInt64 pos = 0;
for (;;)
{
@@ -61,8 +71,13 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
_items.Add(item);
RINOK(stream->Seek(item.GetPackSize(), STREAM_SEEK_CUR, &pos));
if (pos >= endPos)
if (pos > endPos)
return S_FALSE;
if (pos == endPos)
{
_isGood = false;
break;
}
if (callback != NULL)
{
if (_items.Size() == 1)
@@ -98,70 +113,134 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
return S_OK;
}
STDMETHODIMP CHandler::Open(IInStream *stream,
const UInt64 * /* maxCheckStartPosition */,
IArchiveOpenCallback *openArchiveCallback)
STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback *openArchiveCallback)
{
COM_TRY_BEGIN
{
Close();
RINOK(Open2(stream, openArchiveCallback));
_inStream = stream;
_stream = stream;
}
return S_OK;
COM_TRY_END
}
STDMETHODIMP CHandler::OpenSeq(ISequentialInStream *stream)
{
Close();
_seqStream = stream;
return S_OK;
}
STDMETHODIMP CHandler::Close()
{
_phySizeDefined = false;
_curIndex = 0;
_latestIsRead = false;
_items.Clear();
_inStream.Release();
_seqStream.Release();
_stream.Release();
return S_OK;
}
STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
{
*numItems = _items.Size();
*numItems = (_stream ? _items.Size() : (UInt32)(Int32)-1);
return S_OK;
}
CHandler::CHandler()
{
copyCoderSpec = new NCompress::CCopyCoder();
copyCoder = copyCoderSpec;
}
HRESULT CHandler::SkipTo(UInt32 index)
{
while (_curIndex < index || !_latestIsRead)
{
if (_latestIsRead)
{
UInt64 packSize = _latestItem.GetPackSize();
RINOK(copyCoderSpec->Code(_seqStream, NULL, &packSize, &packSize, NULL));
_latestIsRead = false;
_curIndex++;
}
else
{
bool filled;
// item.HeaderPosition = pos;
RINOK(ReadItem(_seqStream, filled, _latestItem));
if (!filled)
return E_INVALIDARG;
_latestIsRead = true;
}
}
return S_OK;
}
static UString TarStringToUnicode(const AString &s)
{
return MultiByteToUnicodeString(s, CP_OEMCP);
}
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NWindows::NCOM::CPropVariant prop;
const CItemEx &item = _items[index];
const CItemEx *item;
if (_stream)
item = &_items[index];
else
{
if (index < _curIndex)
return E_INVALIDARG;
else
{
RINOK(SkipTo(index));
item = &_latestItem;
}
}
switch(propID)
{
case kpidPath: prop = NItemName::GetOSName2(MultiByteToUnicodeString(item.Name, CP_OEMCP)); break;
case kpidIsDir: prop = item.IsDir(); break;
case kpidSize: prop = item.Size; break;
case kpidPackSize: prop = item.GetPackSize(); break;
case kpidPath: prop = NItemName::GetOSName2(TarStringToUnicode(item->Name)); break;
case kpidIsDir: prop = item->IsDir(); break;
case kpidSize: prop = item->Size; break;
case kpidPackSize: prop = item->GetPackSize(); break;
case kpidMTime:
if (item.MTime != 0)
if (item->MTime != 0)
{
FILETIME ft;
NTime::UnixTimeToFileTime(item.MTime, ft);
NTime::UnixTimeToFileTime(item->MTime, ft);
prop = ft;
}
break;
case kpidUser: prop = MultiByteToUnicodeString(item.UserName, CP_OEMCP); break;
case kpidGroup: prop = MultiByteToUnicodeString(item.GroupName, CP_OEMCP); break;
case kpidPosixAttrib: prop = item->Mode; break;
case kpidUser: prop = TarStringToUnicode(item->User); break;
case kpidGroup: prop = TarStringToUnicode(item->Group); break;
case kpidLink: prop = TarStringToUnicode(item->LinkName); break;
}
prop.Detach(value);
return S_OK;
COM_TRY_END
}
STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
HRESULT CHandler::Extract(const UInt32* indices, UInt32 numItems,
Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
{
COM_TRY_BEGIN
ISequentialInStream *stream = _seqStream;
bool seqMode = (_stream == NULL);
if (!seqMode)
stream = _stream;
bool testMode = (_aTestMode != 0);
bool allFilesMode = (numItems == UInt32(-1));
bool allFilesMode = (numItems == (UInt32)-1);
if (allFilesMode)
numItems = _items.Size();
if (numItems == 0)
if (_stream && numItems == 0)
return S_OK;
UInt64 totalSize = 0;
UInt32 i;
@@ -169,24 +248,21 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
totalSize += _items[allFilesMode ? i : indices[i]].Size;
extractCallback->SetTotal(totalSize);
UInt64 totalPackSize, curPackSize, curSize;
UInt64 totalPackSize;
totalSize = totalPackSize = 0;
NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
CLocalProgress *lps = new CLocalProgress;
CMyComPtr<ICompressProgressInfo> progress = lps;
lps->Init(extractCallback, false);
CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
CMyComPtr<ISequentialInStream> inStream(streamSpec);
streamSpec->SetStream(_inStream);
streamSpec->SetStream(stream);
CDummyOutStream *outStreamSpec = new CDummyOutStream;
CLimitedSequentialOutStream *outStreamSpec = new CLimitedSequentialOutStream;
CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
for (i = 0; i < numItems; i++, totalSize += curSize, totalPackSize += curPackSize)
for (i = 0; i < numItems || seqMode; i++)
{
lps->InSize = totalPackSize;
lps->OutSize = totalSize;
@@ -196,29 +272,54 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
NArchive::NExtract::NAskMode::kTest :
NArchive::NExtract::NAskMode::kExtract;
Int32 index = allFilesMode ? i : indices[i];
const CItemEx &item = _items[index];
const CItemEx *item;
if (seqMode)
{
HRESULT res = SkipTo(index);
if (res == E_INVALIDARG)
break;
RINOK(res);
item = &_latestItem;
}
else
item = &_items[index];
RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
curSize = item.Size;
curPackSize = item.GetPackSize();
if (item.IsDir())
totalSize += item->Size;
totalPackSize += item->GetPackSize();
if (item->IsDir())
{
RINOK(extractCallback->PrepareOperation(askMode));
RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
continue;
}
if (!testMode && (!realOutStream))
continue;
bool skipMode = false;
if (!testMode && !realOutStream)
{
if (!seqMode)
continue;
skipMode = true;
askMode = NArchive::NExtract::NAskMode::kSkip;
}
RINOK(extractCallback->PrepareOperation(askMode));
outStreamSpec->SetStream(realOutStream);
realOutStream.Release();
outStreamSpec->Init();
outStreamSpec->Init(skipMode ? 0 : item->Size, true);
RINOK(_inStream->Seek(item.GetDataPosition(), STREAM_SEEK_SET, NULL));
streamSpec->Init(item.Size);
if (!seqMode)
{
RINOK(_stream->Seek(item->GetDataPosition(), STREAM_SEEK_SET, NULL));
}
streamSpec->Init(item->GetPackSize());
RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
if (seqMode)
{
_latestIsRead = false;
_curIndex++;
}
outStreamSpec->ReleaseStream();
RINOK(extractCallback->SetOperationResult(copyCoderSpec->TotalSize == item.Size ?
RINOK(extractCallback->SetOperationResult(outStreamSpec->GetRem() == 0 ?
NArchive::NExtract::NOperationResult::kOK:
NArchive::NExtract::NOperationResult::kDataError));
}
@@ -226,4 +327,12 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
COM_TRY_END
}
STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
{
COM_TRY_BEGIN
const CItemEx &item = _items[index];
return CreateLimitedInStream(_stream, item.GetDataPosition(), item.Size, stream);
COM_TRY_END
}
}}

View File

@@ -1,4 +1,4 @@
// Tar/Handler.h
// TarHandler.h
#ifndef __TAR_HANDLER_H
#define __TAR_HANDLER_H
@@ -6,6 +6,8 @@
#include "Common/MyCom.h"
#include "../IArchive.h"
#include "../../Compress/CopyCoder.h"
#include "TarItem.h"
namespace NArchive {
@@ -13,23 +15,43 @@ namespace NTar {
class CHandler:
public IInArchive,
public IArchiveOpenSeq,
public IInArchiveGetStream,
public IOutArchive,
public CMyUnknownImp
{
CObjectVector<CItemEx> _items;
CMyComPtr<IInStream> _stream;
CMyComPtr<ISequentialInStream> _seqStream;
bool _isGood;
UInt32 _curIndex;
bool _latestIsRead;
CItemEx _latestItem;
UInt64 _phySize;
bool _phySizeDefined;
NCompress::CCopyCoder *copyCoderSpec;
CMyComPtr<ICompressCoder> copyCoder;
HRESULT Open2(IInStream *stream, IArchiveOpenCallback *callback);
HRESULT SkipTo(UInt32 index);
public:
MY_UNKNOWN_IMP2(
MY_UNKNOWN_IMP4(
IInArchive,
IArchiveOpenSeq,
IInArchiveGetStream,
IOutArchive
)
INTERFACE_IInArchive(;)
INTERFACE_IOutArchive(;)
STDMETHOD(OpenSeq)(ISequentialInStream *stream);
STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
HRESULT Open2(IInStream *stream, IArchiveOpenCallback *callback);
private:
CObjectVector<CItemEx> _items;
CMyComPtr<IInStream> _inStream;
CHandler();
};
}}

View File

@@ -1,20 +1,17 @@
// Tar/HandlerOut.cpp
// TarHandlerOut.cpp
#include "StdAfx.h"
#include "Common/StringConvert.h"
#include "Common/ComTry.h"
#include "Common/StringConvert.h"
#include "Windows/PropVariant.h"
#include "Windows/Time.h"
#include "../Common/ItemNameUtils.h"
#include "TarHandler.h"
#include "TarUpdate.h"
using namespace NWindows;
using namespace NCOM;
namespace NArchive {
namespace NTar {
@@ -25,59 +22,40 @@ STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type)
return S_OK;
}
static HRESULT GetPropString(IArchiveUpdateCallback *callback, UInt32 index, PROPID propId, AString &res)
{
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(index, propId, &prop));
if (prop.vt == VT_BSTR)
res = UnicodeStringToMultiByte(prop.bstrVal, CP_OEMCP);
else if (prop.vt != VT_EMPTY)
return E_INVALIDARG;
return S_OK;
}
STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
IArchiveUpdateCallback *callback)
{
COM_TRY_BEGIN
if ((_stream && !_isGood) || _seqStream)
return E_NOTIMPL;
CObjectVector<CUpdateItem> updateItems;
for (UInt32 i = 0; i < numItems; i++)
{
CUpdateItem ui;
Int32 newData;
Int32 newProperties;
Int32 newProps;
UInt32 indexInArchive;
if (!callback)
return E_FAIL;
RINOK(callback->GetUpdateItemInfo(i, &newData, &newProperties, &indexInArchive));
ui.NewProperties = IntToBool(newProperties);
RINOK(callback->GetUpdateItemInfo(i, &newData, &newProps, &indexInArchive));
ui.NewProps = IntToBool(newProps);
ui.NewData = IntToBool(newData);
ui.IndexInArchive = indexInArchive;
ui.IndexInClient = i;
if (IntToBool(newProperties))
if (IntToBool(newProps))
{
FILETIME utcTime;
UString name;
/*
UInt32 attributes;
{
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidAttrib, &prop));
if (prop.vt == VT_EMPTY)
attributes = 0;
else if (prop.vt != VT_UI4)
return E_INVALIDARG;
else
attributes = prop.ulVal;
}
*/
{
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidMTime, &prop));
if (prop.vt != VT_FILETIME)
return E_INVALIDARG;
utcTime = prop.filetime;
}
{
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidPath, &prop));
if (prop.vt == VT_EMPTY)
name.Empty();
else if (prop.vt != VT_BSTR)
return E_INVALIDARG;
else
name = prop.bstrVal;
}
{
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidIsDir, &prop));
@@ -88,31 +66,51 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
else
ui.IsDir = (prop.boolVal != VARIANT_FALSE);
}
ui.Name = UnicodeStringToMultiByte(NItemName::MakeLegalName(name), CP_OEMCP);
if (ui.IsDir)
ui.Name += '/';
if (!NTime::FileTimeToUnixTime(utcTime, ui.Time))
{
ui.Time = 0;
// return E_INVALIDARG;
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidPosixAttrib, &prop));
if (prop.vt == VT_EMPTY)
ui.Mode = 0777 | (ui.IsDir ? 0040000 : 0100000);
else if (prop.vt != VT_UI4)
return E_INVALIDARG;
else
ui.Mode = prop.ulVal;
}
{
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidMTime, &prop));
if (prop.vt == VT_EMPTY)
ui.Time = 0;
else if (prop.vt != VT_FILETIME)
return E_INVALIDARG;
else if (!NTime::FileTimeToUnixTime(prop.filetime, ui.Time))
ui.Time = 0;
}
{
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidPath, &prop));
if (prop.vt == VT_BSTR)
ui.Name = UnicodeStringToMultiByte(NItemName::MakeLegalName(prop.bstrVal), CP_OEMCP);
else if (prop.vt != VT_EMPTY)
return E_INVALIDARG;
if (ui.IsDir)
ui.Name += '/';
}
RINOK(GetPropString(callback, i, kpidUser, ui.User));
RINOK(GetPropString(callback, i, kpidGroup, ui.Group));
}
if (IntToBool(newData))
{
UInt64 size;
{
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidSize, &prop));
if (prop.vt != VT_UI8)
return E_INVALIDARG;
size = prop.uhVal.QuadPart;
}
ui.Size = size;
NCOM::CPropVariant prop;
RINOK(callback->GetProperty(i, kpidSize, &prop));
if (prop.vt != VT_UI8)
return E_INVALIDARG;
ui.Size = prop.uhVal.QuadPart;
}
updateItems.Add(ui);
}
return UpdateArchive(_inStream, outStream, _items, updateItems, callback);
return UpdateArchive(_stream, outStream, _items, updateItems, callback);
COM_TRY_END
}

View File

@@ -1,15 +1,13 @@
// Archive/TarIn.cpp
// TarIn.cpp
#include "StdAfx.h"
#include "TarIn.h"
#include "TarHeader.h"
#include "Common/StringToInt.h"
#include "Windows/Defs.h"
#include "../../Common/StreamUtils.h"
#include "TarIn.h"
namespace NArchive {
namespace NTar {
@@ -98,8 +96,8 @@ static HRESULT GetNextItemReal(ISequentialInStream *stream, bool &filled, CItemE
memcpy(item.Magic, p, 8); p += 8;
ReadString(p, NFileHeader::kUserNameSize, item.UserName); p += NFileHeader::kUserNameSize;
ReadString(p, NFileHeader::kUserNameSize, item.GroupName); p += NFileHeader::kUserNameSize;
ReadString(p, NFileHeader::kUserNameSize, item.User); p += NFileHeader::kUserNameSize;
ReadString(p, NFileHeader::kGroupNameSize, item.Group); p += NFileHeader::kGroupNameSize;
item.DeviceMajorDefined = (p[0] != 0); RIF(OctalToNumber32(p, 8, item.DeviceMajor)); p += 8;
item.DeviceMinorDefined = (p[0] != 0); RIF(OctalToNumber32(p, 8, item.DeviceMinor)); p += 8;
@@ -132,7 +130,8 @@ HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &item)
if (!filled)
return S_OK;
// GNUtar extension
if (item.LinkFlag == 'L')
if (item.LinkFlag == 'L' || // NEXT file has a long name
item.LinkFlag == 'K') // NEXT file has a long linkname
{
if (item.Name.Compare(NFileHeader::kLongLink) != 0)
if (item.Name.Compare(NFileHeader::kLongLink2) != 0)
@@ -150,11 +149,17 @@ HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &item)
fullName.ReleaseBuffer();
UInt64 headerPosition = item.HeaderPosition;
if (item.LinkFlag == 'L')
{
size_t processedSize2;
RINOK(GetNextItemReal(stream, filled, item, processedSize2));
item.LongLinkSize = (unsigned)processedSize;
}
else
{
item.LongLinkSize = (unsigned)processedSize - NFileHeader::kRecordSize;
item.Size = 0;
}
item.LongLinkSize = (unsigned)processedSize;
item.Name = fullName;
item.HeaderPosition = headerPosition;
}

View File

@@ -1,12 +1,10 @@
// Archive/Tar/Item.h
// TarItem.h
#ifndef __ARCHIVE_TAR_ITEM_H
#define __ARCHIVE_TAR_ITEM_H
#include "Common/Types.h"
#include "Common/MyString.h"
#include "../Common/ItemNameUtils.h"
#include "TarHeader.h"
namespace NArchive {
@@ -25,8 +23,8 @@ struct CItem
UInt32 DeviceMinor;
AString LinkName;
AString UserName;
AString GroupName;
AString User;
AString Group;
char Magic[8];
char LinkFlag;

View File

@@ -1,14 +1,13 @@
// Archive/TarOut.cpp
// TarOut.cpp
#include "StdAfx.h"
#include "TarOut.h"
#include "TarHeader.h"
#include "Common/IntToString.h"
#include "Windows/Defs.h"
#include "../../Common/StreamUtils.h"
#include "TarOut.h"
namespace NArchive {
namespace NTar {
@@ -114,10 +113,10 @@ HRESULT COutArchive::WriteHeaderReal(const CItem &item)
memmove(cur, item.Magic, 8);
cur += 8;
RETURN_IF_NOT_TRUE(CopyString(cur, item.UserName, NFileHeader::kUserNameSize));
cur += NFileHeader::kUserNameSize;
RETURN_IF_NOT_TRUE(CopyString(cur, item.GroupName, NFileHeader::kGroupNameSize));
RETURN_IF_NOT_TRUE(CopyString(cur, item.User, NFileHeader::kUserNameSize));
cur += NFileHeader::kUserNameSize;
RETURN_IF_NOT_TRUE(CopyString(cur, item.Group, NFileHeader::kGroupNameSize));
cur += NFileHeader::kGroupNameSize;
if (item.DeviceMajorDefined)

View File

@@ -55,10 +55,12 @@ HRESULT UpdateArchive(IInStream *inStream, ISequentialOutStream *outStream,
const CUpdateItem &ui = updateItems[i];
CItem item;
if (ui.NewProperties)
if (ui.NewProps)
{
item.Mode = 0777;
item.Name = (ui.Name);
item.Mode = ui.Mode;
item.Name = ui.Name;
item.User = ui.User;
item.Group = ui.Group;
if (ui.IsDir)
{
item.LinkFlag = NFileHeader::NLinkFlag::kDirectory;
@@ -77,21 +79,16 @@ HRESULT UpdateArchive(IInStream *inStream, ISequentialOutStream *outStream,
memmove(item.Magic, NFileHeader::NMagic::kEmpty, 8);
}
else
{
const CItemEx &existItemInfo = inputItems[ui.IndexInArchive];
item = existItemInfo;
}
item = inputItems[ui.IndexInArchive];
if (ui.NewData)
{
item.Size = ui.Size;
if (item.Size == UInt64(Int64(-1)))
if (item.Size == (UInt64)(Int64)-1)
return E_INVALIDARG;
}
else
{
const CItemEx &existItemInfo = inputItems[ui.IndexInArchive];
item.Size = existItemInfo.Size;
}
item.Size = inputItems[ui.IndexInArchive].Size;
if (ui.NewData)
{
@@ -116,7 +113,7 @@ HRESULT UpdateArchive(IInStream *inStream, ISequentialOutStream *outStream,
{
const CItemEx &existItemInfo = inputItems[ui.IndexInArchive];
UInt64 size;
if (ui.NewProperties)
if (ui.NewProps)
{
RINOK(outArchive.WriteHeader(item));
RINOK(inStream->Seek(existItemInfo.GetDataPosition(), STREAM_SEEK_SET, NULL));

View File

@@ -1,4 +1,4 @@
// Tar/Update.h
// TarUpdate.h
#ifndef __TAR_UPDATE_H
#define __TAR_UPDATE_H
@@ -11,14 +11,16 @@ namespace NTar {
struct CUpdateItem
{
bool NewData;
bool NewProperties;
int IndexInArchive;
int IndexInClient;
UInt32 Time;
UInt32 Mode;
UInt64 Size;
AString Name;
AString User;
AString Group;
bool NewData;
bool NewProps;
bool IsDir;
};