/************************************************************************** * MMDRV_Alloc [internal] */ LPWINE_MLD MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags, DWORD_PTR* dwCallback, DWORD_PTR* dwInstance, BOOL bFrom32) { LPWINE_MLD mld; UINT i; TRACE("(%d, %04x, %p, %p, %p, %p, %c)\n", size, type, hndl, dwFlags, dwCallback, dwInstance, bFrom32?'Y':'N'); mld = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); if (!mld) return NULL; /* find an empty slot in MM_MLDrvs table */ for (i = 0; i < MAX_MM_MLDRVS; i++) if (!MM_MLDrvs[i]) break; if (i == MAX_MM_MLDRVS) { /* the MM_MLDrvs table could be made growable in the future if needed */ ERR("Too many open drivers\n"); HeapFree(GetProcessHeap(), 0, mld); return NULL; } MM_MLDrvs[i] = mld; *hndl = (HANDLE)(i | 0x8000); mld->type = type; if ((UINT)*hndl < MMDRV_GetNum(type) || HIWORD(*hndl) != 0) { /* FIXME: those conditions must be fulfilled so that: * - we can distinguish between device IDs and handles * - we can use handles as 16 or 32 bit entities */ ERR("Shouldn't happen. Bad allocation scheme\n"); } mld->bFrom32 = bFrom32; mld->dwFlags = HIWORD(*dwFlags); mld->dwCallback = *dwCallback; mld->dwClientInstance = *dwInstance; if (llTypes[type].Callback) { *dwFlags = LOWORD(*dwFlags) | CALLBACK_FUNCTION; *dwCallback = (DWORD)llTypes[type].Callback; *dwInstance = (DWORD)mld; /* FIXME: wouldn't some 16 bit drivers only use the loword ? */ } return mld; }
/************************************************************************** * midiInGetNumDevs [WINMM.@] */ UINT WINAPI midiInGetNumDevs(void) { return MMDRV_GetNum(MMDRV_MIDIIN); }
/************************************************************************** * midiOutGetNumDevs [WINMM.@] */ UINT WINAPI midiOutGetNumDevs(void) { return MMDRV_GetNum(MMDRV_MIDIOUT); }
/************************************************************************** * auxGetNumDevs [WINMM.@] */ UINT WINAPI auxGetNumDevs(void) { return MMDRV_GetNum(MMDRV_AUX); }