Add missing functionality.

Add more and better error messages.
Add checks for failed HeapAlloc.
This commit is contained in:
Robert Reif 2005-03-14 10:03:54 +00:00 committed by Alexandre Julliard
parent 4293b614c4
commit ea7fa3c7db
1 changed files with 431 additions and 191 deletions

View File

@ -391,9 +391,11 @@ static HRESULT WINAPI DSPROPERTY_Description1(
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
else
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
break; break;
} else { } else {
WARN("waveOutMessage failed\n"); WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED; return E_PROP_ID_UNSUPPORTED;
} }
} }
@ -420,9 +422,11 @@ static HRESULT WINAPI DSPROPERTY_Description1(
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
else
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
break; break;
} else { } else {
WARN("waveInMessage failed\n"); WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED; return E_PROP_ID_UNSUPPORTED;
} }
} }
@ -450,10 +454,12 @@ static HRESULT WINAPI DSPROPERTY_Description1(
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
else
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
found = TRUE; found = TRUE;
break; break;
} else { } else {
WARN("waveOutMessage failed\n"); WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED; return E_PROP_ID_UNSUPPORTED;
} }
} }
@ -481,10 +487,12 @@ static HRESULT WINAPI DSPROPERTY_Description1(
err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
else
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
found = TRUE; found = TRUE;
break; break;
} else { } else {
WARN("waveInMessage failed\n"); WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED; return E_PROP_ID_UNSUPPORTED;
} }
} }
@ -543,33 +551,43 @@ static HRESULT WINAPI DSPROPERTY_DescriptionA(
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
wodn = waveOutGetNumDevs(); wodn = waveOutGetNumDevs();
for (wod = 0; wod < wodn; wod++) { for (wod = 0; wod < wodn; wod++) {
if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) { if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) {
DSDRIVERDESC desc; DSDRIVERDESC desc;
ppd->WaveDeviceId = wod; ppd->WaveDeviceId = wod;
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
if (err == DS_OK) { if (err == DS_OK) {
PIDSDRIVER drv = NULL; PIDSDRIVER drv = NULL;
/* FIXME: this is a memory leak */ /* FIXME: this is a memory leak */
CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
strcpy(szDescription, desc.szDesc); if (szDescription && szModule && szInterface) {
strcpy(szModule, desc.szDrvname); strcpy(szDescription, desc.szDesc);
strcpy(szInterface, "Interface"); strcpy(szModule, desc.szDrvname);
strcpy(szInterface, "Interface");
ppd->Description = szDescription; ppd->Description = szDescription;
ppd->Module = szModule; ppd->Module = szModule;
ppd->Interface = szInterface; ppd->Interface = szInterface;
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
break; else
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
break;
} else { } else {
WARN("waveOutMessage failed\n"); WARN("no memory\n");
return E_PROP_ID_UNSUPPORTED; HeapFree(GetProcessHeap(), 0, szDescription);
HeapFree(GetProcessHeap(), 0, szModule);
HeapFree(GetProcessHeap(), 0, szInterface);
return E_OUTOFMEMORY;
} }
} else {
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED;
} }
}
} }
} else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) || } else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) ||
IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) { IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) {
@ -579,33 +597,43 @@ static HRESULT WINAPI DSPROPERTY_DescriptionA(
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
widn = waveInGetNumDevs(); widn = waveInGetNumDevs();
for (wid = 0; wid < widn; wid++) { for (wid = 0; wid < widn; wid++) {
if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) { if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) {
DSDRIVERDESC desc; DSDRIVERDESC desc;
ppd->WaveDeviceId = wid; ppd->WaveDeviceId = wid;
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
if (err == DS_OK) { if (err == DS_OK) {
PIDSCDRIVER drv; PIDSCDRIVER drv;
/* FIXME: this is a memory leak */ /* FIXME: this is a memory leak */
CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
strcpy(szDescription, desc.szDesc); if (szDescription && szModule && szInterface) {
strcpy(szModule, desc.szDrvname); strcpy(szDescription, desc.szDesc);
strcpy(szInterface, "Interface"); strcpy(szModule, desc.szDrvname);
strcpy(szInterface, "Interface");
ppd->Description = szDescription; ppd->Description = szDescription;
ppd->Module = szModule; ppd->Module = szModule;
ppd->Interface = szInterface; ppd->Interface = szInterface;
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
break; else
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
break;
} else { } else {
WARN("waveInMessage failed\n"); WARN("no memory\n");
return E_PROP_ID_UNSUPPORTED; HeapFree(GetProcessHeap(), 0, szDescription);
HeapFree(GetProcessHeap(), 0, szModule);
HeapFree(GetProcessHeap(), 0, szInterface);
return E_OUTOFMEMORY;
} }
} else {
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED;
} }
}
} }
} else { } else {
BOOL found = FALSE; BOOL found = FALSE;
@ -614,19 +642,20 @@ static HRESULT WINAPI DSPROPERTY_DescriptionA(
/* given specific device so try the render devices first */ /* given specific device so try the render devices first */
wodn = waveOutGetNumDevs(); wodn = waveOutGetNumDevs();
for (wod = 0; wod < wodn; wod++) { for (wod = 0; wod < wodn; wod++) {
if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) { if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) {
DSDRIVERDESC desc; DSDRIVERDESC desc;
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n"); TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
ppd->WaveDeviceId = wod; ppd->WaveDeviceId = wod;
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
if (err == DS_OK) { if (err == DS_OK) {
PIDSDRIVER drv = NULL; PIDSDRIVER drv = NULL;
/* FIXME: this is a memory leak */ /* FIXME: this is a memory leak */
CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
if (szDescription && szModule && szInterface) {
strcpy(szDescription, desc.szDesc); strcpy(szDescription, desc.szDesc);
strcpy(szModule, desc.szDrvname); strcpy(szModule, desc.szDrvname);
strcpy(szInterface, "Interface"); strcpy(szInterface, "Interface");
@ -637,13 +666,70 @@ static HRESULT WINAPI DSPROPERTY_DescriptionA(
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
else
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
found = TRUE; found = TRUE;
break; break;
} else { } else {
WARN("waveOutMessage failed\n"); WARN("no memory\n");
return E_PROP_ID_UNSUPPORTED; HeapFree(GetProcessHeap(), 0, szDescription);
HeapFree(GetProcessHeap(), 0, szModule);
HeapFree(GetProcessHeap(), 0, szInterface);
return E_OUTOFMEMORY;
} }
} else {
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED;
} }
}
}
if (found == FALSE) {
ULONG wid;
unsigned int widn;
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
widn = waveInGetNumDevs();
for (wid = 0; wid < widn; wid++) {
if (IsEqualGUID( &ppd->DeviceId, &capture_guids[wod] ) ) {
DSDRIVERDESC desc;
ppd->WaveDeviceId = wid;
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
if (err == DS_OK) {
PIDSCDRIVER drv;
/* FIXME: this is a memory leak */
CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1);
CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1);
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1);
if (szDescription && szModule && szInterface) {
strcpy(szDescription, desc.szDesc);
strcpy(szModule, desc.szDrvname);
strcpy(szInterface, "Interface");
ppd->Description = szDescription;
ppd->Module = szModule;
ppd->Interface = szInterface;
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
else
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
found = TRUE;
break;
} else {
WARN("no memory\n");
HeapFree(GetProcessHeap(), 0, szDescription);
HeapFree(GetProcessHeap(), 0, szModule);
HeapFree(GetProcessHeap(), 0, szInterface);
return E_OUTOFMEMORY;
}
} else {
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED;
}
}
}
} }
if (found == FALSE) { if (found == FALSE) {
@ -698,33 +784,43 @@ static HRESULT WINAPI DSPROPERTY_DescriptionW(
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
wodn = waveOutGetNumDevs(); wodn = waveOutGetNumDevs();
for (wod = 0; wod < wodn; wod++) { for (wod = 0; wod < wodn; wod++) {
if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) { if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) {
DSDRIVERDESC desc; DSDRIVERDESC desc;
ppd->WaveDeviceId = wod; ppd->WaveDeviceId = wod;
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
if (err == DS_OK) { if (err == DS_OK) {
PIDSDRIVER drv = NULL; PIDSDRIVER drv = NULL;
/* FIXME: this is a memory leak */ /* FIXME: this is a memory leak */
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); if (wDescription && wModule && wInterface) {
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
ppd->Description = wDescription; ppd->Description = wDescription;
ppd->Module = wModule; ppd->Module = wModule;
ppd->Interface = wInterface; ppd->Interface = wInterface;
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
break; else
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
break;
} else { } else {
WARN("waveOutMessage failed\n"); WARN("no memory\n");
return E_PROP_ID_UNSUPPORTED; HeapFree(GetProcessHeap(), 0, wDescription);
HeapFree(GetProcessHeap(), 0, wModule);
HeapFree(GetProcessHeap(), 0, wInterface);
return E_OUTOFMEMORY;
} }
} else {
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED;
} }
}
} }
} else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) || } else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) ||
IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) { IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) {
@ -734,33 +830,43 @@ static HRESULT WINAPI DSPROPERTY_DescriptionW(
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
widn = waveInGetNumDevs(); widn = waveInGetNumDevs();
for (wid = 0; wid < widn; wid++) { for (wid = 0; wid < widn; wid++) {
if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) { if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) {
DSDRIVERDESC desc; DSDRIVERDESC desc;
ppd->WaveDeviceId = wid; ppd->WaveDeviceId = wid;
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
if (err == DS_OK) { if (err == DS_OK) {
PIDSCDRIVER drv; PIDSCDRIVER drv;
/* FIXME: this is a memory leak */ /* FIXME: this is a memory leak */
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); if (wDescription && wModule && wInterface) {
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
ppd->Description = wDescription; ppd->Description = wDescription;
ppd->Module = wModule; ppd->Module = wModule;
ppd->Interface = wInterface; ppd->Interface = wInterface;
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
else
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
break; break;
} else { } else {
WARN("waveInMessage failed\n"); WARN("no memory\n");
return E_PROP_ID_UNSUPPORTED; HeapFree(GetProcessHeap(), 0, wDescription);
HeapFree(GetProcessHeap(), 0, wModule);
HeapFree(GetProcessHeap(), 0, wInterface);
return E_OUTOFMEMORY;
} }
} else {
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED;
} }
}
} }
} else { } else {
BOOL found = FALSE; BOOL found = FALSE;
@ -769,19 +875,20 @@ static HRESULT WINAPI DSPROPERTY_DescriptionW(
/* given specific device so try the render devices first */ /* given specific device so try the render devices first */
wodn = waveOutGetNumDevs(); wodn = waveOutGetNumDevs();
for (wod = 0; wod < wodn; wod++) { for (wod = 0; wod < wodn; wod++) {
if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) { if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) {
DSDRIVERDESC desc; DSDRIVERDESC desc;
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n"); TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
ppd->WaveDeviceId = wod; ppd->WaveDeviceId = wod;
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
if (err == DS_OK) { if (err == DS_OK) {
PIDSDRIVER drv = NULL; PIDSDRIVER drv = NULL;
/* FIXME: this is a memory leak */ /* FIXME: this is a memory leak */
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
if (wDescription && wModule && wInterface) {
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
@ -791,14 +898,71 @@ static HRESULT WINAPI DSPROPERTY_DescriptionW(
ppd->Interface = wInterface; ppd->Interface = wInterface;
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0));
if (err == DS_OK && drv) if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
else
WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n");
found = TRUE; found = TRUE;
break; break;
} else { } else {
WARN("waveOutMessage failed\n"); WARN("no memory\n");
return E_PROP_ID_UNSUPPORTED; HeapFree(GetProcessHeap(), 0, wDescription);
HeapFree(GetProcessHeap(), 0, wModule);
HeapFree(GetProcessHeap(), 0, wInterface);
return E_OUTOFMEMORY;
} }
} else {
WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED;
} }
}
}
if (found == FALSE) {
ULONG wid;
unsigned int widn;
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
widn = waveInGetNumDevs();
for (wid = 0; wid < widn; wid++) {
if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) {
DSDRIVERDESC desc;
ppd->WaveDeviceId = wid;
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0));
if (err == DS_OK) {
PIDSCDRIVER drv;
/* FIXME: this is a memory leak */
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
if (wDescription && wModule && wInterface) {
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
ppd->Description = wDescription;
ppd->Module = wModule;
ppd->Interface = wInterface;
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0));
if (err == DS_OK && drv)
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
else
WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n");
found = TRUE;
break;
} else {
WARN("no memory\n");
HeapFree(GetProcessHeap(), 0, wDescription);
HeapFree(GetProcessHeap(), 0, wModule);
HeapFree(GetProcessHeap(), 0, wInterface);
return E_OUTOFMEMORY;
}
} else {
WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n");
return E_PROP_ID_UNSUPPORTED;
}
}
}
} }
if (found == FALSE) { if (found == FALSE) {
@ -821,8 +985,68 @@ static HRESULT WINAPI DSPROPERTY_Enumerate1(
ULONG cbPropData, ULONG cbPropData,
PULONG pcbReturned ) PULONG pcbReturned )
{ {
FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n", PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA) pPropData;
HRESULT err;
TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned); debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
if (ppd) {
if (ppd->Callback) {
unsigned devs, wod, wid;
DSDRIVERDESC desc;
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data;
devs = waveOutGetNumDevs();
for (wod = 0; wod < devs; ++wod) {
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
if (err == DS_OK) {
ZeroMemory(&data, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
data.WaveDeviceId = wod;
data.DeviceId = renderer_guids[wod];
strncpy(data.DescriptionA, desc.szDesc, sizeof(data.DescriptionA));
strncpy(data.ModuleA, desc.szDrvname, sizeof(data.ModuleA));
MultiByteToWideChar( CP_ACP, 0, data.DescriptionA, -1, data.DescriptionW, sizeof(data.DescriptionW) );
MultiByteToWideChar( CP_ACP, 0, data.ModuleA, -1, data.ModuleW, sizeof(data.ModuleW) );
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context);
}
}
devs = waveInGetNumDevs();
for (wid = 0; wid < devs; ++wid) {
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
if (err == DS_OK) {
ZeroMemory(&data, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
data.WaveDeviceId = wod;
data.DeviceId = renderer_guids[wod];
strncpy(data.DescriptionA, desc.szDesc, sizeof(data.DescriptionA));
strncpy(data.ModuleA, desc.szDrvname, sizeof(data.ModuleA));
MultiByteToWideChar( CP_ACP, 0, data.DescriptionA, -1, data.DescriptionW, sizeof(data.DescriptionW) );
MultiByteToWideChar( CP_ACP, 0, data.ModuleA, -1, data.ModuleW, sizeof(data.ModuleW) );
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context);
}
}
return S_OK;
}
}
} else {
FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
}
if (pcbReturned) {
*pcbReturned = 0;
FIXME("*pcbReturned=%ld\n", *pcbReturned);
}
return E_PROP_ID_UNSUPPORTED; return E_PROP_ID_UNSUPPORTED;
} }
@ -849,27 +1073,31 @@ static HRESULT WINAPI DSPROPERTY_EnumerateA(
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
if (err == DS_OK) { if (err == DS_OK) {
DWORD size; DWORD size;
ZeroMemory(&data, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
data.WaveDeviceId = wod;
data.DeviceId = renderer_guids[wod];
data.Description = desc.szDesc;
data.Module = desc.szDrvname;
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0)); err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0));
if (err == DS_OK) { if (err == DS_OK) {
WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size); WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size);
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size)); if (nameW) {
if (err == DS_OK) { err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size));
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR)); if (err == DS_OK) {
WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL ); CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR));
data.Interface = szInterface; if (szInterface) {
ZeroMemory(&data, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
data.WaveDeviceId = wod;
data.DeviceId = renderer_guids[wod];
data.Description = desc.szDesc;
data.Module = desc.szDrvname;
WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL );
data.Interface = szInterface;
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context); (ppd->Callback)(&data, ppd->Context);
HeapFree(GetProcessHeap(),0,szInterface); HeapFree(GetProcessHeap(),0,szInterface);
}
}
HeapFree(GetProcessHeap(),0,nameW);
} }
HeapFree(GetProcessHeap(),0,nameW);
} }
} }
} }
@ -879,27 +1107,31 @@ static HRESULT WINAPI DSPROPERTY_EnumerateA(
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
if (err == DS_OK) { if (err == DS_OK) {
DWORD size; DWORD size;
ZeroMemory(&data, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
data.WaveDeviceId = wid;
data.DeviceId = capture_guids[wid];
data.Description = desc.szDesc;
data.Module = desc.szDrvname;
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0)); err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0));
if (err == DS_OK) { if (err == DS_OK) {
WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size); WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size);
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size)); if (nameW) {
if (err == DS_OK) { err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size));
CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR)); if (err == DS_OK) {
WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL ); CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR));
data.Interface = szInterface; if (szInterface) {
ZeroMemory(&data, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
data.WaveDeviceId = wid;
data.DeviceId = capture_guids[wid];
data.Description = desc.szDesc;
data.Module = desc.szDrvname;
WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL );
data.Interface = szInterface;
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context); (ppd->Callback)(&data, ppd->Context);
HeapFree(GetProcessHeap(),0,szInterface); HeapFree(GetProcessHeap(),0,szInterface);
}
}
HeapFree(GetProcessHeap(),0,nameW);
} }
HeapFree(GetProcessHeap(),0,nameW);
} }
} }
} }
@ -943,31 +1175,35 @@ static HRESULT WINAPI DSPROPERTY_EnumerateW(
if (err == DS_OK) { if (err == DS_OK) {
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
DWORD size; if (wDescription && wModule) {
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0)); DWORD size;
if (err == DS_OK) { err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0));
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
if (err == DS_OK) { if (err == DS_OK) {
ZeroMemory(&data, sizeof(data)); WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; if (wInterface) {
data.WaveDeviceId = wod; err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
data.DeviceId = renderer_guids[wod]; if (err == DS_OK) {
ZeroMemory(&data, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
data.WaveDeviceId = wod;
data.DeviceId = renderer_guids[wod];
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
data.Description = wDescription; data.Description = wDescription;
data.Module = wModule; data.Module = wModule;
data.Interface = wInterface; data.Interface = wInterface;
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context); (ppd->Callback)(&data, ppd->Context);
}
HeapFree(GetProcessHeap(),0,wInterface);
}
} }
HeapFree(GetProcessHeap(),0,wInterface); HeapFree(GetProcessHeap(),0,wDescription);
HeapFree(GetProcessHeap(),0,wModule);
} }
HeapFree(GetProcessHeap(),0,wDescription);
HeapFree(GetProcessHeap(),0,wModule);
} }
} }
@ -977,30 +1213,34 @@ static HRESULT WINAPI DSPROPERTY_EnumerateW(
if (err == DS_OK) { if (err == DS_OK) {
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
DWORD size; if (wDescription && wModule) {
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0)); DWORD size;
if (err == DS_OK) { err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0));
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
if (err == DS_OK) { if (err == DS_OK) {
ZeroMemory(&data, sizeof(data)); WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; if (wInterface) {
data.WaveDeviceId = wid; err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
data.DeviceId = capture_guids[wid]; if (err == DS_OK) {
ZeroMemory(&data, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
data.WaveDeviceId = wid;
data.DeviceId = capture_guids[wid];
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 );
data.Description = wDescription; data.Description = wDescription;
data.Module = wModule; data.Module = wModule;
data.Interface = wInterface; data.Interface = wInterface;
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context); (ppd->Callback)(&data, ppd->Context);
}
HeapFree(GetProcessHeap(),0,wInterface);
}
} }
HeapFree(GetProcessHeap(),0,wInterface); HeapFree(GetProcessHeap(),0,wDescription);
HeapFree(GetProcessHeap(),0,wModule);
} }
HeapFree(GetProcessHeap(),0,wDescription);
HeapFree(GetProcessHeap(),0,wModule);
} }
} }
@ -1027,8 +1267,8 @@ static HRESULT WINAPI IKsPrivatePropertySetImpl_Get(
ULONG cbInstanceData, ULONG cbInstanceData,
LPVOID pPropData, LPVOID pPropData,
ULONG cbPropData, ULONG cbPropData,
PULONG pcbReturned PULONG pcbReturned )
) { {
IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface; IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n", TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned); This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);