Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
680d17b4
Commit
680d17b4
authored
Dec 13, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Fix A<->W conversion when storing names in typelibs.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=52873
parent
03391aab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
25 deletions
+9
-25
typelib.c
dlls/oleaut32/typelib.c
+9
-25
No files found.
dlls/oleaut32/typelib.c
View file @
680d17b4
...
...
@@ -2252,12 +2252,12 @@ static void MSFT_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx )
if
(
size
==
-
1
){
V_BSTR
(
pVar
)
=
NULL
;
}
else
{
int
len
;
ptr
=
heap_alloc_zero
(
size
);
MSFT_Read
(
ptr
,
size
,
pcx
,
DO_NOT_SEEK
);
V_BSTR
(
pVar
)
=
SysAllocStringLen
(
NULL
,
size
);
/* FIXME: do we need a AtoW conversion here? */
V_UNION
(
pVar
,
bstrVal
[
size
])
=
'\0'
;
while
(
size
--
)
V_UNION
(
pVar
,
bstrVal
[
size
])
=
ptr
[
size
];
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ptr
,
size
,
NULL
,
0
);
V_BSTR
(
pVar
)
=
SysAllocStringLen
(
NULL
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
ptr
,
size
,
V_BSTR
(
pVar
),
len
);
heap_free
(
ptr
);
}
}
...
...
@@ -5734,23 +5734,12 @@ static HRESULT TLB_CopyElemDesc( const ELEMDESC *src, ELEMDESC *dest, char **buf
return
S_OK
;
}
static
HRESULT
TLB_SanitizeBSTR
(
BSTR
str
)
{
UINT
len
=
SysStringLen
(
str
),
i
;
for
(
i
=
0
;
i
<
len
;
++
i
)
if
(
str
[
i
]
>
0x7f
)
str
[
i
]
=
'?'
;
return
S_OK
;
}
static
HRESULT
TLB_SanitizeVariant
(
VARIANT
*
var
)
{
if
(
V_VT
(
var
)
==
VT_INT
)
return
VariantChangeType
(
var
,
var
,
0
,
VT_I4
);
else
if
(
V_VT
(
var
)
==
VT_UINT
)
return
VariantChangeType
(
var
,
var
,
0
,
VT_UI4
);
else
if
(
V_VT
(
var
)
==
VT_BSTR
)
return
TLB_SanitizeBSTR
(
V_BSTR
(
var
));
return
S_OK
;
}
...
...
@@ -9421,7 +9410,8 @@ static DWORD WMSFT_encode_variant(VARIANT *value, WMSFT_TLBFile *file)
}
case
VT_BSTR
:
{
int
i
,
len
=
(
6
+
SysStringLen
(
V_BSTR
(
&
v
))
+
3
)
&
~
0x3
;
int
mb_len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
V_BSTR
(
&
v
),
SysStringLen
(
V_BSTR
(
&
v
)),
NULL
,
0
,
NULL
,
NULL
);
int
i
,
len
=
(
6
+
mb_len
+
3
)
&
~
0x3
;
char
*
data
;
if
(
file
->
custdata_seg
.
data
){
...
...
@@ -9434,15 +9424,9 @@ static DWORD WMSFT_encode_variant(VARIANT *value, WMSFT_TLBFile *file)
}
*
((
unsigned
short
*
)
data
)
=
V_VT
(
value
);
*
((
unsigned
int
*
)(
data
+
2
))
=
SysStringLen
(
V_BSTR
(
&
v
));
for
(
i
=
0
;
i
<
SysStringLen
(
V_BSTR
(
&
v
));
i
++
)
{
if
(
V_BSTR
(
&
v
)[
i
]
<=
0x7f
)
data
[
i
+
6
]
=
V_BSTR
(
&
v
)[
i
];
else
data
[
i
+
6
]
=
'?'
;
}
WideCharToMultiByte
(
CP_ACP
,
0
,
V_BSTR
(
&
v
),
SysStringLen
(
V_BSTR
(
&
v
)),
&
data
[
6
],
len
-
6
,
NULL
,
NULL
);
for
(
i
=
6
+
SysStringLen
(
V_BSTR
(
&
v
));
i
<
len
;
i
++
)
*
((
unsigned
int
*
)(
data
+
2
))
=
mb_len
;
WideCharToMultiByte
(
CP_ACP
,
0
,
V_BSTR
(
&
v
),
SysStringLen
(
V_BSTR
(
&
v
)),
&
data
[
6
],
mb_len
,
NULL
,
NULL
);
for
(
i
=
6
+
mb_len
;
i
<
len
;
i
++
)
data
[
i
]
=
0x57
;
/* TODO: Check if the encoded data is already present in custdata_seg */
...
...
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