Commit graph

450 commits

Author SHA1 Message Date
Pierre Schweitzer 1986049a38
[CDFS_NEW] Sync with HEAD.
CORE-14315
2018-02-25 10:14:27 +01:00
Vadim Galyant 62612a7e45 [USBPORT] Use USB2_HS_INTERRUPT_IN_OVERHEAD instead USB2_HS_ISOCHRONOUS_OUT_OVERHEAD. 2018-02-21 13:35:25 +09:00
Pierre Schweitzer 69f51d1533
[FASTFAT] Drop read ahead locking routines in favor of lazy writer routines.
This avoids code duplication while being consistent with MS FastFAT.
2018-02-17 13:49:15 +01:00
Doug Lyons 8ea42001d9
[I8042PRT] Apply a workaround for Dell Latitude D610
CORE-14324
2018-02-15 22:49:39 +01:00
Pierre Schweitzer a5e89014dc
[CDFS_NEW] Fix a bug in Microsoft CDFS implementation where the top level IRP
is set before locking is actually attempted for Cc worker thread (lazy write/read ahead).
So in case locking fails, the top level IRP is set and never unset, and latter
call will hit the assert where it expects the top level IRP to be NULL.

Should be reported upstream (tm).

CORE-14315
2018-02-12 20:47:32 +01:00
Vadim Galyant 11772da783 [USBPORT] Small changes for debugging. 2018-01-26 20:46:34 +09:00
Vadim Galyant f37a3dc42f [USBPORT] Add USB2_BIT_STUFFING_OVERHEAD constant. 2018-01-22 14:15:57 +09:00
Vadim Galyant 797ebcab72 [USBPORT] Fixing use DeviceSpeed instead Direction. 2018-01-21 19:36:01 +01:00
Vadim Galyant a4dee8e3ac [USBPORT] Add a space in indentation. 2018-01-21 19:36:00 +01:00
Vadim Galyant ecd0097e37 [USBPORT] Delete DPRINTs. 2018-01-21 19:36:00 +01:00
Vadim Galyant 0f8079df3a [USBPORT] Add USB2_PREV_MICROFRAME constant. 2018-01-21 19:35:59 +01:00
Vadim Galyant fd5beb5593 [USBPORT] Moving array CMASKS[] to start file. 2018-01-21 19:35:59 +01:00
Vadim Galyant 2c73523b76 [USBPORT] Removing optional braces. 2018-01-21 19:35:59 +01:00
Vadim Galyant c86210e800 [USBPORT] Correcting check Period. 2018-01-21 19:35:58 +01:00
Vadim Galyant dd1297f0d0 [USBPORT] Use min(), max() macro. 2018-01-21 19:35:58 +01:00
Vadim Galyant ab88f25048 [USBPORT] Check Period instead Factor. 2018-01-21 19:35:58 +01:00
Vadim Galyant 954cc021da [USBPORT] Proper naming. 2018-01-21 19:35:57 +01:00
Vadim Galyant 18f4fc71c8 [USBPORT] Use min() macro. 2018-01-21 19:35:57 +01:00
Vadim Galyant 9426d2986d [USBPORT] Fixing calculation pointer for FdoExtension->Usb2Extension. 2018-01-21 19:35:56 +01:00
Vadim Galyant 7b92b8a6e2 [USBPORT] Implement USBPORT_FreeBandwidthUSB2(). 2018-01-21 19:35:56 +01:00
Vadim Galyant 57f092106a [USBPORT] Correcting USB2_DeallocateEndpointBudget(). 2018-01-21 19:35:56 +01:00
Vadim Galyant bc9046c635 [USBPORT] Implement USB2_PromotePeriods(). 2018-01-21 19:35:55 +01:00
Vadim Galyant 0558635f98 [USBPORT] Add USB2_ChangePeriod(). 2018-01-21 19:35:55 +01:00
Vadim Galyant 69406c2628 [USBPORT] Implement USB2_DeallocateEndpointBudget(). 2018-01-21 19:35:54 +01:00
Vadim Galyant 5ad7a2faa5 [USBPORT] Implement USB2_RebalanceEndpoint(). 2018-01-21 19:35:54 +01:00
Vadim Galyant 522c0d3c69 [USBPORT] Implement USB2_Rebalance(). 2018-01-21 19:35:54 +01:00
Vadim Galyant 5d12e3040c [USBPORT] Add stub for USB2_RebalanceEndpoint(). 2018-01-21 19:35:53 +01:00
Vadim Galyant bbbcb1dc75 [USBPORT] Rename variables only in USB2_AllocateTimeForEndpoint(). 2018-01-21 19:35:53 +01:00
Vadim Galyant 3ba9fffbb2 [USBPORT] Start implementation USB2_DeallocateEndpointBudget(). 2018-01-21 19:35:53 +01:00
Vadim Galyant 3031695100 [USBPORT] Add USB2_CommonFrames(). 2018-01-21 19:35:52 +01:00
Vadim Galyant ae800da85b [USBPORT] Implement USB2_MoveTtEndpoint(). 2018-01-21 19:35:52 +01:00
Vadim Galyant c48093573b [USBPORT] Implement USB2_DeallocateHS(). 2018-01-21 19:35:51 +01:00
Vadim Galyant 00dd0c67b6 [USBPORT] Correcting USB2_AllocateHS(). 2018-01-21 19:35:51 +01:00
Vadim Galyant 1926238056 [USBPORT] Reduces output of debug messages. 2018-01-21 19:35:51 +01:00
Vadim Galyant 5ffefbe945 [USBPORT] Add USB2_GetCMASK(). 2018-01-21 19:35:50 +01:00
Vadim Galyant f3c869a16b [USBPORT] Add USB2_GetSMASK()and USB2_ConvertFrame(). 2018-01-21 19:35:50 +01:00
Vadim Galyant df44bc6d84 [USBPORT] Add stub for USB2_MoveTtEndpoint(). 2018-01-21 19:35:50 +01:00
Vadim Galyant ab5810576f [USBPORT] Add stub for USB2_DeallocateHS(). 2018-01-21 19:35:49 +01:00
Vadim Galyant 8b9d5d1514 [USBPORT] Correcting USB2_InitTtEndpoint(). 2018-01-21 19:35:49 +01:00
Vadim Galyant e262bb610d [USBPORT] End implementation USB2_AllocateTimeForEndpoint(). 2018-01-21 19:35:49 +01:00
Vadim Galyant 2be475db5d [USBPORT] Correcting USB2_GetStartTime(). 2018-01-21 19:35:48 +01:00
Vadim Galyant 7553e54199 [USBPORT] Start implementation USB2_AllocateTimeForEndpoint(). 2018-01-21 19:35:48 +01:00
Vadim Galyant 65f8f961a3 [USBPORT] Continue implementation USBPORT_AllocateBandwidthUSB2(). 2018-01-21 19:35:47 +01:00
Vadim Galyant 67138e7d54 [USBPORT] Use ExFreePoolWithTag() instead ExFreePool() for TtExtension. Add debug info. 2018-01-21 19:35:47 +01:00
Vadim Galyant 3bda39fcb8 [USBPORT] Add USBPORT_DumpingEndpointProperties() and USBPORT_DumpingTtEndpoint(). 2018-01-21 19:35:47 +01:00
Vadim Galyant 698f092ab1 [USBPORT] Implement USB2_AllocateHS(). 2018-01-21 19:35:46 +01:00
Vadim Galyant 720d7cfd9b [USBPORT] Add USB2_GetHsOverhead(). 2018-01-21 19:35:46 +01:00
Vadim Galyant 2d4bd7b744 [USBPORT] Reduces output of debug messages. 2018-01-21 19:35:46 +01:00
Vadim Galyant 816b3a572c [USBPORT] Remove unnecessary semicolon. 2018-01-21 19:35:45 +01:00
Vadim Galyant 5654674e8c [USBPORT] Add stubs for USB2_AllocateHS() and USB2_DeallocateEndpointBudget(). 2018-01-21 19:35:45 +01:00
Vadim Galyant e39b88e3e7 [USBPORT] Add USB2_GetPrevMicroFrame(). 2018-01-21 19:35:45 +01:00
Vadim Galyant 71a7208f69 [USBPORT] Add USB2_IncMicroFrame(). 2018-01-21 19:35:44 +01:00
Vadim Galyant 22b8777f84 [USBPORT] Add USB2_GetStartTime(). 2018-01-21 19:35:44 +01:00
Vadim Galyant 0216b033cc [USBPORT] Add USB2_GetLastIsoTime(). 2018-01-21 19:35:44 +01:00
Vadim Galyant c3803bed8a [USBPORT] Add USB2_CheckTtEndpointInsert(). 2018-01-21 19:35:43 +01:00
Vadim Galyant e701da4923 [USBPORT] Add USB2_AllocateCheck(). 2018-01-21 19:35:43 +01:00
Vadim Galyant c034297f2d [USBPORT] Add USB2_AddDataBitStuff(). 2018-01-21 19:35:43 +01:00
Vadim Galyant 754f749cfd [USBPORT] Add USB2_GetOverhead(). 2018-01-21 19:35:42 +01:00
Vadim Galyant c2ae849dab [USBPORT] Start implementation USBPORT_AllocateBandwidthUSB2(). 2018-01-21 19:35:42 +01:00
Vadim Galyant 02d1cfd37f [USBPORT] Change debug message in USBPORT_RemoveDevice((). 2018-01-21 19:35:41 +01:00
Vadim Galyant 5e15ba48b9 [USBPORT] Add support for transaction translators in USBPORT_RemoveDevice(). 2018-01-21 19:35:41 +01:00
Vadim Galyant cbba6e80fc [USBPORT] Correcting USBPORT_InitializeDevice() and USBPORT_RestoreDevice() (DEVICE_HANDLE_FLAG_USB2HUB). 2018-01-21 19:35:41 +01:00
Vadim Galyant 664e48cad5 [USBPORT] Implement USBPORT_FreeBandwidth(). 2018-01-21 19:35:40 +01:00
Vadim Galyant aae6dd6073 [USBPORT] Implement USBPORT_AllocateBandwidth(). 2018-01-21 19:35:40 +01:00
Vadim Galyant c6ca2a8f02 [USBPORT] Add support for transaction translators in USBPORT_OpenPipe() and USBPORT_ClosePipe(). 2018-01-21 19:35:40 +01:00
Vadim Galyant 7c398f6eb7 [USBPORT] Initialize FdoExtension->Bandwidth[] in USBPORT_StartDevice(). 2018-01-21 19:35:39 +01:00
Vadim Galyant 0f8425ed44 [USBPORT] Add USBPORT_GetTt(). 2018-01-21 19:35:39 +01:00
Vadim Galyant c92f591144 [USBPORT] Add support for transaction translators in USBPORT_CreateDevice(). 2018-01-21 19:35:39 +01:00
Vadim Galyant 3fcbd7744c [USBPORT] Add support for transaction translators in USBPORT_OpenPipe(). 2018-01-21 19:35:38 +01:00
Vadim Galyant e48d6136ec [USBPORT] Add USBPORT_UpdateAllocatedBwTt(). 2018-01-21 19:35:38 +01:00
Vadim Galyant 18702047a1 [USBPORT] Implement USBPORT_InitializeTT(). 2018-01-21 19:35:38 +01:00
Vadim Galyant da1e283837 [USBPORT] Add USB2_InitTtEndpoint(). 2018-01-21 19:35:37 +01:00
Vadim Galyant 9cdc1d64b3 [USBPORT] Add USB2_InitTT(). 2018-01-21 19:35:37 +01:00
Vadim Galyant 0f2f4c6ca2 [USBPORT] Add USB2_InitController(). 2018-01-21 19:35:37 +01:00
Vadim Galyant faa792987b [USBPORT] Add initial support for transaction translators in USBPORT_AddDevice(). 2018-01-21 19:35:36 +01:00
Vadim Galyant 0b78ad8eb2 [USBPORT] Use constants in USBPORT_OpenPipe(). 2018-01-21 19:35:36 +01:00
Vadim Galyant d2b088e9d6 [USBPORT] Define structures for Transaction Translator. 2018-01-21 19:35:36 +01:00
Vadim Galyant a3dd5620d3 [USBPORT] Use constants in USBPORT_CalculateUsbBandwidth(). 2018-01-21 19:35:35 +01:00
Vadim Galyant 41f4814c44 [USBPORT] Define constants for Transaction Translator. 2018-01-21 19:35:35 +01:00
Amine Khaldi bb888f9b11 [CMAKE] My eyes! 2018-01-21 13:54:18 +01:00
Amine Khaldi 94e0942644 [USBSTOR_NEW] Create usbstor_new based on usbstor in order to contain Vadim Galyant's work. 2018-01-21 13:51:07 +01:00
Ged Murphy 37a39f1843 Formatting, no code change 2018-01-20 18:22:44 +00:00
Amine Khaldi f2f2dd0552 [USBOHCI_NEW] Bring-in the USB OHCI miniport driver created by Vadim Galyant. (#244)
[USBOHCI_NEW] Add the new usbport-based OHCI driver.
2018-01-12 21:09:58 +01:00
Vadim Galyant a0296dd3de
[USBPORT] In USBHI_GetExtendedHubInformation, pass the correct port index to RH_GetPortStatus. 2018-01-10 18:59:25 +01:00
Vadim Galyant c0f157e589
[USBHUB] Move DPRINT after check Status. 2018-01-10 18:59:23 +01:00
Vadim Galyant 86af8d49fb
[USBHUB] Correcting L"USB\\Vid_0000&Pid_0000" for case BusQueryDeviceID in USBH_PdoQueryId() if INIT_PORT_FAILED. 2018-01-10 18:59:21 +01:00
Thomas Faber f54fb980ba
[TCPIP] Fix buffer sizes in ReadIpConfiguration. 2018-01-10 11:25:05 +01:00
Thomas Faber d87786bf6c
[TCPIP] Check for allocation failures in ReadIpConfiguration. CID 1411924 2018-01-10 11:25:03 +01:00
Serge Gautherie d6fab4158e [FASTFAT] Improve code style in addition to 8294118174. 2018-01-07 19:29:23 +01:00
Pierre Schweitzer f0a1a5c773
[FASTFAT] Notify on file size change in FileAllocationInformation/FileEndOfFileInformation 2018-01-07 15:29:33 +01:00
Pierre Schweitzer 8294118174
[FASTFAT] Add a wrapper around FsRtlNotifyFullReportChange 2018-01-07 14:16:31 +01:00
Pierre Schweitzer 2a36b632ef
[FASTFAT] When a file gets overwritten, notify about the changes 2018-01-07 11:44:25 +01:00
Pierre Schweitzer ffeb3f070b
[FASTFAT] When overwriting a file, also update its write time 2018-01-07 11:34:41 +01:00
Pierre Schweitzer 0eacb0b1ef
[FASTFAT] When dealing with attributes on IRP_MJ_CREATE, filter user input to ensure we have only attributes we can handle.
This applies to files newly created, or for files overwritten where attributes are reset/modified.
2018-01-06 22:02:10 +01:00
Pierre Schweitzer 7bea4ec07e
[NTFS] Apply fix from 52f0726: allow partial info copy on dir enumeration on first entry return.
This is assorted with misc fixes to make this code closer to what we currently have in FastFAT.
This also allows fixing a memory leak in case of single entry return.

CORE-13367
2018-01-06 21:39:25 +01:00
Pierre Schweitzer 48382d1448
[FLTMGR] Properly allocate CCB in CreatePortCCB()
CID 1427031
2018-01-06 13:54:21 +01:00
Pierre Schweitzer 2b4d5c5cff
[FASTFAT] When overwriting a file with FILE_OVERWRITE*, don't erase previous file attributes, only update them.
Keep erasing them in case the file gets overwritten with FILE_SUPERSEDE.

CORE-14158
2018-01-01 14:29:15 +01:00
Pierre Schweitzer f3fecf92c1
[FASTFAT] On file overwrite, deny it if file as HIDDEN/SYSTEM flag and caller doesn't set them.
CORE-14158
2018-01-01 12:13:46 +01:00
Timo Kreuzer a2f7de7ee8
Amd64/misc 64bit fixes (#236)
[REACTOS] Misc 64 bit fixes

* [NTOS:MM] Allow MEM_DOS_LIM in NtMapViewOfSection on x64 as well
* [NTOS:MM] Implement x64 version of MmIsDisabledPage
* [HAL] Remove obsolete code
* [NTOS:KE] Fix amd64 version of KeContextToTrapFrame and KeTrapFrameToContext
* [XDK] Fix CONTEXT_XSTATE definition
* [PCNET] Convert physical address types from pointers to PHYSICAL_ADDRESS
2018-01-01 12:07:50 +01:00
Pierre Schweitzer d2a5322576
[NTFS] Start using different tags for allocations.
They all be Ntf? as for the Windows NTFS driver
2017-12-31 23:11:57 +01:00
Pierre Schweitzer 2d3d74151b
[NTFS] Fix a memory leak on error
CID 1427053
2017-12-31 14:18:02 +01:00
Pierre Schweitzer 216a2cae73
[NTFS] Use LookasideList allocations for FILE_RECORD_HEADER.
TODO: use a specific tag

This, and previous commit, should speed up a bit the driver until caching gets implemented
2017-12-31 14:14:24 +01:00
Pierre Schweitzer 3ddf44ff10
[NTFS] Use LookasideList allocations for NTFS_ATTR_CONTEXT.
TODO: use a specific tag
2017-12-31 12:15:17 +01:00
Pierre Schweitzer 849fa7fbae
[NTFS] Rewrite ReleaseAttributeContext() so that its null checks are consistent
CID 1427067
2017-12-31 10:38:58 +01:00
Pierre Schweitzer 007d3d382a
[NTFS] Don't dereference NULL IRP
CID 1427057
2017-12-31 10:38:58 +01:00
Pierre Schweitzer 7a88e3bfd4
[NTFS] Don't leak memory in case of failure while creating a directory
CID 1427065
2017-12-31 10:38:58 +01:00
Pierre Schweitzer 9d9cce2838
[NTFS] Don't leak attributes contextes in the btree management functions
CID 1427030, 1427062
2017-12-31 10:38:58 +01:00
Pierre Schweitzer 391056ba22
[NTFS] Don't leak memory when reading or writing non-resident attributes
CID 1427048, 1427070
2017-12-31 10:38:58 +01:00
Thomas Faber 4f8379a02b
[DRIVERS] Use KeClearEvent instead of KeResetEvent where the previous state is not needed. 2017-12-30 11:44:25 +01:00
Amine Khaldi a76fdbd8cb [UNIATA] Update to v0.46e5. CORE-14117 2017-12-25 14:18:21 +01:00
Pierre Schweitzer 453e42beb5
[FASTFAT] Revert bd1e7bf: our VPB swapout implementation in FastFAT is buggy and
leaves volumes in half-(dis)mounted state and thus they get remounted while not
completely dismounted.
This can lead to major breakage and data corruption.
This requires deeper fixes (let's just drop that driver!).

CORE-14124
CORE-14126
CORE-14133
2017-12-25 11:24:13 +01:00
Pierre Schweitzer b9b461bde9
[DISK] Properly implement querying partition information for partition 0.
In spite of what was implemented in our NT DDK sample, this is a legit operation.

This may have been turned legit starting NT5 (reminder, our implementation is
NT4 based...). So, in this situation, just return the information about the whole
disk (and not a random size) and also, mark everything with default values.

See disk_new for an example of how it works in NT5+.

CORE-14124
2017-12-24 21:58:47 +01:00
Ivan Labutin 925f1a67ea [SAC] Fix wrong sized variable in SAC driver 2017-12-20 06:56:09 +01:00
Pierre Schweitzer 5a650f6ba5
[FS] During 1st stage, disable any FS we don't support install to in order to let RawFS these volumes.
This avoids bloated setup and avoids potential bugs in 3rd party drivers.

This is following 806cd1.
2017-12-18 08:46:24 +01:00
Pierre Schweitzer bd1e7bf85e
[FASFAT] Enable FAT volume dismount using VPB swapout 2017-12-17 23:29:33 +01:00
Pierre Schweitzer 806cd16328
[SETUP] Remove FSDs which have broken dismount implementation.
This avoids issues when these partitions are formatted to FAT for setup.

For now, this commit doesn't change anything, but once IopParseDevice hack
gets removed, this will make a difference!

CORE-6305
2017-12-17 23:16:01 +01:00
Pierre Schweitzer dcd95c1a85
[FASTFAT] Add a comment (and an ASSERT) in VfatCreateFile() that shows that my stats code is broken... 2017-12-17 18:25:43 +01:00
Pierre Schweitzer 64bc96558e
[FASTFAT] While closing FCBs on dismount, release from tail to head and not the contrary.
It fixes assertion failure in vfatDestroyFCB() where we would have release parent before child.
This is still not perfect, but less bug prone...

With this commits (and ENABLE_SWAPOUT defined), ReactOS seems to unmount FAT volumes quite nice! :-)
(Tried with fsutil volume dismount X:)
2017-12-17 18:24:01 +01:00
Pierre Schweitzer de03686148
[FASTFAT] Fix a handle count leak on volume close. This can prevent locking a volume! 2017-12-17 18:24:01 +01:00
Pierre Schweitzer 27773dbb3f
[FASTFAT] When not able to lock a volume due to open handles, print open handles 2017-12-17 18:24:01 +01:00
Jason Wendt 0fdb5d9b63 [SWENUM] Add version information. CORE-14112
Improves setup of DirectX 9.0b 4.09.00.0902 (which the game Halo wants
to install) after manually lowering DirectX version in registry.
2017-12-17 02:22:28 +01:00
Thomas Faber 03be7587eb
Merge branch 'ntfs_rebase' 2017-12-10 12:46:33 +01:00
Pierre Schweitzer b5555650a8
[NTFS] Fix the FileNamesInformation/FileNameInformation class confusion that was spotted on FastFAT.
What should also be fixed is the partial return of data on first entry enumeration.
2017-12-10 11:25:48 +01:00
Trevor Thompson 1ac7128da0 [NTFS] - Respect NTFS' file ordering when enumerating a directory. Split off part of BrowseIndexEntries() into a separate function to simplify the code.
AddNewMftEntry() - Zero the (larger) buffer for the bitmap prior to reading the bitmap.
BrowseIndexEntries() - Check sub-nodes before checking an index entry. Read and use the index bitmap when checking sub-nodes.
+BrowseSubNodeIndexEntries() - Called for sub-nodes of an index when browsing index entries.
+NtfsDumpData() - Diagnostic function which allows for visualizing a series of bytes.

svn path=/branches/GSoC_2016/NTFS/; revision=75817
2017-12-10 11:15:26 +01:00
Trevor Thompson a40ba448d4 [NTFS] - Fix some errors that break building in C89 mode, and remove an extraneous "ninja livecd" that got inserted in a comment. Thanks to Doug Lyons for spotting these errors.
SplitBTree() - comment-out redundant code for finding the median key and improve comments.

svn path=/branches/GSoC_2016/NTFS/; revision=75727
2017-12-10 11:15:25 +01:00
Trevor Thompson 52c30fdf37 [NTFS] - Add some helper functions for new features. Add some fixes. Add support for creating an index allocation, splitting a b-tree node, or "demoting" the index root. This allows for file creation without functional limitations.
+AddBitmap() - adds a $BITMAP attribute to a file record.
+AddIndexAllocation() - adds an $INDEX_ALLOCATION attribute to a file record.
+CountBTreeKeys() - Counts the number of linked B-Tree keys.
CreateIndexBufferFromBTreeNode() - Set INDEX_NODE_LARGE if the node has sub-nodes.
CreateIndexRootFromBTree() - Simplify the usage and math of MaxIndexSize; make it only account for the cumulative size of the index entries.
+DemoteBTreeRoot() - Replaces the contents of an index root with a dummy key, and puts those contents in a new node, which is made a child of the dummy key. This is done when an index root grows too large.
+GetIndexEntryVCN() - Retrieves the VCN from an index entry.
NtfsAddFilenameToDirectory() - Fix math for MaxIndexRootSize.
NtfsInsertKey() - Add support for splitting a B-Tree node. Don't check size of index root (that will be handled later).
+SplitBTreeNode() - Called when a B-Tree node grows too large.
UpdateIndexAllocation() - Create an $I30 index allocation attribute and bitmap attribute if needed.
UpdateIndexNode() - Update children before updating the current node. Store VCN of child nodes in the index entries of their respective keys.

svn path=/branches/GSoC_2016/NTFS/; revision=75707
2017-12-10 11:15:23 +01:00
Trevor Thompson 5e7c11842a [NTFS] - Fix increasing the mft size, to keep chkdsk happy.
IncreaseMftSize() - Add some fixes. Write blank records to newly-allocated mft entries, and update $MFTMirr when finished; these changes are needed for chkdsk.  Increase size by 64 records instead of 8.
+UpdateMftMirror() - Backs up the first ~4 master file table entries to the $MFTMirr file.

svn path=/branches/GSoC_2016/NTFS/; revision=75694
2017-12-10 11:15:21 +01:00
Trevor Thompson 9a91a51f17 [NTFS] - Fix for C89 compliance.
svn path=/branches/GSoC_2016/NTFS/; revision=75693
2017-12-10 11:15:19 +01:00
Trevor Thompson b033f00f58 [NTFS] - Add support for directory creation. Add some helper functions, some comments, and some fixes.
+AddIndexRoot() - Creates an $INDEX_ROOT attribute and adds it to a file record.
AddNewMftEntry() - Make sure the buffer used by RtlInitializeBitmap() is ULONG-aligned, and a ULONG-multiple in size, per MSDN.
AllocateIndexNode() - Calculate BytesNeeded correctly. Read $BITMAP attribute before increasing its length, in anticipation of a future commit that will check for a free bit before assigning a new index record to the end of the allocation. Use appropriate Set*AttributeDataLength() function, as $BITMAP can be resident or non-resident.
B_TREE_FILENAME_NODE - Give two members more accurate names: change "ExistsOnDisk" member to "HasValidVCN" and rename "NodeNumber" member "VCN."
+CreateEmptyBTree() - Creates a B-Tree to represent an empty directory (for AddIndexRoot).
+NtfsCreateEmptyFileRecord() - Creates an empty file record in memory, with no attributes.
CreateIndexRootFromBTree() - Fix TotalSizeOfEntries calculation.
+NtfsCreateDirectory() - Creates a file record for an empty directory and adds it to the mft.

svn path=/branches/GSoC_2016/NTFS/; revision=75692
2017-12-10 11:15:17 +01:00
Trevor Thompson c63e7e54b5 [NTFS] - When creating files:
-Don't add a preceding backslash when creating files on root.
-Use NTFS_FILE_NAME_POSIX name type if CaseSensitive option is specified.
-Don't try to create a file when a folder is requested (folder creation is still TODO).

svn path=/branches/GSoC_2016/NTFS/; revision=75671
2017-12-10 11:15:16 +01:00
Trevor Thompson 88a7c3d14b [NTFS] - Allow for creating a file when the index root gets too large and needs to be moved into an index record. Add some helper functions.
+AllocateIndexNode() - Allocates a new index record in an index allocation.
+CreateDummyKey() - Creates the final B_TREE_KEY for a B_TREE_FILENAME_NODE. Also creates the associated index entry.
GetSizeOfIndexEntries() - Sums the size of each index entry in every key in a B-Tree node.
+SetIndexEntryVCN() - Sets the VCN of a given IndexEntry.
NtfsInsertKey() - Handle instance when the index root grows too large. If it does, add its contents to a new sub-node, and replace contents with a dummy-key whose child is the new node.
UpdateIndexAllocation() - Update index entry if a key has just been assigned a child allocation.
UpdateIndexNode() - Make sure the node exists on disk, and allocate an index record for it if it doesn't.

svn path=/branches/GSoC_2016/NTFS/; revision=75557
2017-12-10 11:15:14 +01:00
Trevor Thompson d484d91eba [NTFS] - Allow for resizing an attribute in the middle of a file record. Add a helper function and minor improvements:
AddRun() - Allow for resizing the size of the data runs when the attribute isn't the last in the file record. Fix some comments.
CreateIndexBufferFromBTreeNode(), CreateIndexRootFromBTree - Fix math of IndexSize when checking if the index buffer is too large.
InternalSetResidentAttributeLength() - Allow changing the length of an attribute in the middle of a file record. Adjust the position of every attribute after the one being resized.
+MoveAttributes() - Moves a block of attributes to a new location in the file Record.
PrintAllVCNs() - Add consideration for an index allocation with a size of 0.
WriteAttribute() - Add optional parameter for a pointer to the file record being written to. If passed a file record, WriteAttribute() will skip reading the file record from disk, and will update the file record in memory before returning. This helps callers that use the file record after writing an attribute to stay in-sync with what's on disk.

svn path=/branches/GSoC_2016/NTFS/; revision=75554
2017-12-10 11:15:13 +01:00
Trevor Thompson 4dfcd1d582 [NTFS] - Refactor to allow the copy of the attribute stored in NTFS_ATTR_CONTEXT to have a dynamic length; change Record member from an NTFS_ATTR_RECORD to a PNTFS_ATTR_RECORD. Rename it pRecord to reinforce the change. Fix some bugs related to the record size changing.
-PrepareAttributeContext() - update to allocate memory for pRecord. Don't assume allocations are succeeding.
-ReleaseAttributeContext() - update to free memory for pRecord.
-InternalSetResidentAttributeLength() - Increase size of AttrContext->pRecord as needed. Update to return an NTSTATUS.
-SetResidentAttributeDataLength() - Fix bug that could occur when migrating resident attributes to non-resident if AttrContext->pRecord is too small for the new attribute.
-AddRun() - Fix a bug by reallocating AttrContext->pRecord if the record needs to be enlarged.

svn path=/branches/GSoC_2016/NTFS/; revision=75493
2017-12-10 11:15:11 +01:00
Trevor Thompson f2e47474f0 [NTFS] - Fix index entries storing the wrong allocated file size when the file is resident. Fix a typo in a DPRINT.
svn path=/branches/GSoC_2016/NTFS/; revision=75479
2017-12-10 11:15:09 +01:00
Trevor Thompson 92d1f92a61 [NTFS] - Add some improvements to B-Tree support. Add preliminary support for trees of arbitrary depth. Add support for creating files in directories which have an index allocation, provided there aren't too many files and the node doesn't need to be split.
-CreateBTreeFromIndex() - Fix memory allocation; allocate sizeof(B_TREE_KEY) bytes for the key, not the size of the pointer. Add support for child nodes. Update parameter list.
-CreateIndexRootFromBTree() - Update Header->Flags if any of index root's keys have sub-nodes.
+CreateIndexBufferFromBTreeNode() - Converts a B-Tree node to an index buffer to be written to the index allocation.
+UpdateIndexAllocation() - Updates all of the stale nodes in an index allocation based on a PB_TREE.
+UpdateIndexNode() - Writes a B-Tree node into the index allocation.
+CreateBTreeKeyFromFilename() - Creates a PB_TREE_KEY based on a FILENAME_ATTRIBUTE.
-DestroyBTreeKey() - Destroy a child node, if present.
-DumpBTreeKey() - Dump a child node, if present.
-DumpBTreeNode() - Include Node->KeyCount in output.
-NtfsAddFilenameToDirectory() - Call UpdateIndexAllocation() prior to CreateIndexRootFromBTree().
-Update B_TREE_FILENAME_NODE with members to keep track of its existence on disk.

svn path=/branches/GSoC_2016/NTFS/; revision=75428
2017-12-10 11:15:08 +01:00
Trevor Thompson b1eab36f6b [NTFS] - Add GetAllocationOffsetFromVCN() function, which was mistakenly left out of the last commit.
svn path=/branches/GSoC_2016/NTFS/; revision=75425
2017-12-10 11:15:06 +01:00
Trevor Thompson 5579428b4f [NTFS] - Add some utility functions and improve some comments. Improve NtfsAddFilenameToDirectory().
+PrintAllVCNs() - Diagnostic function which prints VCN of every node in an index allocation.
+GetAllocationOffsetFromVCN() - Calculates location of an index buffer from the node's VCN.
+GetInfoClassName() - Gets a string representation of an info class enumeration, to speed up development of unimplemented classes.
-NtfsSetInformation() & NtfsQueryInformation() - Use GetInfoClassName to report unhandled information classes.
-CompareTreeKeys() - Add a comment and clarify some comments.
-NtfsAddFilenameToDirectory() - Don't try to update the size of Index Root on disk if the attribute length hasn't changed.

svn path=/branches/GSoC_2016/NTFS/; revision=75424
2017-12-10 11:15:04 +01:00
Trevor Thompson 9cef425464 [NTFS] - After creating a new file, update creation disposition before calling NtfsCreateFile() recursively. This fixes creating a file via right-clicking in a folder.
svn path=/branches/GSoC_2016/NTFS/; revision=75423
2017-12-10 11:15:03 +01:00
Trevor Thompson 935fcd1b35 [NTFS] - Fix some more issues, including remaining issues marked as "unresolved" from CR-123:
-Add define for indexed flag for resident attributes, RA_INDEXED.
-CreateBTreeFromIndex() - Don't try to read index entries beyond attribute length.
-Move NtfsAddFileNameToDirectory() from dirctl.c to mft.c (no changes to function).
-SetResidentAttributeDataLength() - Don't try to free AttribData if it hasn't been allocated. Cast IndexRecord to PUCHAR for WriteAttribute(), and cast BitmapData to PCHAR for ReadAttribute() (make gcc happy).
-Replace magic number 16 with a define, NTFS_FILE_FIRST_USER_FILE.

svn path=/branches/GSoC_2016/NTFS/; revision=75371
2017-12-10 11:15:01 +01:00
Trevor Thompson 430ce0a9e3 [NTFS] - Fix some formatting / style issues, per CR-123.
svn path=/branches/GSoC_2016/NTFS/; revision=75290
2017-12-10 11:15:00 +01:00
Trevor Thompson 5ab24a5aae [NTFS] - Add a few fixes and improvements, most from CR-123:
-Add ATTR_RECORD_ALIGNMENT define to replace magic value of 8 when we need to adjust an attribute's beginning or length.
-Don't use int's.
-GetPackedByteCount() - Remove unused "bytes" variable.

svn path=/branches/GSoC_2016/NTFS/; revision=75288
2017-12-10 11:14:58 +01:00
Trevor Thompson 68a48b2758 [NTFS] - Add some fixes and improvements to mft.c from CR-123:
FindAttribute() - Use * sizeof(WCHAR) in place bit-shifting wizardry.
IncreaseMftSize() - Remove two useless casts. Return error code if WriteAttribute() fails.
SetNonResidentAttributeDataLength() - Assert that AttrContext parameter describes a NonResident attribute. When migrating a resident attribute to non-resident, don't leak memory if FsRtlInitializeLargeMcb() throws an exception, and don't mark the attribute as non-resident until after the Mcb is initialized.
InternalSetResidentAttributeLength() and SetResidentAttributeLength() - Assert that AttrContext parameter describes a resident attribute.
AddNewMftEntry() - Simplify math of backing up and restoring reserved bits by changing BitmapData to PUCHAR type. Don't attempt to modify a volume with more than 2^32 clusters.
AddFixupArray() - Use ULONG in place of int.

svn path=/branches/GSoC_2016/NTFS/; revision=75284
2017-12-10 11:14:56 +01:00
Trevor Thompson 34696e49fc [NTFS] - Add some fixes and improvements to finfo.c from CR-123:
NtfsSetEndOfFile() - Make fileNameAttribute and filename variables uppercase. Don't leak FileRecord if we can't truncate the file. Don't leak memory if there's no FileName attribute.

svn path=/branches/GSoC_2016/NTFS/; revision=75283
2017-12-10 11:14:55 +01:00
Trevor Thompson 39a06fae0d [NTFS] - Add some fixes and improvements to create.c, dirctl.c and fcb.c from CR-123:
-NtfsOpenFile() - Replace an ExFreePool() with ExFreePoolWithTag().
-NtfsCreateFile() - Fix broken cast with BooleanFlagOn() macro.
-NtfsAddFilenameToDirectory() - Remove an extra cast. Return an error if we fail to allocate I30IndexRoot. 
-NtfsGetNextPathElement(), NtfsWSubString(), NtfsGetFCBForFile() - Use PCWSTR in place of const PWCHAR or PWCHAR  where it makes sense.

svn path=/branches/GSoC_2016/NTFS/; revision=75281
2017-12-10 11:14:53 +01:00
Trevor Thompson 7e9acb7dda [NTFS] - Add some fixes and improvements to btree.c from CR-123:
-CompareTreeKeys() - Assert that the first key isn't the dummy key.
-CreateIndexRootFromBTree() - Assert that CurrentKey->IndexEntry->Length isn't 0.
-DumpBTreeKey() - Use sizeof(WCHAR) in place of magic 2.
-NtfsInsertKey() - Check for allocation failure of NewKey.

svn path=/branches/GSoC_2016/NTFS/; revision=75280
2017-12-10 11:14:51 +01:00
Trevor Thompson e5cc846555 [NTFS] - Add some fixes and improvements to attribute.c from CR-123:
-AddFileName() - Don't use dedicated buffer for FileNameNoPath, just point into FileObject->FileName's buffer. Don't use RtlCopyUnicodeString(), just update pointers.
-AddRun() - Fix an SEH2_YIELD with missing return statement.
-FreeClusters() - Use ULONG_MAX in place of 0xffffffff.
-NtfsDumpIndexRootAttribute() - Use consistent UpperCase naming convention. Use BooleanFlagOn() macro where appropriate. Replace magic 8 with sizeof(ULONGLONG).
-GetFileNameAttributeLength() - Add documentation.

svn path=/branches/GSoC_2016/NTFS/; revision=75279
2017-12-10 11:14:50 +01:00
Trevor Thompson f5b7f90f23 [NTFS] - Fix UpdateFileNameRecord() when the file being updated resides in $INDEX_ROOT. Also, don't attempt to read beyond size of index root attribute, and check return value after reading.
svn path=/branches/GSoC_2016/NTFS/; revision=75278
2017-12-10 11:14:48 +01:00
Trevor Thompson 612facc28f [NTFS] - Fix AddFileName() when the file path is two or more directories deep.
svn path=/branches/GSoC_2016/NTFS/; revision=75277
2017-12-10 11:14:47 +01:00
Trevor Thompson 16204ed3a7 [NTFS] - Fix gcc build. Fix CompareTreeKeys(): Don't consider Key1 a possible dummy key. Don't assume filenames are the same length.
svn path=/branches/GSoC_2016/NTFS/; revision=75228
2017-12-10 11:14:45 +01:00
Trevor Thompson 2dc4938549 [NTFS] - Fix a couple of issues spotted by Thomas: Maintain alphabetical ordering of CMakeLists.txt, fix casts to BOOLEAN with BooleanFlagOn macro.
svn path=/branches/GSoC_2016/NTFS/; revision=75224
2017-12-10 11:14:43 +01:00
Trevor Thompson 54f5c3b6ec [NTFS] - Begin to implement B-Trees. Allow for creating several new files in a directory.
NtfsAddFilenameToDirectory() - Add CaseSensitive parameter. Update to use new B-Tree code: First, the index is read and converted to a B-Tree in memory. Next, a key for the new file is inserted into the tree. Finally, the tree is converted back to an index root attribute which is written to disk.
+btree.c - Includes functions related to B-Trees (AKA B*Trees).
ntfs.h - Added several structures for representing B-Trees in memory.
Known limitations: For simplicity, only trees with a depth of one are currently supported (i.e. an ordered list of filenames). Directories that have or will require an index allocation to store all their filenames are still TODO. As a consequence, the user will only be able to create about 6 files in a directory.

svn path=/branches/GSoC_2016/NTFS/; revision=75223
2017-12-10 11:14:42 +01:00
Trevor Thompson 38c947b7ab [NTFS] - Add some minor fixes and improvements:
Improve, add, or fix some DPRINTs. In particular, ULONG's should use %lu, not %u. Also, don't be silent about filesystem corruption.
NtfsFindMftRecord() - move CaseSensitive parameter before output parameter in parameter list.

svn path=/branches/GSoC_2016/NTFS/; revision=75199
2017-12-10 11:14:40 +01:00
Trevor Thompson e4aab26781 [NTFS] - Fix creation of files with long filenames.
svn path=/branches/GSoC_2016/NTFS/; revision=75193
2017-12-10 11:14:39 +01:00
Trevor Thompson 8bb62e20d3 [NTFS] - In the NtfsAddFilenameToDirectory() function, rename DirectoryContext parameter to the more descriptive, and accurate, IndexRootContext (to simplify the next commit).
svn path=/branches/GSoC_2016/NTFS/; revision=75192
2017-12-10 11:14:37 +01:00
Trevor Thompson 948e91907a [NTFS] - Fix a mistake with AddFileName() from my last commit. Also, move CaseSensitive parameter before output parameters in the parameter list of several functions.
svn path=/branches/GSoC_2016/NTFS/; revision=75191
2017-12-10 11:14:35 +01:00
Trevor Thompson 032be02954 [NTFS] - Fix POSIX rules. Fix accessing long filenames created in Windows when 8dot3 name creation is disabled.
Whether or not a filename should be interpreted as case-sensitive is dependent on a flag passed to the driver when a file is created (opened); it's separate from the namespace associated with the file being accessed.

svn path=/branches/GSoC_2016/NTFS/; revision=75178
2017-12-10 11:14:34 +01:00
Trevor Thompson 98ddf610bc [NTFS] - Fix IncreaseMftSize(); check IrpContext to see if waiting for exclusive access to the MFT is allowed. As pointed out by Pierre.
svn path=/branches/GSoC_2016/NTFS/; revision=75170
2017-12-10 11:14:32 +01:00
Trevor Thompson 9ab86116a9 [NTFS] - Add support for expanding the master file table. Fix a bug with BrowseIndexEntries(). Improve diagnostic output.
-AddNewMftEntry() - Increase size of MFT as needed. Fix math for bitmap length. Don't assign file records to MFT indices 0x10 - 0x17; In Windows, these records aren't used unless they have to be, even though they are marked as unused in the bitmap.
+IncreaseMftSize() - Adds room for additional file records in the master file table.
-BrowseIndexEntries() - allow for the rare situation when a non-system file has an MFT index of 0x10.

svn path=/branches/GSoC_2016/NTFS/; revision=75056
2017-12-10 11:14:30 +01:00
Trevor Thompson 1417f286e0 [NTFS] - Restructure some code in preparation for the next commit:
-SetAttributeDataLength() has been split into two functions, SetNonResidentAttributeDataLength() and SetResidentAttributeDataLength(). This should improve code readibility and allows for resizing an attribute when there's no FileObject associated with it.
-Added "MftDataOffset" member to DEVICE_EXTENSION, which stores the offset of the Mft's $DATA attribute. (I'm starting to think it's better to add a member for offset to NTFS_ATTR_CONTEXT directly, but I'll save that level of restructuring for a future commit.)

svn path=/branches/GSoC_2016/NTFS/; revision=75055
2017-12-10 11:14:29 +01:00
Trevor Thompson 9dce6f4db1 [NTFS] - Add some improvements to the previous commit, as suggested by Thomas.
svn path=/branches/GSoC_2016/NTFS/; revision=75054
2017-12-10 11:14:27 +01:00
Trevor Thompson e0048b1362 [NTFS] - Add the most basic support for file creation. Expand diagnostic output, especially in NtfsDumpIndexRootAttribute(). Replace an ExFreePool() with ExFreePoolWithTag().
AddFileName() - Add a parameter to receive the Mft index of the parent directory. Fix so the name of the file will be stored in the attribute, not the name of the directory.
NtfsCreateFile() - Open a file that was successfully created, instead of assuming failure.
NtfsCreateFileRecord() - Add the filename attribute of the created file to the parent directory's index.
+NtfsAddFilenameToDirectory() - Adds a $FILE_NAME attribute to a given directory index. Presently, a file can be created in an empty directory only.
AddNewMftEntry() - Add a parameter to receive the mft index where the new entry was stored.

svn path=/branches/GSoC_2016/NTFS/; revision=74970
2017-12-10 11:14:26 +01:00
Trevor Thompson 4ca9151300 [NTFS] - Decrease debug spam
svn path=/branches/GSoC_2016/NTFS/; revision=74694
2017-12-10 11:14:24 +01:00
Trevor Thompson 037d88201d [NTFS] - Disable write support by default. Enable it via the registry.
[BOOTDATA] - Add a commented-out section to hivesys.inf which can add the required key to enable NTFS write support.

svn path=/branches/GSoC_2016/NTFS/; revision=74685
2017-12-10 11:14:22 +01:00
Trevor Thompson 7f762aac01 [NTFS] - Add support for changing a file's size via SetEndOfFile():
-Handle IRP_MJ_SET_INFORMATION IRP requests.
+NtfsSetEndOfFile() - Sets the end of file (file size) for a given file.
+NtfsSetInformation() - Sets the specified file information. At this point, only FileEndOfFileInformation is fully implemented. FileAllocationInformation is handled the same way and not truly implemented, but this works well enough for SetEndOfFile().
Overwriting a file in NTFS should now work in the majority of use cases.

svn path=/branches/GSoC_2016/NTFS/; revision=74675
2017-12-10 11:14:21 +01:00
Trevor Thompson 58402b6730 [NTFS] - Fix a bug with last commit, as spotted by Pierre.
svn path=/branches/GSoC_2016/NTFS/; revision=74525
2017-12-10 11:14:19 +01:00
Trevor Thompson c25b9747a1 [NTFS] - Expand support for resizing resident attributes and fix NtfsAllocateClusters().
-Modify SetAttributeDataLength() to allow a resident attribute to migrate to non-resident if the attribute grows too large to remain resident.
-Fix values returned by NtfsAllocateClusters() in case of error; return error codes, not 0.

svn path=/branches/GSoC_2016/NTFS/; revision=74524
2017-12-10 11:14:18 +01:00
Trevor Thompson 52b9f46776 [NTFS] - Commit early results of a small restructuring effort:
-Add a new member to the NTFS_ATTR_CONTEXT struct, a LARGE_MCB. This allows an attribute context to describe the cluster mapping of a non-resident file while allowing that mapping to change dynamically, without the context itself needing to be resized. This fixes problems which sometimes arose from resizing files.
-Remove hacky code from NtfsWriteFile() for dealing with "stale" contexts. This fixes that issue.
-Update SetDataAttributeLength(), PrepareAttributeContext(), ReleaseAttributeContext(), FreeClusters(), and AddRun() for the new member.
-Update ReadAttribute() and WriteAttribute() to work with the changed structure. A very-soon-to-come commit will overhaul these functions so they'll operate directly on the LARGE_MCB, instead of converting to and from a packed list of data runs. (Sparse files are broken until then.)
-Rename "RunBufferOffset" to "RunBufferSize" in several places where appropriate.
-Fix, improve, and add some comments.

svn path=/branches/GSoC_2016/NTFS/; revision=74523
2017-12-10 11:14:16 +01:00
Trevor Thompson 0409b3161e [NTFS] Add support for creating new MFT entries:
+AddStandardInformation(), +AddData(), +AddFileName() - Add attributes to a file record
+NtfsCreateFileRecord() - Creates a new file record and saves it to the MFT.
+AddNewMftEntry() - Adds a file record to the MFT.
NtfsCreateFile() - Modified to create a file record on a file-creation request (file creation is still unsupported; the created file needs to be added to the parent's directory index).
+SetFileRecordEnd() - Establishes a new file record size
UpdateFileRecord() - Improved documentation
InternalSetResidentAttributeLength() - Updated to use SetFileRecordEnd().

svn path=/branches/GSoC_2016/NTFS/; revision=74321
2017-12-10 11:14:14 +01:00
Trevor Thompson 7643831d56 [NTFS]
+NtfsDumpFileRecord() - Provides diagnostic information about a file record.

svn path=/branches/GSoC_2016/NTFS/; revision=72424
2017-12-10 11:14:13 +01:00
Trevor Thompson 6ab3072098 [NTFS]
*UpdateFileRecord() - Fix a DPRINT

svn path=/branches/GSoC_2016/NTFS/; revision=72423
2017-12-10 11:14:11 +01:00
Trevor Thompson 8b893c8e30 [NTFS]
Add some fixes to attrib.c, as suggested by Pierre Schweitzer:
*ConvertLargeMCBToDataRuns() - Use MS portable type, ULONG, for variable i.
*FreeClusters(), AddRun() - Check for invalid parameter before allocating memory, and confirm the memory is allocated.
*ConvertDataRunsToLargeMCB(), AddRun() - Avoid code duplication by using ExRaiseStatus() in try block, and return accurate status via _SEH2_GetExceptionCode().

svn path=/branches/GSoC_2016/NTFS/; revision=72422
2017-12-10 11:14:10 +01:00
Trevor Thompson 920e2f0216 [NTFS]
+FreeClusters(). Fix a DPRINT.

svn path=/branches/GSoC_2016/NTFS/; revision=71968
2017-12-10 11:14:08 +01:00
Trevor Thompson ed1b4bf9bc [NTFS]
Address some minor issues with attrib.c: Fix gcc build. Fix formatting.

svn path=/branches/GSoC_2016/NTFS/; revision=71957
2017-12-10 11:14:07 +01:00
Trevor Thompson d09e1398f8 [NTFS]
*AddRun() - Don't leak RunBuffer when encountering errors.
Handle exception from FsRtlAddLargeMcbEntry().

svn path=/branches/GSoC_2016/NTFS/; revision=71945
2017-12-10 11:14:05 +01:00
Trevor Thompson afe40eb054 [NTFS]
Implement AddRun(). Add support functions and documentation.
+ConvertDataRunsToLargeMCB()
+ConvertLargeMCBToDataRuns()
*SetAttributeDataLength(), *NtfsWriteFile() - Update for AddRun() implementation. Add hack to SetAttributeDataLength() to allow notepad.exe to save files until freeing clusters is implemented.

svn path=/branches/GSoC_2016/NTFS/; revision=71942
2017-12-10 11:14:03 +01:00
Trevor Thompson a135ef5864 [NTFS]
Various minor changes to fix GCC build.

svn path=/branches/GSoC_2016/NTFS/; revision=71922
2017-12-10 11:14:02 +01:00
Trevor Thompson 63e83c7ffc [NTFS]
Add support functions, fix warning from previous commit.
+NtfsDumpDataRuns(), +NtfsDumpDataRunData() - Provide diagnostic output.
+GetPackedByteCount() - Used to encode data runs.

svn path=/branches/GSoC_2016/NTFS/; revision=71921
2017-12-10 11:14:00 +01:00
Trevor Thompson 268a139e63 [NTFS]
UpdateFileRecord() - Remove fixup array before returning.

svn path=/branches/GSoC_2016/NTFS/; revision=71920
2017-12-10 11:13:58 +01:00
Trevor Thompson 7c576a836f [NTFS]
Add error-checking to InternalGetNextAttribute(); don't crash if CurrAttr->Length is invalid.

svn path=/branches/GSoC_2016/NTFS/; revision=71897
2017-12-10 11:13:57 +01:00
Trevor Thompson de5cff4b37 [NTFS]
Fix broken check for free disk space in NtfsAllocateClusters().

svn path=/branches/GSoC_2016/NTFS/; revision=71858
2017-12-10 11:13:55 +01:00
Trevor Thompson 7a6e9bcdf6 [NTFS]
Simplify GetLastClusterInDataRun() and clean up NtfsAllocateClusters(). No functional changes.

svn path=/branches/GSoC_2016/NTFS/; revision=71857
2017-12-10 11:13:54 +01:00
Trevor Thompson c08d37d182 [NTFS]
Simplify and optimize InternalSetResidentAttributeLength(), as suggested by Pierre.

svn path=/branches/GSoC_2016/NTFS/; revision=71837
2017-12-10 11:13:52 +01:00
Trevor Thompson 7eb1264f5f [NTFS]
Fix copy-paste error in SetAttributeDataLength()

svn path=/branches/GSoC_2016/NTFS/; revision=71832
2017-12-10 11:13:50 +01:00
Trevor Thompson 760cdfb5aa [NTFS]
Add ability to write to resident attributes.
SetAttributeDataLength() - Check if the file is memory mapped before truncating
+InternalSetResidentAttributeLength() - Used by SetAttributeDataLength()

svn path=/branches/GSoC_2016/NTFS/; revision=71820
2017-12-10 11:13:49 +01:00
Trevor Thompson 25fdabd8ca [NTFS]
Fix typo in NtfsAllocateClusters(), spotted by ThFabba.

svn path=/branches/GSoC_2016/NTFS/; revision=71697
2017-12-10 11:13:35 +01:00
Trevor Thompson 77fc65dc0e [NTFS]
Lay some groundwork for extending allocation size.
+AddRun() - Unimplemented
+GetLastClusterInDataRun()
+NtfsAllocateClusters()

svn path=/branches/GSoC_2016/NTFS/; revision=71696
2017-12-10 11:13:33 +01:00
Trevor Thompson 84a1280fd6 [NTFS]
Allow for an existing file to be opened with FILE_OVERWRITE, FILE_OVERWRITE_IF, or FILE_SUPERSEDE dispositions, and truncate that file. This allows for a file to be opened and saved in Notepad.exe [provided that file is non-resident and its allocation size doesn't need to change].

svn path=/branches/GSoC_2016/NTFS/; revision=71680
2017-12-10 11:13:31 +01:00
Trevor Thompson f47efca89f [NTFS]
Remove unused parameter from SetAttributeDataLength.

svn path=/branches/GSoC_2016/NTFS/; revision=71677
2017-12-10 11:13:30 +01:00
Trevor Thompson a7a2c0d734 [NTFS]
Update a file's size in the relevant $FILE_NAME attribute of the index entry in the parent directory.
+UpdateFileNameRecord() - Searches a parent directory for the proper index entry, then updates the file sizes in that entry.
+UpdateIndexEntryFileNameSize() - Recursively searches directory index and applies the size update.

svn path=/branches/GSoC_2016/NTFS/; revision=71664
2017-12-10 11:13:28 +01:00
Trevor Thompson 4f8133f44b [NTFS]
Fix Up AddFixupArray - It needs to accept a PNTFS_RECORD_HEADER for parameter 2, not a PFILE_RECORD_HEADER.

svn path=/branches/GSoC_2016/NTFS/; revision=71662
2017-12-10 11:13:26 +01:00
Trevor Thompson ba33b9faac [NTFS]
When writing to a file, increase the file size if trying to write past the end.
*FindAttribute() has been given an optional pointer to a ULONG that will receive the offset of the found attribute from the beginning of the record. This is to allow for found attributes to be written back into their file records.
+SetAttributeDataLength()
+UpdateFileRecord() - Updates a file record in the master file table at a given index.
+AddFixupArray() - Prepares a file record or directory index for writing to the disk.

svn path=/branches/GSoC_2016/NTFS/; revision=71660
2017-12-10 11:13:25 +01:00
Trevor Thompson ea6b9622c4 [NTFS]
Add fixes to WriteAttribute():
-Remove erroneous check for end of run (before writing to the last run returned)
-Properly dereference RealLengthWritten pointer, as reported in CR-90

svn path=/branches/GSoC_2016/NTFS/; revision=71616
2017-12-10 11:13:23 +01:00
Trevor Thompson 58a13831ef [NTFS]
Added minimal write support from CORE-10998 along with updates as suggested by CR-90.

svn path=/branches/GSoC_2016/NTFS/; revision=71224
2017-12-10 11:13:19 +01:00
Pierre Schweitzer 18d6584da4
[FASTFAT] Fix FastFAT not returning short name for FAT volumes in FileBothDirectoryInformation case
This is likely due to a copy paste error where long name was copied twice and short never.
Fun fact: this was not affecting FATX volumes
Fun fact2: this was defeating a buffer overflow check and thus was allowing buffer overflow!

CORE-14088
2017-12-09 21:22:55 +01:00
Amine Khaldi d6cb9f60d1 [ACLEDIT][ATL][ATL80][FLTMGR] Get the def files out of the source files lists. #179 2017-12-09 19:59:02 +01:00
Pierre Schweitzer bddb0db469
[FASTFAT] Finally drop the FileNameInformation class for directories.
It makes no sense for them and shouldn't be implemented.
It's an addendum to 9f3c801.
2017-12-09 14:37:07 +01:00
Pierre Schweitzer 28343c6c0c
[FASTFAT] Fix size checking in VfatGetFileNameInformation() 2017-12-09 12:45:16 +01:00
Pierre Schweitzer 9f3c80193e
[FASTFAT] Don't mix FileNameInformation and FileNamesInformation (and support the later).
This commit fixes weird behavior in our FastFAT implementation. It was mixing two classes:
FileNameInformation and FileNamesInformation. It was handling FileNameInformation like
FileNamesInformation and was filling buffer with FILE_NAMES_INFORMATION structure instead
of FILE_NAME_INFORMATION structure (how many things did that break?!).
Also, it wasn't implementing the FileNamesInformation class at all. This is required by
ntdll_winetest:directory which doesn't expect it to fail and thus, attempts to read
never filled in memory.

This commit fixes the winetest crash, and may fix other weird FS behavior.

CORE-13367
2017-12-09 12:37:34 +01:00
Pierre Schweitzer e95751ab78
[FASTFAT] Calculate more accurately buffer length in VfatGetAllInformation(). 2017-12-09 10:59:37 +01:00
Pierre Schweitzer 52f0726817
[FASTFAT] Allow partial returns on directory info query for first entry.
This mimics what MS FastFAT does and fixes (a bit) ntdll_winetest:directory.
It still crashes, but go farther.

CORE-13367
2017-12-09 10:58:19 +01:00