Fix uninitialized address freeing in case of error in MupGetProviderInformation(), InitializeProvider()
CID 1322227
CID 1322240
svn path=/trunk/; revision=68990
- Don't try to free an uninitialized pointer in VfatSetRenameInformation. CID 1250303
- Actually use the dynamically calculated HashTableSize. CID 1237119/1237120/1237121
svn path=/trunk/; revision=68986
With the newly introduced mechanism (in r68829), on attributes list loop, there shouldn't be any AttributeList attribute anymore.
So, don't attempt to dump them.
svn path=/trunk/; revision=68933
It seems that our disk.sys returns "unknown" media type when performing IOCTL_DISK_GET_DRIVE_GEOMETRY on an extended partition.
Not sure how Windows handles this (if any volunteer for a test :-)), in the meantime, forcibly sector size to 512B to allow NTFS driver opening volumes on extended partitions
svn path=/trunk/; revision=68835
Totally rewrite the way MFT records attributes are handled.
Up to now, we were having really similar loops, only looking at the resident part of the attribute list, not really caring about how the loop was going.
This was leading to some issues:
- In case the attribute we were looking for was stored in the non-resident part of the attribute list, we would miss it (excepted in the case of FindAttribute() which was properly browsing the whole attribute list).
- In the specific case of FindAttribute(), one would have been able to setup a broken MFT record with the resident attribute list pointing on the non resident attribute list which itself would point to the resident attribute list. In such case, the driver would loop forever caught on the loop, allocating tones of memory. It was possible to trigger this by user space, from a non-privileged user, just by browsing the right directory entry.
- In the case of the other loops (non FindAttribute()), another issue (other than missing attributes) was present, one would have been able to setup a broken MFT record with an attribute of null-length. This would have caused the driver to loop forever on the attribute list. This could be triggered from usermode too. And could be triggered by a non-privileged user.
This commit introduces a new set of functions for attributes browsing: FindFirstAttribute(), FindNextAttribute(), FindCloseAttribute(). It allows safely browsing attributes and handles broken cases. It also performs reading of the attribute list when present and makes sure there's only one read. This method should be the only one to use to browse the attributes.
The whole NTFS code base has been converted to use this newly set of functions. This really simplifies the implementation of FindAttribute(), and prevent unsafe code duplication.
CORE-10037 #resolve #comment Fixed with r68829
svn path=/trunk/; revision=68829
Properly set StreamNameLength (with the length of extra data we append).
This fixes truncated output from FindFirstStreamW/FindNextStreamW
svn path=/trunk/; revision=68822
VfatWrite (but not VfatRead) is supposed to return STATUS_INVALID_USER_BUFFER
if an error occurred while locking the buffer.
[KERNEL32]
Reading 0 bytes using ReadFile doesn't always succeed on Windows.
svn path=/trunk/; revision=68620
In CcCopyData, Buffer can be NULL during read/write operations.
[FASTFAT]
Use SEH to catch exceptions thrown by MmProbeAndLockPages.
Lock the user buffer before changing the file allocation size.
svn path=/trunk/; revision=68619
Irp->UserBuffer being NULL doesn't indicate any error. It could be that the
caller really wants the result stored at address NULL (which can be valid,
and is valid by default for programs like NTVDM).
svn path=/trunk/; revision=68607
Remove broken check. Broken cases are already handled by upper if case.
This fixes the regression that leaded some valid ISOs not to be read anymore by ReactOS
CORE-9254
svn path=/trunk/; revision=68595
Continue streams integration:
- NtfsGetFileSize() will now return the file size depending on the open data stream
- NtfsGetFileSize() will also optionally return allocated size
- In NtfsMakeFCBFromDirEntry(), when initializing FSRTL_COMMON_FCB_HEADER entry, use data stream sizes
svn path=/trunk/; revision=68348
Fix user buffer handling for FSCTL_GET_NTFS_VOLUME_DATA. It fixes NTFSInfo.
We're just lacking a few information in the output data now
CORE-8725
svn path=/trunk/; revision=68327
Validate the stream we're trying to open properly exists.
This check might have to be moved later on when the driver switches to RW
svn path=/trunk/; revision=68309
Always gather the size of the unnamed stream for directory display.
This fixes file size display when there are several data streams available
svn path=/trunk/; revision=68308
Implement support for NTFS $DATA streams:
- The driver is now able to read various streams for a same file, using the same syntax as Windows.
- This fixes to read (in general) files with multiple streams where reading unnamed stream was leading to read beyond file end
- Also fix reading small files which are smaller than a sector
For demo, see: http://www.heisspiter.net/~Pierre/rostests/NTFS_Streams.png
svn path=/trunk/; revision=68302
While handling IRP_MN_QUERY_DIRECTORY, in case there is no $FILE_NAME attribute, dump file attributes & MFT ID.
This fixes ASSERT failure when browsing some Win7 volumes
svn path=/trunk/; revision=68290
Don't attempt to open the unnamed stream from $DATA attribute on file lookup. It was unused & leaking.
It fixes opening files that don't have unnamed stream (even though we cannot read there contents yet as we only support unnamed stream)
svn path=/trunk/; revision=68285
Don't attempt to read the unnamed stream of the $DATA attribute of each file matching:
- We don't need such attribute later on
- In case there's no such unammed stream, finding the file fails, whereas the file really exist
This fixes (at least here) browsing Win7 NTFS system drives, where our driver was always failing on pagefile.sys
svn path=/trunk/; revision=68268
In case of directory enumeration, validate the record earlier to really prevent any potentiel buffer overflow
CORE-9254
svn path=/trunk/; revision=68244
Revamp r68233:
- Don't duplicate code, implement checks in a helper function
- When checking name content, do it earlier for better performances
- Add extra checks to prevent a potential buffer overflow in case of Joliet names with illformed entries
CORE-9254
svn path=/trunk/; revision=68239
Add a few sanity checks to our handling of ISO 9660 / Joliet:
- Null name entries are forbidden
- Degenerated entries (mistmaching sizes) reveal broken layout
In both cases, the lookup for a file is aborted and the CD considered as corrupted by the FSD.
explorer displays empty CDs then.
CORE-9254 #resolve #comment Fixed with r68233
svn path=/trunk/; revision=68233
- Set the correct length in FsdGetFsVolumeInformation/FsdGetFsAttributeInformation, and write back partial data when returning STATUS_BUFFER_OVERFLOW
- Replace unnecessary checks with ASSERTs
CORE-9820 #resolve
svn path=/trunk/; revision=68175
Fix compilation for AMD64 and ARM.
- It's no good idea to use the x86 ASM optimizations on any architecture. Luckily Alter made plain C++ ones for that case, too. Thus modify the #ifdefs a bit to use em.
- Fix a few directly used functions instead of the defined architecture fixed ones of em.
- After some discussion with Thomas Faber the ULONG vs UINT32 problems were resolved by using the same platform defines for all three architectures.
BUILDS? yes WORKS? Trololololo ^^
svn path=/trunk/; revision=68144
- Move the fastio code to a separate file.
- Add Pierres IRP-Queue code and use it for IRP_MJ_QUERY_VOLUME_INFORMATION, IRP_MJ_SET_VOLUME_INFORMATION, IRP_MJ_QUERY_INFORMATION, IRP_MJ_SET_INFORMATION, IRP_MJ_DEVICE_CONTROL and IRP_MJ_FILE_SYSTEM_CONTROL requests.
svn path=/trunk/; revision=67988
Directly implement NtfsOpenFileById() for special files from the MFT where we cannot moonwalk there path.
It concerns any file with ID < 0x10.
This function can only cope with file which ID is < 0xc. Windows Internals reports that 0xc - 0xf entries are unused.
It would be interesting to double check returrned status in case of error, and also what Windows returns when attempting weird opening of suchs entries (overwrite, create for unused, etc).
svn path=/trunk/; revision=67983
- Don't attempt to moon walk path name for reserved MFT entries.
- Don't attempt to dereference file name if it doesn't exist
svn path=/trunk/; revision=67918
- Add a debugging assert that will save your lot of time if you attempt to manually queue a wrong IRP. You cannot queue an IRP which is set to be later queued again. This is a broken behavior.
- Remove a bit of code duplication
svn path=/trunk/; revision=67880
- Only free the IRP context in case the request is not to be queued
- Stubplement request queueing support in NtfsDispatch()
svn path=/trunk/; revision=67877
Split NtfsFsdDispatch() in two.
Now, NtfsFsdDispatch() will only take care of allocating the IRP context and complete the IRP in case it failed (that fixes a null-pointer dereference, just for the record).
NtfsDispatch() will really dispatch the IRP to the internal functions. So that it can be called either directly from NtfsFsdDispatch() or by a queued IRP (to be implemented).
svn path=/trunk/; revision=67875
Implement support for FastIO for:
- FastIoQueryBasicInfo
- FastIoQueryStandardInfo
Now, with this commit and the two previous, ReactOS won't attempt to issue an IRP for these query, but will directly go with the FastIO path.
The performance improvement is really visible in 1st stage (at least, here with VBox).
svn path=/trunk/; revision=67824
Fix a fixme in VfatGetUserBuffer():
Only request high priority page when in the paging path. Otherwise, request normal priority
svn path=/trunk/; revision=67808