mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
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.
svn path=/trunk/; revision=17450
This commit is contained in:
parent
1ad828873f
commit
c7163ec449
2 changed files with 4 additions and 4 deletions
|
@ -219,9 +219,9 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
|
||||||
{
|
{
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
SetLastError(0);
|
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 |
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_WRITE_THROUGH, NULL);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"),
|
DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"),
|
||||||
|
|
|
@ -780,9 +780,9 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
/* we need make sure the LastError msg is zero before calling CreateFile */
|
/* we need make sure the LastError msg is zero before calling CreateFile */
|
||||||
SetLastError(0);
|
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,
|
(nRedirFlags & OUTPUT_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS,
|
||||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, NULL);
|
||||||
|
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue