if (ClosePrinter(*phPrinter))
*phPrinter = NULL;
-
- dwErrorCode = GetLastError();
+ else
+ dwErrorCode = GetLastError();
RpcRevertToSelf();
return dwErrorCode;
return dwErrorCode;
}
- EndDocPrinter(hPrinter);
- dwErrorCode = GetLastError();
+ if (!EndDocPrinter(hPrinter))
+ dwErrorCode = GetLastError();
RpcRevertToSelf();
return dwErrorCode;
return dwErrorCode;
}
- EndPagePrinter(hPrinter);
- dwErrorCode = GetLastError();
+ if (!EndPagePrinter(hPrinter))
+ dwErrorCode = GetLastError();
RpcRevertToSelf();
return dwErrorCode;
}
pPrinterEnumAligned = AlignRpcPtr(pPrinterEnum, &cbBuf);
- EnumPrintersW(Flags, Name, Level, pPrinterEnumAligned, cbBuf, pcbNeeded, pcReturned);
- dwErrorCode = GetLastError();
- if (dwErrorCode == ERROR_SUCCESS)
+ if (EnumPrintersW(Flags, Name, Level, pPrinterEnumAligned, cbBuf, pcbNeeded, pcReturned))
{
DWORD i;
PBYTE p = pPrinterEnumAligned;
for (i = 0; i < *pcReturned; i++)
_MarshallDownPrinterInfo(&p, Level);
}
+ else
+ {
+ dwErrorCode = GetLastError();
+ }
RpcRevertToSelf();
UndoAlignRpcPtr(pPrinterEnum, pPrinterEnumAligned, cbBuf, pcbNeeded);
}
pPrinterAligned = AlignRpcPtr(pPrinter, &cbBuf);
- GetPrinterW(hPrinter, Level, pPrinterAligned, cbBuf, pcbNeeded);
- dwErrorCode = GetLastError();
- if (dwErrorCode == ERROR_SUCCESS)
+ if (GetPrinterW(hPrinter, Level, pPrinterAligned, cbBuf, pcbNeeded))
{
PBYTE p = pPrinterAligned;
_MarshallDownPrinterInfo(&p, Level);
}
+ else
+ {
+ dwErrorCode = GetLastError();
+ }
RpcRevertToSelf();
UndoAlignRpcPtr(pPrinter, pPrinterAligned, cbBuf, pcbNeeded);
Default.pDatatype = pDatatype;
Default.pDevMode = (PDEVMODEW)pDevModeContainer->pDevMode;
- OpenPrinterW(pPrinterName, phPrinter, &Default);
- dwErrorCode = GetLastError();
+ if (!OpenPrinterW(pPrinterName, phPrinter, &Default))
+ dwErrorCode = GetLastError();
RpcRevertToSelf();
return dwErrorCode;
return dwErrorCode;
}
- ReadPrinter(hPrinter, pBuf, cbBuf, pcNoBytesRead);
- dwErrorCode = GetLastError();
+ if (!ReadPrinter(hPrinter, pBuf, cbBuf, pcNoBytesRead))
+ dwErrorCode = GetLastError();
RpcRevertToSelf();
return dwErrorCode;
return dwErrorCode;
}
- StartPagePrinter(hPrinter);
- dwErrorCode = GetLastError();
+ if (!StartPagePrinter(hPrinter))
+ dwErrorCode = GetLastError();
RpcRevertToSelf();
return dwErrorCode;
return dwErrorCode;
}
- WritePrinter(hPrinter, pBuf, cbBuf, pcWritten);
- dwErrorCode = GetLastError();
+ if (!WritePrinter(hPrinter, pBuf, cbBuf, pcWritten))
+ dwErrorCode = GetLastError();
RpcRevertToSelf();
return dwErrorCode;