Commit 283c1be7 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

winmm: Use wide-char string literals.

parent c00c6000
......@@ -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)))
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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());
......
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