https://git.reactos.org/?p=reactos.git;a=commitdiff;h=03c233bcd09bb378f9561…
commit 03c233bcd09bb378f9561968b9cbf4f45d140f09
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Apr 29 00:57:16 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Apr 29 00:57:16 2018 +0200
[CMD] Improve how the command prompt displays when one presses Ctrl-C/break after having pressed ENTER, or after a command has been run.
---
base/shell/cmd/cmd.c | 8 +++-----
base/shell/cmd/cmdinput.c | 10 ++++++++--
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/base/shell/cmd/cmd.c b/base/shell/cmd/cmd.c
index 25ddae0c6f..bc92e70e6c 100644
--- a/base/shell/cmd/cmd.c
+++ b/base/shell/cmd/cmd.c
@@ -1418,16 +1418,14 @@ ReadLine(TCHAR *commandline, BOOL bMore)
return FALSE;
}
- if (CheckCtrlBreak(BREAK_INPUT))
- {
+ if (readline[0] == _T('\0'))
ConOutChar(_T('\n'));
+
+ if (CheckCtrlBreak(BREAK_INPUT))
return FALSE;
- }
if (readline[0] == _T('\0'))
- {
return FALSE;
- }
ip = readline;
}
diff --git a/base/shell/cmd/cmdinput.c b/base/shell/cmd/cmdinput.c
index 9257cb6dda..481a04350d 100644
--- a/base/shell/cmd/cmdinput.c
+++ b/base/shell/cmd/cmdinput.c
@@ -453,8 +453,14 @@ BOOL ReadCommand(LPTSTR str, INT maxlen)
if ((ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
{
- /* A CTRL-C. Don't clear the the command line,
- * but return an empty string in str. */
+ /* Ignore the Ctrl-C key event if it has already been handled */
+ if (!bCtrlBreak)
+ break;
+
+ /*
+ * A Ctrl-C. Do not clear the command line,
+ * but return an empty string in str.
+ */
str[0] = _T('\0');
curx = orgx;
cury = orgy;
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=94ead99e0c503faa40b33…
commit 94ead99e0c503faa40b33b813cce296ea5c0bc0c
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Thu Apr 26 18:25:19 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Apr 28 18:33:14 2018 +0200
[FASTFAT] Don't leak directories FILE_OBJECT, FCB and cache entries.
Once a directory is crossed (opened or a child is opened), associated
FCB structure is created in FastFAT, but also a stream FO for caching.
Up to now, due to an extra reference taken by the stream file object,
even when the directory was no longer used, the directory was kept in
memory: the FCB was never deleted, the file object was never dereferenced,
and the cache never released.
The immediate effect of this bug is that our FAT driver was leaking every
directory that was used affecting the whole OS situation. In case of
directories intensive operation (like extraction the ReactOS source code
in ReactOS ;-)), we were just killin the whole OS RAM without any way to
release it and recover.
The other side effects: IOs were faster as half of the FS was always
permanant in RAM.
This commit fixes the issue by forcing the FSD to release the FO,
and the cache when a directory is no longer used, leading to its
destruction in RAM.
Downside: on IO intensive operation, expect slowdowns, obviously,
there's less caching now. But more efficient!
CORE-14557
---
drivers/filesystems/fastfat/cleanup.c | 1 +
drivers/filesystems/fastfat/fcb.c | 20 +++++++++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/filesystems/fastfat/cleanup.c b/drivers/filesystems/fastfat/cleanup.c
index 0a12fd70f8..580ed807a3 100644
--- a/drivers/filesystems/fastfat/cleanup.c
+++ b/drivers/filesystems/fastfat/cleanup.c
@@ -107,6 +107,7 @@ VfatCleanupFile(
{
pFcb->FileObject = NULL;
CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
+ ClearFlag(pFcb->Flags, FCB_CACHE_INITIALIZED);
ObDereferenceObject(tmpFileObject);
}
diff --git a/drivers/filesystems/fastfat/fcb.c b/drivers/filesystems/fastfat/fcb.c
index f96a3178ba..f6734a675e 100644
--- a/drivers/filesystems/fastfat/fcb.c
+++ b/drivers/filesystems/fastfat/fcb.c
@@ -313,10 +313,24 @@ vfatReleaseFCB(
while (pFCB)
{
+ ULONG RefCount;
+
ASSERT(pFCB != pVCB->VolumeFcb);
ASSERT(pFCB->RefCount > 0);
- pFCB->RefCount--;
- if (pFCB->RefCount == 0)
+ RefCount = --pFCB->RefCount;
+
+ if (RefCount == 1 && BooleanFlagOn(pFCB->Flags, FCB_CACHE_INITIALIZED))
+ {
+ PFILE_OBJECT tmpFileObject;
+ tmpFileObject = pFCB->FileObject;
+
+ pFCB->FileObject = NULL;
+ CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
+ ClearFlag(pFCB->Flags, FCB_CACHE_INITIALIZED);
+ ObDereferenceObject(tmpFileObject);
+ }
+
+ if (RefCount == 0)
{
ASSERT(pFCB->OpenHandleCount == 0);
tmpFcb = pFCB->parentFcb;
@@ -623,7 +637,7 @@ vfatFCBInitializeCacheFromVolume(
_SEH2_END;
vfatGrabFCB(vcb, fcb);
- fcb->Flags |= FCB_CACHE_INITIALIZED;
+ SetFlag(fcb->Flags, FCB_CACHE_INITIALIZED);
return STATUS_SUCCESS;
}