ReactOS  0.4.15-dev-3181-g4acf100
printproviders.c
Go to the documentation of this file.
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 Providers
5  * COPYRIGHT: Copyright 2015 Colin Finck (colin@reactos.org)
6  */
7 
8 #include "precomp.h"
9 
10 DWORD
12 {
13  DWORD dwErrorCode;
14 
15  dwErrorCode = RpcImpersonateClient(NULL);
16  if (dwErrorCode != ERROR_SUCCESS)
17  {
18  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
19  return dwErrorCode;
20  }
21 
22  if (!AddPrintProvidorW(pName, pProvidorContainer->Level, (PBYTE)pProvidorContainer->ProvidorInfo.pProvidorInfo1))
23  dwErrorCode = GetLastError();
24 
26  return dwErrorCode;
27 
28 }
29 
30 DWORD
31 _RpcDeletePrintProvidor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pPrintProviderName)
32 {
33  DWORD dwErrorCode;
34 
35  dwErrorCode = RpcImpersonateClient(NULL);
36  if (dwErrorCode != ERROR_SUCCESS)
37  {
38  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
39  return dwErrorCode;
40  }
41 
42  if (!DeletePrintProvidorW(pName, pEnvironment, pPrintProviderName))
43  dwErrorCode = GetLastError();
44 
46  return dwErrorCode;
47 }
#define ERROR_SUCCESS
Definition: deptool.c:10
union _WINSPOOL_PROVIDOR_CONTAINER::@3357 ProvidorInfo
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI AddPrintProvidorW(PWSTR pName, DWORD Level, PBYTE pProviderInfo)
WINSPOOL_PROVIDOR_INFO_1 * pProvidorInfo1
Definition: winspool.idl:727
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
DWORD _RpcAddPrintProvidor(WINSPOOL_HANDLE pName, WINSPOOL_PROVIDOR_CONTAINER *pProvidorContainer)
static LPSTR pName
Definition: security.c:75
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:110
DWORD _RpcDeletePrintProvidor(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pPrintProviderName)
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
#define NULL
Definition: types.h:112
BOOL WINAPI DeletePrintProvidorW(PWSTR pName, PWSTR pEnvironment, PWSTR pPrintProviderName)
BYTE * PBYTE
Definition: pedump.c:66
WCHAR * WINSPOOL_HANDLE
Definition: winspool.idl:15