static void SetDeviceDetails(HWND * hDlgCtrls, LPCGUID classGUID, LPGUID * deviceGUID) { HDEVINFO hInfo; DWORD dwIndex = 0; SP_DEVINFO_DATA InfoData; WCHAR szText[100]; /* create the setup list */ hInfo = SetupDiGetClassDevsW(classGUID, NULL, NULL, DIGCF_PRESENT|DIGCF_PROFILE); if (hInfo == INVALID_HANDLE_VALUE) return; do { ZeroMemory(&InfoData, sizeof(InfoData)); InfoData.cbSize = sizeof(InfoData); if (SetupDiEnumDeviceInfo(hInfo, dwIndex, &InfoData)) { /* set device name */ if (SetupDiGetDeviceRegistryPropertyW(hInfo, &InfoData, SPDRP_DEVICEDESC, NULL, (PBYTE)szText, sizeof(szText), NULL)) SendMessageW(hDlgCtrls[0], WM_SETTEXT, 0, (LPARAM)szText); /* set the manufacturer name */ if (SetupDiGetDeviceRegistryPropertyW(hInfo, &InfoData, SPDRP_MFG, NULL, (PBYTE)szText, sizeof(szText), NULL)) SendMessageW(hDlgCtrls[1], WM_SETTEXT, 0, (LPARAM)szText); /* FIXME * we currently enumerate only the first adapter */ EnumerateDrivers(&hDlgCtrls[2], hInfo, &InfoData); break; } if (GetLastError() == ERROR_NO_MORE_ITEMS) break; dwIndex++; }while(TRUE); /* destroy the setup list */ SetupDiDestroyDeviceInfoList(hInfo); }
static void SetDeviceDetails(HWND hwndDlg, LPCGUID classGUID, LPCWSTR lpcstrDescription) { HDEVINFO hInfo; DWORD dwIndex = 0; SP_DEVINFO_DATA InfoData; WCHAR szText[30]; HWND hDlgCtrls[3]; WAVEOUTCAPSW waveOut; UINT numDev; MMRESULT errCode; /* enumerate waveout devices */ numDev = waveOutGetNumDevs(); if (numDev) { do { ZeroMemory(&waveOut, sizeof(waveOut)); errCode = waveOutGetDevCapsW(dwIndex++, &waveOut, sizeof(waveOut)); if (!wcsncmp(lpcstrDescription, waveOut.szPname, min(MAXPNAMELEN, wcslen(waveOut.szPname)))) { /* set the product id */ SetDlgItemInt(hwndDlg, IDC_STATIC_DSOUND_PRODUCTID, waveOut.wPid, FALSE); /* set the vendor id */ SetDlgItemInt(hwndDlg, IDC_STATIC_DSOUND_VENDORID, waveOut.wMid, FALSE); /* check if its a wdm audio driver */ if (waveOut.wPid == MM_MSFT_WDMAUDIO_WAVEOUT) SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_TYPE, WM_SETTEXT, 0, (LPARAM)L"WDM"); /* check if device is default device */ szText[0] = L'\0'; if (dwIndex - 1 == 0) /* FIXME assume default playback device is device 0 */ LoadStringW(hInst, IDS_OPTION_YES, szText, sizeof(szText)/sizeof(WCHAR)); else LoadStringW(hInst, IDS_OPTION_NO, szText, sizeof(szText)/sizeof(WCHAR)); szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0'; /* set default device info */ SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_STANDARD, WM_SETTEXT, 0, (LPARAM)szText); break; } }while(errCode == MMSYSERR_NOERROR && dwIndex < numDev); } dwIndex = 0; /* create the setup list */ hInfo = SetupDiGetClassDevsW(classGUID, NULL, NULL, DIGCF_PRESENT|DIGCF_PROFILE); if (hInfo == INVALID_HANDLE_VALUE) return; do { ZeroMemory(&InfoData, sizeof(InfoData)); InfoData.cbSize = sizeof(InfoData); if (SetupDiEnumDeviceInfo(hInfo, dwIndex, &InfoData)) { /* set device name */ if (SetupDiGetDeviceInstanceId(hInfo, &InfoData, szText, sizeof(szText)/sizeof(WCHAR), NULL)) SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_DEVICEID, WM_SETTEXT, 0, (LPARAM)szText); /* set the manufacturer name */ if (SetupDiGetDeviceRegistryPropertyW(hInfo, &InfoData, SPDRP_MFG, NULL, (PBYTE)szText, sizeof(szText), NULL)) SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_PROVIDER, WM_SETTEXT, 0, (LPARAM)szText); /* FIXME * we currently enumerate only the first adapter */ hDlgCtrls[0] = GetDlgItem(hwndDlg, IDC_STATIC_DSOUND_DRIVER); hDlgCtrls[1] = GetDlgItem(hwndDlg, IDC_STATIC_DSOUND_VERSION); hDlgCtrls[2] = GetDlgItem(hwndDlg, IDC_STATIC_DSOUND_DATE); EnumerateDrivers(hDlgCtrls, hInfo, &InfoData); break; } if (GetLastError() == ERROR_NO_MORE_ITEMS) break; dwIndex++; }while(TRUE); /* destroy the setup list */ SetupDiDestroyDeviceInfoList(hInfo); }