ReactOS 0.4.15-dev-8100-g1887773
marshalling.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _MARSHALLING_INFO
 
struct  _MARSHALLING
 

Typedefs

typedef struct _MARSHALLING_INFO MARSHALLING_INFO
 
typedef struct _MARSHALLING MARSHALLING
 

Functions

BOOL WINAPI MarshallDownStructure (PVOID pStructure, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
 
BOOL WINAPI MarshallDownStructuresArray (PVOID pStructuresArray, DWORD cElements, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
 
BOOL WINAPI MarshallUpStructure (DWORD cbSize, PVOID pStructure, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
 
BOOL WINAPI MarshallUpStructuresArray (DWORD cbSize, PVOID pStructuresArray, DWORD cElements, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
 

Typedef Documentation

◆ MARSHALLING

◆ MARSHALLING_INFO

Function Documentation

◆ MarshallDownStructure()

BOOL WINAPI MarshallDownStructure ( PVOID  pStructure,
const MARSHALLING_INFO pInfo,
DWORD  cbStructureSize,
BOOL  bSomeBoolean 
)

Definition at line 38 of file marshalling.c.

39{
40 // Sanity checks
41 if (!pStructure || !pInfo)
42 {
44 return FALSE;
45 }
46
47 // Loop until we reach an element with offset set to MAXDWORD.
48 while (pInfo->dwOffset != MAXDWORD)
49 {
50 PULONG_PTR pCurrentField = (PULONG_PTR)((PBYTE)pStructure + pInfo->dwOffset);
51
52 if (pInfo->bAdjustAddress && *pCurrentField)
53 {
54 // Make a relative offset out of the absolute pointer address.
55 *pCurrentField -= (ULONG_PTR)pStructure;
56 }
57
58 // Advance to the next field description.
59 pInfo++;
60 }
61
62 return TRUE;
63}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define ULONG_PTR
Definition: config.h:101
#define MAXDWORD
BYTE * PBYTE
Definition: pedump.c:66
uint32_t * PULONG_PTR
Definition: typedefs.h:65

Referenced by _RpcAddJob(), _RpcGetForm(), _RpcGetJob(), _RpcGetPrinter(), _RpcGetPrinterDriver(), _RpcGetPrinterDriver2(), MarshallDownStructuresArray(), and YGetPrinterDriver2().

◆ MarshallDownStructuresArray()

BOOL WINAPI MarshallDownStructuresArray ( PVOID  pStructuresArray,
DWORD  cElements,
const MARSHALLING_INFO pInfo,
DWORD  cbStructureSize,
BOOL  bSomeBoolean 
)

Definition at line 91 of file marshalling.c.

92{
93 PBYTE pCurrentElement = pStructuresArray;
94
95 // Call MarshallDownStructure on all array elements given by cElements of cbStructureSize.
96 while (cElements--)
97 {
98 if (!MarshallDownStructure(pCurrentElement, pInfo, cbStructureSize, bSomeBoolean))
99 return FALSE;
100
101 // Advance to the next array element.
102 pCurrentElement += cbStructureSize;
103 }
104
105 return TRUE;
106}
BOOL WINAPI MarshallDownStructure(PVOID pStructure, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
Definition: marshalling.c:38

Referenced by _RpcEnumForms(), _RpcEnumJobs(), _RpcEnumMonitors(), _RpcEnumPorts(), _RpcEnumPrinterDrivers(), _RpcEnumPrinters(), _RpcEnumPrintProcessorDatatypes(), _RpcEnumPrintProcessors(), and START_TEST().

◆ MarshallUpStructure()

BOOL WINAPI MarshallUpStructure ( DWORD  cbSize,
PVOID  pStructure,
const MARSHALLING_INFO pInfo,
DWORD  cbStructureSize,
BOOL  bSomeBoolean 
)

Definition at line 137 of file marshalling.c.

138{
139 // Sanity checks
140 if (!pStructure || !pInfo)
141 {
143 return FALSE;
144 }
145
146 // Loop until we reach an element with offset set to MAXDWORD.
147 while (pInfo->dwOffset != MAXDWORD)
148 {
149 PULONG_PTR pCurrentField = (PULONG_PTR)((PBYTE)pStructure + pInfo->dwOffset);
150
151 if (pInfo->bAdjustAddress && *pCurrentField)
152 {
153 // Verify that the offset in the current field is within the bounds given by cbSize.
154 if (cbSize <= *pCurrentField)
155 {
157 return FALSE;
158 }
159
160 // Make an absolute pointer address out of the relative offset.
161 *pCurrentField += (ULONG_PTR)pStructure;
162 }
163
164 // Advance to the next field description.
165 pInfo++;
166 }
167
168 return TRUE;
169}
#define ERROR_INVALID_DATA
Definition: winerror.h:116

Referenced by AddJobW(), GetFormW(), GetJobW(), GetPrinterDriverW(), GetPrinterW(), and MarshallUpStructuresArray().

◆ MarshallUpStructuresArray()

BOOL WINAPI MarshallUpStructuresArray ( DWORD  cbSize,
PVOID  pStructuresArray,
DWORD  cElements,
const MARSHALLING_INFO pInfo,
DWORD  cbStructureSize,
BOOL  bSomeBoolean 
)

Definition at line 202 of file marshalling.c.

203{
204 PBYTE pCurrentElement = pStructuresArray;
205
206 // Call MarshallUpStructure on all array elements given by cElements of cbStructureSize.
207 while (cElements--)
208 {
209 if (!MarshallUpStructure(cbSize, pCurrentElement, pInfo, cbStructureSize, bSomeBoolean))
210 return FALSE;
211
212 // Advance to the next array element.
213 pCurrentElement += cbStructureSize;
214 }
215
216 return TRUE;
217}
BOOL WINAPI MarshallUpStructure(DWORD cbSize, PVOID pStructure, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
Definition: marshalling.c:137

Referenced by EnumFormsW(), EnumJobsW(), EnumMonitorsW(), EnumPortsW(), EnumPrinterDriversW(), EnumPrintersW(), EnumPrintProcessorDatatypesW(), EnumPrintProcessorsW(), and START_TEST().