[PRINTING] Replace all my custom marshalling code by calls to the newly implemented...
[reactos.git] / win32ss / printing / base / winspool / monitors.c
1 /*
2 * PROJECT: ReactOS Spooler API
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Functions related to Print Monitors
5 * COPYRIGHT: Copyright 2015-2018 Colin Finck (colin@reactos.org)
6 */
7
8 #include "precomp.h"
9 #include <marshalling/monitors.h>
10
11 BOOL WINAPI
12 AddMonitorA(PSTR pName, DWORD Level, PBYTE pMonitors)
13 {
14 TRACE("AddMonitorA(%s, %lu, %p)\n", pName, Level, pMonitors);
15 UNIMPLEMENTED;
16 return FALSE;
17 }
18
19 BOOL WINAPI
20 AddMonitorW(PWSTR pName, DWORD Level, PBYTE pMonitors)
21 {
22 TRACE("AddMonitorW(%S, %lu, %p)\n", pName, Level, pMonitors);
23 UNIMPLEMENTED;
24 return FALSE;
25 }
26
27 BOOL WINAPI
28 DeleteMonitorA(PSTR pName, PSTR pEnvironment, PSTR pMonitorName)
29 {
30 TRACE("DeleteMonitorA(%s, %s, %s)\n", pName, pEnvironment, pMonitorName);
31 UNIMPLEMENTED;
32 return FALSE;
33 }
34
35 BOOL WINAPI
36 DeleteMonitorW(PWSTR pName, PWSTR pEnvironment, PWSTR pMonitorName)
37 {
38 TRACE("DeleteMonitorW(%S, %S, %S)\n", pName, pEnvironment, pMonitorName);
39 UNIMPLEMENTED;
40 return FALSE;
41 }
42
43 BOOL WINAPI
44 EnumMonitorsA(PSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
45 {
46 TRACE("EnumMonitorsA(%s, %lu, %p, %lu, %p, %p)\n", pName, Level, pMonitors, cbBuf, pcbNeeded, pcReturned);
47 UNIMPLEMENTED;
48 return FALSE;
49 }
50
51 BOOL WINAPI
52 EnumMonitorsW(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
53 {
54 DWORD dwErrorCode;
55
56 TRACE("EnumMonitorsW(%S, %lu, %p, %lu, %p, %p)\n", pName, Level, pMonitors, cbBuf, pcbNeeded, pcReturned);
57
58 // Do the RPC call
59 RpcTryExcept
60 {
61 dwErrorCode = _RpcEnumMonitors(pName, Level, pMonitors, cbBuf, pcbNeeded, pcReturned);
62 }
63 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
64 {
65 dwErrorCode = RpcExceptionCode();
66 ERR("_RpcEnumPorts failed with exception code %lu!\n", dwErrorCode);
67 }
68 RpcEndExcept;
69
70 if (dwErrorCode == ERROR_SUCCESS)
71 {
72 // Replace relative offset addresses in the output by absolute pointers.
73 ASSERT(Level >= 1 && Level <= 2);
74 MarshallUpStructuresArray(cbBuf, pMonitors, *pcReturned, pMonitorInfoMarshalling[Level]->pInfo, pMonitorInfoMarshalling[Level]->cbStructureSize, TRUE);
75 }
76
77 SetLastError(dwErrorCode);
78 return (dwErrorCode == ERROR_SUCCESS);
79 }