Bugfixing... Part 4/X:
- Fix a nasty bug in NtfsLookupFileAt() (how did it work before?). The name parsing was wrong (no progress was being made) and thus was leading to an infinite loop in directory browsing.
- Fix a lovely bug coming from a non-documented feature in NTFS. To properly read the MFT index, you've to apply a mask. Do this to properly handles MFT record. This fixes returned MFT index which allows resuse.
- Do not allow returning MFT records < 0x10 for now. Not sure whether it should be allowed, but so far, these are MFT special records, so let's forget about it. IIRC, they are available on Windows. But trying to chase another bug for the moment.
This does not fix yet directory enumeration.
svn path=/trunk/; revision=64793
- Use a helper function for copying little chunks of memory (1, 2, 4 and 8 bytes) because a profiling of ntvdm showed that especially 1 and 2 bytes of memory were read the most, and calling RtlCopy/MoveMemory for intensively copying 1 or 2 bytes was shown to be inefficient. We also don't use directly intrinsics/builtins because the compiler cannot know in advance the size of the memory to be copied, it cannot perform the required optimizations. It was checked that using the builtin-memcpy or memmove of GCC when compiling the program in release+full optimization mode just embedded a call to _memcpy, and naively using the movsX intrinsics of MSVC does not do the job of "moving" memory taking into account for the possible overlaps. Therefore, for small sizes (<= 8 bytes), we use copy assignments, whereas for large sizes (and for 3, 5, 7, 9+ bytes) we use the regular method of calling RtlMoveMemory. We gain ~=10% speed with this optimization.
- Also I use >> and & for dividing by 4 and 2 instead of the regular / and % operations because they are not optimized otherwise by default by MSVC (they are however, if you explicitely enable optimizations).
svn path=/trunk/; revision=64792
Properly fix warnings on MSVC, introduced in r38302.
"- 'allowwarnings=true' -- not anymore", they said.
Advice by ThFabba.
svn path=/trunk/; revision=64790
- prevent a buffer underrun (fixes stray quotes being appended on autocomplete in some cases)
- check if the input string is not empty (fixes first file in directory getting skipped on autocomplete)
- fix some typos
CORE-8623
svn path=/trunk/; revision=64787
* Workaround for CORE-8525, CORE-6023, CORE-7735 and CORE-8635.
* Brought to you by V and Amine. Thanks to Timo and Jerome for the reviews.
CORE-8525 CORE-6023 CORE-7735 CORE-8635 #comment Please retest with r64777 or later.
svn path=/trunk/; revision=64777
Bugfixing... Part 3/X:
- Really release the allocated memory in NtfsFindFileAt() and NtfsLookupFileAt(). Don't attempt to release caller pointer!
This fixes crashes on directory enumeration failure. Even though this latter still doesn't work.
svn path=/trunk/; revision=64776
Bugfixing... Part 2/X:
- Please welcome yet another structure in our NTFS driver... The INDX buffer which is used for non resident index entries. Doc (incomplete) here: http://bos.asmhackers.net/docs/filesystems/ntfs/INDX.html
- Make use of it in NtfsFindMftRecord() to replace some totally obscure code.
- Add some asserts to verify we read somehow what we expect. One of the assert is not working properly... Hum! Need to find out why.
We don't go any farther so far. Good news though: a FIXME has been replaced by another FIXME.
NB: This would deserve being ported to FreeLDR to fix the same FIXME.
svn path=/trunk/; revision=64771
Handle int 0x2c (assertion failure) in KDBG by breaking into the debugger instead of ignoring it and pretending it was handled. Now NT_ASSERT works on GCC builds as well. (As good as things work in KDBG...)
svn path=/trunk/; revision=64770
Bugfixing... Part 1/X:
- FixupUpdateSequenceArray() returns a NTSTATUS, so properly handle it.
- Actually... Attributes name can be unicode in case of a file name, but it can also be ansi, for streams name... So, don't force UNICODE_STRING, it causes more troubles than it solves.
So, now, we really progress in reading directory. Instead of finding no files because we improperly read attributes, we now corrupt memory somewhere and crash ReactOS.
svn path=/trunk/; revision=64765
- Don't truncate pipe name in the RootPipe case in NpCreateFcb. Found by Windows's RtlInsertUnicodePrefix implementation -- which might indicate that ours is broken.
svn path=/trunk/; revision=64763
- Use NpAcquire*Vcb/NpReleaseVcb instead of using NpVcb directly
- CaseInsensitiveIndex is integer, not boolean
- Minor fixes involving unnecessary casts and magic numbers
svn path=/trunk/; revision=64761
Implement a simple version of RunTmChk.lib for MSVC runtime check support, which can also be used in kernel mode. This one is good enough to compile ntoskrnl with it.
svn path=/trunk/; revision=64756
- Implement NtfsGetNameInformation()
- Implement NtfsGetDirectoryInformation()
- Implement NtfsGetFullDirectoryInformation()
- Implement NtfsGetBothDirectoryInformation()
- Implement NtfsQueryDirectory() which makes use of all the functions upper + all the previous fixes to make it able to look for a file using WC and file entry index
This is supposed to bring directory enumeration in line on NTFS volumes. BUT, there's a bug at some point which makes it fail (or my test volume is corrupted :-P (which is unlikely (Scheme, get out of this commit message!))). Will look into it later on. Committing so far because it's quite major work anyway.
More to follow~
svn path=/trunk/; revision=64754
Implement NtfsFileFlagsToAttributes() to fix some of the attributes of the MFT to make them usable by ReactOS.
Would deserve a double-check
svn path=/trunk/; revision=64753
- Use macro version of RtlUlonglongByteSwap in winternl.h because using the fastcall version causes stack corruption
CORE-8632 #resolve
svn path=/trunk/; revision=64749
- Invalid extended opcodes get a special handler, so that we are not anymore obliged to check for NULL before running an extended opcode.
- To quickly retrieve extended opcode numbers, add their numbers in regard to their handlers.
svn path=/trunk/; revision=64745
- Also make NtfsFindMftRecord() return the name of the record it found
- Implement support for entry enumeration (from 0 or not) in NtfsFindMftRecord()
- Experimental fix in NtfsLookupFileAt(), look for the attribute using the name of the record, and not the full path
- Implement NtfsFindFileAt() which is used to look for a file/directory using WC in a given directory
svn path=/trunk/; revision=64743