2 * Print processor implementation.
4 * Copyright 2022 Piotr Caban for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include <ddk/winsplp.h>
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(psdrv
);
31 #define PP_MAGIC 0x952173fe
41 static const WCHAR emf_1003
[] = L
"NT EMF 1.003";
43 static struct pp_data
* get_handle_data(HANDLE pp
)
45 struct pp_data
*ret
= (struct pp_data
*)pp
;
47 if (!ret
|| ret
->magic
!= PP_MAGIC
)
49 SetLastError(ERROR_INVALID_HANDLE
);
55 BOOL WINAPI
EnumPrintProcessorDatatypesW(WCHAR
*server
, WCHAR
*name
, DWORD level
,
56 BYTE
*datatypes
, DWORD size
, DWORD
*needed
, DWORD
*no
)
58 DATATYPES_INFO_1W
*info
= (DATATYPES_INFO_1W
*)datatypes
;
60 TRACE("%s, %s, %ld, %p, %ld, %p, %p\n", debugstr_w(server
), debugstr_w(name
),
61 level
, datatypes
, size
, needed
, no
);
65 SetLastError(ERROR_INVALID_PARAMETER
);
70 *needed
= sizeof(*info
) + sizeof(emf_1003
);
72 if (level
!= 1 || (size
&& !datatypes
))
74 SetLastError(ERROR_INVALID_PARAMETER
);
80 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
85 info
->pName
= (WCHAR
*)(info
+ 1);
86 memcpy(info
+ 1, emf_1003
, sizeof(emf_1003
));
90 HANDLE WINAPI
OpenPrintProcessor(WCHAR
*port
, PRINTPROCESSOROPENDATA
*open_data
)
95 TRACE("%s, %p\n", debugstr_w(port
), open_data
);
97 if (!port
|| !open_data
|| !open_data
->pDatatype
)
99 SetLastError(ERROR_INVALID_PARAMETER
);
102 if (wcscmp(open_data
->pDatatype
, emf_1003
))
104 SetLastError(ERROR_INVALID_DATATYPE
);
108 if (!OpenPrinterW(port
, &hport
, NULL
))
111 data
= LocalAlloc(LMEM_FIXED
| LMEM_ZEROINIT
, sizeof(*data
));
114 data
->magic
= PP_MAGIC
;
116 data
->doc_name
= wcsdup(open_data
->pDocumentName
);
117 data
->out_file
= wcsdup(open_data
->pOutputFile
);
121 BOOL WINAPI
PrintDocumentOnPrintProcessor(HANDLE pp
, WCHAR
*doc_name
)
123 FIXME("%p, %s\n", pp
, debugstr_w(doc_name
));
124 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
128 BOOL WINAPI
ControlPrintProcessor(HANDLE pp
, DWORD cmd
)
130 FIXME("%p, %ld\n", pp
, cmd
);
131 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
135 BOOL WINAPI
ClosePrintProcessor(HANDLE pp
)
137 struct pp_data
*data
= get_handle_data(pp
);
144 ClosePrinter(data
->hport
);
145 free(data
->doc_name
);
146 free(data
->out_file
);
148 memset(data
, 0, sizeof(*data
));