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
cdfb8522
Commit
cdfb8522
authored
Aug 30, 2023
by
Davide Beatrici
Committed by
Alexandre Julliard
Sep 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi: Move name string duplication in MMDevice_Create() from caller.
parent
b1b231f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
16 deletions
+5
-16
devenum.c
dlls/mmdevapi/devenum.c
+5
-16
No files found.
dlls/mmdevapi/devenum.c
View file @
cdfb8522
...
...
@@ -312,7 +312,7 @@ static const WCHAR *find_product_name_override(const WCHAR *device_id)
* If GUID is null, a random guid will be assigned
* and the device will be created
*/
static
MMDevice
*
MMDevice_Create
(
WCHAR
*
name
,
GUID
*
id
,
EDataFlow
flow
,
DWORD
state
,
BOOL
setdefault
)
static
MMDevice
*
MMDevice_Create
(
const
WCHAR
*
name
,
GUID
*
id
,
EDataFlow
flow
,
DWORD
state
,
BOOL
setdefault
)
{
HKEY
key
,
root
;
MMDevice
*
device
,
*
cur
=
NULL
;
...
...
@@ -351,7 +351,7 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st
WARN
(
"Modifying an MMDevice with postitive reference count!
\n
"
);
free
(
cur
->
drv_id
);
cur
->
drv_id
=
name
;
cur
->
drv_id
=
wcsdup
(
name
)
;
cur
->
flow
=
flow
;
cur
->
state
=
state
;
...
...
@@ -373,7 +373,7 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st
PROPVARIANT
pv
;
pv
.
vt
=
VT_LPWSTR
;
pv
.
pwszVal
=
name
;
pv
.
pwszVal
=
cur
->
drv_id
;
if
(
SUCCEEDED
(
set_driver_prop_value
(
id
,
flow
,
&
devicepath_key
)))
{
PROPVARIANT
pv2
;
...
...
@@ -482,10 +482,7 @@ HRESULT load_devices_from_reg(void)
&&
SUCCEEDED
(
MMDevice_GetPropValue
(
&
guid
,
curflow
,
(
const
PROPERTYKEY
*
)
&
DEVPKEY_Device_FriendlyName
,
&
pv
))
&&
pv
.
vt
==
VT_LPWSTR
)
{
DWORD
size_bytes
=
(
lstrlenW
(
pv
.
pwszVal
)
+
1
)
*
sizeof
(
WCHAR
);
WCHAR
*
name
=
malloc
(
size_bytes
);
memcpy
(
name
,
pv
.
pwszVal
,
size_bytes
);
MMDevice_Create
(
name
,
&
guid
,
curflow
,
MMDevice_Create
(
pv
.
pwszVal
,
&
guid
,
curflow
,
DEVICE_STATE_NOTPRESENT
,
FALSE
);
CoTaskMemFree
(
pv
.
pwszVal
);
}
...
...
@@ -544,21 +541,13 @@ HRESULT load_driver_devices(EDataFlow flow)
for
(
i
=
0
;
i
<
params
.
num
;
i
++
)
{
GUID
guid
;
WCHAR
*
id
;
MMDevice
*
dev
;
const
WCHAR
*
name
=
(
WCHAR
*
)((
char
*
)
params
.
endpoints
+
params
.
endpoints
[
i
].
name
);
const
char
*
dev_name
=
(
char
*
)
params
.
endpoints
+
params
.
endpoints
[
i
].
device
;
const
unsigned
int
size
=
(
wcslen
(
name
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
(
id
=
malloc
(
size
)))
{
params
.
result
=
E_OUTOFMEMORY
;
goto
end
;
}
memcpy
(
id
,
name
,
size
);
drvs
.
pget_device_guid
(
flow
,
dev_name
,
&
guid
);
dev
=
MMDevice_Create
(
id
,
&
guid
,
flow
,
DEVICE_STATE_ACTIVE
,
params
.
default_idx
==
i
);
dev
=
MMDevice_Create
(
name
,
&
guid
,
flow
,
DEVICE_STATE_ACTIVE
,
params
.
default_idx
==
i
);
set_format
(
dev
);
}
...
...
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