ReactOS 0.4.15-dev-5667-ged97270
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
 
struct  _FILE_INFO_1
 

Macros

#define RESETPRINTERDEFAULTDATATYPE   0x0001
 
#define RESETPRINTERDEFAULTDEVMODE   0x0002
 
#define PORT_IS_UNKNOWN   0
 
#define PORT_IS_LPT   1
 
#define PORT_IS_COM   2
 
#define PORT_IS_FILE   3
 
#define PORT_IS_FILENAME   4
 
#define PORT_IS_WINE   5
 
#define PORT_IS_UNIXNAME   5
 
#define PORT_IS_PIPE   6
 
#define PORT_IS_VNET   7
 
#define PORT_IS_XPS   8
 
#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
 
typedef struct _FILE_INFO_1 FILE_INFO_1
 
typedef struct _FILE_INFO_1PFILE_INFO_1
 

Functions

BOOL WINAPI AddPortExW (LPWSTR, DWORD, LPBYTE, LPWSTR)
 
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 SeekPrinter (HANDLE hPrinter, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER pliNewPointer, DWORD dwMoveMethod, BOOL bWrite)
 
BOOL WINAPI SplInitializeWinSpoolDrv (PVOID *pTable)
 
BOOL WINAPI SpoolerInit (VOID)
 
PDWORD WINAPI UndoAlignRpcPtr (PVOID pDestinationBuffer, PVOID pSourceBuffer, DWORD cbBuffer, PDWORD pcbNeeded)
 
BOOL WINAPI SplGetSpoolFileInfo (HANDLE hPrinter, HANDLE hProcessHandle, DWORD Level, FILE_INFO_1 *pFileInfo, DWORD dwSize, DWORD *dwNeeded)
 
BOOL WINAPI SplCommitSpoolData (HANDLE hPrinter, HANDLE hProcessHandle, DWORD cbCommit, DWORD Level, FILE_INFO_1 *pFileInfo, DWORD dwSize, DWORD *dwNeeded)
 
BOOL WINAPI SplCloseSpoolFileHandle (HANDLE hPrinter)
 
BOOL WINAPI GetPrinterDriverExW (HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded, DWORD dwClientMajorVersion, DWORD dwClientMinorVersion, PDWORD pdwServerMajorVersion, PDWORD pdwServerMinorVersion)
 

Macro Definition Documentation

◆ MAX_PRINTER_NAME

#define MAX_PRINTER_NAME   220

Definition at line 27 of file spoolss.h.

◆ PORT_IS_COM

#define PORT_IS_COM   2

Definition at line 16 of file spoolss.h.

◆ PORT_IS_FILE

#define PORT_IS_FILE   3

Definition at line 17 of file spoolss.h.

◆ PORT_IS_FILENAME

#define PORT_IS_FILENAME   4

Definition at line 18 of file spoolss.h.

◆ PORT_IS_LPT

#define PORT_IS_LPT   1

Definition at line 15 of file spoolss.h.

◆ PORT_IS_PIPE

#define PORT_IS_PIPE   6

Definition at line 21 of file spoolss.h.

◆ PORT_IS_UNIXNAME

#define PORT_IS_UNIXNAME   5

Definition at line 20 of file spoolss.h.

◆ PORT_IS_UNKNOWN

#define PORT_IS_UNKNOWN   0

Definition at line 14 of file spoolss.h.

◆ PORT_IS_VNET

#define PORT_IS_VNET   7

Definition at line 22 of file spoolss.h.

◆ PORT_IS_WINE

#define PORT_IS_WINE   5

Definition at line 19 of file spoolss.h.

◆ PORT_IS_XPS

#define PORT_IS_XPS   8

Definition at line 23 of file spoolss.h.

◆ RESETPRINTERDEFAULTDATATYPE

#define RESETPRINTERDEFAULTDATATYPE   0x0001

Definition at line 11 of file spoolss.h.

◆ RESETPRINTERDEFAULTDEVMODE

#define RESETPRINTERDEFAULTDEVMODE   0x0002

Definition at line 12 of file spoolss.h.

Typedef Documentation

◆ FILE_INFO_1

◆ MARSHALL_DOWN_INFO

◆ PFILE_INFO_1

◆ PMARSHALL_DOWN_INFO

◆ PPRINTER_INFO_STRESS

◆ PRINTER_INFO_STRESS

From MS-RPRN, 2.2.1.10.1

Function Documentation

◆ AddPortExW()

BOOL WINAPI AddPortExW ( LPWSTR  ,
DWORD  ,
LPBYTE  ,
LPWSTR   
)

◆ 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 ASSERT(a)
Definition: mode.c:44
#define DWORD
Definition: nt_native.h:44
PVOID pBuffer
uint32_t ULONG_PTR
Definition: typedefs.h:65
PVOID WINAPI DllAllocSplMem(DWORD dwBytes)
Definition: memory.c:95

Referenced by _RpcAddJob(), _RpcEnumForms(), _RpcEnumJobs(), _RpcEnumMonitors(), _RpcEnumPorts(), _RpcEnumPrinterDrivers(), _RpcEnumPrinters(), _RpcEnumPrintProcessorDatatypes(), _RpcEnumPrintProcessors(), _RpcGetForm(), _RpcGetJob(), _RpcGetPrinter(), _RpcGetPrinterDriver(), _RpcGetPrinterDriver2(), START_TEST(), and YGetPrinterDriver2().

◆ 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}
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define HeapAlloc
Definition: compat.h:733
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HANDLE hProcessHeap
Definition: kbswitch.c:34
uint16_t * PWSTR
Definition: typedefs.h:56
#define CopyMemory
Definition: winbase.h:1668
__wchar_t WCHAR
Definition: xmlstorage.h:180

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

◆ DllAllocSplMem()

PVOID WINAPI DllAllocSplMem ( DWORD  dwBytes)

◆ DllFreeSplMem()

BOOL WINAPI DllFreeSplMem ( PVOID  pMem)

Definition at line 112 of file memory.c.

113{
114 if ( !pMem ) return TRUE;
115 return HeapFree(hProcessHeap, 0, pMem);
116}
#define TRUE
Definition: types.h:120
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by _AddPrintProviderToList(), _ClosePortHandles(), _CreateNonspooledPort(), _HandleDeletePort(), _HandleSetDefaultCommConfig(), _InitializePrintProviderList(), _LocalClosePrinterHandle(), _LocalGetPrinterHandleData(), _LocalGetPrinterLevel0(), _LocalGetPrinterLevel1(), _LocalGetPrinterLevel2(), _LocalGetPrinterLevel4(), _LocalGetPrinterLevel5(), _LocalOpenPortHandle(), _LocalOpenPrinterHandle(), _LocalOpenXcvHandle(), _LocalSetPrinterHandleData(), _OpenEnvironment(), _RpcAddPrinterDriver(), _RpcAddPrinterDriverEx(), AddPrintMonitorList(), AllocAndRegQueryWSZ(), ClosePrinter(), ClosePrintProcessor(), ConstructXcvName(), CreateJob(), CreatePrinterFriendlyName(), CreateUIUserData(), DestroyUIUserData(), DoesPortExist(), FreeJob(), FreeMonitorUI(), GetMonitorUI(), InitializeGlobalJobList(), InitializePortList(), InitializePrinterJobList(), InitializePrinterList(), InitializePrintMonitor2(), InitializePrintMonitorList(), InitializePrintProcessorList(), LocalAddPort(), LocalClosePrinter(), LocalDeleteForm(), LocalDeleteMonitor(), LocalDeletePort(), LocalEnumPrintProcessors(), LocalmonClosePort(), LocalmonDeletePort(), LocalmonShutdown(), LocalmonXcvClosePort(), LocalOpenPrinter(), OpenPrintProcessor(), PrintingThreadProc(), PrintRawJob(), ReadJobShadowFile(), ReallocSplMem(), START_TEST(), UndoAlignRpcPtr(), and WriteJobShadowFile().

◆ DllFreeSplStr()

BOOL WINAPI DllFreeSplStr ( PWSTR  pwszString)

◆ GetPrinterDriverExW()

BOOL WINAPI GetPrinterDriverExW ( HANDLE  hPrinter,
LPWSTR  pEnvironment,
DWORD  Level,
LPBYTE  pDriverInfo,
DWORD  cbBuf,
LPDWORD  pcbNeeded,
DWORD  dwClientMajorVersion,
DWORD  dwClientMinorVersion,
PDWORD  pdwServerMajorVersion,
PDWORD  pdwServerMinorVersion 
)

Definition at line 181 of file printerdrivers.c.

192{
194
195 FIXME("GetPrinterDriverExW(%p, %lu, %lu, %p, %lu, %p, %lu, %lu, %p, %p)\n", hPrinter, pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded, dwClientMajorVersion, dwClientMinorVersion, pdwServerMajorVersion, pdwServerMinorVersion);
196
197 // Sanity checks.
198 if (!pHandle)
199 {
201 return FALSE;
202 }
203
204 if ( cbBuf && !pDriverInfo )
205 {
207 return FALSE;
208 }
209
210 return pHandle->pPrintProvider->PrintProvider.fpGetPrinterDriverEx(pHandle->hPrinter, pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded, dwClientMajorVersion, dwClientMinorVersion, pdwServerMajorVersion, pdwServerMinorVersion);
211}
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
PSPOOLSS_PRINT_PROVIDER pPrintProvider
Definition: precomp.h:46
PRINTPROVIDOR PrintProvider
Definition: precomp.h:36
struct _SPOOLSS_PRINTER_HANDLE * PSPOOLSS_PRINTER_HANDLE
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3828
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56

Referenced by _RpcGetPrinterDriver2(), and YGetPrinterDriver2().

◆ 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}
#define ULONG_PTR
Definition: config.h:101
#define MAXDWORD

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

◆ ReallocSplMem()

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

Definition at line 157 of file memory.c.

158{
159 PVOID pNewMem;
160
161 // Always allocate the new block of memory.
162 pNewMem = DllAllocSplMem(cbNew);
163 if (!pNewMem)
164 {
165 ERR("DllAllocSplMem failed!\n");
166 return NULL;
167 }
168
169 // Copy the old memory into the new block and free it.
170 if (pOldMem)
171 {
172 CopyMemory(pNewMem, pOldMem, min(cbOld, cbNew));
173 DllFreeSplMem(pOldMem);
174 }
175
176 return pNewMem;
177}
#define min(a, b)
Definition: monoChain.cc:55
BOOL WINAPI DllFreeSplMem(PVOID pMem)
Definition: memory.c:112

◆ ReallocSplStr()

BOOL WINAPI ReallocSplStr ( PWSTR ppwszString,
PCWSTR  pwszInput 
)

Definition at line 195 of file memory.c.

196{
197 if (*ppwszString)
198 DllFreeSplStr(*ppwszString);
199
200 *ppwszString = AllocSplStr(pwszInput);
201
202 return TRUE;
203}
BOOL WINAPI DllFreeSplStr(PWSTR pwszString)
Definition: memory.c:130
PWSTR WINAPI AllocSplStr(PCWSTR pwszInput)
Definition: memory.c:56

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

◆ SeekPrinter()

BOOL WINAPI SeekPrinter ( HANDLE  hPrinter,
LARGE_INTEGER  liDistanceToMove,
PLARGE_INTEGER  pliNewPointer,
DWORD  dwMoveMethod,
BOOL  bWrite 
)

Definition at line 412 of file printers.c.

413{
415
416 // Sanity checks.
417 if (!pHandle)
418 {
420 return FALSE;
421 }
422
423 return pHandle->pPrintProvider->PrintProvider.fpSeekPrinter( pHandle->hPrinter, liDistanceToMove, pliNewPointer, dwMoveMethod, bWrite );
424}

Referenced by _RpcSeekPrinter().

◆ SplCloseSpoolFileHandle()

BOOL WINAPI SplCloseSpoolFileHandle ( HANDLE  hPrinter)

Definition at line 76 of file spoolfile.c.

77{
79
80 // Sanity checks.
81 if (!pHandle)
82 {
84 return FALSE;
85 }
86
87 return pHandle->pPrintProvider->PrintProvider.fpCloseSpoolFileHandle( pHandle->hPrinter );
88}

Referenced by _RpcCloseSpoolFileHandle().

◆ SplCommitSpoolData()

BOOL WINAPI SplCommitSpoolData ( HANDLE  hPrinter,
HANDLE  hProcessHandle,
DWORD  cbCommit,
DWORD  Level,
FILE_INFO_1 pFileInfo,
DWORD  dwSize,
DWORD dwNeeded 
)

◆ SplGetSpoolFileInfo()

BOOL WINAPI SplGetSpoolFileInfo ( HANDLE  hPrinter,
HANDLE  hProcessHandle,
DWORD  Level,
FILE_INFO_1 pFileInfo,
DWORD  dwSize,
DWORD dwNeeded 
)

◆ 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 GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
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 L(x)
Definition: ntvdm.h:50
static const EHCI_PERIOD pTable[]
Definition: usbehci.c:29
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
char * LPSTR
Definition: xmlstorage.h:182

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 ERROR_SUCCESS
Definition: deptool.c:10

Referenced by _RpcSpoolerInit().

◆ UndoAlignRpcPtr()

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

Definition at line 239 of file memory.c.

240{
241 // pDestinationBuffer is accessed unless pSourceBuffer equals pDestinationBuffer or cbBuffer is 0.
242 ASSERT(pDestinationBuffer || pSourceBuffer == pDestinationBuffer || cbBuffer == 0);
243
244 // If pSourceBuffer is given, and source and destination pointers don't match,
245 // we assume that pSourceBuffer is the buffer allocated by AlignRpcPtr.
246 if (pSourceBuffer && pSourceBuffer != pDestinationBuffer)
247 {
248 // Copy back the buffer data to the (usually unaligned) destination buffer
249 // and free the buffer allocated by AlignRpcPtr.
250 CopyMemory(pDestinationBuffer, pSourceBuffer, cbBuffer);
251 DllFreeSplMem(pSourceBuffer);
252 }
253
254 // If pcbNeeded is given, align it up to a 4-byte boundary.
255 if (pcbNeeded && *pcbNeeded % sizeof(DWORD))
256 *pcbNeeded += sizeof(DWORD) - *pcbNeeded % sizeof(DWORD);
257
258 return pcbNeeded;
259}

Referenced by _RpcAddJob(), _RpcEnumForms(), _RpcEnumJobs(), _RpcEnumMonitors(), _RpcEnumPorts(), _RpcEnumPrinterDrivers(), _RpcEnumPrinters(), _RpcEnumPrintProcessorDatatypes(), _RpcEnumPrintProcessors(), _RpcGetForm(), _RpcGetJob(), _RpcGetPrinter(), _RpcGetPrinterDriver(), _RpcGetPrinterDriver2(), START_TEST(), and YGetPrinterDriver2().