2 * PROJECT: ReactOS Print Spooler Service
3 * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
4 * PURPOSE: Functions related to Print Monitors
5 * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
11 _MarshallDownMonitorInfo(PBYTE pMonitorInfo
, DWORD Level
)
13 PMONITOR_INFO_2W pMonitorInfo2
= (PMONITOR_INFO_2W
)pMonitorInfo
; // MONITOR_INFO_1W is a subset of MONITOR_INFO_2W
15 // Replace absolute pointer addresses in the output by relative offsets.
16 pMonitorInfo2
->pName
= (PWSTR
)((ULONG_PTR
)pMonitorInfo2
->pName
- (ULONG_PTR
)pMonitorInfo2
);
20 pMonitorInfo2
->pDLLName
= (PWSTR
)((ULONG_PTR
)pMonitorInfo2
->pDLLName
- (ULONG_PTR
)pMonitorInfo2
);
21 pMonitorInfo2
->pEnvironment
= (PWSTR
)((ULONG_PTR
)pMonitorInfo2
->pEnvironment
- (ULONG_PTR
)pMonitorInfo2
);
26 _RpcAddMonitor(WINSPOOL_HANDLE pName
, WINSPOOL_MONITOR_CONTAINER
* pMonitorContainer
)
29 return ERROR_INVALID_FUNCTION
;
33 _RpcDeleteMonitor(WINSPOOL_HANDLE pName
, WCHAR
* pEnvironment
, WCHAR
* pMonitorName
)
36 return ERROR_INVALID_FUNCTION
;
40 _RpcEnumMonitors(WINSPOOL_HANDLE pName
, DWORD Level
, BYTE
* pMonitor
, DWORD cbBuf
, DWORD
* pcbNeeded
, DWORD
* pcReturned
)
46 dwErrorCode
= RpcImpersonateClient(NULL
);
47 if (dwErrorCode
!= ERROR_SUCCESS
)
49 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode
);
53 EnumMonitorsW(pName
, Level
, pMonitor
, cbBuf
, pcbNeeded
, pcReturned
);
54 dwErrorCode
= GetLastError();
56 if (dwErrorCode
== ERROR_SUCCESS
)
58 // Replace absolute pointer addresses in the output by relative offsets.
59 for (i
= 0; i
< *pcReturned
; i
++)
61 _MarshallDownMonitorInfo(p
, Level
);
64 p
+= sizeof(MONITOR_INFO_1W
);
66 p
+= sizeof(MONITOR_INFO_2W
);