86 DPRINT(
"Getting position %I64x\n",
205 DPRINT(
"NtfsGetNetworkOpenInformation(%p, %p, %p, %p)\n",
Fcb, DeviceExt, NetworkInfo,
BufferLength);
241 FileRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
242 if (FileRecord ==
NULL)
244 DPRINT1(
"Not enough memory!\n");
251 DPRINT1(
"Can't find record!\n");
252 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
277 if (Previous !=
NULL)
281 Previous = CurrentInfo;
290 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
298 const PCSTR fileInfoClassNames[] = {
"???????",
299 "FileDirectoryInformation",
300 "FileFullDirectoryInformation",
301 "FileBothDirectoryInformation",
302 "FileBasicInformation",
303 "FileStandardInformation",
304 "FileInternalInformation",
306 "FileAccessInformation",
307 "FileNameInformation",
308 "FileRenameInformation",
309 "FileLinkInformation",
310 "FileNamesInformation",
311 "FileDispositionInformation",
312 "FilePositionInformation",
313 "FileFullEaInformation",
314 "FileModeInformation",
315 "FileAlignmentInformation",
316 "FileAllInformation",
317 "FileAllocationInformation",
318 "FileEndOfFileInformation",
319 "FileAlternateNameInformation",
320 "FileStreamInformation",
321 "FilePipeInformation",
322 "FilePipeLocalInformation",
323 "FilePipeRemoteInformation",
324 "FileMailslotQueryInformation",
325 "FileMailslotSetInformation",
326 "FileCompressionInformation",
327 "FileObjectIdInformation",
328 "FileCompletionInformation",
329 "FileMoveClusterInformation",
330 "FileQuotaInformation",
331 "FileReparsePointInformation",
332 "FileNetworkOpenInformation",
333 "FileAttributeTagInformation",
334 "FileTrackingInformation",
335 "FileIdBothDirectoryInformation",
336 "FileIdFullDirectoryInformation",
337 "FileValidDataLengthInformation",
338 "FileShortNameInformation",
339 "FileIoCompletionNotificationInformation",
340 "FileIoStatusBlockRangeInformation",
341 "FileIoPriorityHintInformation",
342 "FileSfioReserveInformation",
343 "FileSfioVolumeInformation",
344 "FileHardLinkInformation",
345 "FileProcessIdsUsingFileInformation",
346 "FileNormalizedNameInformation",
347 "FileNetworkPhysicalNameInformation",
348 "FileIdGlobalTxDirectoryInformation",
349 "FileIsRemoteDeviceInformation",
350 "FileAttributeCacheInformation",
351 "FileNumaNodeInformation",
352 "FileStandardLinkInformation",
353 "FileRemoteProtocolInformation",
354 "FileReplaceCompletionInformation",
355 "FileMaximumInformation",
356 "FileDirectoryInformation",
357 "FileFullDirectoryInformation",
358 "FileBothDirectoryInformation",
359 "FileBasicInformation",
360 "FileStandardInformation",
361 "FileInternalInformation",
363 "FileAccessInformation",
364 "FileNameInformation",
365 "FileRenameInformation",
366 "FileLinkInformation",
367 "FileNamesInformation",
368 "FileDispositionInformation",
369 "FilePositionInformation",
370 "FileFullEaInformation",
371 "FileModeInformation",
372 "FileAlignmentInformation",
373 "FileAllInformation",
374 "FileAllocationInformation",
375 "FileEndOfFileInformation",
376 "FileAlternateNameInformation",
377 "FileStreamInformation",
378 "FilePipeInformation",
379 "FilePipeLocalInformation",
380 "FilePipeRemoteInformation",
381 "FileMailslotQueryInformation",
382 "FileMailslotSetInformation",
383 "FileCompressionInformation",
384 "FileObjectIdInformation",
385 "FileCompletionInformation",
386 "FileMoveClusterInformation",
387 "FileQuotaInformation",
388 "FileReparsePointInformation",
389 "FileNetworkOpenInformation",
390 "FileAttributeTagInformation",
391 "FileTrackingInformation",
392 "FileIdBothDirectoryInformation",
393 "FileIdFullDirectoryInformation",
394 "FileValidDataLengthInformation",
395 "FileShortNameInformation",
396 "FileIoCompletionNotificationInformation",
397 "FileIoStatusBlockRangeInformation",
398 "FileIoPriorityHintInformation",
399 "FileSfioReserveInformation",
400 "FileSfioVolumeInformation",
401 "FileHardLinkInformation",
402 "FileProcessIdsUsingFileInformation",
403 "FileNormalizedNameInformation",
404 "FileNetworkPhysicalNameInformation",
405 "FileIdGlobalTxDirectoryInformation",
406 "FileIsRemoteDeviceInformation",
407 "FileAttributeCacheInformation",
408 "FileNumaNodeInformation",
409 "FileStandardLinkInformation",
410 "FileRemoteProtocolInformation",
411 "FileReplaceCompletionInformation",
412 "FileMaximumInformation" };
413 return fileInfoClassNames[infoClass];
432 DPRINT1(
"NtfsQueryInformation(%p)\n", IrpContext);
441 SystemBuffer =
Irp->AssociatedIrp.SystemBuffer;
515 Irp->IoStatus.Information =
518 Irp->IoStatus.Information = 0;
573 ULONG AttributeOffset;
582 FileRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
583 if (FileRecord ==
NULL)
585 DPRINT1(
"Couldn't allocate memory for file record!");
590 DPRINT(
"Reading file record...\n");
596 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
611 DPRINT1(
"Couldn't decrease file size!\n");
612 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
618 DPRINT(
"Finding Data Attribute...\n");
631 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
647 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
657 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
664 if (FileNameAttribute ==
NULL)
666 DPRINT1(
"Unable to find FileName attribute associated with file!\n");
668 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
689 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
732 DPRINT(
"NtfsSetInformation(%p)\n", IrpContext);
742 SystemBuffer =
Irp->AssociatedIrp.SystemBuffer;
758 DPRINT1(
"FIXME: Using hacky method of setting FileAllocationInformation.\n");
779 Irp->IoStatus.Information =
782 Irp->IoStatus.Information = 0;
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
NTSTATUS FindFirstAttribute(PFIND_ATTR_CONTXT Context, PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord, BOOLEAN OnlyResident, PNTFS_ATTR_RECORD *Attribute)
VOID FindCloseAttribute(PFIND_ATTR_CONTXT Context)
NTSTATUS FindNextAttribute(PFIND_ATTR_CONTXT Context, PNTFS_ATTR_RECORD *Attribute)
PFILENAME_ATTRIBUTE GetBestFileNameFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
VOID NtfsFileFlagsToAttributes(ULONG NtfsAttributes, PULONG FileAttributes)
FORCEINLINE NTSTATUS NtfsMarkIrpContextForQueue(PNTFS_IRP_CONTEXT IrpContext)
#define IRPCONTEXT_CANWAIT
#define ExAcquireResourceSharedLite(res, wait)
#define BooleanFlagOn(F, SF)
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
struct _FileName FileName
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ HANDLE _In_ ULONG FileNameLength
@ FilePositionInformation
@ FileEndOfFileInformation
@ FileInternalInformation
@ FileAlternateNameInformation
@ FileAllocationInformation
@ FileNetworkOpenInformation
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
struct _FILE_INTERNAL_INFORMATION FILE_INTERNAL_INFORMATION
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING StreamName
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
struct _FILE_STREAM_INFORMATION * PFILE_STREAM_INFORMATION
NTSTATUS ReadFileRecord(PDEVICE_EXTENSION Vcb, ULONGLONG index, PFILE_RECORD_HEADER file)
VOID ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context)
NTSTATUS UpdateFileNameRecord(PDEVICE_EXTENSION Vcb, ULONGLONG ParentMFTIndex, PUNICODE_STRING FileName, BOOLEAN DirSearch, ULONGLONG NewDataSize, ULONGLONG NewAllocationSize, BOOLEAN CaseSensitive)
ULONGLONG AttributeDataLength(PNTFS_ATTR_RECORD AttrRecord)
NTSTATUS FindAttribute(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER MftRecord, ULONG Type, PCWSTR Name, ULONG NameLength, PNTFS_ATTR_CONTEXT *AttrCtx, PULONG Offset)
ULONGLONG AttributeAllocatedLength(PNTFS_ATTR_RECORD AttrRecord)
NTSTATUS SetAttributeDataLength(PFILE_OBJECT FileObject, PNTFS_FCB Fcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, PLARGE_INTEGER DataSize)
#define FILE_STANDARD_INFORMATION
#define FILE_BASIC_INFORMATION
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
_In_ UINT _In_ UINT BytesToCopy
struct _FILE_POSITION_INFORMATION FILE_POSITION_INFORMATION
struct _FILE_END_OF_FILE_INFORMATION * PFILE_END_OF_FILE_INFORMATION
#define UNREFERENCED_PARAMETER(P)
ULONGLONG NtfsGetFileSize(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, PCWSTR Stream, ULONG StreamLength, PULONGLONG AllocatedSize)
BOOLEAN NtfsFCBIsDirectory(PNTFS_FCB Fcb)
static NTSTATUS NtfsGetNameInformation(PFILE_OBJECT FileObject, PNTFS_FCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_NAME_INFORMATION NameInfo, PULONG BufferLength)
static NTSTATUS NtfsGetStreamInformation(PNTFS_FCB Fcb, PDEVICE_EXTENSION DeviceExt, PFILE_STREAM_INFORMATION StreamInfo, PULONG BufferLength)
NTSTATUS NtfsSetEndOfFile(PNTFS_FCB Fcb, PFILE_OBJECT FileObject, PDEVICE_EXTENSION DeviceExt, ULONG IrpFlags, BOOLEAN CaseSensitive, PLARGE_INTEGER NewFileSize)
NTSTATUS NtfsQueryInformation(PNTFS_IRP_CONTEXT IrpContext)
static NTSTATUS NtfsGetPositionInformation(PFILE_OBJECT FileObject, PFILE_POSITION_INFORMATION PositionInfo, PULONG BufferLength)
const PCSTR GetInfoClassName(FILE_INFORMATION_CLASS infoClass)
static NTSTATUS NtfsGetStandardInformation(PNTFS_FCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_STANDARD_INFORMATION StandardInfo, PULONG BufferLength)
static NTSTATUS NtfsGetNetworkOpenInformation(PNTFS_FCB Fcb, PDEVICE_EXTENSION DeviceExt, PFILE_NETWORK_OPEN_INFORMATION NetworkInfo, PULONG BufferLength)
static NTSTATUS NtfsGetInternalInformation(PNTFS_FCB Fcb, PFILE_INTERNAL_INFORMATION InternalInfo, PULONG BufferLength)
NTSTATUS NtfsSetInformation(PNTFS_IRP_CONTEXT IrpContext)
static NTSTATUS NtfsGetBasicInformation(PFILE_OBJECT FileObject, PNTFS_FCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_BASIC_INFORMATION BasicInfo, PULONG BufferLength)
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
#define STATUS_USER_MAPPED_FILE
#define FileStandardInformation
BOOLEAN NTAPI MmCanFileBeTruncated(_In_ PSECTION_OBJECT_POINTERS SectionObjectPointer, _In_opt_ PLARGE_INTEGER NewFileSize)
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
ULONGLONG DirectoryFileReferenceNumber
PDEVICE_OBJECT DeviceObject
FSRTL_COMMON_FCB_HEADER RFCB
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define RtlMoveMemory(Destination, Source, Length)
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
#define SL_CASE_SENSITIVE
_In_opt_ PLARGE_INTEGER NewFileSize