The goal is to eventually move all interfaces from each driver's `mmdevdrv.c` into `mmdevapi`.
-- v2: wine{alsa,coreaudio,oss,pulse}: Move test_connect handling into mmdevapi. winepulse: Move process_attach and process_detach handling into mmdevapi. mmdevapi: Query MemoryWineUnixFuncs virtual memory and store the resulting handle. wine{alsa,coreaudio,oss,pulse}: Return STATUS_NOT_IMPLEMENTED for unused unixlib functions. include: Add missing "winternl.h" include to unixlib.h.
From: Davide Beatrici git@davidebeatrici.dev
Required for the NTSTATUS definition.
The other types, such as UINT64, are also guaranteed to be defined. --- include/wine/unixlib.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/wine/unixlib.h b/include/wine/unixlib.h index f8360f1549e..f43d4264252 100644 --- a/include/wine/unixlib.h +++ b/include/wine/unixlib.h @@ -21,6 +21,8 @@ #ifndef __WINE_WINE_UNIXLIB_H #define __WINE_WINE_UNIXLIB_H
+#include "winternl.h" + typedef UINT64 unixlib_handle_t;
extern NTSTATUS WINAPI __wine_unix_call( unixlib_handle_t handle, unsigned int code, void *args );
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winealsa.drv/alsa.c | 33 ++++++++++++++---------- dlls/winecoreaudio.drv/coreaudio.c | 41 +++++++++++++++++------------- dlls/wineoss.drv/oss.c | 29 ++++++++++++--------- dlls/winepulse.drv/pulse.c | 33 ++++++++++++++---------- 4 files changed, 78 insertions(+), 58 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index ffa39f5e484..71e59c610d9 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -88,6 +88,11 @@ static const WCHAR drv_keyW[] = {'S','o','f','t','w','a','r','e','\', 'W','i','n','e','\','D','r','i','v','e','r','s','\', 'w','i','n','e','a','l','s','a','.','d','r','v'};
+static NTSTATUS alsa_not_implemented(void *args) +{ + return STATUS_NOT_IMPLEMENTED; +} + static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len ) { while (len--) *dst++ = (unsigned char)*src++; @@ -2431,9 +2436,9 @@ static NTSTATUS alsa_get_prop_value(void *args)
unixlib_entry_t __wine_unix_call_funcs[] = { - NULL, - NULL, - NULL, + alsa_not_implemented, + alsa_not_implemented, + alsa_not_implemented, alsa_get_endpoint_ids, alsa_create_stream, alsa_release_stream, @@ -2447,7 +2452,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = alsa_release_capture_buffer, alsa_is_format_supported, alsa_get_mix_format, - NULL, + alsa_not_implemented, alsa_get_buffer_size, alsa_get_latency, alsa_get_current_padding, @@ -2456,15 +2461,15 @@ unixlib_entry_t __wine_unix_call_funcs[] = alsa_get_position, alsa_set_volumes, alsa_set_event_handle, - NULL, + alsa_not_implemented, alsa_is_started, alsa_get_prop_value, - NULL, + alsa_not_implemented, alsa_midi_release, alsa_midi_out_message, alsa_midi_in_message, alsa_midi_notify_wait, - NULL, + alsa_not_implemented, };
#ifdef _WIN64 @@ -2852,9 +2857,9 @@ static NTSTATUS alsa_wow64_get_prop_value(void *args)
unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - NULL, - NULL, - NULL, + alsa_not_implemented, + alsa_not_implemented, + alsa_not_implemented, alsa_wow64_get_endpoint_ids, alsa_wow64_create_stream, alsa_wow64_release_stream, @@ -2868,7 +2873,7 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = alsa_release_capture_buffer, alsa_wow64_is_format_supported, alsa_wow64_get_mix_format, - NULL, + alsa_not_implemented, alsa_wow64_get_buffer_size, alsa_wow64_get_latency, alsa_wow64_get_current_padding, @@ -2877,15 +2882,15 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = alsa_wow64_get_position, alsa_wow64_set_volumes, alsa_wow64_set_event_handle, - NULL, + alsa_not_implemented, alsa_is_started, alsa_wow64_get_prop_value, - NULL, + alsa_not_implemented, alsa_midi_release, alsa_wow64_midi_out_message, alsa_wow64_midi_in_message, alsa_wow64_midi_notify_wait, - NULL, + alsa_not_implemented, };
#endif /* _WIN64 */ diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index b48a0c751fd..f003f160908 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -96,6 +96,11 @@ struct coreaudio_stream BYTE *local_buffer, *cap_buffer, *wrap_buffer, *resamp_buffer, *tmp_buffer; };
+static NTSTATUS unix_not_implemented(void *args) +{ + return STATUS_NOT_IMPLEMENTED; +} + static HRESULT osstatus_to_hresult(OSStatus sc) { switch(sc){ @@ -1647,23 +1652,23 @@ static NTSTATUS unix_set_volumes(void *args)
unixlib_entry_t __wine_unix_call_funcs[] = { - NULL, - NULL, - NULL, + unix_not_implemented, + unix_not_implemented, + unix_not_implemented, unix_get_endpoint_ids, unix_create_stream, unix_release_stream, unix_start, unix_stop, unix_reset, - NULL, + unix_not_implemented, unix_get_render_buffer, unix_release_render_buffer, unix_get_capture_buffer, unix_release_capture_buffer, unix_is_format_supported, unix_get_mix_format, - NULL, + unix_not_implemented, unix_get_buffer_size, unix_get_latency, unix_get_current_padding, @@ -1671,16 +1676,16 @@ unixlib_entry_t __wine_unix_call_funcs[] = unix_get_frequency, unix_get_position, unix_set_volumes, - NULL, - NULL, + unix_not_implemented, + unix_not_implemented, unix_is_started, - NULL, + unix_not_implemented, unix_midi_init, unix_midi_release, unix_midi_out_message, unix_midi_in_message, unix_midi_notify_wait, - NULL, + unix_not_implemented, };
#ifdef _WIN64 @@ -1991,23 +1996,23 @@ static NTSTATUS unix_wow64_set_volumes(void *args)
unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - NULL, - NULL, - NULL, + unix_not_implemented, + unix_not_implemented, + unix_not_implemented, unix_wow64_get_endpoint_ids, unix_wow64_create_stream, unix_wow64_release_stream, unix_start, unix_stop, unix_reset, - NULL, + unix_not_implemented, unix_wow64_get_render_buffer, unix_release_render_buffer, unix_wow64_get_capture_buffer, unix_release_capture_buffer, unix_wow64_is_format_supported, unix_wow64_get_mix_format, - NULL, + unix_not_implemented, unix_wow64_get_buffer_size, unix_wow64_get_latency, unix_wow64_get_current_padding, @@ -2015,16 +2020,16 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = unix_wow64_get_frequency, unix_wow64_get_position, unix_wow64_set_volumes, - NULL, - NULL, + unix_not_implemented, + unix_not_implemented, unix_is_started, - NULL, + unix_not_implemented, unix_wow64_midi_init, unix_midi_release, unix_wow64_midi_out_message, unix_wow64_midi_in_message, unix_wow64_midi_notify_wait, - NULL, + unix_not_implemented, };
#endif /* _WIN64 */ diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index 4bc8bc20666..4ed2449645c 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -69,6 +69,11 @@ struct oss_stream
WINE_DEFAULT_DEBUG_CHANNEL(oss);
+static NTSTATUS oss_not_implemented(void *args) +{ + return STATUS_NOT_IMPLEMENTED; +} + /* copied from kernelbase */ static int muldiv( int a, int b, int c ) { @@ -1612,9 +1617,9 @@ static NTSTATUS oss_aux_message(void *args)
unixlib_entry_t __wine_unix_call_funcs[] = { - NULL, - NULL, - NULL, + oss_not_implemented, + oss_not_implemented, + oss_not_implemented, oss_get_endpoint_ids, oss_create_stream, oss_release_stream, @@ -1628,7 +1633,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = oss_release_capture_buffer, oss_is_format_supported, oss_get_mix_format, - NULL, + oss_not_implemented, oss_get_buffer_size, oss_get_latency, oss_get_current_padding, @@ -1639,8 +1644,8 @@ unixlib_entry_t __wine_unix_call_funcs[] = oss_set_event_handle, oss_test_connect, oss_is_started, - NULL, - NULL, + oss_not_implemented, + oss_not_implemented, oss_midi_release, oss_midi_out_message, oss_midi_in_message, @@ -2016,9 +2021,9 @@ static NTSTATUS oss_wow64_aux_message(void *args)
unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - NULL, - NULL, - NULL, + oss_not_implemented, + oss_not_implemented, + oss_not_implemented, oss_wow64_get_endpoint_ids, oss_wow64_create_stream, oss_wow64_release_stream, @@ -2032,7 +2037,7 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = oss_release_capture_buffer, oss_wow64_is_format_supported, oss_wow64_get_mix_format, - NULL, + oss_not_implemented, oss_wow64_get_buffer_size, oss_wow64_get_latency, oss_wow64_get_current_padding, @@ -2043,8 +2048,8 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = oss_wow64_set_event_handle, oss_wow64_test_connect, oss_is_started, - NULL, - NULL, + oss_not_implemented, + oss_not_implemented, oss_midi_release, oss_wow64_midi_out_message, oss_wow64_midi_in_message, diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 9446feb452c..c027d7fcd36 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -119,6 +119,11 @@ static const REFERENCE_TIME DefaultPeriod = 100000; static pthread_mutex_t pulse_mutex; static pthread_cond_t pulse_cond = PTHREAD_COND_INITIALIZER;
+static NTSTATUS pulse_not_implemented(void *args) +{ + return STATUS_NOT_IMPLEMENTED; +} + static void pulse_lock(void) { pthread_mutex_lock(&pulse_mutex); @@ -2373,7 +2378,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = pulse_release_render_buffer, pulse_get_capture_buffer, pulse_release_capture_buffer, - NULL, + pulse_not_implemented, pulse_get_mix_format, pulse_get_device_period, pulse_get_buffer_size, @@ -2387,12 +2392,12 @@ const unixlib_entry_t __wine_unix_call_funcs[] = pulse_test_connect, pulse_is_started, pulse_get_prop_value, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, };
#ifdef _WIN64 @@ -2820,7 +2825,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = pulse_release_render_buffer, pulse_wow64_get_capture_buffer, pulse_release_capture_buffer, - NULL, + pulse_not_implemented, pulse_wow64_get_mix_format, pulse_wow64_get_device_period, pulse_wow64_get_buffer_size, @@ -2834,12 +2839,12 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = pulse_wow64_test_connect, pulse_is_started, pulse_wow64_get_prop_value, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, + pulse_not_implemented, };
#endif /* _WIN64 */
From: Davide Beatrici git@davidebeatrici.dev
In preparation for calling the audio driver's UNIX functions directly. --- dlls/mmdevapi/main.c | 20 ++++++++++++++------ dlls/mmdevapi/mmdevapi.h | 2 ++ 2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index c792661af33..43fc03f3aa3 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -65,23 +65,28 @@ static const char *get_priority_string(int prio)
static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) { - WCHAR driver_module[264]; + NTSTATUS status;
+ WCHAR driver_module[264]; lstrcpyW(driver_module, L"wine"); lstrcatW(driver_module, name); lstrcatW(driver_module, L".drv");
TRACE("Attempting to load %s\n", wine_dbgstr_w(driver_module));
- driver->module = LoadLibraryW(driver_module); - if(!driver->module){ - TRACE("Unable to load %s: %lu\n", wine_dbgstr_w(driver_module), - GetLastError()); + if (!(driver->module = LoadLibraryW(driver_module))) { + ERR("Unable to load %s: %lu\n", wine_dbgstr_w(driver_module), GetLastError()); return FALSE; }
+ if ((status = NtQueryVirtualMemory(GetCurrentProcess(), driver->module, MemoryWineUnixFuncs, + &driver->module_unixlib, sizeof(driver->module_unixlib), NULL))) { + ERR("Unable to load UNIX functions: %lx\n", status); + goto fail; + } + #define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\ - if(!driver->p##n) { FreeLibrary(driver->module); return FALSE; } } while(0) + if(!driver->p##n) { goto fail; } } while(0) LDFC(GetPriority); LDFC(GetEndpointIDs); LDFC(GetAudioEndpoint); @@ -98,6 +103,9 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) wine_dbgstr_w(driver_module), get_priority_string(driver->priority));
return TRUE; +fail: + FreeLibrary(driver->module); + return FALSE; }
static BOOL WINAPI init_driver(INIT_ONCE *once, void *param, void **context) diff --git a/dlls/mmdevapi/mmdevapi.h b/dlls/mmdevapi/mmdevapi.h index d694a3930aa..410d958bf46 100644 --- a/dlls/mmdevapi/mmdevapi.h +++ b/dlls/mmdevapi/mmdevapi.h @@ -19,12 +19,14 @@ #include "unixlib.h"
#include <wine/list.h> +#include <wine/unixlib.h>
extern HRESULT MMDevEnum_Create(REFIID riid, void **ppv) DECLSPEC_HIDDEN; extern void MMDevEnum_Free(void) DECLSPEC_HIDDEN;
typedef struct _DriverFuncs { HMODULE module; + unixlib_handle_t module_unixlib; WCHAR module_name[64]; int priority;
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/main.c | 19 ++++++++++++++++--- dlls/winepulse.drv/mmdevdrv.c | 4 +--- 2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index 43fc03f3aa3..e67c8f8b10a 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -19,7 +19,9 @@
#include <stdarg.h>
+#include "ntstatus.h" #define COBJMACROS +#define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" #include "wingdi.h" @@ -85,6 +87,12 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) goto fail; }
+ if ((status = __wine_unix_call(driver->module_unixlib, process_attach, NULL)) && + status != STATUS_NOT_IMPLEMENTED) { + ERR("Unable to initialize library: %lx\n", status); + goto fail; + } + #define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\ if(!driver->p##n) { goto fail; } } while(0) LDFC(GetPriority); @@ -175,9 +183,14 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DisableThreadLibraryCalls(hinstDLL); break; case DLL_PROCESS_DETACH: - if(lpvReserved) - break; - MMDevEnum_Free(); + if (drvs.module_unixlib) { + const NTSTATUS status = __wine_unix_call(drvs.module_unixlib, process_detach, NULL); + if (status && status != STATUS_NOT_IMPLEMENTED) + WARN("Unable to deinitialize library: %lx\n", status); + } + + if (!lpvReserved) + MMDevEnum_Free(); break; }
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 5de9a941099..99dbe24c82f 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -87,14 +87,12 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) DisableThreadLibraryCalls(dll); if (__wine_init_unix_call()) return FALSE; - if (WINE_UNIX_CALL(process_attach, NULL)) - return FALSE; } else if (reason == DLL_PROCESS_DETACH) { struct device_cache *device, *device_next;
LIST_FOR_EACH_ENTRY_SAFE(device, device_next, &g_devices_cache, struct device_cache, entry) free(device); - WINE_UNIX_CALL(process_detach, NULL); + if (pulse_thread) { WaitForSingleObject(pulse_thread, INFINITE); CloseHandle(pulse_thread);
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/main.c | 46 ++++++++++++++++++- dlls/mmdevapi/mmdevapi.h | 5 +- dlls/winealsa.drv/mmdevdrv.c | 5 -- dlls/winealsa.drv/winealsa.drv.spec | 1 - dlls/winecoreaudio.drv/mmdevdrv.c | 5 -- dlls/winecoreaudio.drv/winecoreaudio.drv.spec | 1 - dlls/wineoss.drv/mmdevdrv.c | 11 ----- dlls/wineoss.drv/wineoss.drv.spec | 1 - dlls/winepulse.drv/mmdevdrv.c | 11 ----- dlls/winepulse.drv/winepulse.drv.spec | 1 - 10 files changed, 46 insertions(+), 41 deletions(-)
diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index e67c8f8b10a..a148555ca22 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -18,6 +18,7 @@ */
#include <stdarg.h> +#include <wchar.h>
#include "ntstatus.h" #define COBJMACROS @@ -50,6 +51,26 @@ DriverFuncs drvs;
const WCHAR drv_keyW[] = L"Software\Wine\Drivers";
+static char *get_test_connect_name(void) +{ + WCHAR path[MAX_PATH], *name; + size_t len; + char *str; + + GetModuleFileNameW(NULL, path, ARRAY_SIZE(path)); + + name = wcsrchr(path, '\'); + name = name ? name + 1 : path; + + 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; +} + static const char *get_priority_string(int prio) { switch(prio){ @@ -95,7 +116,6 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
#define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\ if(!driver->p##n) { goto fail; } } while(0) - LDFC(GetPriority); LDFC(GetEndpointIDs); LDFC(GetAudioEndpoint); LDFC(GetAudioSessionManager); @@ -104,7 +124,29 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) /* optional - do not fail if not found */ driver->pGetPropValue = (void*)GetProcAddress(driver->module, "GetPropValue");
- driver->priority = driver->pGetPriority(); + { + struct test_connect_params params; + char *name = get_test_connect_name(); + params.name = name; + + status = __wine_unix_call(driver->module_unixlib, test_connect, ¶ms); + + free(name); + + switch (status) + { + case STATUS_SUCCESS: + driver->priority = params.priority; + break; + case STATUS_NOT_IMPLEMENTED: + driver->priority = Priority_Neutral; + break; + default: + ERR("Unable to retrieve driver priority: %lx\n", status); + goto fail; + } + } + lstrcpyW(driver->module_name, driver_module);
TRACE("Successfully loaded %s with priority %s\n", diff --git a/dlls/mmdevapi/mmdevapi.h b/dlls/mmdevapi/mmdevapi.h index 410d958bf46..bfbcc4ad96c 100644 --- a/dlls/mmdevapi/mmdevapi.h +++ b/dlls/mmdevapi/mmdevapi.h @@ -28,13 +28,12 @@ typedef struct _DriverFuncs { HMODULE module; unixlib_handle_t module_unixlib; 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 * priority value reflecting the likelihood that they are actually * valid. See enum _DriverPriority. */ - int (WINAPI *pGetPriority)(void); + int priority;
/* ids gets an array of human-friendly endpoint names * keys gets an array of driver-specific stuff that is used diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index ea48143005b..fb81faf9d00 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -212,11 +212,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) return TRUE; }
-int WINAPI AUDDRV_GetPriority(void) -{ - return Priority_Neutral; -} - static HRESULT alsa_stream_release(stream_handle stream, HANDLE timer_thread) { struct release_stream_params params; diff --git a/dlls/winealsa.drv/winealsa.drv.spec b/dlls/winealsa.drv/winealsa.drv.spec index bd83ea2e765..d846ade8ce2 100644 --- a/dlls/winealsa.drv/winealsa.drv.spec +++ b/dlls/winealsa.drv/winealsa.drv.spec @@ -4,7 +4,6 @@ @ stdcall -private modMessage(long long long long long) ALSA_modMessage
# MMDevAPI driver functions -@ stdcall -private GetPriority() AUDDRV_GetPriority @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 367f7ba0ab8..877c1f7c3bc 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -213,11 +213,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) return TRUE; }
-int WINAPI AUDDRV_GetPriority(void) -{ - return Priority_Neutral; -} - static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name, GUID *guid) { diff --git a/dlls/winecoreaudio.drv/winecoreaudio.drv.spec b/dlls/winecoreaudio.drv/winecoreaudio.drv.spec index 9d9f781cf4e..1dfbfb79eb9 100644 --- a/dlls/winecoreaudio.drv/winecoreaudio.drv.spec +++ b/dlls/winecoreaudio.drv/winecoreaudio.drv.spec @@ -4,7 +4,6 @@ @ stdcall -private modMessage(long long long long long) CoreAudio_modMessage
# MMDevAPI driver functions -@ stdcall -private GetPriority() AUDDRV_GetPriority @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 7411f87a4d7..6993fa88d0a 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -226,17 +226,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) return TRUE; }
-int WINAPI AUDDRV_GetPriority(void) -{ - struct test_connect_params params; - - params.name = NULL; - - OSS_CALL(test_connect, ¶ms); - - return params.priority; -} - static HRESULT stream_release(stream_handle stream, HANDLE timer_thread) { struct release_stream_params params; diff --git a/dlls/wineoss.drv/wineoss.drv.spec b/dlls/wineoss.drv/wineoss.drv.spec index fe6cc518c33..a093649e982 100644 --- a/dlls/wineoss.drv/wineoss.drv.spec +++ b/dlls/wineoss.drv/wineoss.drv.spec @@ -5,7 +5,6 @@ @ stdcall -private modMessage(long long long long long) OSS_modMessage
# MMDevAPI driver functions -@ stdcall -private GetPriority() AUDDRV_GetPriority @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 99dbe24c82f..b8151956c14 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -478,17 +478,6 @@ end: return params.result; }
-int WINAPI AUDDRV_GetPriority(void) -{ - struct test_connect_params params; - char *name; - - params.name = name = get_application_name(FALSE); - pulse_call(test_connect, ¶ms); - free(name); - return params.priority; -} - static BOOL get_pulse_name_by_guid(const GUID *guid, char pulse_name[MAX_PULSE_NAME_LEN], EDataFlow *flow) { struct device_cache *device; diff --git a/dlls/winepulse.drv/winepulse.drv.spec b/dlls/winepulse.drv/winepulse.drv.spec index 7aeb1756ed1..b822fd08353 100644 --- a/dlls/winepulse.drv/winepulse.drv.spec +++ b/dlls/winepulse.drv/winepulse.drv.spec @@ -1,5 +1,4 @@ # MMDevAPI driver functions -@ stdcall -private GetPriority() AUDDRV_GetPriority @ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs @ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint @ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
Huw Davies (@huw) commented about include/wine/unixlib.h:
#ifndef __WINE_WINE_UNIXLIB_H #define __WINE_WINE_UNIXLIB_H
+#include "winternl.h"
I'm not convinced this is worthwhile; just make the parent C file include it.
Huw Davies (@huw) commented about dlls/mmdevapi/main.c:
static BOOL load_driver(const WCHAR *name, DriverFuncs *driver) {
- WCHAR driver_module[264];
NTSTATUS status;
WCHAR driver_module[264];
Please move the blank line to below this.
Huw Davies (@huw) commented about dlls/mmdevapi/main.c:
- WCHAR driver_module[264];
NTSTATUS status;
WCHAR driver_module[264]; lstrcpyW(driver_module, L"wine"); lstrcatW(driver_module, name); lstrcatW(driver_module, L".drv");
TRACE("Attempting to load %s\n", wine_dbgstr_w(driver_module));
- driver->module = LoadLibraryW(driver_module);
- if(!driver->module){
TRACE("Unable to load %s: %lu\n", wine_dbgstr_w(driver_module),
GetLastError());
- if (!(driver->module = LoadLibraryW(driver_module))) {
ERR("Unable to load %s: %lu\n", wine_dbgstr_w(driver_module), GetLastError());
On linux this is producing: ``` 0024:err:mmdevapi:load_driver Unable to load L"winecoreaudio.drv": 126 ``` which doesn't look right.
Huw Davies (@huw) commented about dlls/mmdevapi/main.c:
goto fail; }
- if ((status = __wine_unix_call(driver->module_unixlib, process_attach, NULL)) &&
status != STATUS_NOT_IMPLEMENTED) {
ERR("Unable to initialize library: %lx\n", status);
goto fail;
- }
Rather than testing for `STATUS_NOT_IMPLEMENTED` in the caller I think we should implement dummy versions in the driver that simply return `STATUS_SUCCESS`. Likewise for `test_connect`.
Huw Davies (@huw) commented about dlls/mmdevapi/main.c:
+static char *get_test_connect_name(void) +{
- WCHAR path[MAX_PATH], *name;
- size_t len;
- char *str;
- GetModuleFileNameW(NULL, path, ARRAY_SIZE(path));
- name = wcsrchr(path, '\');
- name = name ? name + 1 : path;
- 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);
The two different codepages don't look right. I realise this came from `winepulse` but we should fix the bug in there before copying it.
It would probably be cleaner to pass the unicode string straight to the driver and have the driver worry about converting it to whatever format it needs - I'd suggest doing this first.
Huw Davies (@huw) commented about dlls/mmdevapi/main.c:
/* optional - do not fail if not found */ driver->pGetPropValue = (void*)GetProcAddress(driver->module, "GetPropValue");
- driver->priority = driver->pGetPriority();
- {
Unless there's a compelling reason to indent this block, please don't - just move the variable declarations to the top. However, if you're going to add a conditional around the block in a later patch then it could stay as it is to reduce a subsequent diff.