Commit a20e1df9 authored by Davide Beatrici's avatar Davide Beatrici Committed by Alexandre Julliard

mmdevapi: Move test_connect handling into mmdevapi.

parent ec9aab2c
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <wchar.h>
#include "ntstatus.h" #include "ntstatus.h"
#define COBJMACROS #define COBJMACROS
...@@ -68,7 +69,8 @@ static const char *get_priority_string(int prio) ...@@ -68,7 +69,8 @@ static const char *get_priority_string(int prio)
static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
{ {
NTSTATUS status; NTSTATUS status;
WCHAR driver_module[264]; WCHAR driver_module[264], path[MAX_PATH];
struct test_connect_params params;
lstrcpyW(driver_module, L"wine"); lstrcpyW(driver_module, L"wine");
lstrcatW(driver_module, name); lstrcatW(driver_module, name);
...@@ -96,7 +98,6 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) ...@@ -96,7 +98,6 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
#define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\ #define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\
if(!driver->p##n) { goto fail; } } while(0) if(!driver->p##n) { goto fail; } } while(0)
LDFC(GetPriority);
LDFC(GetEndpointIDs); LDFC(GetEndpointIDs);
LDFC(GetAudioEndpoint); LDFC(GetAudioEndpoint);
LDFC(GetAudioSessionManager); LDFC(GetAudioSessionManager);
...@@ -105,7 +106,18 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) ...@@ -105,7 +106,18 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
/* optional - do not fail if not found */ /* optional - do not fail if not found */
driver->pGetPropValue = (void*)GetProcAddress(driver->module, "GetPropValue"); driver->pGetPropValue = (void*)GetProcAddress(driver->module, "GetPropValue");
driver->priority = driver->pGetPriority(); GetModuleFileNameW(NULL, path, ARRAY_SIZE(path));
params.name = wcsrchr(path, '\\');
params.name = params.name ? params.name + 1 : path;
params.priority = Priority_Neutral;
if ((status = __wine_unix_call(driver->module_unixlib, test_connect, &params))) {
ERR("Unable to retrieve driver priority: %lx\n", status);
goto fail;
}
driver->priority = params.priority;
lstrcpyW(driver->module_name, driver_module); lstrcpyW(driver->module_name, driver_module);
TRACE("Successfully loaded %s with priority %s\n", TRACE("Successfully loaded %s with priority %s\n",
......
...@@ -30,13 +30,12 @@ typedef struct _DriverFuncs { ...@@ -30,13 +30,12 @@ typedef struct _DriverFuncs {
HMODULE module; HMODULE module;
unixlib_handle_t module_unixlib; unixlib_handle_t module_unixlib;
WCHAR module_name[64]; WCHAR module_name[64];
int priority;
/* Returns a "priority" value for the driver. Highest priority wins. /* Highest priority wins.
* If multiple drivers think they are valid, they will return a * If multiple drivers think they are valid, they will return a
* priority value reflecting the likelihood that they are actually * priority value reflecting the likelihood that they are actually
* valid. See enum _DriverPriority. */ * valid. See enum _DriverPriority. */
int (WINAPI *pGetPriority)(void); int priority;
/* ids gets an array of human-friendly endpoint names /* ids gets an array of human-friendly endpoint names
* keys gets an array of driver-specific stuff that is used * keys gets an array of driver-specific stuff that is used
......
...@@ -212,11 +212,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) ...@@ -212,11 +212,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
return TRUE; return TRUE;
} }
int WINAPI AUDDRV_GetPriority(void)
{
return Priority_Neutral;
}
static HRESULT alsa_stream_release(stream_handle stream, HANDLE timer_thread) static HRESULT alsa_stream_release(stream_handle stream, HANDLE timer_thread)
{ {
struct release_stream_params params; struct release_stream_params params;
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
@ stdcall -private modMessage(long long long long long) ALSA_modMessage @ stdcall -private modMessage(long long long long long) ALSA_modMessage
# MMDevAPI driver functions # MMDevAPI driver functions
@ stdcall -private GetPriority() AUDDRV_GetPriority
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
@ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
......
...@@ -213,11 +213,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) ...@@ -213,11 +213,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
return TRUE; return TRUE;
} }
int WINAPI AUDDRV_GetPriority(void)
{
return Priority_Neutral;
}
static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name, static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name,
GUID *guid) GUID *guid)
{ {
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
@ stdcall -private modMessage(long long long long long) CoreAudio_modMessage @ stdcall -private modMessage(long long long long long) CoreAudio_modMessage
# MMDevAPI driver functions # MMDevAPI driver functions
@ stdcall -private GetPriority() AUDDRV_GetPriority
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
@ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
...@@ -226,17 +226,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) ...@@ -226,17 +226,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
return TRUE; return TRUE;
} }
int WINAPI AUDDRV_GetPriority(void)
{
struct test_connect_params params;
params.name = NULL;
OSS_CALL(test_connect, &params);
return params.priority;
}
static HRESULT stream_release(stream_handle stream, HANDLE timer_thread) static HRESULT stream_release(stream_handle stream, HANDLE timer_thread)
{ {
struct release_stream_params params; struct release_stream_params params;
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
@ stdcall -private modMessage(long long long long long) OSS_modMessage @ stdcall -private modMessage(long long long long long) OSS_modMessage
# MMDevAPI driver functions # MMDevAPI driver functions
@ stdcall -private GetPriority() AUDDRV_GetPriority
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
@ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
...@@ -467,17 +467,6 @@ end: ...@@ -467,17 +467,6 @@ end:
return params.result; return params.result;
} }
int WINAPI AUDDRV_GetPriority(void)
{
struct test_connect_params params;
WCHAR *name;
params.name = name = get_application_name(FALSE);
pulse_call(test_connect, &params);
free(name);
return params.priority;
}
static BOOL get_pulse_name_by_guid(const GUID *guid, char pulse_name[MAX_PULSE_NAME_LEN], EDataFlow *flow) static BOOL get_pulse_name_by_guid(const GUID *guid, char pulse_name[MAX_PULSE_NAME_LEN], EDataFlow *flow)
{ {
struct device_cache *device; struct device_cache *device;
......
# MMDevAPI driver functions # MMDevAPI driver functions
@ stdcall -private GetPriority() AUDDRV_GetPriority
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
@ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment