mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 09:50:02 +00:00
[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. svn path=/branches/colins-printing-for-freedom/; revision=68403
This commit is contained in:
parent
afb3ba35d8
commit
843622e20a
1 changed files with 6 additions and 3 deletions
|
@ -300,7 +300,7 @@ _CreateNonspooledPort(PLOCALMON_PORT pPort)
|
||||||
CopyMemory(&pwszNonspooledFileName[cchLocalSlashes + cchNonspooledPrefix], pwszPortNameWithoutColon, (cchPortNameWithoutColon + 1) * sizeof(WCHAR));
|
CopyMemory(&pwszNonspooledFileName[cchLocalSlashes + cchNonspooledPrefix], pwszPortNameWithoutColon, (cchPortNameWithoutColon + 1) * sizeof(WCHAR));
|
||||||
|
|
||||||
// Finally open it for reading and writing.
|
// 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)
|
if (pPort->hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
dwErrorCode = GetLastError();
|
dwErrorCode = GetLastError();
|
||||||
|
@ -577,6 +577,9 @@ LocalmonEndDocPort(HANDLE hPort)
|
||||||
// We're done with the printer.
|
// We're done with the printer.
|
||||||
ClosePrinter(pPort->hPrinter);
|
ClosePrinter(pPort->hPrinter);
|
||||||
pPort->hPrinter = NULL;
|
pPort->hPrinter = NULL;
|
||||||
|
|
||||||
|
// A new document can now be started again.
|
||||||
|
pPort->bStartedDoc = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
@ -979,7 +982,7 @@ LocalmonStartDocPort(HANDLE hPort, PWSTR pPrinterName, DWORD JobId, DWORD Level,
|
||||||
else if(pPort->PortType == PortType_FILE)
|
else if(pPort->PortType == PortType_FILE)
|
||||||
{
|
{
|
||||||
// This is a FILE: port. Open the output file given in the Document Info.
|
// 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)
|
if (pPort->hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
dwErrorCode = GetLastError();
|
dwErrorCode = GetLastError();
|
||||||
|
@ -999,7 +1002,7 @@ LocalmonStartDocPort(HANDLE hPort, PWSTR pPrinterName, DWORD JobId, DWORD Level,
|
||||||
{
|
{
|
||||||
if (GetLastError() == ERROR_SUCCESS)
|
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)
|
if (pPort->hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
dwErrorCode = GetLastError();
|
dwErrorCode = GetLastError();
|
||||||
|
|
Loading…
Reference in a new issue