12{
13 const DWORD cchMaxJobIdDigits = 5;
14 const WCHAR wszJobAppendix[] =
L", Job ";
16 const WCHAR wszPortAppendix[] =
L", Port";
17
27
28 TRACE(
"PrintingThreadProc(%p)\n", pJob);
29
30
31
34 if (!pwszPrinterPort)
35 {
37 ERR(
"DllAllocSplMem failed!\n");
39 }
40
42 CopyMemory(&pwszPrinterPort[cchPortName], wszPortAppendix,
sizeof(wszPortAppendix));
43
44
52
53
54
55
57
58
60 if (!hPrintProcessor)
61 {
63 ERR(
"OpenPrintProcessor failed with error %lu!\n", dwErrorCode);
65 }
66
67
69
70
72 pwszPrinterAndJob =
DllAllocSplMem((cchPrinterName + cchJobAppendix + cchMaxJobIdDigits + 1) *
sizeof(
WCHAR));
73 if (!pwszPrinterAndJob)
74 {
76 ERR(
"DllAllocSplMem failed!\n");
78 }
79
81 CopyMemory(&pwszPrinterAndJob[cchPrinterName], wszJobAppendix, cchJobAppendix *
sizeof(
WCHAR));
82 _ultow(OpenData.
JobId, &pwszPrinterAndJob[cchPrinterName + cchJobAppendix], 10);
83
84
86
87
88
90 {
92 ERR(
"PrintDocumentOnPrintProcessor failed with error %lu!\n", dwErrorCode);
94 }
95
96
98 hPrintProcessor =
NULL;
99
100
102 if (!pwszSPLFile)
103 {
105 ERR(
"DllAllocSplMem failed!\n");
107 }
108
111
112
114
116 if (hPrintProcessor)
118
119 if (pwszPrinterPort)
121
122 if (pwszPrinterAndJob)
124
125 if (pwszSPLFile)
127
128 return dwErrorCode;
129}
#define ERROR_NOT_ENOUGH_MEMORY
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
static const WCHAR Cleanup[]
_CRTIMP wchar_t *__cdecl _ultow(_In_ unsigned long _Value, _Pre_notnull_ _Post_z_ wchar_t *_Dest, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
DWORD GetJobFilePath(PCWSTR pwszExtension, DWORD dwJobID, PWSTR pwszOutput)
PLOCAL_PRINT_PROCESSOR pPrintProcessor
PWSTR pwszPrintProcessorParameters
PLOCAL_JOB pNextJobToProcess
PPrintDocumentOnPrintProcessor pfnPrintDocumentOnPrintProcessor
PClosePrintProcessor pfnClosePrintProcessor
POpenPrintProcessor pfnOpenPrintProcessor
BOOL WINAPI DllFreeSplMem(PVOID pMem)
PVOID WINAPI DllAllocSplMem(DWORD dwBytes)
DWORD WINAPI GetLastError(void)
#define JOB_STATUS_PRINTING