Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d8780c75
Commit
d8780c75
authored
Jul 19, 2005
by
Robert Shearman
Committed by
Alexandre Julliard
Jul 19, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix confusion between number of characters and number of bytes in
unmarshaling BSTRs. Convert it all to characters for consistency with the BSTR_User* routines.
parent
c0d7a25a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
20 deletions
+24
-20
tmarshal.c
dlls/oleaut32/tmarshal.c
+24
-20
No files found.
dlls/oleaut32/tmarshal.c
View file @
d8780c75
...
...
@@ -565,15 +565,18 @@ serialize_param(
if
(
writeit
)
{
/* ptr to ptr to magic widestring, basically */
BSTR
*
bstr
=
(
BSTR
*
)
*
arg
;
DWORD
len
;
if
(
!*
bstr
)
{
/* -1 means "null string" which is equivalent to empty string */
DWORD
fakelen
=
-
1
;
xbuf_add
(
buf
,
(
LPBYTE
)
&
fakelen
,
4
);
len
=
-
1
;
hres
=
xbuf_add
(
buf
,
(
LPBYTE
)
&
len
,
sizeof
(
DWORD
));
if
(
hres
)
return
hres
;
}
else
{
/* BSTRs store the length behind the first character */
DWORD
*
len
=
((
DWORD
*
)(
*
bstr
))
-
1
;
hres
=
xbuf_add
(
buf
,
(
LPBYTE
)
len
,
*
len
+
4
);
if
(
hres
)
return
hres
;
len
=
*
((
DWORD
*
)
*
bstr
-
1
)
/
sizeof
(
WCHAR
);
hres
=
xbuf_add
(
buf
,(
LPBYTE
)
&
len
,
sizeof
(
DWORD
));
if
(
hres
)
return
hres
;
hres
=
xbuf_add
(
buf
,(
LPBYTE
)
*
bstr
,
len
*
sizeof
(
WCHAR
));
if
(
hres
)
return
hres
;
}
}
...
...
@@ -592,17 +595,18 @@ serialize_param(
TRACE_
(
olerelay
)(
"<bstr NULL>"
);
}
if
(
writeit
)
{
if
(
!*
arg
)
{
DWORD
fakelen
=
-
1
;
hres
=
xbuf_add
(
buf
,(
LPBYTE
)
&
fakelen
,
4
);
if
(
hres
)
return
hres
;
BSTR
bstr
=
(
BSTR
)
*
arg
;
DWORD
len
;
if
(
!
bstr
)
{
len
=
-
1
;
hres
=
xbuf_add
(
buf
,(
LPBYTE
)
&
len
,
sizeof
(
DWORD
));
if
(
hres
)
return
hres
;
}
else
{
DWORD
*
bstr
=
((
DWORD
*
)(
*
arg
))
-
1
;
hres
=
xbuf_add
(
buf
,(
LPBYTE
)
bstr
,
bstr
[
0
]
+
4
)
;
if
(
hres
)
return
hres
;
len
=
*
((
DWORD
*
)
bstr
-
1
)
/
sizeof
(
WCHAR
)
;
hres
=
xbuf_add
(
buf
,(
LPBYTE
)
&
len
,
sizeof
(
DWORD
));
if
(
hres
)
return
hres
;
hres
=
xbuf_add
(
buf
,(
LPBYTE
)
bstr
,
len
*
sizeof
(
WCHAR
));
if
(
hres
)
return
hres
;
}
}
...
...
@@ -1139,8 +1143,8 @@ deserialize_param(
**
bstr
=
NULL
;
if
(
debugout
)
TRACE_
(
olerelay
)(
"<bstr NULL>"
);
}
else
{
str
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
+
sizeof
(
WCHAR
));
hres
=
xbuf_get
(
buf
,(
LPBYTE
)
str
,
len
);
str
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
hres
=
xbuf_get
(
buf
,(
LPBYTE
)
str
,
len
*
sizeof
(
WCHAR
)
);
if
(
hres
)
{
ERR
(
"Failed to read BSTR.
\n
"
);
return
hres
;
...
...
@@ -1169,8 +1173,8 @@ deserialize_param(
*
arg
=
0
;
if
(
debugout
)
TRACE_
(
olerelay
)(
"<bstr NULL>"
);
}
else
{
str
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
+
sizeof
(
WCHAR
));
hres
=
xbuf_get
(
buf
,(
LPBYTE
)
str
,
len
);
str
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
hres
=
xbuf_get
(
buf
,(
LPBYTE
)
str
,
len
*
sizeof
(
WCHAR
)
);
if
(
hres
)
{
ERR
(
"Failed to read BSTR.
\n
"
);
return
hres
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment