1 /* 2 * PROJECT: ReactOS Print Spooler Service 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 DWORD 12 _RpcAddMonitor(WINSPOOL_HANDLE pName, WINSPOOL_MONITOR_CONTAINER* pMonitorContainer) 13 { 14 UNIMPLEMENTED; 15 return ERROR_INVALID_FUNCTION; 16 } 17 18 DWORD 19 _RpcDeleteMonitor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pMonitorName) 20 { 21 UNIMPLEMENTED; 22 return ERROR_INVALID_FUNCTION; 23 } 24 25 DWORD 26 _RpcEnumMonitors(WINSPOOL_HANDLE pName, DWORD Level, BYTE* pMonitor, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned) 27 { 28 DWORD dwErrorCode; 29 PBYTE pMonitorAligned; 30 31 dwErrorCode = RpcImpersonateClient(NULL); 32 if (dwErrorCode != ERROR_SUCCESS) 33 { 34 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode); 35 return dwErrorCode; 36 } 37 38 pMonitorAligned = AlignRpcPtr(pMonitor, &cbBuf); 39 40 if(EnumMonitorsW(pName, Level, pMonitorAligned, cbBuf, pcbNeeded, pcReturned)) 41 { 42 // Replace absolute pointer addresses in the output by relative offsets. 43 ASSERT(Level >= 1 && Level <= 2); 44 MarshallDownStructuresArray(pMonitorAligned, *pcReturned, pMonitorInfoMarshalling[Level]->pInfo, pMonitorInfoMarshalling[Level]->cbStructureSize, TRUE); 45 } 46 else 47 { 48 dwErrorCode = GetLastError(); 49 } 50 51 RpcRevertToSelf(); 52 UndoAlignRpcPtr(pMonitor, pMonitorAligned, cbBuf, pcbNeeded); 53 54 return dwErrorCode; 55 } 56