ReactOS  0.4.15-dev-1068-g467feb9
spoolfile.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Spooler Router
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Functions related to Spool File
5  * COPYRIGHT: Copyright 1998-2022 ReactOS
6  */
7 
8 #include "precomp.h"
9 
12  HANDLE hPrinter,
13  HANDLE hProcessHandle,
14  DWORD Level,
15  PFILE_INFO_1 pFileInfo,
16  DWORD dwSize,
17  DWORD* dwNeeded )
18 {
19  BOOL Ret;
20  HANDLE hHandle, hSourceProcessHandle;
22 
23  // Sanity checks.
24  if (!pHandle)
25  {
27  return FALSE;
28  }
29 
30  hSourceProcessHandle = GetCurrentProcess();
31 
32  // No Local? Ok, what ever...
33 
34  Ret = pHandle->pPrintProvider->PrintProvider.fpGetSpoolFileInfo( pHandle->hPrinter,
35  NULL,
36  &hHandle,
37  hProcessHandle,
38  hSourceProcessHandle );
39  if ( Ret )
40  {
41  pFileInfo->hSpoolFileHandle = hHandle;
42  pFileInfo->bInheritHandle = TRUE;
43  pFileInfo->dwOptions = DUPLICATE_CLOSE_SOURCE;
44  }
45 
46  return Ret;
47 }
48 
51  HANDLE hPrinter,
52  HANDLE hProcessHandle,
53  DWORD cbCommit,
54  DWORD Level,
55  PFILE_INFO_1 pFileInfo,
56  DWORD dwSize,
57  DWORD* dwNeeded )
58 {
60 
61  // Sanity checks.
62  if (!pHandle)
63  {
65  return FALSE;
66  }
67 
69  pFileInfo->bInheritHandle = TRUE;
70  pFileInfo->dwOptions = DUPLICATE_CLOSE_SOURCE;
71 
72  return pHandle->pPrintProvider->PrintProvider.fpCommitSpoolData( hPrinter, cbCommit );
73 }
74 
77 {
79 
80  // Sanity checks.
81  if (!pHandle)
82  {
84  return FALSE;
85  }
86 
87  return pHandle->pPrintProvider->PrintProvider.fpCloseSpoolFileHandle( pHandle->hPrinter );
88 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define DUPLICATE_CLOSE_SOURCE
HANDLE hSpoolFileHandle
Definition: spoolss.h:78
#define TRUE
Definition: types.h:120
BOOL WINAPI SplCommitSpoolData(HANDLE hPrinter, HANDLE hProcessHandle, DWORD cbCommit, DWORD Level, PFILE_INFO_1 pFileInfo, DWORD dwSize, DWORD *dwNeeded)
Definition: spoolfile.c:50
DWORD dwOptions
Definition: spoolss.h:79
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
struct _SPOOLSS_PRINTER_HANDLE * PSPOOLSS_PRINTER_HANDLE
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI SplCloseSpoolFileHandle(HANDLE hPrinter)
Definition: spoolfile.c:76
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SplGetSpoolFileInfo(HANDLE hPrinter, HANDLE hProcessHandle, DWORD Level, PFILE_INFO_1 pFileInfo, DWORD dwSize, DWORD *dwNeeded)
Definition: spoolfile.c:11
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:500
#define GetCurrentProcess()
Definition: compat.h:507
PRINTPROVIDOR PrintProvider
Definition: precomp.h:36
BOOL bInheritHandle
Definition: spoolss.h:77
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
PSPOOLSS_PRINT_PROVIDER pPrintProvider
Definition: precomp.h:46