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

Go to the source code of this file.

Functions

DWORD _RpcAddPort (WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR *pMonitorName)
 
DWORD _RpcAddPortEx (WINSPOOL_HANDLE pName, WINSPOOL_PORT_CONTAINER *pPortContainer, WINSPOOL_PORT_VAR_CONTAINER *pPortVarContainer, WCHAR *pMonitorName)
 
DWORD _RpcConfigurePort (WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR *pPortName)
 
DWORD _RpcDeletePort (WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR *pPortName)
 
DWORD _RpcEnumPorts (WINSPOOL_HANDLE pName, DWORD Level, BYTE *pPort, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
 
DWORD _RpcSetPort (WINSPOOL_HANDLE pName, WCHAR *pPortName, WINSPOOL_PORT_CONTAINER *pPortContainer)
 

Function Documentation

◆ _RpcAddPort()

DWORD _RpcAddPort ( WINSPOOL_HANDLE  pName,
ULONG_PTR  hWnd,
WCHAR pMonitorName 
)

Definition at line 12 of file ports.c.

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

Referenced by AddPortW(), and pointer_default().

◆ _RpcAddPortEx()

DWORD _RpcAddPortEx ( WINSPOOL_HANDLE  pName,
WINSPOOL_PORT_CONTAINER pPortContainer,
WINSPOOL_PORT_VAR_CONTAINER pPortVarContainer,
WCHAR pMonitorName 
)

Definition at line 19 of file ports.c.

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

Referenced by AddPortExW(), and pointer_default().

◆ _RpcConfigurePort()

DWORD _RpcConfigurePort ( WINSPOOL_HANDLE  pName,
ULONG_PTR  hWnd,
WCHAR pPortName 
)

Definition at line 26 of file ports.c.

27 {
30 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by ConfigurePortW(), and pointer_default().

◆ _RpcDeletePort()

DWORD _RpcDeletePort ( WINSPOOL_HANDLE  pName,
ULONG_PTR  hWnd,
WCHAR pPortName 
)

Definition at line 33 of file ports.c.

34 {
37 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by DeletePortW(), and pointer_default().

◆ _RpcEnumPorts()

DWORD _RpcEnumPorts ( WINSPOOL_HANDLE  pName,
DWORD  Level,
BYTE pPort,
DWORD  cbBuf,
DWORD pcbNeeded,
DWORD pcReturned 
)

Definition at line 40 of file ports.c.

41 {
42  DWORD dwErrorCode;
43  PBYTE pPortAligned;
44 
45  dwErrorCode = RpcImpersonateClient(NULL);
46  if (dwErrorCode != ERROR_SUCCESS)
47  {
48  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
49  return dwErrorCode;
50  }
51 
52  pPortAligned = AlignRpcPtr(pPort, &cbBuf);
53 
54  if (EnumPortsW(pName, Level, pPortAligned, cbBuf, pcbNeeded, pcReturned))
55  {
56  // Replace absolute pointer addresses in the output by relative offsets.
57  ASSERT(Level >= 1 && Level <= 2);
58  MarshallDownStructuresArray(pPortAligned, *pcReturned, pPortInfoMarshalling[Level]->pInfo, pPortInfoMarshalling[Level]->cbStructureSize, TRUE);
59  }
60  else
61  {
62  dwErrorCode = GetLastError();
63  }
64 
66  UndoAlignRpcPtr(pPort, pPortAligned, cbBuf, pcbNeeded);
67 
68  return dwErrorCode;
69 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
Definition: ports.c:11
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
static const MARSHALLING * pPortInfoMarshalling[]
Definition: ports.h:28
smooth NULL
Definition: ftsmooth.c:416
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 EnumPortsW(), and pointer_default().

◆ _RpcSetPort()

DWORD _RpcSetPort ( WINSPOOL_HANDLE  pName,
WCHAR pPortName,
WINSPOOL_PORT_CONTAINER pPortContainer 
)

Definition at line 72 of file ports.c.

73 {
76 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by pointer_default(), and SetPortW().