ReactOS  0.4.15-dev-509-g96a357b
monitors.c File Reference
#include "precomp.h"
#include <marshalling/monitors.h>
Include dependency graph for monitors.c:

Go to the source code of this file.

Functions

DWORD _RpcAddMonitor (WINSPOOL_HANDLE pName, WINSPOOL_MONITOR_CONTAINER *pMonitorContainer)
 
DWORD _RpcDeleteMonitor (WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pMonitorName)
 
DWORD _RpcEnumMonitors (WINSPOOL_HANDLE pName, DWORD Level, BYTE *pMonitor, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
 

Function Documentation

◆ _RpcAddMonitor()

DWORD _RpcAddMonitor ( WINSPOOL_HANDLE  pName,
WINSPOOL_MONITOR_CONTAINER pMonitorContainer 
)

Definition at line 12 of file monitors.c.

13 {
16 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by AddMonitorW(), and pointer_default().

◆ _RpcDeleteMonitor()

DWORD _RpcDeleteMonitor ( WINSPOOL_HANDLE  pName,
WCHAR pEnvironment,
WCHAR pMonitorName 
)

Definition at line 19 of file monitors.c.

20 {
23 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by DeleteMonitorW(), and pointer_default().

◆ _RpcEnumMonitors()

DWORD _RpcEnumMonitors ( WINSPOOL_HANDLE  pName,
DWORD  Level,
BYTE pMonitor,
DWORD  cbBuf,
DWORD pcbNeeded,
DWORD pcReturned 
)

Definition at line 26 of file monitors.c.

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 
52  UndoAlignRpcPtr(pMonitor, pMonitorAligned, cbBuf, pcbNeeded);
53 
54  return dwErrorCode;
55 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
static const MARSHALLING * pMonitorInfoMarshalling[]
Definition: monitors.h:26
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EnumMonitorsW(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
Definition: monitors.c:11
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
static LPSTR pName
Definition: security.c:75
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ERR(fmt,...)
Definition: debug.h:110
PVOID WINAPI AlignRpcPtr(PVOID pBuffer, PDWORD pcbBuffer)
Definition: memory.c:29
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
PDWORD WINAPI UndoAlignRpcPtr(PVOID pDestinationBuffer, PVOID pSourceBuffer, DWORD cbBuffer, PDWORD pcbNeeded)
Definition: memory.c:239
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
BYTE * PBYTE
Definition: pedump.c:66
BOOL WINAPI MarshallDownStructuresArray(PVOID pStructuresArray, DWORD cElements, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
Definition: marshalling.c:91

Referenced by EnumMonitorsW(), and pointer_default().