Commit d37c304e authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

msacm32: Use wide-char string literals.

parent 31f6332f
...@@ -434,12 +434,10 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA ...@@ -434,12 +434,10 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA
if (!pConfigInfo) { if (!pConfigInfo) {
ERR("OOM while supplying DRVCONFIGINFO for DRV_CONFIGURE, using NULL\n"); ERR("OOM while supplying DRVCONFIGINFO for DRV_CONFIGURE, using NULL\n");
} else { } else {
static const WCHAR drivers32[] = {'D','r','i','v','e','r','s','3','2','\0'};
pConfigInfo->dwDCISize = iStructSize; pConfigInfo->dwDCISize = iStructSize;
section_name = HeapAlloc(MSACM_hHeap, 0, (lstrlenW(drivers32) + 1) * sizeof(WCHAR)); section_name = HeapAlloc(MSACM_hHeap, 0, sizeof(L"Drivers32"));
if (section_name) lstrcpyW(section_name, drivers32); if (section_name) lstrcpyW(section_name, L"Drivers32");
pConfigInfo->lpszDCISectionName = section_name; pConfigInfo->lpszDCISectionName = section_name;
alias_name = HeapAlloc(MSACM_hHeap, 0, (lstrlenW(pAlias) + 1) * sizeof(WCHAR)); alias_name = HeapAlloc(MSACM_hHeap, 0, (lstrlenW(pAlias) + 1) * sizeof(WCHAR));
if (alias_name) lstrcpyW(alias_name, pAlias); if (alias_name) lstrcpyW(alias_name, pAlias);
......
...@@ -93,7 +93,6 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid, ...@@ -93,7 +93,6 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
afd.cbwfx = paftd->cbFormatSize; afd.cbwfx = paftd->cbFormatSize;
for (i = 0; i < paftd->cStandardFormats; i++) { for (i = 0; i < paftd->cStandardFormats; i++) {
static const WCHAR fmtW[] = {'%','d',' ','K','o','/','s','\0'};
int j, index; int j, index;
afd.dwFormatIndex = i; afd.dwFormatIndex = i;
...@@ -105,7 +104,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid, ...@@ -105,7 +104,7 @@ static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
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,
fmtW, (afd.pwfx->nAvgBytesPerSec + 512) / 1024); L"%d Ko/s", (afd.pwfx->nAvgBytesPerSec + 512) / 1024);
index = SendDlgItemMessageW(affd->hWnd, index = SendDlgItemMessageW(affd->hWnd,
IDD_ACMFORMATCHOOSE_CMB_FORMAT, IDD_ACMFORMATCHOOSE_CMB_FORMAT,
CB_ADDSTRING, 0, (LPARAM)buffer); CB_ADDSTRING, 0, (LPARAM)buffer);
...@@ -213,19 +212,17 @@ static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEW afc) ...@@ -213,19 +212,17 @@ static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEW afc)
return affd.ret; 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, static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam) 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); TRACE("hwnd=%p msg=%i 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam);
switch (msg) { switch (msg) {
case WM_INITDIALOG: case WM_INITDIALOG:
afc = (PACMFORMATCHOOSEW)lParam; afc = (PACMFORMATCHOOSEW)lParam;
SetPropW(hWnd, fmt_prop, (HANDLE)afc); SetPropW(hWnd, L"acmprop", (HANDLE)afc);
MSACM_FillFormatTags(hWnd, afc); MSACM_FillFormatTags(hWnd, afc);
MSACM_FillFormat(hWnd, afc); MSACM_FillFormat(hWnd, afc);
if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP| if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP|
...@@ -431,8 +428,6 @@ MMRESULT WINAPI acmFormatDetailsA(HACMDRIVER had, PACMFORMATDETAILSA pafd, ...@@ -431,8 +428,6 @@ MMRESULT WINAPI acmFormatDetailsA(HACMDRIVER had, PACMFORMATDETAILSA pafd,
MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails) MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails)
{ {
MMRESULT mmr; MMRESULT mmr;
static const WCHAR fmt1[] = {'%','d',' ','H','z',0};
static const WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0};
ACMFORMATTAGDETAILSW aftd = {0}; ACMFORMATTAGDETAILSW aftd = {0};
TRACE("(%p, %p, %d)\n", had, pafd, fdwDetails); TRACE("(%p, %p, %d)\n", had, pafd, fdwDetails);
...@@ -497,9 +492,9 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD ...@@ -497,9 +492,9 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD
} }
if (mmr == MMSYSERR_NOERROR && pafd->szFormat[0] == 0) { 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) { if (pafd->pwfx->wBitsPerSample) {
wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2, wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), L"; %d bits",
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,
......
...@@ -347,10 +347,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileNa ...@@ -347,10 +347,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileNa
*/ */
void MSACM_RegisterAllDrivers(void) 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 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; DWORD i, cnt, bufLen, lRet, type;
WCHAR buf[2048], valname[64], *name, *s; WCHAR buf[2048], valname[64], *name, *s;
FILETIME lastWrite; FILETIME lastWrite;
...@@ -384,7 +381,7 @@ void MSACM_RegisterAllDrivers(void) ...@@ -384,7 +381,7 @@ void MSACM_RegisterAllDrivers(void)
RegCloseKey( hKey ); 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) for(s = buf; *s; s += lstrlenW(s) + 1)
{ {
...@@ -396,7 +393,7 @@ void MSACM_RegisterAllDrivers(void) ...@@ -396,7 +393,7 @@ void MSACM_RegisterAllDrivers(void)
} }
} }
MSACM_ReorderDriversByPriority(); 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) ...@@ -590,15 +587,13 @@ static void MSACM_ReorderDriversByPriority(void)
*/ */
for (i = 0; i < iNumDrivers; i++) for (i = 0; i < iNumDrivers; i++)
{ {
static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'};
WCHAR szSubKey[17]; WCHAR szSubKey[17];
unsigned int iTargetPosition; unsigned int iTargetPosition;
unsigned int iCurrentPosition; unsigned int iCurrentPosition;
WCHAR * pAlias; WCHAR * pAlias;
static const WCHAR sPrefix[] = {'m','s','a','c','m','.','\0'};
/* Build expected entry name */ /* Build expected entry name */
swprintf(szSubKey, 17, priorityTmpl, i + 1); swprintf(szSubKey, 17, L"Priority%ld", 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;
...@@ -607,7 +602,7 @@ static void MSACM_ReorderDriversByPriority(void) ...@@ -607,7 +602,7 @@ static void MSACM_ReorderDriversByPriority(void)
iTargetPosition = i; iTargetPosition = i;
/* Locate driver alias in driver list */ /* Locate driver alias in driver list */
pAlias = wcsstr(szBuffer, sPrefix); pAlias = wcsstr(szBuffer, L"msacm.");
if (pAlias == NULL) continue; if (pAlias == NULL) continue;
for (iCurrentPosition = 0; iCurrentPosition < iNumDrivers; iCurrentPosition++) { for (iCurrentPosition = 0; iCurrentPosition < iNumDrivers; iCurrentPosition++) {
...@@ -653,9 +648,6 @@ void MSACM_WriteCurrentPriorities(void) ...@@ -653,9 +648,6 @@ void MSACM_WriteCurrentPriorities(void)
HKEY hPriorityKey; HKEY hPriorityKey;
PWINE_ACMDRIVERID padid; PWINE_ACMDRIVERID padid;
DWORD dwPriorityCounter; 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 szSubKey[17];
WCHAR szBuffer[256]; WCHAR szBuffer[256];
...@@ -680,10 +672,10 @@ void MSACM_WriteCurrentPriorities(void) ...@@ -680,10 +672,10 @@ void MSACM_WriteCurrentPriorities(void)
/* Build required value name */ /* Build required value name */
dwPriorityCounter++; 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 */ /* 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); wcslwr(szBuffer);
lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (lstrlenW(szBuffer) + 1) * sizeof(WCHAR)); lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (lstrlenW(szBuffer) + 1) * sizeof(WCHAR));
...@@ -695,15 +687,15 @@ void MSACM_WriteCurrentPriorities(void) ...@@ -695,15 +687,15 @@ void MSACM_WriteCurrentPriorities(void)
/* Build required value name */ /* Build required value name */
dwPriorityCounter++; 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 */ /* 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)); 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 Internal PCM Converter under key %s (0x%08x)\n",
debugstr_w(converterAlias), debugstr_w(basePriorityKey), lError); debugstr_w(basePriorityKey), lError);
} }
RegCloseKey(hPriorityKey); RegCloseKey(hPriorityKey);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment