[PATCH] winmm: Use wide-char string literals.
Andrew Eikum
aeikum at codeweavers.com
Wed Nov 18 10:44:33 CST 2020
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Wed, Nov 18, 2020 at 12:06:38AM +0100, Michael Stefaniuc wrote:
> Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
> ---
> dlls/winmm/driver.c | 12 +++----
> dlls/winmm/lolvldrv.c | 5 +--
> dlls/winmm/mci.c | 75 +++++++++++++++--------------------------
> dlls/winmm/playsound.c | 52 +++++++++-------------------
> dlls/winmm/tests/wave.c | 7 ++--
> dlls/winmm/waveform.c | 3 +-
> 6 files changed, 52 insertions(+), 102 deletions(-)
>
> diff --git a/dlls/winmm/driver.c b/dlls/winmm/driver.c
> index 24db0edc37a..0ddc81dc717 100644
> --- a/dlls/winmm/driver.c
> +++ b/dlls/winmm/driver.c
> @@ -46,8 +46,6 @@ static CRITICAL_SECTION_DEBUG mmdriver_lock_debug =
> static CRITICAL_SECTION mmdriver_lock = { &mmdriver_lock_debug, -1, 0, 0, 0, 0 };
>
> static LPWINE_DRIVER lpDrvItemList /* = NULL */;
> -static const WCHAR HKLM_BASE[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
> - 'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
>
> static void DRIVER_Dump(const char *comment)
> {
> @@ -246,12 +244,11 @@ BOOL DRIVER_GetLibName(LPCWSTR keyName, LPCWSTR sectName, LPWSTR buf, int sz)
> {
> HKEY hKey, hSecKey;
> DWORD bufLen, lRet;
> - static const WCHAR wszSystemIni[] = {'S','Y','S','T','E','M','.','I','N','I',0};
> - WCHAR wsznull = '\0';
>
> TRACE("registry: %s, %s, %p, %d\n", debugstr_w(keyName), debugstr_w(sectName), buf, sz);
>
> - lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, HKLM_BASE, 0, KEY_QUERY_VALUE, &hKey);
> + lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion",
> + 0, KEY_QUERY_VALUE, &hKey);
> if (lRet == ERROR_SUCCESS) {
> lRet = RegOpenKeyExW(hKey, sectName, 0, KEY_QUERY_VALUE, &hSecKey);
> if (lRet == ERROR_SUCCESS) {
> @@ -266,7 +263,7 @@ BOOL DRIVER_GetLibName(LPCWSTR keyName, LPCWSTR sectName, LPWSTR buf, int sz)
> /* default to system.ini if we can't find it in the registry,
> * to support native installations where system.ini is still used */
> TRACE("system.ini: %s, %s, %p, %d\n", debugstr_w(keyName), debugstr_w(sectName), buf, sz);
> - return GetPrivateProfileStringW(sectName, keyName, &wsznull, buf, sz / sizeof(WCHAR), wszSystemIni);
> + return GetPrivateProfileStringW(sectName, keyName, L"", buf, sz / sizeof(WCHAR), L"SYSTEM.INI");
> }
>
> /**************************************************************************
> @@ -391,12 +388,11 @@ HDRVR WINAPI OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lPar
> DRIVER_Dump("BEFORE:");
>
> if (lsn == NULL) {
> - static const WCHAR wszDrivers32[] = {'D','r','i','v','e','r','s','3','2',0};
> lstrcpynW(libName, lpDriverName, ARRAY_SIZE(libName));
>
> if ((lpDrv = DRIVER_TryOpenDriver32(libName, lParam)))
> goto the_end;
> - lsn = wszDrivers32;
> + lsn = L"Drivers32";
> }
> if (DRIVER_GetLibName(lpDriverName, lsn, libName, sizeof(libName)) &&
> (lpDrv = DRIVER_TryOpenDriver32(libName, lParam)))
> diff --git a/dlls/winmm/lolvldrv.c b/dlls/winmm/lolvldrv.c
> index f03eac61ad8..d5efc7f6b9f 100644
> --- a/dlls/winmm/lolvldrv.c
> +++ b/dlls/winmm/lolvldrv.c
> @@ -498,9 +498,6 @@ static void MMDRV_Init(void)
> char *drvA;
> HRESULT init_hr, hr;
>
> - static const WCHAR wine_info_deviceW[] = {'W','i','n','e',' ',
> - 'i','n','f','o',' ','d','e','v','i','c','e',0};
> -
> TRACE("()\n");
>
> init_hr = CoInitialize(NULL);
> @@ -512,7 +509,7 @@ static void MMDRV_Init(void)
> goto exit;
> }
>
> - hr = IMMDeviceEnumerator_GetDevice(devenum, wine_info_deviceW, &device);
> + hr = IMMDeviceEnumerator_GetDevice(devenum, L"Wine info device", &device);
> IMMDeviceEnumerator_Release(devenum);
> if(FAILED(hr)){
> ERR("GetDevice failed: %08x\n", hr);
> diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c
> index 870f5d1ca24..c19ab453290 100644
> --- a/dlls/winmm/mci.c
> +++ b/dlls/winmm/mci.c
> @@ -62,12 +62,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mci);
> #define MCI_MAGIC 0x0001
>
> /* MCI settings */
> -static const WCHAR wszHklmMci [] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','M','C','I',0};
> -static const WCHAR wszNull [] = {0};
> -static const WCHAR wszAll [] = {'A','L','L',0};
> -static const WCHAR wszMci [] = {'M','C','I',0};
> -static const WCHAR wszOpen [] = {'o','p','e','n',0};
> -static const WCHAR wszSystemIni[] = {'s','y','s','t','e','m','.','i','n','i',0};
> +static const WCHAR wszHklmMci [] = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\MCI";
>
> static WINE_MCIDRIVER *MciDrivers;
>
> @@ -114,7 +109,7 @@ static UINT MCI_GetDriverFromString(LPCWSTR lpstrName)
> if (!lpstrName)
> return 0;
>
> - if (!wcsicmp(lpstrName, wszAll))
> + if (!wcsicmp(lpstrName, L"ALL"))
> return MCI_ALL_DEVICE_ID;
>
> EnterCriticalSection(&WINMM_cs);
> @@ -523,11 +518,9 @@ static DWORD MCI_GetDevTypeFromFileName(LPCWSTR fileName, LPWSTR buf, UINT len)
> {
> LPCWSTR tmp;
> HKEY hKey;
> - static const WCHAR keyW[] = {'S','O','F','T','W','A','R','E','\\','M','i','c','r','o','s','o','f','t','\\',
> - 'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
> - 'M','C','I',' ','E','x','t','e','n','s','i','o','n','s',0};
> if ((tmp = wcsrchr(fileName, '.'))) {
> - if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, keyW,
> + if (RegOpenKeyExW( HKEY_LOCAL_MACHINE,
> + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\MCI Extensions",
> 0, KEY_QUERY_VALUE, &hKey ) == ERROR_SUCCESS) {
> DWORD dwLen = len;
> LONG lRet = RegQueryValueExW( hKey, tmp + 1, 0, 0, (void*)buf, &dwLen );
> @@ -668,8 +661,7 @@ static UINT MCI_GetCommandTable(UINT uDevType)
> str = buf;
> }
> } else if (uDevType == 0) {
> - static const WCHAR wszCore[] = {'C','O','R','E',0};
> - str = wszCore;
> + str = L"CORE";
> }
> uTbl = MCI_NO_COMMAND_TABLE;
> if (str) {
> @@ -793,7 +785,7 @@ static BOOL MCI_OpenMciDriver(LPWINE_MCIDRIVER wmd, LPCWSTR drvTyp, DWORD_PTR lp
> {
> WCHAR libName[128];
>
> - if (!DRIVER_GetLibName(drvTyp, wszMci, libName, sizeof(libName)))
> + if (!DRIVER_GetLibName(drvTyp, L"MCI", libName, sizeof(libName)))
> return FALSE;
>
> /* First load driver */
> @@ -843,7 +835,7 @@ static DWORD MCI_LoadMciDriver(LPCWSTR _strDevTyp, LPWINE_MCIDRIVER* lpwmd)
> /* silence warning if all is used... some bogus program use commands like
> * 'open all'...
> */
> - if (wcsicmp(strDevTyp, wszAll) == 0) {
> + if (wcsicmp(strDevTyp, L"ALL") == 0) {
> dwRet = MCIERR_CANNOT_USE_ALL;
> } else {
> FIXME("Couldn't load driver for type %s.\n",
> @@ -1198,11 +1190,6 @@ static DWORD MCI_ParseOptArgs(DWORD* data, int _offset, LPCWSTR lpCmd,
> static DWORD MCI_HandleReturnValues(DWORD dwRet, LPWINE_MCIDRIVER wmd, DWORD retType,
> MCI_GENERIC_PARMS *params, LPWSTR lpstrRet, UINT uRetLen)
> {
> - static const WCHAR fmt_d [] = {'%','d',0};
> - static const WCHAR fmt_d4 [] = {'%','d',' ','%','d',' ','%','d',' ','%','d',0};
> - static const WCHAR wszCol3[] = {'%','0','2','d',':','%','0','2','d',':','%','0','2','d',0};
> - static const WCHAR wszCol4[] = {'%','0','2','d',':','%','0','2','d',':','%','0','2','d',':','%','0','2','d',0};
> -
> if (lpstrRet) {
> switch (retType) {
> case 0: /* nothing to return */
> @@ -1213,7 +1200,7 @@ static DWORD MCI_HandleReturnValues(DWORD dwRet, LPWINE_MCIDRIVER wmd, DWORD ret
> switch (dwRet & 0xFFFF0000ul) {
> case 0:
> case MCI_INTEGER_RETURNED:
> - swprintf(lpstrRet, uRetLen, fmt_d, data);
> + swprintf(lpstrRet, uRetLen, L"%d", data);
> break;
> case MCI_RESOURCE_RETURNED:
> /* return string which ID is HIWORD(data),
> @@ -1228,12 +1215,12 @@ static DWORD MCI_HandleReturnValues(DWORD dwRet, LPWINE_MCIDRIVER wmd, DWORD ret
> HIWORD(data), lpstrRet, uRetLen);
> break;
> case MCI_COLONIZED3_RETURN:
> - swprintf(lpstrRet, uRetLen, wszCol3,
> + swprintf(lpstrRet, uRetLen, L"%02d:%02d:%02d",
> LOBYTE(LOWORD(data)), HIBYTE(LOWORD(data)),
> LOBYTE(HIWORD(data)));
> break;
> case MCI_COLONIZED4_RETURN:
> - swprintf(lpstrRet, uRetLen, wszCol4,
> + swprintf(lpstrRet, uRetLen, L"%02d:%02d:%02d:%02d",
> LOBYTE(LOWORD(data)), HIBYTE(LOWORD(data)),
> LOBYTE(HIWORD(data)), HIBYTE(HIWORD(data)));
> break;
> @@ -1244,12 +1231,11 @@ static DWORD MCI_HandleReturnValues(DWORD dwRet, LPWINE_MCIDRIVER wmd, DWORD ret
> #ifdef MCI_INTEGER64
> case MCI_INTEGER64:
> {
> - static const WCHAR fmt_ld [] = {'%','l','d',0};
> DWORD_PTR data = *(DWORD_PTR *)(params + 1);
> switch (dwRet & 0xFFFF0000ul) {
> case 0:
> case MCI_INTEGER_RETURNED:
> - swprintf(lpstrRet, uRetLen, fmt_ld, data);
> + swprintf(lpstrRet, uRetLen, L"%ld", data);
> break;
> case MCI_RESOURCE_RETURNED:
> /* return string which ID is HIWORD(data),
> @@ -1264,12 +1250,12 @@ static DWORD MCI_HandleReturnValues(DWORD dwRet, LPWINE_MCIDRIVER wmd, DWORD ret
> HIWORD(data), lpstrRet, uRetLen);
> break;
> case MCI_COLONIZED3_RETURN:
> - swprintf(lpstrRet, uRetLen, wszCol3,
> + swprintf(lpstrRet, uRetLen, L"%02d:%02d:%02d",
> LOBYTE(LOWORD(data)), HIBYTE(LOWORD(data)),
> LOBYTE(HIWORD(data)));
> break;
> case MCI_COLONIZED4_RETURN:
> - swprintf(lpstrRet, uRetLen, wszCol4,
> + swprintf(lpstrRet, uRetLen, L"%02d:%02d:%02d:%02d",
> LOBYTE(LOWORD(data)), HIBYTE(LOWORD(data)),
> LOBYTE(HIWORD(data)), HIBYTE(HIWORD(data)));
> break;
> @@ -1287,7 +1273,7 @@ static DWORD MCI_HandleReturnValues(DWORD dwRet, LPWINE_MCIDRIVER wmd, DWORD ret
> {
> DWORD *data = (DWORD *)(params + 1);
> *data = *(LPDWORD)lpstrRet;
> - swprintf(lpstrRet, uRetLen, fmt_d, *data);
> + swprintf(lpstrRet, uRetLen, L"%d", *data);
> break;
> }
> default:
> @@ -1300,7 +1286,7 @@ static DWORD MCI_HandleReturnValues(DWORD dwRet, LPWINE_MCIDRIVER wmd, DWORD ret
> DWORD *data = (DWORD *)(params + 1);
> if (dwRet & 0xFFFF0000ul)
> WARN("Oooch. MCI_STRING and HIWORD(dwRet)=%04x\n", HIWORD(dwRet));
> - swprintf(lpstrRet, uRetLen, fmt_d4, data[0], data[1], data[2], data[3]);
> + swprintf(lpstrRet, uRetLen, L"%d %d %d %d", data[0], data[1], data[2], data[3]);
> break;
> }
> default: FIXME("Unknown MCI return type %d\n", retType);
> @@ -1323,9 +1309,6 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
> DWORD retType;
> LPCWSTR lpCmd = 0;
> WORD wMsg = 0;
> - static const WCHAR wszNew[] = {'n','e','w',0};
> - static const WCHAR wszSAliasS[] = {' ','a','l','i','a','s',' ',0};
> - static const WCHAR wszTypeS[] = {'t','y','p','e',' ',0};
> union
> {
> MCI_GENERIC_PARMS generic;
> @@ -1358,17 +1341,17 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
> if ((dwRet = MCI_GetString(&dev, &args))) {
> goto errCleanUp;
> }
> - uDevID = wcsicmp(dev, wszAll) ? 0 : MCI_ALL_DEVICE_ID;
> + uDevID = wcsicmp(dev, L"ALL") ? 0 : MCI_ALL_DEVICE_ID;
>
> /* Determine devType from open */
> - if (!wcscmp(verb, wszOpen)) {
> + if (!wcscmp(verb, L"open")) {
> LPWSTR tmp;
> WCHAR buf[128];
>
> /* case dev == 'new' has to be handled */
> - if (!wcscmp(dev, wszNew)) {
> + if (!wcscmp(dev, L"new")) {
> dev = 0;
> - if ((devType = wcsstr(args, wszTypeS)) != NULL) {
> + if ((devType = wcsstr(args, L"type ")) != NULL) {
> devType += 5;
> tmp = wcschr(devType, ' ');
> if (tmp) *tmp = '\0';
> @@ -1381,7 +1364,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
> goto errCleanUp;
> }
> dwFlags |= MCI_OPEN_ELEMENT;
> - data.open.lpstrElementName = &wszNull[0];
> + data.open.lpstrElementName = &L""[0];
> } else if ((devType = wcschr(dev, '!')) != NULL) {
> *devType++ = '\0';
> tmp = devType; devType = dev; dev = tmp;
> @@ -1391,7 +1374,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
> devType = str_dup_upper(devType);
> dwFlags |= MCI_OPEN_ELEMENT;
> data.open.lpstrElementName = dev;
> - } else if (DRIVER_GetLibName(dev, wszMci, buf, sizeof(buf))) {
> + } else if (DRIVER_GetLibName(dev, L"MCI", buf, sizeof(buf))) {
> /* this is the name of a mci driver's type */
> tmp = wcschr(dev, ' ');
> if (tmp) *tmp = '\0';
> @@ -1400,7 +1383,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
> if (tmp) *tmp = ' ';
> dwFlags |= MCI_OPEN_TYPE;
> } else {
> - if ((devType = wcsstr(args, wszTypeS)) != NULL) {
> + if ((devType = wcsstr(args, L"type ")) != NULL) {
> devType += 5;
> tmp = wcschr(devType, ' ');
> if (tmp) *tmp = '\0';
> @@ -1420,7 +1403,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
> dwRet = MCIERR_CANNOT_USE_ALL;
> goto errCleanUp;
> }
> - if (!wcsstr(args, wszSAliasS) && !dev) {
> + if (!wcsstr(args, L" alias ") && !dev) {
> dwRet = MCIERR_NEW_REQUIRES_ALIAS;
> goto errCleanUp;
> }
> @@ -1444,9 +1427,8 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
> break;
> default:
> {
> - static const WCHAR wszOpenWait[] = {'o','p','e','n',' ','%','s',' ','w','a','i','t',0};
> WCHAR buf[138], retbuf[6];
> - swprintf(buf, ARRAY_SIZE(buf), wszOpenWait, dev);
> + swprintf(buf, ARRAY_SIZE(buf), L"open %s wait", dev);
> /* open via mciSendString handles quoting, dev!file syntax and alias creation */
> if ((dwRet = mciSendStringW(buf, retbuf, ARRAY_SIZE(retbuf), 0)) != 0)
> goto errCleanUp;
> @@ -1537,7 +1519,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
>
> switch (wMsg) {
> case MCI_OPEN:
> - if (wcscmp(verb, wszOpen)) {
> + if (wcscmp(verb, L"open")) {
> FIXME("Cannot open with command %s\n", debugstr_w(verb));
> dwRet = MCIERR_DRIVER_INTERNAL;
> wMsg = 0;
> @@ -1795,13 +1777,12 @@ static DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSW lpParms)
> if (!strDevTyp[0] &&
> MCI_GetDevTypeFromFileName(lpParms->lpstrElementName,
> strDevTyp, sizeof(strDevTyp))) {
> - static const WCHAR wszCdAudio[] = {'C','D','A','U','D','I','O',0};
> if (GetDriveTypeW(lpParms->lpstrElementName) != DRIVE_CDROM) {
> dwRet = MCIERR_EXTENSION_NOT_FOUND;
> goto errCleanUp;
> }
> /* FIXME: this will not work if several CDROM drives are installed on the machine */
> - lstrcpyW(strDevTyp, wszCdAudio);
> + lstrcpyW(strDevTyp, L"CDAUDIO");
> }
> }
>
> @@ -1940,7 +1921,7 @@ static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParm
> RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
> RegCloseKey( hKey );
> }
> - if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf, ARRAY_SIZE(buf), wszSystemIni))
> + if (GetPrivateProfileStringW(L"MCI", 0, L"", buf, ARRAY_SIZE(buf), L"system.ini"))
> for (s = buf; *s; s += lstrlenW(s) + 1) cnt++;
> }
> } else {
> @@ -2018,7 +1999,7 @@ static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParm
> RegCloseKey( hKey );
> }
> if (!s) {
> - if (GetPrivateProfileStringW(wszMci, 0, wszNull, buf, ARRAY_SIZE(buf), wszSystemIni)) {
> + if (GetPrivateProfileStringW(L"MCI", 0, L"", buf, ARRAY_SIZE(buf), L"system.ini")) {
> for (p = buf; *p; p += lstrlenW(p) + 1, cnt++) {
> TRACE("%d: %s\n", cnt, debugstr_w(p));
> if (cnt == lpParms->dwNumber - 1) {
> diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c
> index be3f9d4c80b..d74e5a7af4a 100644
> --- a/dlls/winmm/playsound.c
> +++ b/dlls/winmm/playsound.c
> @@ -55,12 +55,11 @@ static HMMIO get_mmioFromFile(LPCWSTR lpszName)
> HMMIO ret;
> WCHAR buf[256];
> LPWSTR dummy;
> - static const WCHAR dotwav[] = {'.','w','a','v',0};
>
> ret = mmioOpenW((LPWSTR)lpszName, NULL,
> MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
> if (ret != 0) return ret;
> - if (SearchPathW(NULL, lpszName, dotwav, ARRAY_SIZE(buf), buf, &dummy))
> + if (SearchPathW(NULL, lpszName, L".wav", ARRAY_SIZE(buf), buf, &dummy))
> {
> return mmioOpenW(buf, NULL,
> MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
> @@ -76,21 +75,12 @@ static HMMIO get_mmioFromProfile(UINT uFlags, LPCWSTR lpszName)
> HKEY hRegSnd, hRegApp, hScheme, hSnd;
> DWORD err, type, count;
>
> - static const WCHAR wszSounds[] = {'S','o','u','n','d','s',0};
> - static const WCHAR wszDefault[] = {'D','e','f','a','u','l','t',0};
> - static const WCHAR wszKey[] = {'A','p','p','E','v','e','n','t','s','\\',
> - 'S','c','h','e','m','e','s','\\',
> - 'A','p','p','s',0};
> - static const WCHAR wszDotDefault[] = {'.','D','e','f','a','u','l','t',0};
> - static const WCHAR wszDotCurrent[] = {'.','C','u','r','r','e','n','t',0};
> - static const WCHAR wszNull[] = {0};
> -
> TRACE("searching in SystemSound list for %s\n", debugstr_w(lpszName));
> - GetProfileStringW(wszSounds, lpszName, wszNull, str, ARRAY_SIZE(str));
> + GetProfileStringW(L"Sounds", lpszName, L"", str, ARRAY_SIZE(str));
> if (!*str)
> {
> if (uFlags & SND_NODEFAULT) goto next;
> - GetProfileStringW(wszSounds, wszDefault, wszNull, str, ARRAY_SIZE(str));
> + GetProfileStringW(L"Sounds", L"Default", L"", str, ARRAY_SIZE(str));
> if (!*str) goto next;
> }
> for (ptr = str; *ptr && *ptr != ','; ptr++);
> @@ -102,7 +92,7 @@ static HMMIO get_mmioFromProfile(UINT uFlags, LPCWSTR lpszName)
> * HKCU\AppEvents\Schemes\Apps\.Default
> * HKCU\AppEvents\Schemes\Apps\<AppName>
> */
> - if (RegOpenKeyW(HKEY_CURRENT_USER, wszKey, &hRegSnd) != 0) goto none;
> + if (RegOpenKeyW(HKEY_CURRENT_USER, L"AppEvents\\Schemes\\Apps", &hRegSnd) != 0) goto none;
> if (uFlags & SND_APPLICATION)
> {
> DWORD len;
> @@ -124,7 +114,7 @@ static HMMIO get_mmioFromProfile(UINT uFlags, LPCWSTR lpszName)
> }
> else
> {
> - err = RegOpenKeyW(hRegSnd, wszDotDefault, &hRegApp);
> + err = RegOpenKeyW(hRegSnd, L".Default", &hRegApp);
> }
> RegCloseKey(hRegSnd);
> if (err != 0) goto none;
> @@ -132,10 +122,10 @@ static HMMIO get_mmioFromProfile(UINT uFlags, LPCWSTR lpszName)
> RegCloseKey(hRegApp);
> if (err != 0) goto none;
> /* what's the difference between .Current and .Default ? */
> - err = RegOpenKeyW(hScheme, wszDotDefault, &hSnd);
> + err = RegOpenKeyW(hScheme, L".Default", &hSnd);
> if (err != 0)
> {
> - err = RegOpenKeyW(hScheme, wszDotCurrent, &hSnd);
> + err = RegOpenKeyW(hScheme, L".Current", &hSnd);
> RegCloseKey(hScheme);
> if (err != 0)
> goto none;
> @@ -279,11 +269,10 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
>
> /* if resource, grab it */
> if ((wps->fdwSound & SND_RESOURCE) == SND_RESOURCE) {
> - static const WCHAR wszWave[] = {'W','A','V','E',0};
> HRSRC hRes;
> HGLOBAL hGlob;
>
> - if ((hRes = FindResourceW(wps->hMod, wps->pszSound, wszWave)) == 0 ||
> + if ((hRes = FindResourceW(wps->hMod, wps->pszSound, L"WAVE")) == 0 ||
> (hGlob = LoadResource(wps->hMod, hRes)) == 0)
> goto errCleanUp;
> if ((data = LockResource(hGlob)) == NULL) {
> @@ -310,32 +299,23 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
> {
> if ((wps->fdwSound & SND_ALIAS_ID) == SND_ALIAS_ID)
> {
> - static const WCHAR wszSystemAsterisk[] = {'S','y','s','t','e','m','A','s','t','e','r','i','s','k',0};
> - static const WCHAR wszSystemDefault[] = {'S','y','s','t','e','m','D','e','f','a','u','l','t',0};
> - static const WCHAR wszSystemExclamation[] = {'S','y','s','t','e','m','E','x','c','l','a','m','a','t','i','o','n',0};
> - static const WCHAR wszSystemExit[] = {'S','y','s','t','e','m','E','x','i','t',0};
> - static const WCHAR wszSystemHand[] = {'S','y','s','t','e','m','H','a','n','d',0};
> - static const WCHAR wszSystemQuestion[] = {'S','y','s','t','e','m','Q','u','e','s','t','i','o','n',0};
> - static const WCHAR wszSystemStart[] = {'S','y','s','t','e','m','S','t','a','r','t',0};
> - static const WCHAR wszSystemWelcome[] = {'S','y','s','t','e','m','W','e','l','c','o','m','e',0};
> -
> wps->fdwSound &= ~(SND_ALIAS_ID ^ SND_ALIAS);
> if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMASTERISK)
> - wps->pszSound = wszSystemAsterisk;
> + wps->pszSound = L"SystemAsterisk";
> else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMDEFAULT)
> - wps->pszSound = wszSystemDefault;
> + wps->pszSound = L"SystemDefault";
> else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMEXCLAMATION)
> - wps->pszSound = wszSystemExclamation;
> + wps->pszSound = L"SystemExclamation";
> else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMEXIT)
> - wps->pszSound = wszSystemExit;
> + wps->pszSound = L"SystemExit";
> else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMHAND)
> - wps->pszSound = wszSystemHand;
> + wps->pszSound = L"SystemHand";
> else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMQUESTION)
> - wps->pszSound = wszSystemQuestion;
> + wps->pszSound = L"SystemQuestion";
> else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMSTART)
> - wps->pszSound = wszSystemStart;
> + wps->pszSound = L"SystemStart";
> else if (wps->pszSound == (LPCWSTR)SND_ALIAS_SYSTEMWELCOME)
> - wps->pszSound = wszSystemWelcome;
> + wps->pszSound = L"SystemWelcome";
> else goto errCleanUp;
> }
> hmmio = get_mmioFromProfile(wps->fdwSound, wps->pszSound);
> diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c
> index eec1ba2a034..819489e5566 100644
> --- a/dlls/winmm/tests/wave.c
> +++ b/dlls/winmm/tests/wave.c
> @@ -1542,9 +1542,6 @@ static void test_sndPlaySound(void)
> {
> BOOL br;
>
> - static const WCHAR not_existW[] = {'C',':','\\','n','o','t','_','e','x','i','s','t','.','w','a','v',0};
> - static const WCHAR SystemAsteriskW[] = {'S','y','s','t','e','m','A','s','t','e','r','i','s','k',0};
> -
> br = sndPlaySoundA((LPCSTR)SND_ALIAS_SYSTEMASTERISK, SND_ALIAS_ID|SND_SYNC);
> ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
>
> @@ -1560,13 +1557,13 @@ static void test_sndPlaySound(void)
> br = sndPlaySoundA("SystemAsterisk", SND_ALIAS|SND_SYNC);
> ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
>
> - br = sndPlaySoundW(SystemAsteriskW, SND_ALIAS|SND_SYNC);
> + br = sndPlaySoundW(L"SystemAsterisk", SND_ALIAS|SND_SYNC);
> ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
>
> br = sndPlaySoundA("C:\not_exist.wav", SND_FILENAME|SND_SYNC);
> ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
>
> - br = sndPlaySoundW(not_existW, SND_FILENAME|SND_SYNC);
> + br = sndPlaySoundW(L"C:\\not_exist.wav", SND_FILENAME|SND_SYNC);
> ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
> }
>
> diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c
> index 39461743c4a..9d58b78c779 100644
> --- a/dlls/winmm/waveform.c
> +++ b/dlls/winmm/waveform.c
> @@ -2458,7 +2458,6 @@ static DWORD WINAPI WINMM_DevicesThreadProc(void *arg)
> {
> HANDLE evt = arg;
> HRESULT hr;
> - static const WCHAR messageW[] = {'M','e','s','s','a','g','e',0};
>
> hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
> if(FAILED(hr)){
> @@ -2480,7 +2479,7 @@ static DWORD WINAPI WINMM_DevicesThreadProc(void *arg)
> FreeLibraryAndExitThread(g_devthread_module, 1);
> }
>
> - g_devices_hwnd = CreateWindowW(messageW, NULL, 0, 0, 0, 0, 0,
> + g_devices_hwnd = CreateWindowW(L"Message", NULL, 0, 0, 0, 0, 0,
> HWND_MESSAGE, NULL, NULL, NULL);
> if(!g_devices_hwnd){
> WARN("CreateWindow failed: %d\n", GetLastError());
> --
> 2.26.2
>
>
More information about the wine-devel
mailing list