public NTStatus SetFileInformation(object handle, FileInformation information) { IO_STATUS_BLOCK ioStatusBlock; if (information is FileRenameInformationType2) { FileRenameInformationType2 fileRenameInformationRemote = (FileRenameInformationType2)information; if (ProcessHelper.Is64BitProcess) { // We should not modify the FileRenameInformationType2 instance we received - the caller may use it later. FileRenameInformationType2 fileRenameInformationLocal = new FileRenameInformationType2(); fileRenameInformationLocal.ReplaceIfExists = fileRenameInformationRemote.ReplaceIfExists; fileRenameInformationLocal.FileName = ToNativePath(fileRenameInformationRemote.FileName); information = fileRenameInformationLocal; } else { // Note: WOW64 process should use FILE_RENAME_INFORMATION_TYPE_1. // Note: Server 2003 x64 has issues with using FILE_RENAME_INFORMATION under WOW64. FileRenameInformationType1 fileRenameInformationLocal = new FileRenameInformationType1(); fileRenameInformationLocal.ReplaceIfExists = fileRenameInformationRemote.ReplaceIfExists; fileRenameInformationLocal.FileName = ToNativePath(fileRenameInformationRemote.FileName); information = fileRenameInformationLocal; } } else if (information is FileLinkInformationType2) { FileLinkInformationType2 fileLinkInformationRemote = (FileLinkInformationType2)information; if (ProcessHelper.Is64BitProcess) { FileRenameInformationType2 fileLinkInformationLocal = new FileRenameInformationType2(); fileLinkInformationLocal.ReplaceIfExists = fileLinkInformationRemote.ReplaceIfExists; fileLinkInformationLocal.FileName = ToNativePath(fileLinkInformationRemote.FileName); information = fileLinkInformationRemote; } else { FileLinkInformationType1 fileLinkInformationLocal = new FileLinkInformationType1(); fileLinkInformationLocal.ReplaceIfExists = fileLinkInformationRemote.ReplaceIfExists; fileLinkInformationLocal.FileName = ToNativePath(fileLinkInformationRemote.FileName); information = fileLinkInformationRemote; } } byte[] buffer = information.GetBytes(); return(NtSetInformationFile((IntPtr)handle, out ioStatusBlock, buffer, (uint)buffer.Length, (uint)information.FileInformationClass)); }
/// <remarks> /// Support for pass-through Information Levels must be enabled. /// </remarks> public void SetFileInformation(FileInformation information) { InformationBytes = information.GetBytes(); }
public void SetFileInformation(FileInformation fileInformation) { Buffer = fileInformation.GetBytes(); }
/// <remarks> /// Support for pass-through Information Levels must be enabled. /// </remarks> public void SetInformation(FileInformation information) { FileInformationClass = information.FileInformationClass; InformationBytes = information.GetBytes(); }