msacm32: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-11-24 23:29:18 +01:00 committed by Alexandre Julliard
parent 31f6332f48
commit d37c304ef7
3 changed files with 21 additions and 36 deletions

View file

@ -434,12 +434,10 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
if (!pConfigInfo) {
ERR("OOM while supplying DRVCONFIGINFO for DRV_CONFIGURE, using NULL\n");
} else {
static const WCHAR drivers32[] = {'D','r','i','v','e','r','s','3','2','\0'};
pConfigInfo->dwDCISize = iStructSize;
section_name = HeapAlloc(MSACM_hHeap, 0, (lstrlenW(drivers32) + 1) * sizeof(WCHAR));
if (section_name) lstrcpyW(section_name, drivers32);
section_name = HeapAlloc(MSACM_hHeap, 0, sizeof(L"Drivers32"));
if (section_name) lstrcpyW(section_name, L"Drivers32");
pConfigInfo->lpszDCISectionName = section_name;
alias_name = HeapAlloc(MSACM_hHeap, 0, (lstrlenW(pAlias) + 1) * sizeof(WCHAR));
if (alias_name) lstrcpyW(alias_name, pAlias);

View file

@ -93,7 +93,6 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
afd.cbwfx = paftd->cbFormatSize;
for (i = 0; i < paftd->cStandardFormats; i++) {
static const WCHAR fmtW[] = {'%','d',' ','K','o','/','s','\0'};
int j, index;
afd.dwFormatIndex = i;
@ -105,7 +104,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
for (j = len; j < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; j++)
buffer[j] = ' ';
wsprintfW(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS,
fmtW, (afd.pwfx->nAvgBytesPerSec + 512) / 1024);
L"%d Ko/s", (afd.pwfx->nAvgBytesPerSec + 512) / 1024);
index = SendDlgItemMessageW(affd->hWnd,
IDD_ACMFORMATCHOOSE_CMB_FORMAT,
CB_ADDSTRING, 0, (LPARAM)buffer);
@ -213,19 +212,17 @@ static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEW afc)
return affd.ret;
}
static const WCHAR fmt_prop[] = {'a','c','m','p','r','o','p','\0'};
static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam)
{
PACMFORMATCHOOSEW afc = (PACMFORMATCHOOSEW)GetPropW(hWnd, fmt_prop);
ACMFORMATCHOOSEW *afc = (ACMFORMATCHOOSEW *)GetPropW(hWnd, L"acmprop");
TRACE("hwnd=%p msg=%i 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam);
switch (msg) {
case WM_INITDIALOG:
afc = (PACMFORMATCHOOSEW)lParam;
SetPropW(hWnd, fmt_prop, (HANDLE)afc);
SetPropW(hWnd, L"acmprop", (HANDLE)afc);
MSACM_FillFormatTags(hWnd, afc);
MSACM_FillFormat(hWnd, afc);
if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP|
@ -431,8 +428,6 @@ MMRESULT WINAPI acmFormatDetailsA(HACMDRIVER had, PACMFORMATDETAILSA pafd,
MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails)
{
MMRESULT mmr;
static const WCHAR fmt1[] = {'%','d',' ','H','z',0};
static const WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0};
ACMFORMATTAGDETAILSW aftd = {0};
TRACE("(%p, %p, %d)\n", had, pafd, fdwDetails);
@ -497,9 +492,9 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD
}
if (mmr == MMSYSERR_NOERROR && pafd->szFormat[0] == 0) {
wsprintfW(pafd->szFormat, fmt1, pafd->pwfx->nSamplesPerSec);
wsprintfW(pafd->szFormat, L"%d Hz", pafd->pwfx->nSamplesPerSec);
if (pafd->pwfx->wBitsPerSample) {
wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2,
wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), L"; %d bits",
pafd->pwfx->wBitsPerSample);
}
MultiByteToWideChar(CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,

View file

@ -347,10 +347,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileNa
*/
void MSACM_RegisterAllDrivers(void)
{
static const WCHAR msacm32[] = {'m','s','a','c','m','3','2','.','d','l','l','\0'};
static const WCHAR msacmW[] = {'M','S','A','C','M','.'};
static const WCHAR drv32[] = {'d','r','i','v','e','r','s','3','2','\0'};
static const WCHAR sys[] = {'s','y','s','t','e','m','.','i','n','i','\0'};
DWORD i, cnt, bufLen, lRet, type;
WCHAR buf[2048], valname[64], *name, *s;
FILETIME lastWrite;
@ -384,7 +381,7 @@ void MSACM_RegisterAllDrivers(void)
RegCloseKey( hKey );
}
if (GetPrivateProfileSectionW(drv32, buf, ARRAY_SIZE(buf), sys))
if (GetPrivateProfileSectionW(L"drivers32", buf, ARRAY_SIZE(buf), L"system.ini"))
{
for(s = buf; *s; s += lstrlenW(s) + 1)
{
@ -396,7 +393,7 @@ void MSACM_RegisterAllDrivers(void)
}
}
MSACM_ReorderDriversByPriority();
MSACM_RegisterDriver(msacm32, msacm32, 0);
MSACM_RegisterDriver(L"msacm32.dll", L"msacm32.dll", 0);
}
/***********************************************************************
@ -590,15 +587,13 @@ static void MSACM_ReorderDriversByPriority(void)
*/
for (i = 0; i < iNumDrivers; i++)
{
static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'};
WCHAR szSubKey[17];
unsigned int iTargetPosition;
unsigned int iCurrentPosition;
WCHAR * pAlias;
static const WCHAR sPrefix[] = {'m','s','a','c','m','.','\0'};
/* Build expected entry name */
swprintf(szSubKey, 17, priorityTmpl, i + 1);
swprintf(szSubKey, 17, L"Priority%ld", i + 1);
lBufferLength = sizeof(szBuffer);
lError = RegQueryValueExW(hPriorityKey, szSubKey, NULL, NULL, (LPBYTE)szBuffer, (LPDWORD)&lBufferLength);
if (lError != ERROR_SUCCESS) continue;
@ -607,7 +602,7 @@ static void MSACM_ReorderDriversByPriority(void)
iTargetPosition = i;
/* Locate driver alias in driver list */
pAlias = wcsstr(szBuffer, sPrefix);
pAlias = wcsstr(szBuffer, L"msacm.");
if (pAlias == NULL) continue;
for (iCurrentPosition = 0; iCurrentPosition < iNumDrivers; iCurrentPosition++) {
@ -653,9 +648,6 @@ void MSACM_WriteCurrentPriorities(void)
HKEY hPriorityKey;
PWINE_ACMDRIVERID padid;
DWORD dwPriorityCounter;
static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'};
static const WCHAR valueTmpl[] = {'%','c',',',' ','%','s','\0'};
static const WCHAR converterAlias[] = {'I','n','t','e','r','n','a','l',' ','P','C','M',' ','C','o','n','v','e','r','t','e','r','\0'};
WCHAR szSubKey[17];
WCHAR szBuffer[256];
@ -680,10 +672,10 @@ void MSACM_WriteCurrentPriorities(void)
/* Build required value name */
dwPriorityCounter++;
swprintf(szSubKey, 17, priorityTmpl, dwPriorityCounter);
swprintf(szSubKey, 17, L"Priority%ld", dwPriorityCounter);
/* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
swprintf(szBuffer, 256, valueTmpl, (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ? '0' : '1', padid->pszDriverAlias);
swprintf(szBuffer, 256, L"%c, %s", (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ? '0' : '1', padid->pszDriverAlias);
wcslwr(szBuffer);
lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (lstrlenW(szBuffer) + 1) * sizeof(WCHAR));
@ -695,15 +687,15 @@ void MSACM_WriteCurrentPriorities(void)
/* Build required value name */
dwPriorityCounter++;
swprintf(szSubKey, 17, priorityTmpl, dwPriorityCounter);
swprintf(szSubKey, 17, L"Priority%ld", dwPriorityCounter);
/* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
swprintf(szBuffer, 256, valueTmpl, '1', converterAlias);
swprintf(szBuffer, 256, L"%c, %s", '1', L"Internal PCM Converter");
lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (lstrlenW(szBuffer) + 1) * sizeof(WCHAR));
if (lError != ERROR_SUCCESS) {
ERR("unable to write value for %s under key %s (0x%08x)\n",
debugstr_w(converterAlias), debugstr_w(basePriorityKey), lError);
ERR("unable to write value for Internal PCM Converter under key %s (0x%08x)\n",
debugstr_w(basePriorityKey), lError);
}
RegCloseKey(hPriorityKey);
}