/************************************************************************** * OpenDriver [WINMM.@] * DrvOpen [WINMM.@] */ HDRVR WINAPI OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam) { LPWINE_DRIVER lpDrv = NULL; WCHAR libName[MAX_PATH + 1]; LPCWSTR lsn = lpSectionName; TRACE("(%s, %s, 0x%08lx);\n", debugstr_w(lpDriverName), debugstr_w(lpSectionName), lParam); DRIVER_Dump("BEFORE:"); if (lsn == NULL) { static const WCHAR wszDrivers32[] = {'D','r','i','v','e','r','s','3','2',0}; lstrcpynW(libName, lpDriverName, sizeof(libName) / sizeof(WCHAR)); if ((lpDrv = DRIVER_TryOpenDriver32(libName, lParam))) goto the_end; lsn = wszDrivers32; } if (DRIVER_GetLibName(lpDriverName, lsn, libName, sizeof(libName)) && (lpDrv = DRIVER_TryOpenDriver32(libName, lParam))) goto the_end; TRACE("Failed to open driver %s from system.ini file, section %s\n", debugstr_w(lpDriverName), debugstr_w(lpSectionName)); the_end: TRACE("=> %p\n", lpDrv); DRIVER_Dump("AFTER:"); return (HDRVR)lpDrv; }
/************************************************************************** * OpenDriver [WINMM.@] * DrvOpen [WINMM.@] */ HDRVR WINAPI OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam) { LPWINE_DRIVER lpDrv = NULL; WCHAR libName[128]; LPCWSTR lsn = lpSectionName; TRACE("(%s, %s, 0x%08lx);\n", debugstr_w(lpDriverName), debugstr_w(lpSectionName), lParam); /* If no section name is specified, either the caller is intending on opening a driver by filename, or wants to open a user-installable driver that has an entry in the Drivers32 key in the registry */ if (lsn == NULL) { /* Default registry key */ static const WCHAR wszDrivers32[] = {'D','r','i','v','e','r','s','3','2',0}; lstrcpynW(libName, lpDriverName, sizeof(libName) / sizeof(WCHAR)); /* Try and open the driver by filename */ if ( (lpDrv = DRIVER_TryOpenDriver32(libName, lParam)) ) goto the_end; /* If we got here, the file wasn't found. So we assume the caller wanted a driver specified under the Drivers32 registry key */ lsn = wszDrivers32; } /* Attempt to locate the driver filename in the registry */ if ( DRIVER_GetLibName(lpDriverName, lsn, libName, sizeof(libName)) ) { /* Now we have the filename, we can try and load it */ if ( (lpDrv = DRIVER_TryOpenDriver32(libName, lParam)) ) goto the_end; } /* now we will try a 16 bit driver (and add all the glue to make it work... which * is located in our mmsystem implementation) * so ensure, we can load our mmsystem, otherwise just fail */ WINMM_CheckForMMSystem(); #if 0 if (pFnOpenDriver16 && (lpDrv = pFnOpenDriver16(lpDriverName, lpSectionName, lParam))) { if (DRIVER_AddToList(lpDrv, 0, lParam)) goto the_end; HeapFree(GetProcessHeap(), 0, lpDrv); } TRACE("Failed to open driver %s from system.ini file, section %s\n", debugstr_w(lpDriverName), debugstr_w(lpSectionName)); #endif return 0; the_end: if (lpDrv) TRACE("=> %p\n", lpDrv); return (HDRVR)lpDrv; }