ReactOS 0.4.16-dev-297-gc569aee
spoolfile.c File Reference
#include "precomp.h"
Include dependency graph for spoolfile.c:

Go to the source code of this file.

Functions

DWORD _RpcGetSpoolFileInfo (WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_HANDLE hProcessHandle, DWORD Level, WINSPOOL_FILE_INFO_1 *pFileInfo, DWORD dwSize, DWORD *dwNeeded)
 
DWORD _RpcCommitSpoolData (WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_HANDLE hProcessHandle, DWORD cbCommit, DWORD Level, WINSPOOL_FILE_INFO_1 *pFileInfo, DWORD dwSize, DWORD *dwNeeded)
 
DWORD _RpcGetSpoolFileInfo2 (WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwProcessId, DWORD Level, WINSPOOL_FILE_INFO_CONTAINER *pFileInfoContainer)
 
DWORD _RpcCommitSpoolData2 (WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwProcessId, DWORD cbCommit, DWORD Level, WINSPOOL_FILE_INFO_CONTAINER *pFileInfoContainer)
 
DWORD _RpcCloseSpoolFileHandle (WINSPOOL_PRINTER_HANDLE hPrinter)
 

Function Documentation

◆ _RpcCloseSpoolFileHandle()

DWORD _RpcCloseSpoolFileHandle ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 104 of file spoolfile.c.

105{
106 DWORD dwErrorCode;
107
108 dwErrorCode = RpcImpersonateClient(NULL);
109 if (dwErrorCode != ERROR_SUCCESS)
110 {
111 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
112 return dwErrorCode;
113 }
114
115 if (!SplCloseSpoolFileHandle( hPrinter ) )
116 dwErrorCode = GetLastError();
117
119 return dwErrorCode;
120}
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL WINAPI SplCloseSpoolFileHandle(HANDLE hPrinter)
Definition: spoolfile.c:76
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1463
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1056
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by CloseSpoolFileHandle(), and pointer_default().

◆ _RpcCommitSpoolData()

DWORD _RpcCommitSpoolData ( WINSPOOL_PRINTER_HANDLE  hPrinter,
WINSPOOL_HANDLE  hProcessHandle,
DWORD  cbCommit,
DWORD  Level,
WINSPOOL_FILE_INFO_1 pFileInfo,
DWORD  dwSize,
DWORD dwNeeded 
)

Definition at line 30 of file spoolfile.c.

31{
32 DWORD dwErrorCode;
33
34 dwErrorCode = RpcImpersonateClient(NULL);
35 if (dwErrorCode != ERROR_SUCCESS)
36 {
37 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
38 return dwErrorCode;
39 }
40
41 if (!SplCommitSpoolData( hPrinter, hProcessHandle, cbCommit, Level, (FILE_INFO_1*)pFileInfo, dwSize, dwNeeded ) )
42 dwErrorCode = GetLastError();
43
45 return dwErrorCode;
46}
BOOL WINAPI SplCommitSpoolData(HANDLE hPrinter, HANDLE hProcessHandle, DWORD cbCommit, DWORD Level, PFILE_INFO_1 pFileInfo, DWORD dwSize, DWORD *dwNeeded)
Definition: spoolfile.c:50
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56

Referenced by pointer_default().

◆ _RpcCommitSpoolData2()

DWORD _RpcCommitSpoolData2 ( WINSPOOL_PRINTER_HANDLE  hPrinter,
DWORD  dwProcessId,
DWORD  cbCommit,
DWORD  Level,
WINSPOOL_FILE_INFO_CONTAINER pFileInfoContainer 
)

Definition at line 77 of file spoolfile.c.

78{
79 DWORD dwErrorCode, dwNeeded = 0;
80 HANDLE hProcessHandle;
81
82 dwErrorCode = RpcImpersonateClient(NULL);
83 if (dwErrorCode != ERROR_SUCCESS)
84 {
85 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
86 return dwErrorCode;
87 }
88
89 hProcessHandle = OpenProcess( PROCESS_DUP_HANDLE, FALSE, dwProcessId );
90
91 if (!SplCommitSpoolData( hPrinter, hProcessHandle, cbCommit, Level, (FILE_INFO_1*)pFileInfoContainer->FileInfo.pFileInfo1, sizeof(FILE_INFO_1), &dwNeeded ) )
92 dwErrorCode = GetLastError();
93
94 if ( hProcessHandle )
95 {
96 CloseHandle( hProcessHandle );
97 }
98
100 return dwErrorCode;
101}
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
#define PROCESS_DUP_HANDLE
union _WINSPOOL_FILE_INFO_CONTAINER::@3446 FileInfo
WINSPOOL_FILE_INFO_1 * pFileInfo1
Definition: winspool.idl:852

Referenced by CommitSpoolData(), and pointer_default().

◆ _RpcGetSpoolFileInfo()

DWORD _RpcGetSpoolFileInfo ( WINSPOOL_PRINTER_HANDLE  hPrinter,
WINSPOOL_HANDLE  hProcessHandle,
DWORD  Level,
WINSPOOL_FILE_INFO_1 pFileInfo,
DWORD  dwSize,
DWORD dwNeeded 
)

Definition at line 11 of file spoolfile.c.

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 (!SplGetSpoolFileInfo( hPrinter, hProcessHandle, Level, (FILE_INFO_1*)pFileInfo, dwSize, dwNeeded ) )
23 dwErrorCode = GetLastError();
24
26 return dwErrorCode;
27}
BOOL WINAPI SplGetSpoolFileInfo(HANDLE hPrinter, HANDLE hProcessHandle, DWORD Level, PFILE_INFO_1 pFileInfo, DWORD dwSize, DWORD *dwNeeded)
Definition: spoolfile.c:11

Referenced by pointer_default().

◆ _RpcGetSpoolFileInfo2()

DWORD _RpcGetSpoolFileInfo2 ( WINSPOOL_PRINTER_HANDLE  hPrinter,
DWORD  dwProcessId,
DWORD  Level,
WINSPOOL_FILE_INFO_CONTAINER pFileInfoContainer 
)

Definition at line 49 of file spoolfile.c.

50{
51 DWORD dwErrorCode, dwNeeded = 0;
52 HANDLE hProcessHandle;
53
54 dwErrorCode = RpcImpersonateClient(NULL);
55 if (dwErrorCode != ERROR_SUCCESS)
56 {
57 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
58 return dwErrorCode;
59 }
60
61 hProcessHandle = OpenProcess( PROCESS_DUP_HANDLE, FALSE, dwProcessId );
62
63
64 if (!SplGetSpoolFileInfo( hPrinter, hProcessHandle, Level, (FILE_INFO_1*)pFileInfoContainer->FileInfo.pFileInfo1, sizeof(FILE_INFO_1), &dwNeeded ) )
65 dwErrorCode = GetLastError();
66
67 if ( hProcessHandle )
68 {
69 CloseHandle( hProcessHandle );
70 }
71
73 return dwErrorCode;
74}

Referenced by GetSpoolFileHandle(), and pointer_default().