From dddacc25a53e12b036b3599fd045b9eab942d5af Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 6 Mar 2012 13:15:55 -0800 Subject: Store a duplicate of the mmdevapi device ID --- Alc/backends/mmdevapi.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Alc/backends/mmdevapi.c') 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; -- cgit v1.2.3