Author: tfaber
Date: Sat May 6 08:43:56 2017
New Revision: 74483
URL:
http://svn.reactos.org/svn/reactos?rev=74483&view=rev
Log:
[MMSYS]
- Pass byte counts to RegQueryValueEx instead of character counts. Based on a patch by
Katayama Hirofumi MZ.
CORE-12903
Modified:
trunk/reactos/dll/cpl/mmsys/sounds.c
Modified: trunk/reactos/dll/cpl/mmsys/sounds.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/mmsys/sounds.c?rev…
==============================================================================
--- trunk/reactos/dll/cpl/mmsys/sounds.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/mmsys/sounds.c [iso-8859-1] Sat May 6 08:43:56 2017
@@ -178,8 +178,7 @@
LoadEventLabel(HKEY hKey, TCHAR * szSubKey)
{
HKEY hSubKey;
- DWORD dwData;
- DWORD dwDesc;
+ DWORD cbValue;
TCHAR szDesc[MAX_PATH];
TCHAR szData[MAX_PATH];
PLABEL_MAP pMap;
@@ -193,25 +192,25 @@
return FALSE;
}
- dwDesc = sizeof(szDesc) / sizeof(TCHAR);
+ cbValue = sizeof(szDesc);
if (RegQueryValueEx(hSubKey,
NULL,
NULL,
NULL,
(LPBYTE)szDesc,
- &dwDesc) != ERROR_SUCCESS)
+ &cbValue) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
return FALSE;
}
- dwData = sizeof(szDesc) / sizeof(TCHAR);
+ cbValue = sizeof(szData);
if (RegQueryValueEx(hSubKey,
_T("DispFileName"),
NULL,
NULL,
(LPBYTE)szData,
- &dwData) != ERROR_SUCCESS)
+ &cbValue) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
return FALSE;
@@ -293,7 +292,7 @@
{
HKEY hSubKey;
TCHAR szValue[MAX_PATH];
- DWORD dwValue, dwResult;
+ DWORD cbValue, dwResult;
LRESULT lResult;
PSOUND_SCHEME_CONTEXT pScheme;
@@ -306,13 +305,13 @@
return FALSE;
}
- dwValue = sizeof(szValue) / sizeof(TCHAR);
+ cbValue = sizeof(szValue);
dwResult = RegQueryValueEx(hSubKey,
NULL,
NULL,
NULL,
(LPBYTE)szValue,
- &dwValue);
+ &cbValue);
RegCloseKey(hSubKey);
if (dwResult != ERROR_SUCCESS)
@@ -351,15 +350,16 @@
{
HKEY hSubKey;
DWORD dwName, dwCurKey, dwResult, dwNumSchemes;
+ DWORD cbDefault;
TCHAR szName[MAX_PATH];
- dwName = sizeof(szDefault) / sizeof(TCHAR);
+ cbDefault = sizeof(szDefault);
if (RegQueryValueEx(hKey,
NULL,
NULL,
NULL,
(LPBYTE)szDefault,
- &dwName) != ERROR_SUCCESS)
+ &cbDefault) != ERROR_SUCCESS)
{
return FALSE;
}
@@ -440,7 +440,7 @@
HKEY hSubKey;
TCHAR szValue[MAX_PATH];
TCHAR szBuffer[MAX_PATH];
- DWORD dwValue;
+ DWORD cbValue, cchLength;
PSOUND_SCHEME_CONTEXT pScheme;
PLABEL_CONTEXT pLabelContext;
BOOL bCurrentProfile, bActiveProfile;
@@ -459,13 +459,13 @@
return FALSE;
}
- dwValue = sizeof(szValue) / sizeof(TCHAR);
+ cbValue = sizeof(szValue);
if (RegQueryValueEx(hSubKey,
NULL,
NULL,
NULL,
(LPBYTE)szValue,
- &dwValue) != ERROR_SUCCESS)
+ &cbValue) != ERROR_SUCCESS)
{
return FALSE;
}
@@ -482,8 +482,8 @@
}
pLabelContext = FindLabelContext(pScheme, AppMap->szName, LabelMap->szName);
- dwValue = ExpandEnvironmentStrings(szValue, szBuffer, _countof(szBuffer));
- if (dwValue == 0 || dwValue > _countof(szBuffer))
+ cchLength = ExpandEnvironmentStrings(szValue, szBuffer, _countof(szBuffer));
+ if (cchLength == 0 || cchLength > _countof(szBuffer))
{
/* fixme */
return FALSE;
@@ -562,7 +562,7 @@
{
HKEY hSubKey;
TCHAR szDefault[MAX_PATH];
- DWORD dwDefault;
+ DWORD cbValue;
DWORD dwCurKey;
DWORD dwResult;
DWORD dwNumEntry;
@@ -587,26 +587,26 @@
return 0;
}
- dwDefault = sizeof(szDefault) / sizeof(TCHAR);
+ cbValue = sizeof(szDefault);
if (RegQueryValueEx(hSubKey,
NULL,
NULL,
NULL,
(LPBYTE)szDefault,
- &dwDefault) != ERROR_SUCCESS)
+ &cbValue) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
HeapFree(GetProcessHeap(), 0, AppMap);
return 0;
}
- dwDefault = sizeof(szIcon) / sizeof(TCHAR);
+ cbValue = sizeof(szIcon);
if (RegQueryValueEx(hSubKey,
_T("DispFileName"),
NULL,
NULL,
(LPBYTE)szIcon,
- &dwDefault) != ERROR_SUCCESS)
+ &cbValue) != ERROR_SUCCESS)
{
szIcon[0] = _T('\0');
}