2015-07-16 13:59:20 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Print Spooler Service
|
2017-09-29 17:18:19 +00:00
|
|
|
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
2015-07-16 13:59:20 +00:00
|
|
|
* PURPOSE: Functions related to Ports
|
2018-01-17 11:52:12 +00:00
|
|
|
* COPYRIGHT: Copyright 2015-2018 Colin Finck (colin@reactos.org)
|
2015-07-16 13:59:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
2018-01-17 11:52:12 +00:00
|
|
|
#include <marshalling/ports.h>
|
2015-07-17 10:57:10 +00:00
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcAddPort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR* pMonitorName)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcAddPortEx(WINSPOOL_HANDLE pName, WINSPOOL_PORT_CONTAINER* pPortContainer, WINSPOOL_PORT_VAR_CONTAINER* pPortVarContainer, WCHAR* pMonitorName)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcConfigurePort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR* pPortName)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcDeletePort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR* pPortName)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
2015-07-16 13:59:20 +00:00
|
|
|
DWORD
|
|
|
|
_RpcEnumPorts(WINSPOOL_HANDLE pName, DWORD Level, BYTE* pPort, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned)
|
|
|
|
{
|
|
|
|
DWORD dwErrorCode;
|
2017-07-05 15:29:13 +00:00
|
|
|
PBYTE pPortAligned;
|
2015-07-16 13:59:20 +00:00
|
|
|
|
|
|
|
dwErrorCode = RpcImpersonateClient(NULL);
|
|
|
|
if (dwErrorCode != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
|
|
|
|
return dwErrorCode;
|
|
|
|
}
|
|
|
|
|
2017-07-05 15:29:13 +00:00
|
|
|
pPortAligned = AlignRpcPtr(pPort, &cbBuf);
|
2015-07-16 13:59:20 +00:00
|
|
|
|
2017-07-05 15:29:13 +00:00
|
|
|
if (EnumPortsW(pName, Level, pPortAligned, cbBuf, pcbNeeded, pcReturned))
|
2015-07-17 10:57:10 +00:00
|
|
|
{
|
|
|
|
// Replace absolute pointer addresses in the output by relative offsets.
|
2018-01-17 11:52:12 +00:00
|
|
|
ASSERT(Level >= 1 && Level <= 2);
|
|
|
|
MarshallDownStructuresArray(pPortAligned, *pcReturned, pPortInfoMarshalling[Level]->pInfo, pPortInfoMarshalling[Level]->cbStructureSize, TRUE);
|
2017-07-05 15:29:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dwErrorCode = GetLastError();
|
2015-07-17 10:57:10 +00:00
|
|
|
}
|
|
|
|
|
2015-07-16 13:59:20 +00:00
|
|
|
RpcRevertToSelf();
|
2017-07-05 15:29:13 +00:00
|
|
|
UndoAlignRpcPtr(pPort, pPortAligned, cbBuf, pcbNeeded);
|
|
|
|
|
2015-07-16 13:59:20 +00:00
|
|
|
return dwErrorCode;
|
|
|
|
}
|
2015-07-17 10:57:10 +00:00
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcSetPort(WINSPOOL_HANDLE pName, WCHAR* pPortName, WINSPOOL_PORT_CONTAINER* pPortContainer)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|