Change the way batch files and output files are opened. They now allow
write and delete while being excuted. This is how MS cmd is done.
Thanks to Greatlord, Filip, Thomas.
Modified: trunk/reactos/subsys/system/cmd/batch.c
Modified: trunk/reactos/subsys/system/cmd/cmd.c
_____
Modified: trunk/reactos/subsys/system/cmd/batch.c
--- trunk/reactos/subsys/system/cmd/batch.c 2005-08-20 17:17:44 UTC
(rev 17449)
+++ trunk/reactos/subsys/system/cmd/batch.c 2005-08-20 18:07:59 UTC
(rev 17450)
@@ -219,9 +219,9 @@
{
HANDLE hFile;
SetLastError(0);
- hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_READ,
NULL,
+ hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_WRITE |
FILE_SHARE_READ | FILE_SHARE_DELETE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
- FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ FILE_FLAG_SEQUENTIAL_SCAN |
FILE_FLAG_WRITE_THROUGH, NULL);
#ifdef _DEBUG
DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile =
%x\n"),
_____
Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c 2005-08-20 17:17:44 UTC
(rev 17449)
+++ trunk/reactos/subsys/system/cmd/cmd.c 2005-08-20 18:07:59 UTC
(rev 17450)
@@ -780,9 +780,9 @@
/* we need make sure the LastError msg is zero before calling
CreateFile */
SetLastError(0);
- hFile = CreateFile (out, GENERIC_WRITE, FILE_SHARE_WRITE, &sa,
+ hFile = CreateFile (out, GENERIC_WRITE, FILE_SHARE_WRITE |
FILE_SHARE_READ | FILE_SHARE_DELETE, &sa,
(nRedirFlags & OUTPUT_APPEND) ?
OPEN_ALWAYS : CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_ATTRIBUTE_NORMAL |
FILE_FLAG_WRITE_THROUGH, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{