ReactOS
0.4.16-dev-297-gc569aee
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
_
c
d
e
f
g
h
i
l
n
o
p
s
t
u
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
_
c
d
f
i
l
m
o
p
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
x
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
tools.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: Miscellaneous tool functions
5
* COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
6
*/
7
8
#include "
precomp.h
"
9
10
38
PBYTE
WINAPI
39
PackStrings
(
PCWSTR
* pSource,
PBYTE
pDest,
const
DWORD
* DestOffsets,
PBYTE
pEnd)
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
}
PackStrings
PBYTE WINAPI PackStrings(PCWSTR *pSource, PBYTE pDest, const DWORD *DestOffsets, PBYTE pEnd)
Definition:
tools.c:39
ULONG_PTR
#define ULONG_PTR
Definition:
config.h:101
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
wcslen
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
MAXDWORD
#define MAXDWORD
PBYTE
BYTE * PBYTE
Definition:
pedump.c:66
PCWSTR
const uint16_t * PCWSTR
Definition:
typedefs.h:57
ULONG_PTR
uint32_t ULONG_PTR
Definition:
typedefs.h:65
precomp.h
CopyMemory
#define CopyMemory
Definition:
winbase.h:1735
WINAPI
#define WINAPI
Definition:
msvc.h:6
WCHAR
__wchar_t WCHAR
Definition:
xmlstorage.h:180
win32ss
printing
base
spoolss
tools.c
Generated on Wed Nov 27 2024 06:15:19 for ReactOS by
1.9.6