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
d0f4487c
Commit
d0f4487c
authored
Mar 25, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf: Fix string array access for registration data helpers.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e121a552
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
main.c
dlls/mf/main.c
+9
-8
No files found.
dlls/mf/main.c
View file @
d0f4487c
...
@@ -1090,7 +1090,7 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
...
@@ -1090,7 +1090,7 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
return
TRUE
;
return
TRUE
;
}
}
static
HRESULT
prop_string_vector_append
(
PROPVARIANT
*
vector
,
unsigned
int
*
c
ount
,
BOOL
unique
,
const
WCHAR
*
str
)
static
HRESULT
prop_string_vector_append
(
PROPVARIANT
*
vector
,
unsigned
int
*
c
apacity
,
BOOL
unique
,
const
WCHAR
*
str
)
{
{
WCHAR
*
ptrW
;
WCHAR
*
ptrW
;
int
len
,
i
;
int
len
,
i
;
...
@@ -1104,17 +1104,17 @@ static HRESULT prop_string_vector_append(PROPVARIANT *vector, unsigned int *coun
...
@@ -1104,17 +1104,17 @@ static HRESULT prop_string_vector_append(PROPVARIANT *vector, unsigned int *coun
}
}
}
}
if
(
!
vector
->
calpwstr
.
cElems
||
*
count
>
vector
->
calpwstr
.
cElems
-
1
)
if
(
!
*
capacity
||
*
capacity
-
1
<
vector
->
calpwstr
.
cElems
)
{
{
unsigned
int
new_count
;
unsigned
int
new_count
;
WCHAR
**
ptr
;
WCHAR
**
ptr
;
new_count
=
*
c
ount
?
*
count
*
2
:
10
;
new_count
=
*
c
apacity
?
*
capacity
*
2
:
10
;
ptr
=
CoTaskMemRealloc
(
vector
->
calpwstr
.
pElems
,
new_count
*
sizeof
(
*
vector
->
calpwstr
.
pElems
));
ptr
=
CoTaskMemRealloc
(
vector
->
calpwstr
.
pElems
,
new_count
*
sizeof
(
*
vector
->
calpwstr
.
pElems
));
if
(
!
ptr
)
if
(
!
ptr
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
vector
->
calpwstr
.
pElems
=
ptr
;
vector
->
calpwstr
.
pElems
=
ptr
;
*
c
ount
=
new_count
;
*
c
apacity
=
new_count
;
}
}
len
=
lstrlenW
(
str
);
len
=
lstrlenW
(
str
);
...
@@ -1129,12 +1129,14 @@ static HRESULT prop_string_vector_append(PROPVARIANT *vector, unsigned int *coun
...
@@ -1129,12 +1129,14 @@ static HRESULT prop_string_vector_append(PROPVARIANT *vector, unsigned int *coun
static
int
__cdecl
qsort_string_compare
(
const
void
*
a
,
const
void
*
b
)
static
int
__cdecl
qsort_string_compare
(
const
void
*
a
,
const
void
*
b
)
{
{
return
lstrcmpW
(
a
,
b
);
const
WCHAR
*
left
=
*
(
const
WCHAR
**
)
a
,
*
right
=
*
(
const
WCHAR
**
)
b
;
return
lstrcmpW
(
left
,
right
);
}
}
static
HRESULT
mf_get_handler_strings
(
const
WCHAR
*
path
,
WCHAR
filter
,
unsigned
int
maxlen
,
PROPVARIANT
*
dst
)
static
HRESULT
mf_get_handler_strings
(
const
WCHAR
*
path
,
WCHAR
filter
,
unsigned
int
maxlen
,
PROPVARIANT
*
dst
)
{
{
static
const
HKEY
hkey_roots
[
2
]
=
{
HKEY_CURRENT_USER
,
HKEY_LOCAL_MACHINE
};
static
const
HKEY
hkey_roots
[
2
]
=
{
HKEY_CURRENT_USER
,
HKEY_LOCAL_MACHINE
};
unsigned
int
capacity
=
0
,
count
,
size
;
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
int
i
,
index
;
int
i
,
index
;
WCHAR
*
buffW
;
WCHAR
*
buffW
;
...
@@ -1148,8 +1150,6 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned
...
@@ -1148,8 +1150,6 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
hkey_roots
);
++
i
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
hkey_roots
);
++
i
)
{
{
unsigned
int
count
;
DWORD
size
;
HKEY
hkey
;
HKEY
hkey
;
if
(
RegOpenKeyW
(
hkey_roots
[
i
],
path
,
&
hkey
))
if
(
RegOpenKeyW
(
hkey_roots
[
i
],
path
,
&
hkey
))
...
@@ -1162,7 +1162,8 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned
...
@@ -1162,7 +1162,8 @@ static HRESULT mf_get_handler_strings(const WCHAR *path, WCHAR filter, unsigned
{
{
if
(
filter
&&
!
wcschr
(
buffW
,
filter
))
if
(
filter
&&
!
wcschr
(
buffW
,
filter
))
continue
;
continue
;
if
(
FAILED
(
hr
=
prop_string_vector_append
(
dst
,
&
count
,
i
>
0
,
buffW
)))
if
(
FAILED
(
hr
=
prop_string_vector_append
(
dst
,
&
capacity
,
i
>
0
,
buffW
)))
break
;
break
;
size
=
maxlen
;
size
=
maxlen
;
}
}
...
...
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