Reactos
1/*
2 * PROJECT: ReactOS Print Spooler Service
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Various initialization functions
5 * COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
6 */
7
8#include "precomp.h"
9
10DWORD
11_RpcSpoolerInit(VOID)
12{
13 DWORD dwErrorCode;
14
15 // Call SpoolerInit in the security context of the client.
16 // This delay-loads spoolss.dll in the user context and all further calls to functions in spoolss.dll will be done in the user context as well.
17 dwErrorCode = RpcImpersonateClient(NULL);
18 if (dwErrorCode != ERROR_SUCCESS)
19 {
20 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
21 return dwErrorCode;
22 }
23
24 if (!SpoolerInit())
25 dwErrorCode = GetLastError();
26
27 RpcRevertToSelf();
28 return dwErrorCode;
29}