Open err redirection the same as output redirection. Batch file does not need to be opened with FILE_FLAG_WRITE_THROUGH since it is read only, catch by thomas.

svn path=/trunk/; revision=17451
This commit is contained in:
Brandon Turner 2005-08-20 18:30:25 +00:00
parent c7163ec449
commit bf127ab4fb
2 changed files with 5 additions and 5 deletions

View file

@ -221,7 +221,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
SetLastError(0); SetLastError(0);
hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, 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 | FILE_FLAG_WRITE_THROUGH, NULL); FILE_FLAG_SEQUENTIAL_SCAN, NULL);
#ifdef _DEBUG #ifdef _DEBUG
DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"), DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"),

View file

@ -796,9 +796,9 @@ VOID ParseCommandLine (LPTSTR cmd)
} }
out[size]=_T('\0'); out[size]=_T('\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)
{ {
@ -858,10 +858,10 @@ VOID ParseCommandLine (LPTSTR cmd)
{ {
hFile = CreateFile (err, hFile = CreateFile (err,
GENERIC_WRITE, GENERIC_WRITE,
0, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
&sa, &sa,
(nRedirFlags & ERROR_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS, (nRedirFlags & ERROR_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,
NULL); NULL);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {