mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 09:00:48 +00:00
mmdevapi: Use UTF-16 for client name in "test_connect_params" and "create_stream_params" structs.
The conversion to another encoding is now up to the unixlib.
This commit is contained in:
parent
3cc61002a8
commit
ec9aab2c46
|
@ -53,7 +53,7 @@ struct get_endpoint_ids_params
|
|||
|
||||
struct create_stream_params
|
||||
{
|
||||
const char *name;
|
||||
const WCHAR *name;
|
||||
const char *device;
|
||||
EDataFlow flow;
|
||||
AUDCLNT_SHAREMODE share;
|
||||
|
@ -219,7 +219,7 @@ struct set_event_handle_params
|
|||
|
||||
struct test_connect_params
|
||||
{
|
||||
const char *name;
|
||||
const WCHAR *name;
|
||||
enum driver_priority priority;
|
||||
};
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
@ -247,11 +248,9 @@ static BOOL query_productname(void *data, LANGANDCODEPAGE *lang, LPVOID *buffer,
|
|||
return VerQueryValueW(data, pn, buffer, len) && *len;
|
||||
}
|
||||
|
||||
static char *get_application_name(BOOL query_app_name)
|
||||
static WCHAR *get_application_name(BOOL query_app_name)
|
||||
{
|
||||
WCHAR path[MAX_PATH], *name;
|
||||
char *str = NULL;
|
||||
size_t len;
|
||||
|
||||
GetModuleFileNameW(NULL, path, ARRAY_SIZE(path));
|
||||
|
||||
|
@ -327,15 +326,9 @@ static char *get_application_name(BOOL query_app_name)
|
|||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, productname, -1, NULL, 0, NULL, NULL);
|
||||
str = malloc(len);
|
||||
if (str) WideCharToMultiByte(CP_UTF8, 0, productname, -1, str, len, NULL, NULL);
|
||||
}
|
||||
|
||||
skip:
|
||||
free(data);
|
||||
if (str) return str;
|
||||
if (found) return wcsdup(productname);
|
||||
}
|
||||
|
||||
name = wcsrchr(path, '\\');
|
||||
|
@ -343,11 +336,7 @@ static char *get_application_name(BOOL query_app_name)
|
|||
name = path;
|
||||
else
|
||||
name++;
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, name, -1, NULL, 0, NULL, NULL);
|
||||
if (!(str = malloc(len)))
|
||||
return NULL;
|
||||
WideCharToMultiByte(CP_UNIXCP, 0, name, -1, str, len, NULL, NULL);
|
||||
return str;
|
||||
return wcsdup(name);
|
||||
}
|
||||
|
||||
static DWORD WINAPI pulse_timer_cb(void *user)
|
||||
|
@ -481,7 +470,7 @@ end:
|
|||
int WINAPI AUDDRV_GetPriority(void)
|
||||
{
|
||||
struct test_connect_params params;
|
||||
char *name;
|
||||
WCHAR *name;
|
||||
|
||||
params.name = name = get_application_name(FALSE);
|
||||
pulse_call(test_connect, ¶ms);
|
||||
|
@ -817,7 +806,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
|
|||
struct create_stream_params params;
|
||||
unsigned int i, channel_count;
|
||||
stream_handle stream;
|
||||
char *name;
|
||||
WCHAR *name;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%x, %lx, %s, %s, %p, %s)\n", This, mode, flags,
|
||||
|
|
|
@ -196,6 +196,14 @@ static int muldiv(int a, int b, int c)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static char *wstr_to_str(const WCHAR *wstr)
|
||||
{
|
||||
const int len = wcslen(wstr);
|
||||
char *str = malloc(len * 3 + 1);
|
||||
ntdll_wcstoumbs(wstr, len + 1, str, len * 3 + 1, FALSE);
|
||||
return str;
|
||||
}
|
||||
|
||||
/* Following pulseaudio design here, mainloop has the lock taken whenever
|
||||
* it is handling something for pulse, and the lock is required whenever
|
||||
* doing any pa_* call that can affect the state in any way
|
||||
|
@ -765,13 +773,17 @@ static NTSTATUS pulse_test_connect(void *args)
|
|||
PhysDevice *dev;
|
||||
pa_operation *o;
|
||||
int ret;
|
||||
char *name = wstr_to_str(params->name);
|
||||
|
||||
pulse_lock();
|
||||
pulse_ml = pa_mainloop_new();
|
||||
|
||||
pa_mainloop_set_poll_func(pulse_ml, pulse_poll_func, NULL);
|
||||
|
||||
pulse_ctx = pa_context_new(pa_mainloop_get_api(pulse_ml), params->name);
|
||||
pulse_ctx = pa_context_new(pa_mainloop_get_api(pulse_ml), name);
|
||||
|
||||
free(name);
|
||||
|
||||
if (!pulse_ctx) {
|
||||
ERR("Failed to create context\n");
|
||||
pa_mainloop_free(pulse_ml);
|
||||
|
@ -1104,10 +1116,15 @@ static NTSTATUS pulse_create_stream(void *args)
|
|||
struct pulse_stream *stream;
|
||||
unsigned int i, bufsize_bytes;
|
||||
HRESULT hr;
|
||||
char *name = wstr_to_str(params->name);
|
||||
|
||||
pulse_lock();
|
||||
|
||||
if (FAILED(params->result = pulse_connect(params->name)))
|
||||
params->result = pulse_connect(name);
|
||||
|
||||
free(name);
|
||||
|
||||
if (FAILED(params->result))
|
||||
{
|
||||
pulse_unlock();
|
||||
return STATUS_SUCCESS;
|
||||
|
|
Loading…
Reference in a new issue