ReactOS  0.4.14-dev-1256-g2125fec
spoolss.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _MARSHALL_DOWN_INFO
 
struct  _PRINTER_INFO_STRESS
 

Macros

#define MAX_PRINTER_NAME   220
 

Typedefs

typedef struct _MARSHALL_DOWN_INFO MARSHALL_DOWN_INFO
 
typedef struct _MARSHALL_DOWN_INFOPMARSHALL_DOWN_INFO
 
typedef struct _PRINTER_INFO_STRESS PRINTER_INFO_STRESS
 
typedef struct _PRINTER_INFO_STRESSPPRINTER_INFO_STRESS
 

Functions

PVOID WINAPI AlignRpcPtr (PVOID pBuffer, PDWORD pcbBuffer)
 
PWSTR WINAPI AllocSplStr (PCWSTR pwszInput)
 
PVOID WINAPI DllAllocSplMem (DWORD dwBytes)
 
BOOL WINAPI DllFreeSplMem (PVOID pMem)
 
BOOL WINAPI DllFreeSplStr (PWSTR pwszString)
 
BOOL WINAPI InitializeRouter (HANDLE SpoolerStatusHandle)
 
PBYTE WINAPI PackStrings (PCWSTR *pSource, PBYTE pDest, const DWORD *DestOffsets, PBYTE pEnd)
 
PVOID WINAPI ReallocSplMem (PVOID pOldMem, DWORD cbOld, DWORD cbNew)
 
BOOL WINAPI ReallocSplStr (PWSTR *ppwszString, PCWSTR pwszInput)
 
BOOL WINAPI SplInitializeWinSpoolDrv (PVOID *pTable)
 
BOOL WINAPI SpoolerInit (VOID)
 
PDWORD WINAPI UndoAlignRpcPtr (PVOID pDestinationBuffer, PVOID pSourceBuffer, DWORD cbBuffer, PDWORD pcbNeeded)
 

Macro Definition Documentation

◆ MAX_PRINTER_NAME

#define MAX_PRINTER_NAME   220

Definition at line 12 of file spoolss.h.

Typedef Documentation

◆ MARSHALL_DOWN_INFO

◆ PMARSHALL_DOWN_INFO

◆ PPRINTER_INFO_STRESS

◆ PRINTER_INFO_STRESS

From MS-RPRN, 2.2.1.10.1

Function Documentation

◆ AlignRpcPtr()

PVOID WINAPI AlignRpcPtr ( PVOID  pBuffer,
PDWORD  pcbBuffer 
)

Definition at line 29 of file memory.c.

30 {
31  ASSERT(pcbBuffer);
32 
33  // Align down the buffer size in pcbBuffer to a 4-byte boundary.
34  *pcbBuffer -= *pcbBuffer % sizeof(DWORD);
35 
36  // Check if pBuffer is 4-byte aligned. If not, allocate a 4-byte aligned buffer.
37  if ((ULONG_PTR)pBuffer % sizeof(DWORD))
38  pBuffer = DllAllocSplMem(*pcbBuffer);
39 
40  return pBuffer;
41 }
#define DWORD
Definition: nt_native.h:44
uint32_t ULONG_PTR
Definition: typedefs.h:64
PVOID pBuffer
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PVOID WINAPI DllAllocSplMem(DWORD dwBytes)
Definition: memory.c:95

Referenced by _RpcAddJob(), _RpcEnumJobs(), _RpcEnumMonitors(), _RpcEnumPorts(), _RpcEnumPrinters(), _RpcEnumPrintProcessorDatatypes(), _RpcEnumPrintProcessors(), _RpcGetJob(), _RpcGetPrinter(), _RpcGetPrinterDriver(), and START_TEST().

◆ AllocSplStr()

PWSTR WINAPI AllocSplStr ( PCWSTR  pwszInput)

Definition at line 56 of file memory.c.

57 {
58  DWORD cbInput;
59  PWSTR pwszOutput;
60 
61  // Sanity check
62  if (!pwszInput)
63  return NULL;
64 
65  // Get the length of the input string.
66  cbInput = (wcslen(pwszInput) + 1) * sizeof(WCHAR);
67 
68  // Allocate it. We don't use DllAllocSplMem here, because it unnecessarily zeroes the memory.
69  pwszOutput = HeapAlloc(hProcessHeap, 0, cbInput);
70  if (!pwszOutput)
71  {
72  ERR("HeapAlloc failed!\n");
73  return NULL;
74  }
75 
76  // Copy the string and return it.
77  CopyMemory(pwszOutput, pwszInput, cbInput);
78  return pwszOutput;
79 }
uint16_t * PWSTR
Definition: typedefs.h:55
smooth NULL
Definition: ftsmooth.c:416
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1646
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:109
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HANDLE hProcessHeap
Definition: kbswitch.c:25

Referenced by _CreateNonspooledPort(), _LocalOpenPrinterHandle(), CreateJob(), InitializePrinterList(), OpenPrintProcessor(), ReadJobShadowFile(), ReallocSplStr(), and START_TEST().

◆ DllAllocSplMem()

◆ DllFreeSplMem()

◆ DllFreeSplStr()

BOOL WINAPI DllFreeSplStr ( PWSTR  pwszString)

Definition at line 129 of file memory.c.

130 {
131  return HeapFree(hProcessHeap, 0, pwszString);
132 }
#define HeapFree(x, y, z)
Definition: compat.h:402
HANDLE hProcessHeap
Definition: kbswitch.c:25

Referenced by _ClosePortHandles(), _CreateNonspooledPort(), _LocalClosePrinterHandle(), _LocalOpenPrinterHandle(), ClosePrintProcessor(), FreeJob(), InitializePrinterList(), InitializePrintProcessorList(), and ReallocSplStr().

◆ InitializeRouter()

BOOL WINAPI InitializeRouter ( HANDLE  SpoolerStatusHandle)

Definition at line 199 of file main.c.

200 {
202 }
static BOOL _InitializePrintProviderList(VOID)
Definition: main.c:73

Referenced by _ServiceMain().

◆ PackStrings()

PBYTE WINAPI PackStrings ( PCWSTR pSource,
PBYTE  pDest,
const DWORD DestOffsets,
PBYTE  pEnd 
)

Definition at line 39 of file tools.c.

40 {
41  DWORD cbString;
42  ULONG_PTR StringAddress;
43 
44  // Loop until we reach an element with offset set to MAXDWORD.
45  while (*DestOffsets != MAXDWORD)
46  {
47  StringAddress = 0;
48 
49  if (*pSource)
50  {
51  // Determine the length of the source string.
52  cbString = (wcslen(*pSource) + 1) * sizeof(WCHAR);
53 
54  // Copy it before the last string.
55  pEnd -= cbString;
56  StringAddress = (ULONG_PTR)pEnd;
57  CopyMemory(pEnd, *pSource, cbString);
58  }
59 
60  // Copy the address of the copied string to the location given by the offset.
61  CopyMemory(&pDest[*DestOffsets], &StringAddress, sizeof(ULONG_PTR));
62 
63  // Advance to the next source string and destination offset.
64  pSource++;
65  DestOffsets++;
66  }
67 
68  // pEnd is now at the last string we copied. Return this value as a pointer to the beginning of all strings in the output buffer.
69  return pEnd;
70 }
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define MAXDWORD
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1646
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ULONG_PTR
Definition: config.h:101
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by _DumpLevel1PrintProviderInformation(), _LocalGetJobLevel1(), _LocalGetJobLevel2(), _LocalGetMonitorLevel1(), _LocalGetMonitorLevel2(), _LocalGetPrinterDriverLevel1(), _LocalGetPrinterDriverLevel2(), _LocalGetPrinterDriverLevel3(), _LocalGetPrinterDriverLevel4(), _LocalGetPrinterDriverLevel5(), _LocalGetPrinterLevel0(), _LocalGetPrinterLevel1(), _LocalGetPrinterLevel2(), _LocalGetPrinterLevel4(), _LocalGetPrinterLevel5(), _LocalmonGetPortLevel1(), _LocalmonGetPortLevel2(), EnumPrintProcessorDatatypesW(), and START_TEST().

◆ ReallocSplMem()

PVOID WINAPI ReallocSplMem ( PVOID  pOldMem,
DWORD  cbOld,
DWORD  cbNew 
)

Definition at line 154 of file memory.c.

155 {
156  PVOID pNewMem;
157 
158  // Always allocate the new block of memory.
159  pNewMem = DllAllocSplMem(cbNew);
160  if (!pNewMem)
161  {
162  ERR("DllAllocSplMem failed!\n");
163  return NULL;
164  }
165 
166  // Copy the old memory into the new block and free it.
167  if (pOldMem)
168  {
169  CopyMemory(pNewMem, pOldMem, min(cbOld, cbNew));
170  DllFreeSplMem(pOldMem);
171  }
172 
173  return pNewMem;
174 }
BOOL WINAPI DllFreeSplMem(PVOID pMem)
Definition: memory.c:112
smooth NULL
Definition: ftsmooth.c:416
#define CopyMemory
Definition: winbase.h:1646
#define ERR(fmt,...)
Definition: debug.h:109
#define min(a, b)
Definition: monoChain.cc:55
PVOID WINAPI DllAllocSplMem(DWORD dwBytes)
Definition: memory.c:95

◆ ReallocSplStr()

BOOL WINAPI ReallocSplStr ( PWSTR ppwszString,
PCWSTR  pwszInput 
)

Definition at line 192 of file memory.c.

193 {
194  if (*ppwszString)
195  DllFreeSplStr(*ppwszString);
196 
197  *ppwszString = AllocSplStr(pwszInput);
198 
199  return TRUE;
200 }
PWSTR WINAPI AllocSplStr(PCWSTR pwszInput)
Definition: memory.c:56
#define TRUE
Definition: types.h:120
BOOL WINAPI DllFreeSplStr(PWSTR pwszString)
Definition: memory.c:129

Referenced by _LocalSetJobLevel1(), _LocalSetJobLevel2(), LocalStartDocPrinter(), and START_TEST().

◆ SplInitializeWinSpoolDrv()

BOOL WINAPI SplInitializeWinSpoolDrv ( PVOID pTable)

Definition at line 205 of file main.c.

206 {
207  HINSTANCE hWinspool;
208  int i;
209 
210  hWinspool = LoadLibraryW(L"winspool.drv");
211  if (!hWinspool)
212  {
213  ERR("Could not load winspool.drv, last error is %lu!\n", GetLastError());
214  return FALSE;
215  }
216 
217  // Get the function pointers which are meant to be returned by this function.
218  pTable[0] = GetProcAddress(hWinspool, "OpenPrinterW");
219  pTable[1] = GetProcAddress(hWinspool, "ClosePrinter");
220  pTable[2] = GetProcAddress(hWinspool, "SpoolerDevQueryPrintW");
221  pTable[3] = GetProcAddress(hWinspool, "SpoolerPrinterEvent");
222  pTable[4] = GetProcAddress(hWinspool, "DocumentPropertiesW");
223  pTable[5] = GetProcAddress(hWinspool, (LPSTR)212);
224  pTable[6] = GetProcAddress(hWinspool, (LPSTR)213);
225  pTable[7] = GetProcAddress(hWinspool, (LPSTR)214);
226  pTable[8] = GetProcAddress(hWinspool, (LPSTR)215);
227 
228  // Verify that all calls succeeded.
229  for (i = 0; i < 9; i++)
230  {
231  if (!pTable[i])
232  {
233  FreeLibrary(hWinspool);
234  return FALSE;
235  }
236  }
237 
238  return TRUE;
239 }
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
char * LPSTR
Definition: xmlstorage.h:182
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LoadLibraryW(x)
Definition: compat.h:412
#define FreeLibrary(x)
Definition: compat.h:413
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:109
#define GetProcAddress(x, y)
Definition: compat.h:418
static const EHCI_PERIOD pTable[]
Definition: usbehci.c:29

Referenced by START_TEST().

◆ SpoolerInit()

BOOL WINAPI SpoolerInit ( VOID  )

Definition at line 248 of file main.c.

249 {
250  // Nothing to do here yet
252  return TRUE;
253 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SetLastError(x)
Definition: compat.h:417

Referenced by _RpcSpoolerInit().

◆ UndoAlignRpcPtr()

PDWORD WINAPI UndoAlignRpcPtr ( PVOID  pDestinationBuffer,
PVOID  pSourceBuffer,
DWORD  cbBuffer,
PDWORD  pcbNeeded 
)

Definition at line 236 of file memory.c.

237 {
238  // pDestinationBuffer is accessed unless pSourceBuffer equals pDestinationBuffer or cbBuffer is 0.
239  ASSERT(pDestinationBuffer || pSourceBuffer == pDestinationBuffer || cbBuffer == 0);
240 
241  // If pSourceBuffer is given, and source and destination pointers don't match,
242  // we assume that pSourceBuffer is the buffer allocated by AlignRpcPtr.
243  if (pSourceBuffer && pSourceBuffer != pDestinationBuffer)
244  {
245  // Copy back the buffer data to the (usually unaligned) destination buffer
246  // and free the buffer allocated by AlignRpcPtr.
247  CopyMemory(pDestinationBuffer, pSourceBuffer, cbBuffer);
248  DllFreeSplMem(pSourceBuffer);
249  }
250 
251  // If pcbNeeded is given, align it up to a 4-byte boundary.
252  if (pcbNeeded && *pcbNeeded % sizeof(DWORD))
253  *pcbNeeded += sizeof(DWORD) - *pcbNeeded % sizeof(DWORD);
254 
255  return pcbNeeded;
256 }
BOOL WINAPI DllFreeSplMem(PVOID pMem)
Definition: memory.c:112
#define DWORD
Definition: nt_native.h:44
#define CopyMemory
Definition: winbase.h:1646
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827

Referenced by _RpcAddJob(), _RpcEnumJobs(), _RpcEnumMonitors(), _RpcEnumPorts(), _RpcEnumPrinters(), _RpcEnumPrintProcessorDatatypes(), _RpcEnumPrintProcessors(), _RpcGetJob(), _RpcGetPrinter(), _RpcGetPrinterDriver(), and START_TEST().