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
bfb3bbba
Commit
bfb3bbba
authored
Jun 16, 2023
by
Davide Beatrici
Committed by
Alexandre Julliard
Jun 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winepulse: Move get_application_name into mmdevapi.
parent
62cd90e8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
114 deletions
+114
-114
Makefile.in
dlls/mmdevapi/Makefile.in
+1
-1
client.c
dlls/mmdevapi/client.c
+107
-0
Makefile.in
dlls/winealsa.drv/Makefile.in
+1
-1
Makefile.in
dlls/winecoreaudio.drv/Makefile.in
+1
-1
Makefile.in
dlls/wineoss.drv/Makefile.in
+1
-1
mmdevdrv.c
dlls/winepulse.drv/mmdevdrv.c
+3
-110
No files found.
dlls/mmdevapi/Makefile.in
View file @
bfb3bbba
MODULE
=
mmdevapi.dll
IMPORTS
=
uuid ole32 oleaut32 user32 advapi32
IMPORTS
=
uuid ole32 oleaut32 user32 advapi32
version
C_SRCS
=
\
audiosessionmanager.c
\
...
...
dlls/mmdevapi/client.c
View file @
bfb3bbba
...
...
@@ -21,6 +21,8 @@
#define COBJMACROS
#include <wchar.h>
#include <audiopolicy.h>
#include <mmdeviceapi.h>
#include <winternl.h>
...
...
@@ -33,6 +35,12 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
mmdevapi
);
typedef
struct
tagLANGANDCODEPAGE
{
WORD
wLanguage
;
WORD
wCodePage
;
}
LANGANDCODEPAGE
;
extern
void
sessions_lock
(
void
)
DECLSPEC_HIDDEN
;
extern
void
sessions_unlock
(
void
)
DECLSPEC_HIDDEN
;
...
...
@@ -169,6 +177,105 @@ static DWORD CALLBACK timer_loop_func(void *user)
return
0
;
}
static
BOOL
query_productname
(
void
*
data
,
LANGANDCODEPAGE
*
lang
,
LPVOID
*
buffer
,
UINT
*
len
)
{
WCHAR
pn
[
37
];
swprintf
(
pn
,
ARRAY_SIZE
(
pn
),
L"
\\
StringFileInfo
\\
%04x%04x
\\
ProductName"
,
lang
->
wLanguage
,
lang
->
wCodePage
);
return
VerQueryValueW
(
data
,
pn
,
buffer
,
len
)
&&
*
len
;
}
WCHAR
*
get_application_name
(
void
)
{
WCHAR
path
[
MAX_PATH
],
*
name
;
UINT
translate_size
,
productname_size
;
LANGANDCODEPAGE
*
translate
;
LPVOID
productname
;
BOOL
found
=
FALSE
;
void
*
data
=
NULL
;
unsigned
int
i
;
LCID
locale
;
DWORD
size
;
GetModuleFileNameW
(
NULL
,
path
,
ARRAY_SIZE
(
path
));
size
=
GetFileVersionInfoSizeW
(
path
,
NULL
);
if
(
!
size
)
goto
skip
;
data
=
malloc
(
size
);
if
(
!
data
)
goto
skip
;
if
(
!
GetFileVersionInfoW
(
path
,
0
,
size
,
data
))
goto
skip
;
if
(
!
VerQueryValueW
(
data
,
L"
\\
VarFileInfo
\\
Translation"
,
(
LPVOID
*
)
&
translate
,
&
translate_size
))
goto
skip
;
/* No translations found. */
if
(
translate_size
<
sizeof
(
LANGANDCODEPAGE
))
goto
skip
;
/* The following code will try to find the best translation. We first search for an
* exact match of the language, then a match of the language PRIMARYLANGID, then we
* search for a LANG_NEUTRAL match, and if that still doesn't work we pick the
* first entry which contains a proper productname. */
locale
=
GetThreadLocale
();
for
(
i
=
0
;
i
<
translate_size
/
sizeof
(
LANGANDCODEPAGE
);
i
++
)
{
if
(
translate
[
i
].
wLanguage
==
locale
&&
query_productname
(
data
,
&
translate
[
i
],
&
productname
,
&
productname_size
))
{
found
=
TRUE
;
break
;
}
}
if
(
!
found
)
{
for
(
i
=
0
;
i
<
translate_size
/
sizeof
(
LANGANDCODEPAGE
);
i
++
)
{
if
(
PRIMARYLANGID
(
translate
[
i
].
wLanguage
)
==
PRIMARYLANGID
(
locale
)
&&
query_productname
(
data
,
&
translate
[
i
],
&
productname
,
&
productname_size
))
{
found
=
TRUE
;
break
;
}
}
}
if
(
!
found
)
{
for
(
i
=
0
;
i
<
translate_size
/
sizeof
(
LANGANDCODEPAGE
);
i
++
)
{
if
(
PRIMARYLANGID
(
translate
[
i
].
wLanguage
)
==
LANG_NEUTRAL
&&
query_productname
(
data
,
&
translate
[
i
],
&
productname
,
&
productname_size
))
{
found
=
TRUE
;
break
;
}
}
}
if
(
!
found
)
{
for
(
i
=
0
;
i
<
translate_size
/
sizeof
(
LANGANDCODEPAGE
);
i
++
)
{
if
(
query_productname
(
data
,
&
translate
[
i
],
&
productname
,
&
productname_size
))
{
found
=
TRUE
;
break
;
}
}
}
skip:
if
(
found
)
{
name
=
wcsdup
(
productname
);
free
(
data
);
return
name
;
}
free
(
data
);
name
=
wcsrchr
(
path
,
'\\'
);
if
(
!
name
)
name
=
path
;
else
name
++
;
return
wcsdup
(
name
);
}
static
HRESULT
WINAPI
capture_QueryInterface
(
IAudioCaptureClient
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
struct
audio_client
*
This
=
impl_from_IAudioCaptureClient
(
iface
);
...
...
dlls/winealsa.drv/Makefile.in
View file @
bfb3bbba
MODULE
=
winealsa.drv
UNIXLIB
=
winealsa.so
IMPORTS
=
uuid ole32 advapi32
IMPORTS
=
uuid ole32 advapi32
version
PARENTSRC
=
../mmdevapi
DELAYIMPORTS
=
winmm
UNIX_LIBS
=
$(ALSA_LIBS)
$(PTHREAD_LIBS)
...
...
dlls/winecoreaudio.drv/Makefile.in
View file @
bfb3bbba
MODULE
=
winecoreaudio.drv
UNIXLIB
=
winecoreaudio.so
IMPORTS
=
uuid ole32 user32 advapi32
IMPORTS
=
uuid ole32 user32 advapi32
version
PARENTSRC
=
../mmdevapi
DELAYIMPORTS
=
winmm
UNIX_LIBS
=
$(COREAUDIO_LIBS)
...
...
dlls/wineoss.drv/Makefile.in
View file @
bfb3bbba
MODULE
=
wineoss.drv
UNIXLIB
=
wineoss.so
IMPORTS
=
uuid ole32 user32 advapi32
IMPORTS
=
uuid ole32 user32 advapi32
version
PARENTSRC
=
../mmdevapi
DELAYIMPORTS
=
winmm
UNIX_LIBS
=
$(OSS4_LIBS)
$(PTHREAD_LIBS)
...
...
dlls/winepulse.drv/mmdevdrv.c
View file @
bfb3bbba
...
...
@@ -133,6 +133,8 @@ extern HRESULT main_loop_start(void) DECLSPEC_HIDDEN;
extern
struct
audio_session_wrapper
*
session_wrapper_create
(
struct
audio_client
*
client
)
DECLSPEC_HIDDEN
;
extern
WCHAR
*
get_application_name
(
void
);
static
inline
ACImpl
*
impl_from_IAudioClient3
(
IAudioClient3
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
ACImpl
,
IAudioClient3_iface
);
...
...
@@ -153,115 +155,6 @@ static void pulse_release_stream(stream_handle stream, HANDLE timer)
pulse_call
(
release_stream
,
&
params
);
}
typedef
struct
tagLANGANDCODEPAGE
{
WORD
wLanguage
;
WORD
wCodePage
;
}
LANGANDCODEPAGE
;
static
BOOL
query_productname
(
void
*
data
,
LANGANDCODEPAGE
*
lang
,
LPVOID
*
buffer
,
UINT
*
len
)
{
WCHAR
pn
[
37
];
swprintf
(
pn
,
ARRAY_SIZE
(
pn
),
L"
\\
StringFileInfo
\\
%04x%04x
\\
ProductName"
,
lang
->
wLanguage
,
lang
->
wCodePage
);
return
VerQueryValueW
(
data
,
pn
,
buffer
,
len
)
&&
*
len
;
}
static
WCHAR
*
get_application_name
(
BOOL
query_app_name
)
{
WCHAR
path
[
MAX_PATH
],
*
name
;
GetModuleFileNameW
(
NULL
,
path
,
ARRAY_SIZE
(
path
));
if
(
query_app_name
)
{
UINT
translate_size
,
productname_size
;
LANGANDCODEPAGE
*
translate
;
LPVOID
productname
;
BOOL
found
=
FALSE
;
void
*
data
=
NULL
;
unsigned
int
i
;
LCID
locale
;
DWORD
size
;
size
=
GetFileVersionInfoSizeW
(
path
,
NULL
);
if
(
!
size
)
goto
skip
;
data
=
malloc
(
size
);
if
(
!
data
)
goto
skip
;
if
(
!
GetFileVersionInfoW
(
path
,
0
,
size
,
data
))
goto
skip
;
if
(
!
VerQueryValueW
(
data
,
L"
\\
VarFileInfo
\\
Translation"
,
(
LPVOID
*
)
&
translate
,
&
translate_size
))
goto
skip
;
/* no translations found */
if
(
translate_size
<
sizeof
(
LANGANDCODEPAGE
))
goto
skip
;
/* The following code will try to find the best translation. We first search for an
* exact match of the language, then a match of the language PRIMARYLANGID, then we
* search for a LANG_NEUTRAL match, and if that still doesn't work we pick the
* first entry which contains a proper productname. */
locale
=
GetThreadLocale
();
for
(
i
=
0
;
i
<
translate_size
/
sizeof
(
LANGANDCODEPAGE
);
i
++
)
{
if
(
translate
[
i
].
wLanguage
==
locale
&&
query_productname
(
data
,
&
translate
[
i
],
&
productname
,
&
productname_size
))
{
found
=
TRUE
;
break
;
}
}
if
(
!
found
)
{
for
(
i
=
0
;
i
<
translate_size
/
sizeof
(
LANGANDCODEPAGE
);
i
++
)
{
if
(
PRIMARYLANGID
(
translate
[
i
].
wLanguage
)
==
PRIMARYLANGID
(
locale
)
&&
query_productname
(
data
,
&
translate
[
i
],
&
productname
,
&
productname_size
))
{
found
=
TRUE
;
break
;
}
}
}
if
(
!
found
)
{
for
(
i
=
0
;
i
<
translate_size
/
sizeof
(
LANGANDCODEPAGE
);
i
++
)
{
if
(
PRIMARYLANGID
(
translate
[
i
].
wLanguage
)
==
LANG_NEUTRAL
&&
query_productname
(
data
,
&
translate
[
i
],
&
productname
,
&
productname_size
))
{
found
=
TRUE
;
break
;
}
}
}
if
(
!
found
)
{
for
(
i
=
0
;
i
<
translate_size
/
sizeof
(
LANGANDCODEPAGE
);
i
++
)
{
if
(
query_productname
(
data
,
&
translate
[
i
],
&
productname
,
&
productname_size
))
{
found
=
TRUE
;
break
;
}
}
}
skip:
if
(
found
)
{
name
=
wcsdup
(
productname
);
free
(
data
);
return
name
;
}
free
(
data
);
}
name
=
wcsrchr
(
path
,
'\\'
);
if
(
!
name
)
name
=
path
;
else
name
++
;
return
wcsdup
(
name
);
}
static
void
set_stream_volumes
(
ACImpl
*
This
)
{
struct
set_volumes_params
params
;
...
...
@@ -726,7 +619,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
return
hr
;
}
params
.
name
=
name
=
get_application_name
(
TRUE
);
params
.
name
=
name
=
get_application_name
();
params
.
device
=
This
->
device_name
;
params
.
flow
=
This
->
dataflow
;
params
.
share
=
mode
;
...
...
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