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
2ac287e8
Commit
2ac287e8
authored
Jan 09, 2004
by
Marcus Meissner
Committed by
Alexandre Julliard
Jan 09, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy BSTRs byte wise.
Added a testcase for byte wise copy of VT_BSTR variant with VariantCopy().
parent
e24d3fec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
safearray.c
dlls/oleaut32/safearray.c
+3
-3
vartype.c
dlls/oleaut32/tests/vartype.c
+12
-0
variant.c
dlls/oleaut32/variant.c
+2
-2
No files found.
dlls/oleaut32/safearray.c
View file @
2ac287e8
...
...
@@ -383,7 +383,7 @@ static HRESULT SAFEARRAY_CopyData(SAFEARRAY *psa, SAFEARRAY *dest)
{
if
(
*
lpBstr
)
{
*
lpDest
=
SysAllocString
Len
(
*
lpBstr
,
SysString
Len
(
*
lpBstr
));
*
lpDest
=
SysAllocString
ByteLen
((
char
*
)
*
lpBstr
,
SysStringByte
Len
(
*
lpBstr
));
if
(
!*
lpDest
)
return
E_OUTOFMEMORY
;
}
...
...
@@ -887,7 +887,7 @@ HRESULT WINAPI SafeArrayPutElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
if
(
lpBstr
)
{
*
lpDest
=
SysAllocString
Len
(
lpBstr
,
SysString
Len
(
lpBstr
));
*
lpDest
=
SysAllocString
ByteLen
((
char
*
)
lpBstr
,
SysStringByte
Len
(
lpBstr
));
if
(
!*
lpDest
)
hRet
=
E_OUTOFMEMORY
;
}
...
...
@@ -968,7 +968,7 @@ HRESULT WINAPI SafeArrayGetElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
if
(
*
lpBstr
)
{
*
lpDest
=
SysAllocString
Len
(
*
lpBstr
,
SysString
Len
(
*
lpBstr
));
*
lpDest
=
SysAllocString
ByteLen
((
char
*
)
*
lpBstr
,
SysStringByte
Len
(
*
lpBstr
));
if
(
!*
lpBstr
)
hRet
=
E_OUTOFMEMORY
;
}
...
...
dlls/oleaut32/tests/vartype.c
View file @
2ac287e8
...
...
@@ -4607,6 +4607,7 @@ static void test_SysAllocStringByteLen()
const
OLECHAR
szTest
[
10
]
=
{
'T'
,
'e'
,
's'
,
't'
,
'\0'
};
const
CHAR
szTestA
[
6
]
=
{
'T'
,
'e'
,
's'
,
't'
,
'\0'
,
'?'
};
BSTR
str
;
HRESULT
hres
;
str
=
SysAllocStringByteLen
(
szTestA
,
0x80000000
);
ok
(
str
==
NULL
,
"Expected NULL, got %p
\n
"
,
str
);
...
...
@@ -4640,9 +4641,20 @@ static void test_SysAllocStringByteLen()
{
const
CHAR
szTestTruncA
[
4
]
=
{
'T'
,
'e'
,
's'
,
'\0'
};
LPINTERNAL_BSTR
bstr
=
Get
(
str
);
VARIANT
vt1
,
vt2
;
ok
(
bstr
->
dwLen
==
3
,
"Expected 3, got %ld
\n
"
,
bstr
->
dwLen
);
ok
(
!
lstrcmpA
((
LPCSTR
)
bstr
->
szString
,
szTestTruncA
),
"String different
\n
"
);
V_VT
(
&
vt1
)
=
VT_BSTR
;
V_BSTR
(
&
vt1
)
=
str
;
V_VT
(
&
vt2
)
=
VT_EMPTY
;
hres
=
VariantCopy
(
&
vt2
,
&
vt1
);
ok
(
hres
==
S_OK
,
"Failed to copy binary bstring with hres 0x%08lx
\n
"
,
hres
);
bstr
=
Get
(
V_BSTR
(
&
vt2
));
ok
(
bstr
->
dwLen
==
3
,
"Expected 3, got %ld
\n
"
,
bstr
->
dwLen
);
ok
(
!
lstrcmpA
((
LPCSTR
)
bstr
->
szString
,
szTestTruncA
),
"String different
\n
"
);
SysFreeString
(
str
);
}
...
...
dlls/oleaut32/variant.c
View file @
2ac287e8
...
...
@@ -727,7 +727,7 @@ HRESULT WINAPI VariantCopy(VARIANTARG* pvargDest, VARIANTARG* pvargSrc)
{
if
(
V_BSTR
(
pvargSrc
))
{
V_BSTR
(
pvargDest
)
=
SysAllocString
Len
(
V_BSTR
(
pvargSrc
),
SysString
Len
(
V_BSTR
(
pvargSrc
)));
V_BSTR
(
pvargDest
)
=
SysAllocString
ByteLen
((
char
*
)
V_BSTR
(
pvargSrc
),
SysStringByte
Len
(
V_BSTR
(
pvargSrc
)));
if
(
!
V_BSTR
(
pvargDest
))
hres
=
E_OUTOFMEMORY
;
}
...
...
@@ -852,7 +852,7 @@ HRESULT WINAPI VariantCopyInd(VARIANT* pvargDest, VARIANTARG* pvargSrc)
else
if
(
V_VT
(
pSrc
)
==
(
VT_BSTR
|
VT_BYREF
))
{
/* Native doesn't check that *V_BSTRREF(pSrc) is valid */
V_BSTR
(
pvargDest
)
=
SysAllocString
Len
(
*
V_BSTRREF
(
pSrc
),
SysString
Len
(
*
V_BSTRREF
(
pSrc
)));
V_BSTR
(
pvargDest
)
=
SysAllocString
ByteLen
((
char
*
)
*
V_BSTRREF
(
pSrc
),
SysStringByte
Len
(
*
V_BSTRREF
(
pSrc
)));
}
else
if
(
V_VT
(
pSrc
)
==
(
VT_RECORD
|
VT_BYREF
))
{
...
...
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