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:
Brandon Turner 2005-08-20 18:07:59 +00:00
parent 1ad828873f
commit c7163ec449
2 changed files with 4 additions and 4 deletions

View file

@ -219,9 +219,9 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
{
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"),

View file

@ -780,9 +780,9 @@ VOID ParseCommandLine (LPTSTR cmd)
/* 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)
{