public Transaction2SetFileInformationRequest(byte[] parameters, byte[] data, bool isUnicode) : base() { FID = LittleEndianConverter.ToUInt16(parameters, 0); InformationLevel = (SetInformationLevel)LittleEndianConverter.ToUInt16(parameters, 2); Reserved = LittleEndianConverter.ToUInt16(parameters, 4); SetInfo = SetInformation.GetSetInformation(data, InformationLevel); }
public static FileInformation ToFileInformation(SetInformation information) { switch (information) { case SetFileBasicInfo info: { SetFileBasicInfo basicInfo = info; FileBasicInformation fileBasicInfo = new FileBasicInformation { CreationTime = basicInfo.CreationTime, LastAccessTime = basicInfo.LastAccessTime, LastWriteTime = basicInfo.LastWriteTime, ChangeTime = basicInfo.LastChangeTime, FileAttributes = (FileAttributes)basicInfo.ExtFileAttributes, Reserved = basicInfo.Reserved }; return(fileBasicInfo); } case SetFileDispositionInfo info: { FileDispositionInformation fileDispositionInfo = new FileDispositionInformation { DeletePending = info.DeletePending }; return(fileDispositionInfo); } case SetFileAllocationInfo info: { // This information level is used to set the file length in bytes. // Note: the input will NOT be a multiple of the cluster size / bytes per sector. FileAllocationInformation fileAllocationInfo = new FileAllocationInformation { AllocationSize = info.AllocationSize }; return(fileAllocationInfo); } case SetFileEndOfFileInfo info: { FileEndOfFileInformation fileEndOfFileInfo = new FileEndOfFileInformation { EndOfFile = info.EndOfFile }; return(fileEndOfFileInfo); } default: throw new NotImplementedException(); } }
public static FileInformation ToFileInformation(SetInformation information) { if (information is SetFileBasicInfo) { SetFileBasicInfo basicInfo = (SetFileBasicInfo)information; FileBasicInformation fileBasicInfo = new FileBasicInformation(); fileBasicInfo.CreationTime = basicInfo.CreationTime; fileBasicInfo.LastAccessTime = basicInfo.LastAccessTime; fileBasicInfo.LastWriteTime = basicInfo.LastWriteTime; fileBasicInfo.ChangeTime = basicInfo.LastChangeTime; fileBasicInfo.FileAttributes = (FileAttributes)basicInfo.ExtFileAttributes; fileBasicInfo.Reserved = basicInfo.Reserved; return(fileBasicInfo); } else if (information is SetFileDispositionInfo) { FileDispositionInformation fileDispositionInfo = new FileDispositionInformation(); fileDispositionInfo.DeletePending = ((SetFileDispositionInfo)information).DeletePending; return(fileDispositionInfo); } else if (information is SetFileAllocationInfo) { // This information level is used to set the file length in bytes. // Note: the input will NOT be a multiple of the cluster size / bytes per sector. FileAllocationInformation fileAllocationInfo = new FileAllocationInformation(); fileAllocationInfo.AllocationSize = ((SetFileAllocationInfo)information).AllocationSize; return(fileAllocationInfo); } else if (information is SetFileEndOfFileInfo) { FileEndOfFileInformation fileEndOfFileInfo = new FileEndOfFileInformation(); fileEndOfFileInfo.EndOfFile = ((SetFileEndOfFileInfo)information).EndOfFile; return(fileEndOfFileInfo); } else { throw new NotImplementedException(); } }
public void SetInformation(SetInformation information) { InformationBytes = information.GetBytes(); }
public void SetInformation(SetInformation information) { SetInformationLevel = information.InformationLevel; InformationBytes = information.GetBytes(); }