/*********************************************************************** * DllMain (DSOUND.init) */ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved) { int i; TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpvReserved); switch (fdwReason) { case DLL_PROCESS_ATTACH: TRACE("DLL_PROCESS_ATTACH\n"); for (i = 0; i < MAXWAVEDRIVERS; i++) { DSOUND_renderer[i] = NULL; DSOUND_capture[i] = NULL; INIT_GUID(DSOUND_renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i); INIT_GUID(DSOUND_capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i); } instance = hInstDLL; DisableThreadLibraryCalls(hInstDLL); /* Increase refcount on dsound by 1 */ GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)hInstDLL, &hInstDLL); break; case DLL_PROCESS_DETACH: TRACE("DLL_PROCESS_DETACH\n"); break; default: TRACE("UNKNOWN REASON\n"); break; } return TRUE; }
HRESULT EnumerateAudioFilter( LPFILTERINFO CurInfo, OUT PULONG WaveInCount, OUT PULONG WaveOutCount) { DWORD Status; ULONG PinCount, WaveInPins, WaveOutPins; /* first step open filter */ Status = OpenFilter((LPCWSTR)CurInfo->DevicePath, &CurInfo->hFilter); if (Status != ERROR_SUCCESS) { DPRINT("Failed to open filter with %lx Path %ws\n", Status, CurInfo->DevicePath); return E_FAIL; } /* get filter pin count */ Status = GetFilterPinCount(CurInfo->hFilter, &PinCount); if (Status != ERROR_SUCCESS) { DPRINT("Failed to get pin count with %lx\n", Status); return E_FAIL; } /* sanity check */ ASSERT(PinCount); /* store pin count */ CurInfo->PinCount = PinCount; /* now allocate an pin array */ CurInfo->Pin = HeapAlloc(GetProcessHeap(), 0, PinCount * sizeof(ULONG)); if (!CurInfo->Pin) { /* no memory */ return E_FAIL; } /* no try to find playback / recording pins */ FindAudioFilterPins(CurInfo, &WaveInPins, &WaveOutPins); DPRINT("WaveInPins %u WaveOutPins %u %S\n", WaveInPins, WaveOutPins, CurInfo->DevicePath); if (WaveOutPins) { /* create a unique guid for this playback device */ if (FindWinMMDeviceIndex(CurInfo, TRUE)) { (*WaveOutCount)++; INIT_GUID(CurInfo->DeviceGuid[0], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + *WaveInCount); } } if (WaveInPins) { if (FindWinMMDeviceIndex(CurInfo, FALSE)) { /* create a unique guid for this record device */ (*WaveInCount)++; INIT_GUID(CurInfo->DeviceGuid[1], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + *WaveOutCount); } } return S_OK; }