1 /*
2  * PROJECT:     ReactOS Printing Stack Marshalling Functions
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Marshalling definitions for PRINTER_INFO_*
5  * COPYRIGHT:   Copyright 2015-2018 Colin Finck (colin@reactos.org)
6  */
7 
8 static const MARSHALLING PrinterInfoStressMarshalling = {
9     sizeof(PRINTER_INFO_STRESS),
10     {
11         { FIELD_OFFSET(PRINTER_INFO_STRESS, pPrinterName), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, pPrinterName), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, pPrinterName), TRUE },
12         { FIELD_OFFSET(PRINTER_INFO_STRESS, pServerName), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, pServerName), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, pServerName), TRUE },
13         { FIELD_OFFSET(PRINTER_INFO_STRESS, cJobs), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cJobs), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cJobs), FALSE },
14         { FIELD_OFFSET(PRINTER_INFO_STRESS, cTotalJobs), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cTotalJobs), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cTotalJobs), FALSE },
15         { FIELD_OFFSET(PRINTER_INFO_STRESS, cTotalBytes), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cTotalBytes), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cTotalBytes), FALSE },
16         { FIELD_OFFSET(PRINTER_INFO_STRESS, stUpTime), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, stUpTime), sizeof(WORD), FALSE },
17         { FIELD_OFFSET(PRINTER_INFO_STRESS, MaxcRef), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, MaxcRef), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, MaxcRef), FALSE },
18         { FIELD_OFFSET(PRINTER_INFO_STRESS, cTotalPagesPrinted), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cTotalPagesPrinted), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cTotalPagesPrinted), FALSE },
19         { FIELD_OFFSET(PRINTER_INFO_STRESS, dwGetVersion), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwGetVersion), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwGetVersion), FALSE },
20         { FIELD_OFFSET(PRINTER_INFO_STRESS, fFreeBuild), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, fFreeBuild), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, fFreeBuild), FALSE },
21         { FIELD_OFFSET(PRINTER_INFO_STRESS, cSpooling), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cSpooling), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cSpooling), FALSE },
22         { FIELD_OFFSET(PRINTER_INFO_STRESS, cMaxSpooling), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cMaxSpooling), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cMaxSpooling), FALSE },
23         { FIELD_OFFSET(PRINTER_INFO_STRESS, cRef), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cRef), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cRef), FALSE },
24         { FIELD_OFFSET(PRINTER_INFO_STRESS, cErrorOutOfPaper), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cErrorOutOfPaper), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cErrorOutOfPaper), FALSE },
25         { FIELD_OFFSET(PRINTER_INFO_STRESS, cErrorNotReady), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cErrorNotReady), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cErrorNotReady), FALSE },
26         { FIELD_OFFSET(PRINTER_INFO_STRESS, cJobError), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cJobError), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cJobError), FALSE },
27         { FIELD_OFFSET(PRINTER_INFO_STRESS, dwNumberOfProcessors), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwNumberOfProcessors), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwNumberOfProcessors), FALSE },
28         { FIELD_OFFSET(PRINTER_INFO_STRESS, dwProcessorType), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwProcessorType), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwProcessorType), FALSE },
29         { FIELD_OFFSET(PRINTER_INFO_STRESS, dwHighPartTotalBytes), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwHighPartTotalBytes), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwHighPartTotalBytes), FALSE },
30         { FIELD_OFFSET(PRINTER_INFO_STRESS, cChangeID), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cChangeID), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cChangeID), FALSE },
31         { FIELD_OFFSET(PRINTER_INFO_STRESS, dwLastError), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwLastError), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwLastError), FALSE },
32         { FIELD_OFFSET(PRINTER_INFO_STRESS, Status), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, Status), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, Status), FALSE },
33         { FIELD_OFFSET(PRINTER_INFO_STRESS, cEnumerateNetworkPrinters), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cEnumerateNetworkPrinters), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cEnumerateNetworkPrinters), FALSE },
34         { FIELD_OFFSET(PRINTER_INFO_STRESS, cAddNetPrinters), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cAddNetPrinters), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cAddNetPrinters), FALSE },
35         { FIELD_OFFSET(PRINTER_INFO_STRESS, wProcessorArchitecture), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, wProcessorArchitecture), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, wProcessorArchitecture), FALSE },
36         { FIELD_OFFSET(PRINTER_INFO_STRESS, wProcessorLevel), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, wProcessorLevel), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, wProcessorLevel), FALSE },
37         { FIELD_OFFSET(PRINTER_INFO_STRESS, cRefIC), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cRefIC), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, cRefIC), FALSE },
38         { FIELD_OFFSET(PRINTER_INFO_STRESS, dwReserved2), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwReserved2), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwReserved2), FALSE },
39         { FIELD_OFFSET(PRINTER_INFO_STRESS, dwReserved3), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwReserved3), RTL_FIELD_SIZE(PRINTER_INFO_STRESS, dwReserved3), FALSE },
40         { MAXDWORD, 0, 0, FALSE }
41     }
42 };
43 
44 static const MARSHALLING PrinterInfo1Marshalling = {
45     sizeof(PRINTER_INFO_1W),
46     {
47         { FIELD_OFFSET(PRINTER_INFO_1W, Flags), RTL_FIELD_SIZE(PRINTER_INFO_1W, Flags), RTL_FIELD_SIZE(PRINTER_INFO_1W, Flags), FALSE },
48         { FIELD_OFFSET(PRINTER_INFO_1W, pDescription), RTL_FIELD_SIZE(PRINTER_INFO_1W, pDescription), RTL_FIELD_SIZE(PRINTER_INFO_1W, pDescription), TRUE },
49         { FIELD_OFFSET(PRINTER_INFO_1W, pName), RTL_FIELD_SIZE(PRINTER_INFO_1W, pName), RTL_FIELD_SIZE(PRINTER_INFO_1W, pName), TRUE },
50         { FIELD_OFFSET(PRINTER_INFO_1W, pComment), RTL_FIELD_SIZE(PRINTER_INFO_1W, pComment), RTL_FIELD_SIZE(PRINTER_INFO_1W, pComment), TRUE },
51         { MAXDWORD, 0, 0, FALSE }
52     }
53 };
54 
55 static const MARSHALLING PrinterInfo2Marshalling = {
56     sizeof(PRINTER_INFO_2W),
57     {
58         { FIELD_OFFSET(PRINTER_INFO_2W, pServerName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pServerName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pServerName), TRUE },
59         { FIELD_OFFSET(PRINTER_INFO_2W, pPrinterName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pPrinterName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pPrinterName), TRUE },
60         { FIELD_OFFSET(PRINTER_INFO_2W, pShareName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pShareName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pShareName), TRUE },
61         { FIELD_OFFSET(PRINTER_INFO_2W, pPortName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pPortName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pPortName), TRUE },
62         { FIELD_OFFSET(PRINTER_INFO_2W, pDriverName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pDriverName), RTL_FIELD_SIZE(PRINTER_INFO_2W, pDriverName), TRUE },
63         { FIELD_OFFSET(PRINTER_INFO_2W, pComment), RTL_FIELD_SIZE(PRINTER_INFO_2W, pComment), RTL_FIELD_SIZE(PRINTER_INFO_2W, pComment), TRUE },
64         { FIELD_OFFSET(PRINTER_INFO_2W, pLocation), RTL_FIELD_SIZE(PRINTER_INFO_2W, pLocation), RTL_FIELD_SIZE(PRINTER_INFO_2W, pLocation), TRUE },
65         { FIELD_OFFSET(PRINTER_INFO_2W, pDevMode), RTL_FIELD_SIZE(PRINTER_INFO_2W, pDevMode), RTL_FIELD_SIZE(PRINTER_INFO_2W, pDevMode), TRUE },
66         { FIELD_OFFSET(PRINTER_INFO_2W, pSepFile), RTL_FIELD_SIZE(PRINTER_INFO_2W, pSepFile), RTL_FIELD_SIZE(PRINTER_INFO_2W, pSepFile), TRUE },
67         { FIELD_OFFSET(PRINTER_INFO_2W, pPrintProcessor), RTL_FIELD_SIZE(PRINTER_INFO_2W, pPrintProcessor), RTL_FIELD_SIZE(PRINTER_INFO_2W, pPrintProcessor), TRUE },
68         { FIELD_OFFSET(PRINTER_INFO_2W, pDatatype), RTL_FIELD_SIZE(PRINTER_INFO_2W, pDatatype), RTL_FIELD_SIZE(PRINTER_INFO_2W, pDatatype), TRUE },
69         { FIELD_OFFSET(PRINTER_INFO_2W, pParameters), RTL_FIELD_SIZE(PRINTER_INFO_2W, pParameters), RTL_FIELD_SIZE(PRINTER_INFO_2W, pParameters), TRUE },
70         { FIELD_OFFSET(PRINTER_INFO_2W, pSecurityDescriptor), RTL_FIELD_SIZE(PRINTER_INFO_2W, pSecurityDescriptor), RTL_FIELD_SIZE(PRINTER_INFO_2W, pSecurityDescriptor), TRUE },
71         { FIELD_OFFSET(PRINTER_INFO_2W, Attributes), RTL_FIELD_SIZE(PRINTER_INFO_2W, Attributes), RTL_FIELD_SIZE(PRINTER_INFO_2W, Attributes), FALSE },
72         { FIELD_OFFSET(PRINTER_INFO_2W, Priority), RTL_FIELD_SIZE(PRINTER_INFO_2W, Priority), RTL_FIELD_SIZE(PRINTER_INFO_2W, Priority), FALSE },
73         { FIELD_OFFSET(PRINTER_INFO_2W, DefaultPriority), RTL_FIELD_SIZE(PRINTER_INFO_2W, DefaultPriority), RTL_FIELD_SIZE(PRINTER_INFO_2W, DefaultPriority), FALSE },
74         { FIELD_OFFSET(PRINTER_INFO_2W, StartTime), RTL_FIELD_SIZE(PRINTER_INFO_2W, StartTime), RTL_FIELD_SIZE(PRINTER_INFO_2W, StartTime), FALSE },
75         { FIELD_OFFSET(PRINTER_INFO_2W, UntilTime), RTL_FIELD_SIZE(PRINTER_INFO_2W, UntilTime), RTL_FIELD_SIZE(PRINTER_INFO_2W, UntilTime), FALSE },
76         { FIELD_OFFSET(PRINTER_INFO_2W, Status), RTL_FIELD_SIZE(PRINTER_INFO_2W, Status), RTL_FIELD_SIZE(PRINTER_INFO_2W, Status), FALSE },
77         { FIELD_OFFSET(PRINTER_INFO_2W, cJobs), RTL_FIELD_SIZE(PRINTER_INFO_2W, cJobs), RTL_FIELD_SIZE(PRINTER_INFO_2W, cJobs), FALSE },
78         { FIELD_OFFSET(PRINTER_INFO_2W, AveragePPM), RTL_FIELD_SIZE(PRINTER_INFO_2W, AveragePPM), RTL_FIELD_SIZE(PRINTER_INFO_2W, AveragePPM), FALSE },
79         { MAXDWORD, 0, 0, FALSE }
80     }
81 };
82 
83 static const MARSHALLING PrinterInfo3Marshalling = {
84     sizeof(PRINTER_INFO_3),
85     {
86         { FIELD_OFFSET(PRINTER_INFO_3, pSecurityDescriptor), RTL_FIELD_SIZE(PRINTER_INFO_3, pSecurityDescriptor), RTL_FIELD_SIZE(PRINTER_INFO_3, pSecurityDescriptor), TRUE },
87         { MAXDWORD, 0, 0, FALSE }
88     }
89 };
90 
91 static const MARSHALLING PrinterInfo4Marshalling = {
92     sizeof(PRINTER_INFO_4W),
93     {
94         { FIELD_OFFSET(PRINTER_INFO_4W, pPrinterName), RTL_FIELD_SIZE(PRINTER_INFO_4W, pPrinterName), RTL_FIELD_SIZE(PRINTER_INFO_4W, pPrinterName), TRUE },
95         { FIELD_OFFSET(PRINTER_INFO_4W, pServerName), RTL_FIELD_SIZE(PRINTER_INFO_4W, pServerName), RTL_FIELD_SIZE(PRINTER_INFO_4W, pServerName), TRUE },
96         { FIELD_OFFSET(PRINTER_INFO_4W, Attributes), RTL_FIELD_SIZE(PRINTER_INFO_4W, Attributes), RTL_FIELD_SIZE(PRINTER_INFO_4W, Attributes), FALSE },
97         { MAXDWORD, 0, 0, FALSE }
98     }
99 };
100 
101 static const MARSHALLING PrinterInfo5Marshalling = {
102     sizeof(PRINTER_INFO_5W),
103     {
104         { FIELD_OFFSET(PRINTER_INFO_5W, pPrinterName), RTL_FIELD_SIZE(PRINTER_INFO_5W, pPrinterName), RTL_FIELD_SIZE(PRINTER_INFO_5W, pPrinterName), TRUE },
105         { FIELD_OFFSET(PRINTER_INFO_5W, pPortName), RTL_FIELD_SIZE(PRINTER_INFO_5W, pPortName), RTL_FIELD_SIZE(PRINTER_INFO_5W, pPortName), TRUE },
106         { FIELD_OFFSET(PRINTER_INFO_5W, Attributes), RTL_FIELD_SIZE(PRINTER_INFO_5W, Attributes), RTL_FIELD_SIZE(PRINTER_INFO_5W, Attributes), FALSE },
107         { FIELD_OFFSET(PRINTER_INFO_5W, DeviceNotSelectedTimeout), RTL_FIELD_SIZE(PRINTER_INFO_5W, DeviceNotSelectedTimeout), RTL_FIELD_SIZE(PRINTER_INFO_5W, DeviceNotSelectedTimeout), FALSE },
108         { FIELD_OFFSET(PRINTER_INFO_5W, TransmissionRetryTimeout), RTL_FIELD_SIZE(PRINTER_INFO_5W, TransmissionRetryTimeout), RTL_FIELD_SIZE(PRINTER_INFO_5W, TransmissionRetryTimeout), FALSE },
109         { MAXDWORD, 0, 0, FALSE }
110     }
111 };
112 
113 static const MARSHALLING PrinterInfo6Marshalling = {
114     sizeof(PRINTER_INFO_6),
115     {
116         { FIELD_OFFSET(PRINTER_INFO_6, dwStatus), RTL_FIELD_SIZE(PRINTER_INFO_6, dwStatus), RTL_FIELD_SIZE(PRINTER_INFO_6, dwStatus), FALSE },
117         { MAXDWORD, 0, 0, FALSE }
118     }
119 };
120 
121 static const MARSHALLING PrinterInfo7Marshalling = {
122     sizeof(PRINTER_INFO_7W),
123     {
124         { FIELD_OFFSET(PRINTER_INFO_7W, pszObjectGUID), RTL_FIELD_SIZE(PRINTER_INFO_7W, pszObjectGUID), RTL_FIELD_SIZE(PRINTER_INFO_7W, pszObjectGUID), TRUE },
125         { FIELD_OFFSET(PRINTER_INFO_7W, dwAction), RTL_FIELD_SIZE(PRINTER_INFO_7W, dwAction), RTL_FIELD_SIZE(PRINTER_INFO_7W, dwAction), FALSE },
126         { MAXDWORD, 0, 0, FALSE }
127     }
128 };
129 
130 static const MARSHALLING PrinterInfo8Marshalling = {
131     sizeof(PRINTER_INFO_8W),
132     {
133         { FIELD_OFFSET(PRINTER_INFO_8W, pDevMode), RTL_FIELD_SIZE(PRINTER_INFO_8W, pDevMode), RTL_FIELD_SIZE(PRINTER_INFO_8W, pDevMode), TRUE },
134         { MAXDWORD, 0, 0, FALSE }
135     }
136 };
137 
138 static const MARSHALLING PrinterInfo9Marshalling = {
139     sizeof(PRINTER_INFO_9W),
140     {
141         { FIELD_OFFSET(PRINTER_INFO_9W, pDevMode), RTL_FIELD_SIZE(PRINTER_INFO_9W, pDevMode), RTL_FIELD_SIZE(PRINTER_INFO_9W, pDevMode), TRUE },
142         { MAXDWORD, 0, 0, FALSE }
143     }
144 };
145 
146 static const MARSHALLING* pPrinterInfoMarshalling[] = {
147     &PrinterInfoStressMarshalling,
148     &PrinterInfo1Marshalling,
149     &PrinterInfo2Marshalling,
150     &PrinterInfo3Marshalling,
151     &PrinterInfo4Marshalling,
152     &PrinterInfo5Marshalling,
153     &PrinterInfo6Marshalling,
154     &PrinterInfo7Marshalling,
155     &PrinterInfo8Marshalling,
156     &PrinterInfo9Marshalling
157 };
158