mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 04:43:21 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
27
dll/win32/mmdevapi/CMakeLists.txt
Normal file
27
dll/win32/mmdevapi/CMakeLists.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
|
||||
add_definitions(-D__WINESRC__)
|
||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
|
||||
spec2def(mmdevapi.dll mmdevapi.spec ADD_IMPORTLIB)
|
||||
|
||||
list(APPEND SOURCE
|
||||
audiovolume.c
|
||||
devenum.c
|
||||
main.c
|
||||
mmdevapi.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mmdevapi_stubs.c)
|
||||
|
||||
add_library(mmdevapi SHARED
|
||||
${SOURCE}
|
||||
guid.c
|
||||
mmdevapi.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mmdevapi.def)
|
||||
|
||||
set_module_type(mmdevapi win32dll)
|
||||
target_link_libraries(mmdevapi uuid wine)
|
||||
add_importlibs(mmdevapi ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll)
|
||||
add_pch(mmdevapi mmdevapi.h SOURCE)
|
||||
add_dependencies(mmdevapi dxsdk)
|
||||
add_cd_file(TARGET mmdevapi DESTINATION reactos/system32 FOR all)
|
298
dll/win32/mmdevapi/audiovolume.c
Normal file
298
dll/win32/mmdevapi/audiovolume.c
Normal file
|
@ -0,0 +1,298 @@
|
|||
/*
|
||||
* Copyright 2010 Maarten Lankhorst for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "mmdevapi.h"
|
||||
|
||||
typedef struct AEVImpl {
|
||||
IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface;
|
||||
LONG ref;
|
||||
float master_vol;
|
||||
BOOL mute;
|
||||
} AEVImpl;
|
||||
|
||||
static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, AEVImpl, IAudioEndpointVolumeEx_iface);
|
||||
}
|
||||
|
||||
static void AudioEndpointVolume_Destroy(AEVImpl *This)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_QueryInterface(IAudioEndpointVolumeEx *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
|
||||
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
|
||||
if (!ppv)
|
||||
return E_POINTER;
|
||||
*ppv = NULL;
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IAudioEndpointVolume) ||
|
||||
IsEqualIID(riid, &IID_IAudioEndpointVolumeEx)) {
|
||||
*ppv = &This->IAudioEndpointVolumeEx_iface;
|
||||
}
|
||||
else
|
||||
return E_NOINTERFACE;
|
||||
IUnknown_AddRef((IUnknown *)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI AEV_AddRef(IAudioEndpointVolumeEx *iface)
|
||||
{
|
||||
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
TRACE("(%p) new ref %u\n", This, ref);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI AEV_Release(IAudioEndpointVolumeEx *iface)
|
||||
{
|
||||
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
TRACE("(%p) new ref %u\n", This, ref);
|
||||
if (!ref)
|
||||
AudioEndpointVolume_Destroy(This);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_RegisterControlChangeNotify(IAudioEndpointVolumeEx *iface, IAudioEndpointVolumeCallback *notify)
|
||||
{
|
||||
TRACE("(%p)->(%p)\n", iface, notify);
|
||||
if (!notify)
|
||||
return E_POINTER;
|
||||
FIXME("stub\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_UnregisterControlChangeNotify(IAudioEndpointVolumeEx *iface, IAudioEndpointVolumeCallback *notify)
|
||||
{
|
||||
TRACE("(%p)->(%p)\n", iface, notify);
|
||||
if (!notify)
|
||||
return E_POINTER;
|
||||
FIXME("stub\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_GetChannelCount(IAudioEndpointVolumeEx *iface, UINT *count)
|
||||
{
|
||||
TRACE("(%p)->(%p)\n", iface, count);
|
||||
if (!count)
|
||||
return E_POINTER;
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_SetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float leveldb, const GUID *ctx)
|
||||
{
|
||||
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
|
||||
|
||||
TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
|
||||
|
||||
if(leveldb < -100.f || leveldb > 0.f)
|
||||
return E_INVALIDARG;
|
||||
|
||||
This->master_vol = leveldb;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float level, const GUID *ctx)
|
||||
{
|
||||
TRACE("(%p)->(%f,%s)\n", iface, level, debugstr_guid(ctx));
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_GetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float *leveldb)
|
||||
{
|
||||
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n", iface, leveldb);
|
||||
|
||||
if (!leveldb)
|
||||
return E_POINTER;
|
||||
|
||||
*leveldb = This->master_vol;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_GetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float *level)
|
||||
{
|
||||
TRACE("(%p)->(%p)\n", iface, level);
|
||||
if (!level)
|
||||
return E_POINTER;
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_SetChannelVolumeLevel(IAudioEndpointVolumeEx *iface, UINT chan, float leveldb, const GUID *ctx)
|
||||
{
|
||||
TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_SetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *iface, UINT chan, float level, const GUID *ctx)
|
||||
{
|
||||
TRACE("(%p)->(%u,%f,%s)\n", iface, chan, level, debugstr_guid(ctx));
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_GetChannelVolumeLevel(IAudioEndpointVolumeEx *iface, UINT chan, float *leveldb)
|
||||
{
|
||||
TRACE("(%p)->(%u,%p)\n", iface, chan, leveldb);
|
||||
if (!leveldb)
|
||||
return E_POINTER;
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_GetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *iface, UINT chan, float *level)
|
||||
{
|
||||
TRACE("(%p)->(%u,%p)\n", iface, chan, level);
|
||||
if (!level)
|
||||
return E_POINTER;
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_SetMute(IAudioEndpointVolumeEx *iface, BOOL mute, const GUID *ctx)
|
||||
{
|
||||
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
|
||||
HRESULT ret;
|
||||
|
||||
TRACE("(%p)->(%u,%s)\n", iface, mute, debugstr_guid(ctx));
|
||||
|
||||
ret = This->mute == mute ? S_FALSE : S_OK;
|
||||
|
||||
This->mute = mute;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_GetMute(IAudioEndpointVolumeEx *iface, BOOL *mute)
|
||||
{
|
||||
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n", iface, mute);
|
||||
|
||||
if (!mute)
|
||||
return E_POINTER;
|
||||
|
||||
*mute = This->mute;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_GetVolumeStepInfo(IAudioEndpointVolumeEx *iface, UINT *stepsize, UINT *stepcount)
|
||||
{
|
||||
TRACE("(%p)->(%p,%p)\n", iface, stepsize, stepcount);
|
||||
if (!stepsize && !stepcount)
|
||||
return E_POINTER;
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_VolumeStepUp(IAudioEndpointVolumeEx *iface, const GUID *ctx)
|
||||
{
|
||||
TRACE("(%p)->(%s)\n", iface, debugstr_guid(ctx));
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_VolumeStepDown(IAudioEndpointVolumeEx *iface, const GUID *ctx)
|
||||
{
|
||||
TRACE("(%p)->(%s)\n", iface, debugstr_guid(ctx));
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_QueryHardwareSupport(IAudioEndpointVolumeEx *iface, DWORD *mask)
|
||||
{
|
||||
TRACE("(%p)->(%p)\n", iface, mask);
|
||||
if (!mask)
|
||||
return E_POINTER;
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_GetVolumeRange(IAudioEndpointVolumeEx *iface, float *mindb, float *maxdb, float *inc)
|
||||
{
|
||||
TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
|
||||
|
||||
if (!mindb || !maxdb || !inc)
|
||||
return E_POINTER;
|
||||
|
||||
*mindb = -100.f;
|
||||
*maxdb = 0.f;
|
||||
*inc = 1.f;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AEV_GetVolumeRangeChannel(IAudioEndpointVolumeEx *iface, UINT chan, float *mindb, float *maxdb, float *inc)
|
||||
{
|
||||
TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
|
||||
if (!mindb || !maxdb || !inc)
|
||||
return E_POINTER;
|
||||
FIXME("stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl = {
|
||||
AEV_QueryInterface,
|
||||
AEV_AddRef,
|
||||
AEV_Release,
|
||||
AEV_RegisterControlChangeNotify,
|
||||
AEV_UnregisterControlChangeNotify,
|
||||
AEV_GetChannelCount,
|
||||
AEV_SetMasterVolumeLevel,
|
||||
AEV_SetMasterVolumeLevelScalar,
|
||||
AEV_GetMasterVolumeLevel,
|
||||
AEV_GetMasterVolumeLevelScalar,
|
||||
AEV_SetChannelVolumeLevel,
|
||||
AEV_SetChannelVolumeLevelScalar,
|
||||
AEV_GetChannelVolumeLevel,
|
||||
AEV_GetChannelVolumeLevelScalar,
|
||||
AEV_SetMute,
|
||||
AEV_GetMute,
|
||||
AEV_GetVolumeStepInfo,
|
||||
AEV_VolumeStepUp,
|
||||
AEV_VolumeStepDown,
|
||||
AEV_QueryHardwareSupport,
|
||||
AEV_GetVolumeRange,
|
||||
AEV_GetVolumeRangeChannel
|
||||
};
|
||||
|
||||
HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **ppv)
|
||||
{
|
||||
AEVImpl *This;
|
||||
|
||||
*ppv = NULL;
|
||||
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
|
||||
if (!This)
|
||||
return E_OUTOFMEMORY;
|
||||
This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
|
||||
This->ref = 1;
|
||||
|
||||
*ppv = &This->IAudioEndpointVolumeEx_iface;
|
||||
return S_OK;
|
||||
}
|
1618
dll/win32/mmdevapi/devenum.c
Normal file
1618
dll/win32/mmdevapi/devenum.c
Normal file
File diff suppressed because it is too large
Load diff
18
dll/win32/mmdevapi/guid.c
Normal file
18
dll/win32/mmdevapi/guid.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* DO NOT USE THE PRECOMPILED HEADER FOR THIS FILE! */
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <wingdi.h>
|
||||
#include <objbase.h>
|
||||
#include <initguid.h>
|
||||
#include <audiopolicy.h>
|
||||
#include <endpointvolume.h>
|
||||
#include <mmdeviceapi.h>
|
||||
|
||||
/* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */
|
301
dll/win32/mmdevapi/main.c
Normal file
301
dll/win32/mmdevapi/main.c
Normal file
|
@ -0,0 +1,301 @@
|
|||
/*
|
||||
* Copyright 2009 Maarten Lankhorst
|
||||
* Copyright 2011 Andrew Eikum for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "mmdevapi.h"
|
||||
|
||||
#include <rpcproxy.h>
|
||||
|
||||
static HINSTANCE instance;
|
||||
|
||||
DriverFuncs drvs;
|
||||
|
||||
const WCHAR drv_keyW[] = {'S','o','f','t','w','a','r','e','\\',
|
||||
'W','i','n','e','\\','D','r','i','v','e','r','s',0};
|
||||
|
||||
static const char *get_priority_string(int prio)
|
||||
{
|
||||
switch(prio){
|
||||
case Priority_Unavailable:
|
||||
return "Unavailable";
|
||||
case Priority_Low:
|
||||
return "Low";
|
||||
case Priority_Neutral:
|
||||
return "Neutral";
|
||||
case Priority_Preferred:
|
||||
return "Preferred";
|
||||
}
|
||||
return "Invalid";
|
||||
}
|
||||
|
||||
static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
|
||||
{
|
||||
WCHAR driver_module[264];
|
||||
static const WCHAR wineW[] = {'w','i','n','e',0};
|
||||
static const WCHAR dotdrvW[] = {'.','d','r','v',0};
|
||||
|
||||
lstrcpyW(driver_module, wineW);
|
||||
lstrcatW(driver_module, name);
|
||||
lstrcatW(driver_module, dotdrvW);
|
||||
|
||||
TRACE("Attempting to load %s\n", wine_dbgstr_w(driver_module));
|
||||
|
||||
driver->module = LoadLibraryW(driver_module);
|
||||
if(!driver->module){
|
||||
TRACE("Unable to load %s: %u\n", wine_dbgstr_w(driver_module),
|
||||
GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define LDFC(n) do { driver->p##n = (void*)GetProcAddress(driver->module, #n);\
|
||||
if(!driver->p##n) { FreeLibrary(driver->module); return FALSE; } } while(0)
|
||||
LDFC(GetPriority);
|
||||
LDFC(GetEndpointIDs);
|
||||
LDFC(GetAudioEndpoint);
|
||||
LDFC(GetAudioSessionManager);
|
||||
#undef LDFC
|
||||
|
||||
/* optional - do not fail if not found */
|
||||
driver->pGetPropValue = (void*)GetProcAddress(driver->module, "GetPropValue");
|
||||
|
||||
driver->priority = driver->pGetPriority();
|
||||
lstrcpyW(driver->module_name, driver_module);
|
||||
|
||||
TRACE("Successfully loaded %s with priority %s\n",
|
||||
wine_dbgstr_w(driver_module), get_priority_string(driver->priority));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL init_driver(void)
|
||||
{
|
||||
static const WCHAR drv_value[] = {'A','u','d','i','o',0};
|
||||
|
||||
static WCHAR default_list[] = {'p','u','l','s','e',',','a','l','s','a',',','o','s','s',',',
|
||||
'c','o','r','e','a','u','d','i','o',0};
|
||||
|
||||
DriverFuncs driver;
|
||||
HKEY key;
|
||||
WCHAR reg_list[256], *p, *next, *driver_list = default_list;
|
||||
|
||||
if(drvs.module)
|
||||
return TRUE;
|
||||
|
||||
if(RegOpenKeyW(HKEY_CURRENT_USER, drv_keyW, &key) == ERROR_SUCCESS){
|
||||
DWORD size = sizeof(reg_list);
|
||||
|
||||
if(RegQueryValueExW(key, drv_value, 0, NULL, (BYTE*)reg_list,
|
||||
&size) == ERROR_SUCCESS){
|
||||
if(reg_list[0] == '\0'){
|
||||
TRACE("User explicitly chose no driver\n");
|
||||
RegCloseKey(key);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
driver_list = reg_list;
|
||||
}
|
||||
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
TRACE("Loading driver list %s\n", wine_dbgstr_w(driver_list));
|
||||
for(next = p = driver_list; next; p = next + 1){
|
||||
next = strchrW(p, ',');
|
||||
if(next)
|
||||
*next = '\0';
|
||||
|
||||
driver.priority = Priority_Unavailable;
|
||||
if(load_driver(p, &driver)){
|
||||
if(driver.priority == Priority_Unavailable)
|
||||
FreeLibrary(driver.module);
|
||||
else if(!drvs.module || driver.priority > drvs.priority){
|
||||
TRACE("Selecting driver %s with priority %s\n",
|
||||
wine_dbgstr_w(p), get_priority_string(driver.priority));
|
||||
if(drvs.module)
|
||||
FreeLibrary(drvs.module);
|
||||
drvs = driver;
|
||||
}else
|
||||
FreeLibrary(driver.module);
|
||||
}else
|
||||
TRACE("Failed to load driver %s\n", wine_dbgstr_w(p));
|
||||
|
||||
if(next)
|
||||
*next = ',';
|
||||
}
|
||||
|
||||
return drvs.module != 0;
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
|
||||
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
instance = hinstDLL;
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
if(lpvReserved)
|
||||
break;
|
||||
MMDevEnum_Free();
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HRESULT WINAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
typedef HRESULT (*FnCreateInstance)(REFIID riid, LPVOID *ppobj);
|
||||
|
||||
typedef struct {
|
||||
IClassFactory IClassFactory_iface;
|
||||
REFCLSID rclsid;
|
||||
FnCreateInstance pfnCreateInstance;
|
||||
} IClassFactoryImpl;
|
||||
|
||||
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
MMCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
|
||||
{
|
||||
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
|
||||
if (ppobj == NULL)
|
||||
return E_POINTER;
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IClassFactory))
|
||||
{
|
||||
*ppobj = iface;
|
||||
IClassFactory_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI MMCF_AddRef(LPCLASSFACTORY iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI MMCF_Release(LPCLASSFACTORY iface)
|
||||
{
|
||||
/* static class, won't be freed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI MMCF_CreateInstance(
|
||||
LPCLASSFACTORY iface,
|
||||
LPUNKNOWN pOuter,
|
||||
REFIID riid,
|
||||
LPVOID *ppobj)
|
||||
{
|
||||
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||
TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), ppobj);
|
||||
|
||||
if (pOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
if (ppobj == NULL) {
|
||||
WARN("invalid parameter\n");
|
||||
return E_POINTER;
|
||||
}
|
||||
*ppobj = NULL;
|
||||
return This->pfnCreateInstance(riid, ppobj);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI MMCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
|
||||
{
|
||||
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||
FIXME("(%p, %d) stub!\n", This, dolock);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IClassFactoryVtbl MMCF_Vtbl = {
|
||||
MMCF_QueryInterface,
|
||||
MMCF_AddRef,
|
||||
MMCF_Release,
|
||||
MMCF_CreateInstance,
|
||||
MMCF_LockServer
|
||||
};
|
||||
|
||||
static IClassFactoryImpl MMDEVAPI_CF[] = {
|
||||
{ { &MMCF_Vtbl }, &CLSID_MMDeviceEnumerator, (FnCreateInstance)MMDevEnum_Create }
|
||||
};
|
||||
|
||||
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||
|
||||
if(!init_driver()){
|
||||
ERR("Driver initialization failed\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (ppv == NULL) {
|
||||
WARN("invalid parameter\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
if (!IsEqualIID(riid, &IID_IClassFactory) &&
|
||||
!IsEqualIID(riid, &IID_IUnknown)) {
|
||||
WARN("no interface for %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(MMDEVAPI_CF)/sizeof(MMDEVAPI_CF[0]); ++i)
|
||||
{
|
||||
if (IsEqualGUID(rclsid, MMDEVAPI_CF[i].rclsid)) {
|
||||
IClassFactory_AddRef(&MMDEVAPI_CF[i].IClassFactory_iface);
|
||||
*ppv = &MMDEVAPI_CF[i];
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
WARN("(%s, %s, %p): no class found.\n", debugstr_guid(rclsid),
|
||||
debugstr_guid(riid), ppv);
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllRegisterServer (MMDEVAPI.@)
|
||||
*/
|
||||
HRESULT WINAPI DllRegisterServer(void)
|
||||
{
|
||||
return __wine_register_resources( instance );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllUnregisterServer (MMDEVAPI.@)
|
||||
*/
|
||||
HRESULT WINAPI DllUnregisterServer(void)
|
||||
{
|
||||
return __wine_unregister_resources( instance );
|
||||
}
|
106
dll/win32/mmdevapi/mmdevapi.h
Normal file
106
dll/win32/mmdevapi/mmdevapi.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright 2009 Maarten Lankhorst
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _MMDEVAPI_H_
|
||||
#define _MMDEVAPI_H_
|
||||
|
||||
#include <wine/config.h>
|
||||
#include <wine/port.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#define COBJMACROS
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <wingdi.h>
|
||||
#include <winreg.h>
|
||||
#include <objbase.h>
|
||||
#include <audiopolicy.h>
|
||||
#include <endpointvolume.h>
|
||||
#include <mmdeviceapi.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
#include <wine/unicode.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
|
||||
|
||||
extern HRESULT MMDevEnum_Create(REFIID riid, void **ppv) DECLSPEC_HIDDEN;
|
||||
extern void MMDevEnum_Free(void) DECLSPEC_HIDDEN;
|
||||
|
||||
|
||||
/* Changes to this enum must be synced in drivers. */
|
||||
enum _DriverPriority {
|
||||
Priority_Unavailable = 0, /* driver won't work */
|
||||
Priority_Low, /* driver may work, but unlikely */
|
||||
Priority_Neutral, /* driver makes no judgment */
|
||||
Priority_Preferred /* driver thinks it's correct */
|
||||
};
|
||||
|
||||
typedef struct _DriverFuncs {
|
||||
HMODULE module;
|
||||
WCHAR module_name[64];
|
||||
int priority;
|
||||
|
||||
/* Returns a "priority" value for the driver. 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);
|
||||
|
||||
/* ids gets an array of human-friendly endpoint names
|
||||
* keys gets an array of driver-specific stuff that is used
|
||||
* in GetAudioEndpoint to identify the endpoint
|
||||
* it is the caller's responsibility to free both arrays, and
|
||||
* all of the elements in both arrays with HeapFree() */
|
||||
HRESULT (WINAPI *pGetEndpointIDs)(EDataFlow flow, WCHAR ***ids,
|
||||
GUID **guids, UINT *num, UINT *default_index);
|
||||
HRESULT (WINAPI *pGetAudioEndpoint)(void *key, IMMDevice *dev,
|
||||
IAudioClient **out);
|
||||
HRESULT (WINAPI *pGetAudioSessionManager)(IMMDevice *device,
|
||||
IAudioSessionManager2 **out);
|
||||
HRESULT (WINAPI *pGetPropValue)(GUID *guid,
|
||||
const PROPERTYKEY *prop, PROPVARIANT *out);
|
||||
} DriverFuncs;
|
||||
|
||||
extern DriverFuncs drvs DECLSPEC_HIDDEN;
|
||||
|
||||
typedef struct MMDevice {
|
||||
IMMDevice IMMDevice_iface;
|
||||
IMMEndpoint IMMEndpoint_iface;
|
||||
LONG ref;
|
||||
|
||||
CRITICAL_SECTION crst;
|
||||
|
||||
EDataFlow flow;
|
||||
DWORD state;
|
||||
GUID devguid;
|
||||
WCHAR *drv_id;
|
||||
} MMDevice;
|
||||
|
||||
extern HRESULT AudioClient_Create(MMDevice *parent, IAudioClient **ppv) DECLSPEC_HIDDEN;
|
||||
extern HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **ppv) DECLSPEC_HIDDEN;
|
||||
|
||||
extern const WCHAR drv_keyW[] DECLSPEC_HIDDEN;
|
||||
|
||||
#endif /* _MMDEVAPI_H_ */
|
1
dll/win32/mmdevapi/mmdevapi.rc
Normal file
1
dll/win32/mmdevapi/mmdevapi.rc
Normal file
|
@ -0,0 +1 @@
|
|||
1 WINE_REGISTRY "mmdevapi_classes.rgs"
|
19
dll/win32/mmdevapi/mmdevapi.spec
Normal file
19
dll/win32/mmdevapi/mmdevapi.spec
Normal file
|
@ -0,0 +1,19 @@
|
|||
2 stub MMDEVAPI_2
|
||||
3 stub MMDEVAPI_3
|
||||
4 stub MMDEVAPI_4
|
||||
5 stub MMDEVAPI_5
|
||||
6 stub MMDEVAPI_6
|
||||
7 stub MMDEVAPI_7
|
||||
8 stub MMDEVAPI_8
|
||||
9 stub MMDEVAPI_9
|
||||
10 stub MMDEVAPI_10
|
||||
11 stub MMDEVAPI_11
|
||||
12 stub MMDEVAPI_12
|
||||
13 stub MMDEVAPI_13
|
||||
14 stub MMDEVAPI_14
|
||||
15 stub MMDEVAPI_15
|
||||
|
||||
@ stdcall -private DllCanUnloadNow()
|
||||
@ stdcall -private DllGetClassObject( ptr ptr ptr )
|
||||
@ stdcall -private DllRegisterServer()
|
||||
@ stdcall -private DllUnregisterServer()
|
28
dll/win32/mmdevapi/mmdevapi_classes.idl
Normal file
28
dll/win32/mmdevapi/mmdevapi_classes.idl
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* COM Classes for mmdevapi
|
||||
*
|
||||
* Copyright 2010 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#pragma makedep register
|
||||
|
||||
[
|
||||
helpstring("MMDeviceEnumerator class"),
|
||||
threading(both),
|
||||
uuid(bcde0395-e52f-467c-8e3d-c4579291692e)
|
||||
]
|
||||
coclass MMDeviceEnumerator { interface IMMDeviceEnumerator; }
|
13
dll/win32/mmdevapi/mmdevapi_classes.rgs
Normal file
13
dll/win32/mmdevapi/mmdevapi_classes.rgs
Normal file
|
@ -0,0 +1,13 @@
|
|||
HKCR
|
||||
{
|
||||
NoRemove Interface
|
||||
{
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
'{BCDE0395-E52F-467C-8E3D-C4579291692E}' = s 'MMDeviceEnumerator class'
|
||||
{
|
||||
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue