[PRINTING] Replace all my custom marshalling code by calls to the newly implemented...
[reactos.git] / win32ss / printing / base / winspool / ports.c
1 /*
2 * PROJECT: ReactOS Spooler API
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Functions related to Ports
5 * COPYRIGHT: Copyright 2015-2018 Colin Finck (colin@reactos.org)
6 */
7
8 #include "precomp.h"
9 #include <marshalling/ports.h>
10
11 BOOL WINAPI
12 AddPortA(PSTR pName, HWND hWnd, PSTR pMonitorName)
13 {
14 TRACE("AddPortA(%s, %p, %s)\n", pName, hWnd, pMonitorName);
15 UNIMPLEMENTED;
16 return FALSE;
17 }
18
19 BOOL WINAPI
20 AddPortExA(PSTR pName, DWORD Level, PBYTE lpBuffer, PSTR lpMonitorName)
21 {
22 TRACE("AddPortExA(%s, %lu, %p, %s)\n", pName, Level, lpBuffer, lpMonitorName);
23 UNIMPLEMENTED;
24 return FALSE;
25 }
26
27 BOOL WINAPI
28 AddPortExW(PWSTR pName, DWORD Level, PBYTE lpBuffer, PWSTR lpMonitorName)
29 {
30 TRACE("AddPortExA(%S, %lu, %p, %S)\n", pName, Level, lpBuffer, lpMonitorName);
31 UNIMPLEMENTED;
32 return FALSE;
33 }
34
35 BOOL WINAPI
36 AddPortW(PWSTR pName, HWND hWnd, PWSTR pMonitorName)
37 {
38 TRACE("AddPortW(%S, %p, %S)\n", pName, hWnd, pMonitorName);
39 UNIMPLEMENTED;
40 return FALSE;
41 }
42
43 BOOL WINAPI
44 ConfigurePortA(PSTR pName, HWND hWnd, PSTR pPortName)
45 {
46 TRACE("ConfigurePortA(%s, %p, %s)\n", pName, hWnd, pPortName);
47 UNIMPLEMENTED;
48 return FALSE;
49 }
50
51 BOOL WINAPI
52 ConfigurePortW(PWSTR pName, HWND hWnd, PWSTR pPortName)
53 {
54 TRACE("ConfigurePortW(%S, %p, %S)\n", pName, hWnd, pPortName);
55 UNIMPLEMENTED;
56 return FALSE;
57 }
58
59 BOOL WINAPI
60 DeletePortA(PSTR pName, HWND hWnd, PSTR pPortName)
61 {
62 TRACE("DeletePortA(%s, %p, %s)\n", pName, hWnd, pPortName);
63 UNIMPLEMENTED;
64 return FALSE;
65 }
66
67 BOOL WINAPI
68 DeletePortW(PWSTR pName, HWND hWnd, PWSTR pPortName)
69 {
70 TRACE("DeletePortW(%S, %p, %S)\n", pName, hWnd, pPortName);
71 UNIMPLEMENTED;
72 return FALSE;
73 }
74
75 BOOL WINAPI
76 EnumPortsA(PSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
77 {
78 TRACE("EnumPortsA(%s, %lu, %p, %lu, %p, %p)\n", pName, Level, pPorts, cbBuf, pcbNeeded, pcReturned);
79 UNIMPLEMENTED;
80 return FALSE;
81 }
82
83 BOOL WINAPI
84 EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
85 {
86 DWORD dwErrorCode;
87
88 TRACE("EnumPortsW(%S, %lu, %p, %lu, %p, %p)\n", pName, Level, pPorts, cbBuf, pcbNeeded, pcReturned);
89
90 // Do the RPC call
91 RpcTryExcept
92 {
93 dwErrorCode = _RpcEnumPorts(pName, Level, pPorts, cbBuf, pcbNeeded, pcReturned);
94 }
95 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
96 {
97 dwErrorCode = RpcExceptionCode();
98 ERR("_RpcEnumPorts failed with exception code %lu!\n", dwErrorCode);
99 }
100 RpcEndExcept;
101
102 if (dwErrorCode == ERROR_SUCCESS)
103 {
104 // Replace relative offset addresses in the output by absolute pointers.
105 ASSERT(Level >= 1 && Level <= 2);
106 MarshallUpStructuresArray(cbBuf, pPorts, *pcReturned, pPortInfoMarshalling[Level]->pInfo, pPortInfoMarshalling[Level]->cbStructureSize, TRUE);
107 }
108
109 SetLastError(dwErrorCode);
110 return (dwErrorCode == ERROR_SUCCESS);
111 }
112
113 BOOL WINAPI
114 SetPortA(PSTR pName, PSTR pPortName, DWORD dwLevel, PBYTE pPortInfo)
115 {
116 TRACE("SetPortA(%s, %s, %lu, %p)\n", pName, pPortName, dwLevel, pPortInfo);
117 UNIMPLEMENTED;
118 return FALSE;
119 }
120
121 BOOL WINAPI
122 SetPortW(PWSTR pName, PWSTR pPortName, DWORD dwLevel, PBYTE pPortInfo)
123 {
124 TRACE("SetPortW(%S, %S, %lu, %p)\n", pName, pPortName, dwLevel, pPortInfo);
125 UNIMPLEMENTED;
126 return FALSE;
127 }