summaryrefslogtreecommitdiffstats
path: root/Alc/backends/mmdevapi.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-03-06 13:15:55 -0800
committerChris Robinson <[email protected]>2012-03-06 13:15:55 -0800
commitdddacc25a53e12b036b3599fd045b9eab942d5af (patch)
tree6089e77ea08b4716cce3f53adb263215a6ada30f /Alc/backends/mmdevapi.c
parent2ba2da467cc166979a32f40497f54488d8f70726 (diff)
Store a duplicate of the mmdevapi device ID
Diffstat (limited to 'Alc/backends/mmdevapi.c')
-rw-r--r--Alc/backends/mmdevapi.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index ccfb1a44..13d63941 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -71,7 +71,7 @@ typedef struct {
typedef struct {
ALCchar *name;
- LPWSTR devid;
+ WCHAR *devid;
} DevMap;
static DevMap *PlaybackDeviceList;
@@ -144,12 +144,16 @@ static ALCchar *get_device_name(IMMDevice *device)
static void add_device(IMMDevice *device, DevMap *devmap)
{
+ LPWSTR devid;
HRESULT hr;
- hr = IMMDevice_GetId(device, &devmap->devid);
+
+ hr = IMMDevice_GetId(device, &devid);
if(SUCCEEDED(hr))
{
+ devmap->devid = strdupW(devid);
devmap->name = get_device_name(device);
TRACE("Got device \"%s\", \"%ls\"\n", devmap->name, devmap->devid);
+ CoTaskMemFree(devid);
}
}
@@ -739,7 +743,7 @@ static DWORD CALLBACK MMDevApiMsgProc(void *ptr)
for(i = 0;i < *numdevs;i++)
{
free((*devlist)[i].name);
- CoTaskMemFree((*devlist)[i].devid);
+ free((*devlist)[i].devid);
}
free(*devlist);
*devlist = NULL;
@@ -948,7 +952,7 @@ void alcMMDevApiDeinit(void)
for(i = 0;i < NumPlaybackDevices;i++)
{
free(PlaybackDeviceList[i].name);
- CoTaskMemFree(PlaybackDeviceList[i].devid);
+ free(PlaybackDeviceList[i].devid);
}
free(PlaybackDeviceList);
PlaybackDeviceList = NULL;
@@ -957,7 +961,7 @@ void alcMMDevApiDeinit(void)
for(i = 0;i < NumCaptureDevices;i++)
{
free(CaptureDeviceList[i].name);
- CoTaskMemFree(CaptureDeviceList[i].devid);
+ free(CaptureDeviceList[i].devid);
}
free(CaptureDeviceList);
CaptureDeviceList = NULL;