msacm32: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-12 09:38:13 +02:00
parent 9479a00138
commit 77872fa87d
5 changed files with 36 additions and 40 deletions

View File

@ -2,6 +2,8 @@ MODULE = msacm32.dll
IMPORTLIB = msacm32 IMPORTLIB = msacm32
IMPORTS = winmm user32 advapi32 IMPORTS = winmm user32 advapi32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
driver.c \ driver.c \
filter.c \ filter.c \

View File

@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -38,7 +36,6 @@
#include "msacmdrv.h" #include "msacmdrv.h"
#include "wineacm.h" #include "wineacm.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msacm); WINE_DEFAULT_DEBUG_CHANNEL(msacm);
@ -441,11 +438,11 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
pConfigInfo->dwDCISize = iStructSize; pConfigInfo->dwDCISize = iStructSize;
section_name = HeapAlloc(MSACM_hHeap, 0, (strlenW(drivers32) + 1) * sizeof(WCHAR)); section_name = HeapAlloc(MSACM_hHeap, 0, (lstrlenW(drivers32) + 1) * sizeof(WCHAR));
if (section_name) strcpyW(section_name, drivers32); if (section_name) lstrcpyW(section_name, drivers32);
pConfigInfo->lpszDCISectionName = section_name; pConfigInfo->lpszDCISectionName = section_name;
alias_name = HeapAlloc(MSACM_hHeap, 0, (strlenW(pAlias) + 1) * sizeof(WCHAR)); alias_name = HeapAlloc(MSACM_hHeap, 0, (lstrlenW(pAlias) + 1) * sizeof(WCHAR));
if (alias_name) strcpyW(alias_name, pAlias); if (alias_name) lstrcpyW(alias_name, pAlias);
pConfigInfo->lpszDCIAliasName = alias_name; pConfigInfo->lpszDCIAliasName = alias_name;
if (pConfigInfo->lpszDCISectionName == NULL || pConfigInfo->lpszDCIAliasName == NULL) { if (pConfigInfo->lpszDCISectionName == NULL || pConfigInfo->lpszDCIAliasName == NULL) {

View File

@ -27,7 +27,6 @@
#include "winerror.h" #include "winerror.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "mmsystem.h" #include "mmsystem.h"
#include "mmreg.h" #include "mmreg.h"
@ -75,7 +74,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
} }
break; break;
case WINE_ACMFF_FORMAT: case WINE_ACMFF_FORMAT:
if (strcmpW(affd->szFormatTag, paftd->szFormatTag) == 0) { if (lstrcmpW(affd->szFormatTag, paftd->szFormatTag) == 0) {
HACMDRIVER had; HACMDRIVER had;
if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {
@ -102,7 +101,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
mmr = acmFormatDetailsW(had, &afd, ACM_FORMATDETAILSF_INDEX); mmr = acmFormatDetailsW(had, &afd, ACM_FORMATDETAILSF_INDEX);
if (mmr == MMSYSERR_NOERROR) { if (mmr == MMSYSERR_NOERROR) {
lstrcpynW(buffer, afd.szFormat, ACMFORMATTAGDETAILS_FORMATTAG_CHARS + 1); lstrcpynW(buffer, afd.szFormat, ACMFORMATTAGDETAILS_FORMATTAG_CHARS + 1);
len = strlenW(buffer); len = lstrlenW(buffer);
for (j = len; j < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; j++) for (j = len; j < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; j++)
buffer[j] = ' '; buffer[j] = ' ';
wsprintfW(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS, wsprintfW(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS,
@ -123,7 +122,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
} }
break; break;
case WINE_ACMFF_WFX: case WINE_ACMFF_WFX:
if (strcmpW(affd->szFormatTag, paftd->szFormatTag) == 0) { if (lstrcmpW(affd->szFormatTag, paftd->szFormatTag) == 0) {
HACMDRIVER had; HACMDRIVER had;
if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {
@ -504,8 +503,8 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD
pafd->pwfx->wBitsPerSample); pafd->pwfx->wBitsPerSample);
} }
MultiByteToWideChar(CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1, MultiByteToWideChar(CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,
pafd->szFormat + strlenW(pafd->szFormat), pafd->szFormat + lstrlenW(pafd->szFormat),
ARRAY_SIZE(pafd->szFormat) - strlenW(pafd->szFormat)); ARRAY_SIZE(pafd->szFormat) - lstrlenW(pafd->szFormat));
} }
TRACE("=> %d\n", mmr); TRACE("=> %d\n", mmr);

View File

@ -36,7 +36,6 @@
#include "msacmdrv.h" #include "msacmdrv.h"
#include "wineacm.h" #include "wineacm.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msacm); WINE_DEFAULT_DEBUG_CHANNEL(msacm);
@ -72,7 +71,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry(LPCWSTR pszRegEntry)
/* The requested registry entry must have the format msacm.XXXXX in order to /* The requested registry entry must have the format msacm.XXXXX in order to
be recognized in any future sessions of msacm be recognized in any future sessions of msacm
*/ */
if (0 == strncmpiW(pszRegEntry, msacmW, ARRAY_SIZE(msacmW))) { if (0 == wcsnicmp(pszRegEntry, msacmW, ARRAY_SIZE(msacmW))) {
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey); lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) { if (lRet != ERROR_SUCCESS) {
WARN("unable to open registry key - 0x%08x\n", lRet); WARN("unable to open registry key - 0x%08x\n", lRet);
@ -192,12 +191,12 @@ static LPWSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID* padid)
ERR("No alias needed for registry entry\n"); ERR("No alias needed for registry entry\n");
return NULL; return NULL;
} }
len = strlenW(baseKey); len = lstrlenW(baseKey);
ret = HeapAlloc(MSACM_hHeap, 0, (len + strlenW(padid->pszDriverAlias) + 1) * sizeof(WCHAR)); ret = HeapAlloc(MSACM_hHeap, 0, (len + lstrlenW(padid->pszDriverAlias) + 1) * sizeof(WCHAR));
if (!ret) return NULL; if (!ret) return NULL;
strcpyW(ret, baseKey); lstrcpyW(ret, baseKey);
strcpyW(ret + len, padid->pszDriverAlias); lstrcpyW(ret + len, padid->pszDriverAlias);
CharLowerW(ret + len); CharLowerW(ret + len);
return ret; return ret;
} }
@ -296,23 +295,23 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileNa
padid->pszDriverAlias = NULL; padid->pszDriverAlias = NULL;
if (pszDriverAlias) if (pszDriverAlias)
{ {
padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszDriverAlias)+1) * sizeof(WCHAR) ); padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (lstrlenW(pszDriverAlias)+1) * sizeof(WCHAR) );
if (!padid->pszDriverAlias) { if (!padid->pszDriverAlias) {
HeapFree(MSACM_hHeap, 0, padid); HeapFree(MSACM_hHeap, 0, padid);
return NULL; return NULL;
} }
strcpyW( padid->pszDriverAlias, pszDriverAlias ); lstrcpyW( padid->pszDriverAlias, pszDriverAlias );
} }
padid->pszFileName = NULL; padid->pszFileName = NULL;
if (pszFileName) if (pszFileName)
{ {
padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszFileName)+1) * sizeof(WCHAR) ); padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (lstrlenW(pszFileName)+1) * sizeof(WCHAR) );
if (!padid->pszFileName) { if (!padid->pszFileName) {
HeapFree(MSACM_hHeap, 0, padid->pszDriverAlias); HeapFree(MSACM_hHeap, 0, padid->pszDriverAlias);
HeapFree(MSACM_hHeap, 0, padid); HeapFree(MSACM_hHeap, 0, padid);
return NULL; return NULL;
} }
strcpyW( padid->pszFileName, pszFileName ); lstrcpyW( padid->pszFileName, pszFileName );
} }
padid->pLocalDriver = pLocalDriver; padid->pLocalDriver = pLocalDriver;
@ -376,8 +375,8 @@ void MSACM_RegisterAllDrivers(void)
bufLen = ARRAY_SIZE(buf); bufLen = ARRAY_SIZE(buf);
lRet = RegEnumKeyExW(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite); lRet = RegEnumKeyExW(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
if (lRet != ERROR_SUCCESS) continue; if (lRet != ERROR_SUCCESS) continue;
if (strncmpiW(buf, msacmW, ARRAY_SIZE(msacmW))) continue; if (wcsnicmp(buf, msacmW, ARRAY_SIZE(msacmW))) continue;
if (!(name = strchrW(buf, '='))) continue; if (!(name = wcschr(buf, '='))) continue;
*name = 0; *name = 0;
MSACM_RegisterDriver(buf, name + 1, 0); MSACM_RegisterDriver(buf, name + 1, 0);
} }
@ -386,7 +385,7 @@ void MSACM_RegisterAllDrivers(void)
bufLen = sizeof(buf); bufLen = sizeof(buf);
while(RegEnumValueW(hKey, i, valname, &cnt, 0, while(RegEnumValueW(hKey, i, valname, &cnt, 0,
&type, (BYTE*)buf, &bufLen) == ERROR_SUCCESS){ &type, (BYTE*)buf, &bufLen) == ERROR_SUCCESS){
if (!strncmpiW(valname, msacmW, ARRAY_SIZE(msacmW))) if (!wcsnicmp(valname, msacmW, ARRAY_SIZE(msacmW)))
MSACM_RegisterDriver(valname, buf, 0); MSACM_RegisterDriver(valname, buf, 0);
++i; ++i;
} }
@ -395,10 +394,10 @@ void MSACM_RegisterAllDrivers(void)
if (GetPrivateProfileSectionW(drv32, buf, ARRAY_SIZE(buf), sys)) if (GetPrivateProfileSectionW(drv32, buf, ARRAY_SIZE(buf), sys))
{ {
for(s = buf; *s; s += strlenW(s) + 1) for(s = buf; *s; s += lstrlenW(s) + 1)
{ {
if (strncmpiW(s, msacmW, ARRAY_SIZE(msacmW))) continue; if (wcsnicmp(s, msacmW, ARRAY_SIZE(msacmW))) continue;
if (!(name = strchrW(s, '='))) continue; if (!(name = wcschr(s, '='))) continue;
*name = 0; *name = 0;
MSACM_RegisterDriver(s, name + 1, 0); MSACM_RegisterDriver(s, name + 1, 0);
*name = '='; *name = '=';
@ -614,7 +613,7 @@ static void MSACM_ReorderDriversByPriority(void)
static const WCHAR sPrefix[] = {'m','s','a','c','m','.','\0'}; static const WCHAR sPrefix[] = {'m','s','a','c','m','.','\0'};
/* Build expected entry name */ /* Build expected entry name */
snprintfW(szSubKey, 17, priorityTmpl, i + 1); swprintf(szSubKey, 17, priorityTmpl, i + 1);
lBufferLength = sizeof(szBuffer); lBufferLength = sizeof(szBuffer);
lError = RegQueryValueExW(hPriorityKey, szSubKey, NULL, NULL, (LPBYTE)szBuffer, (LPDWORD)&lBufferLength); lError = RegQueryValueExW(hPriorityKey, szSubKey, NULL, NULL, (LPBYTE)szBuffer, (LPDWORD)&lBufferLength);
if (lError != ERROR_SUCCESS) continue; if (lError != ERROR_SUCCESS) continue;
@ -623,11 +622,11 @@ static void MSACM_ReorderDriversByPriority(void)
iTargetPosition = i; iTargetPosition = i;
/* Locate driver alias in driver list */ /* Locate driver alias in driver list */
pAlias = strstrW(szBuffer, sPrefix); pAlias = wcsstr(szBuffer, sPrefix);
if (pAlias == NULL) continue; if (pAlias == NULL) continue;
for (iCurrentPosition = 0; iCurrentPosition < iNumDrivers; iCurrentPosition++) { for (iCurrentPosition = 0; iCurrentPosition < iNumDrivers; iCurrentPosition++) {
if (strcmpiW(driverList[iCurrentPosition]->pszDriverAlias, pAlias) == 0) if (wcsicmp(driverList[iCurrentPosition]->pszDriverAlias, pAlias) == 0)
break; break;
} }
if (iCurrentPosition < iNumDrivers && iTargetPosition != iCurrentPosition) { if (iCurrentPosition < iNumDrivers && iTargetPosition != iCurrentPosition) {
@ -703,13 +702,13 @@ void MSACM_WriteCurrentPriorities(void)
/* Build required value name */ /* Build required value name */
dwPriorityCounter++; dwPriorityCounter++;
snprintfW(szSubKey, 17, priorityTmpl, dwPriorityCounter); swprintf(szSubKey, 17, priorityTmpl, dwPriorityCounter);
/* Value has a 1 in front for enabled drivers and 0 for disabled drivers */ /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
snprintfW(szBuffer, 256, valueTmpl, (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ? '0' : '1', padid->pszDriverAlias); swprintf(szBuffer, 256, valueTmpl, (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ? '0' : '1', padid->pszDriverAlias);
strlwrW(szBuffer); wcslwr(szBuffer);
lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (strlenW(szBuffer) + 1) * sizeof(WCHAR)); lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (lstrlenW(szBuffer) + 1) * sizeof(WCHAR));
if (lError != ERROR_SUCCESS) { if (lError != ERROR_SUCCESS) {
ERR("unable to write value for %s under key %s (0x%08x)\n", ERR("unable to write value for %s under key %s (0x%08x)\n",
debugstr_w(padid->pszDriverAlias), debugstr_w(basePriorityKey), lError); debugstr_w(padid->pszDriverAlias), debugstr_w(basePriorityKey), lError);
@ -718,12 +717,12 @@ void MSACM_WriteCurrentPriorities(void)
/* Build required value name */ /* Build required value name */
dwPriorityCounter++; dwPriorityCounter++;
snprintfW(szSubKey, 17, priorityTmpl, dwPriorityCounter); swprintf(szSubKey, 17, priorityTmpl, dwPriorityCounter);
/* Value has a 1 in front for enabled drivers and 0 for disabled drivers */ /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
snprintfW(szBuffer, 256, valueTmpl, '1', converterAlias); swprintf(szBuffer, 256, valueTmpl, '1', converterAlias);
lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (strlenW(szBuffer) + 1) * sizeof(WCHAR)); lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (lstrlenW(szBuffer) + 1) * sizeof(WCHAR));
if (lError != ERROR_SUCCESS) { if (lError != ERROR_SUCCESS) {
ERR("unable to write value for %s under key %s (0x%08x)\n", ERR("unable to write value for %s under key %s (0x%08x)\n",
debugstr_w(converterAlias), debugstr_w(basePriorityKey), lError); debugstr_w(converterAlias), debugstr_w(basePriorityKey), lError);

View File

@ -26,7 +26,6 @@
* embedded driver handling scheme in msacm32.dll which isn't done yet * embedded driver handling scheme in msacm32.dll which isn't done yet
*/ */
#include "config.h"
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>