Author: cfinck Date: Wed Jul 15 18:45:37 2015 New Revision: 68403
URL: http://svn.reactos.org/svn/reactos?rev=68403&view=rev Log: [LOCALMON] - Bugfix: Unset bStartedDoc in LocalmonEndDocPort so that new documents can be started again. - Bugfix: Use CREATE_ALWAYS instead of OPEN_ALWAYS for CreateFileW to truncate any existing output file before writing a new document into it.
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/monitors/localmon/ports.c
Modified: branches/colins-printing-for-freedom/reactos/win32ss/printing/monitors/localmon/ports.c URL: http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reac... ============================================================================== --- branches/colins-printing-for-freedom/reactos/win32ss/printing/monitors/localmon/ports.c [iso-8859-1] (original) +++ branches/colins-printing-for-freedom/reactos/win32ss/printing/monitors/localmon/ports.c [iso-8859-1] Wed Jul 15 18:45:37 2015 @@ -300,7 +300,7 @@ CopyMemory(&pwszNonspooledFileName[cchLocalSlashes + cchNonspooledPrefix], pwszPortNameWithoutColon, (cchPortNameWithoutColon + 1) * sizeof(WCHAR));
// Finally open it for reading and writing. - pPort->hFile = CreateFileW(pwszNonspooledFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL); + pPort->hFile = CreateFileW(pwszNonspooledFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL); if (pPort->hFile == INVALID_HANDLE_VALUE) { dwErrorCode = GetLastError(); @@ -577,6 +577,9 @@ // We're done with the printer. ClosePrinter(pPort->hPrinter); pPort->hPrinter = NULL; + + // A new document can now be started again. + pPort->bStartedDoc = FALSE; }
SetLastError(ERROR_SUCCESS); @@ -979,7 +982,7 @@ else if(pPort->PortType == PortType_FILE) { // This is a FILE: port. Open the output file given in the Document Info. - pPort->hFile = CreateFileW(pDocInfo1->pOutputFile, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL); + pPort->hFile = CreateFileW(pDocInfo1->pOutputFile, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL); if (pPort->hFile == INVALID_HANDLE_VALUE) { dwErrorCode = GetLastError(); @@ -999,7 +1002,7 @@ { if (GetLastError() == ERROR_SUCCESS) { - pPort->hFile = CreateFileW(pPort->pwszPortName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL); + pPort->hFile = CreateFileW(pPort->pwszPortName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL); if (pPort->hFile == INVALID_HANDLE_VALUE) { dwErrorCode = GetLastError();