mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 21:46:05 +00:00
[MMSYS]
- Pass byte counts to RegQueryValueEx instead of character counts. Based on a patch by Katayama Hirofumi MZ. CORE-12903 svn path=/trunk/; revision=74483
This commit is contained in:
parent
96e7761203
commit
9ef60ad5b0
1 changed files with 21 additions and 21 deletions
|
@ -178,8 +178,7 @@ BOOL
|
||||||
LoadEventLabel(HKEY hKey, TCHAR * szSubKey)
|
LoadEventLabel(HKEY hKey, TCHAR * szSubKey)
|
||||||
{
|
{
|
||||||
HKEY hSubKey;
|
HKEY hSubKey;
|
||||||
DWORD dwData;
|
DWORD cbValue;
|
||||||
DWORD dwDesc;
|
|
||||||
TCHAR szDesc[MAX_PATH];
|
TCHAR szDesc[MAX_PATH];
|
||||||
TCHAR szData[MAX_PATH];
|
TCHAR szData[MAX_PATH];
|
||||||
PLABEL_MAP pMap;
|
PLABEL_MAP pMap;
|
||||||
|
@ -193,25 +192,25 @@ LoadEventLabel(HKEY hKey, TCHAR * szSubKey)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwDesc = sizeof(szDesc) / sizeof(TCHAR);
|
cbValue = sizeof(szDesc);
|
||||||
if (RegQueryValueEx(hSubKey,
|
if (RegQueryValueEx(hSubKey,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)szDesc,
|
(LPBYTE)szDesc,
|
||||||
&dwDesc) != ERROR_SUCCESS)
|
&cbValue) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
RegCloseKey(hSubKey);
|
RegCloseKey(hSubKey);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwData = sizeof(szDesc) / sizeof(TCHAR);
|
cbValue = sizeof(szData);
|
||||||
if (RegQueryValueEx(hSubKey,
|
if (RegQueryValueEx(hSubKey,
|
||||||
_T("DispFileName"),
|
_T("DispFileName"),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)szData,
|
(LPBYTE)szData,
|
||||||
&dwData) != ERROR_SUCCESS)
|
&cbValue) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
RegCloseKey(hSubKey);
|
RegCloseKey(hSubKey);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -293,7 +292,7 @@ AddSoundProfile(HWND hwndDlg, HKEY hKey, TCHAR * szSubKey, BOOL SetDefault)
|
||||||
{
|
{
|
||||||
HKEY hSubKey;
|
HKEY hSubKey;
|
||||||
TCHAR szValue[MAX_PATH];
|
TCHAR szValue[MAX_PATH];
|
||||||
DWORD dwValue, dwResult;
|
DWORD cbValue, dwResult;
|
||||||
LRESULT lResult;
|
LRESULT lResult;
|
||||||
PSOUND_SCHEME_CONTEXT pScheme;
|
PSOUND_SCHEME_CONTEXT pScheme;
|
||||||
|
|
||||||
|
@ -306,13 +305,13 @@ AddSoundProfile(HWND hwndDlg, HKEY hKey, TCHAR * szSubKey, BOOL SetDefault)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwValue = sizeof(szValue) / sizeof(TCHAR);
|
cbValue = sizeof(szValue);
|
||||||
dwResult = RegQueryValueEx(hSubKey,
|
dwResult = RegQueryValueEx(hSubKey,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)szValue,
|
(LPBYTE)szValue,
|
||||||
&dwValue);
|
&cbValue);
|
||||||
RegCloseKey(hSubKey);
|
RegCloseKey(hSubKey);
|
||||||
|
|
||||||
if (dwResult != ERROR_SUCCESS)
|
if (dwResult != ERROR_SUCCESS)
|
||||||
|
@ -351,15 +350,16 @@ EnumerateSoundProfiles(HWND hwndDlg, HKEY hKey)
|
||||||
{
|
{
|
||||||
HKEY hSubKey;
|
HKEY hSubKey;
|
||||||
DWORD dwName, dwCurKey, dwResult, dwNumSchemes;
|
DWORD dwName, dwCurKey, dwResult, dwNumSchemes;
|
||||||
|
DWORD cbDefault;
|
||||||
TCHAR szName[MAX_PATH];
|
TCHAR szName[MAX_PATH];
|
||||||
|
|
||||||
dwName = sizeof(szDefault) / sizeof(TCHAR);
|
cbDefault = sizeof(szDefault);
|
||||||
if (RegQueryValueEx(hKey,
|
if (RegQueryValueEx(hKey,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)szDefault,
|
(LPBYTE)szDefault,
|
||||||
&dwName) != ERROR_SUCCESS)
|
&cbDefault) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ ImportSoundLabel(HWND hwndDlg, HKEY hKey, TCHAR * szProfile, TCHAR * szLabelName
|
||||||
HKEY hSubKey;
|
HKEY hSubKey;
|
||||||
TCHAR szValue[MAX_PATH];
|
TCHAR szValue[MAX_PATH];
|
||||||
TCHAR szBuffer[MAX_PATH];
|
TCHAR szBuffer[MAX_PATH];
|
||||||
DWORD dwValue;
|
DWORD cbValue, cchLength;
|
||||||
PSOUND_SCHEME_CONTEXT pScheme;
|
PSOUND_SCHEME_CONTEXT pScheme;
|
||||||
PLABEL_CONTEXT pLabelContext;
|
PLABEL_CONTEXT pLabelContext;
|
||||||
BOOL bCurrentProfile, bActiveProfile;
|
BOOL bCurrentProfile, bActiveProfile;
|
||||||
|
@ -459,13 +459,13 @@ ImportSoundLabel(HWND hwndDlg, HKEY hKey, TCHAR * szProfile, TCHAR * szLabelName
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwValue = sizeof(szValue) / sizeof(TCHAR);
|
cbValue = sizeof(szValue);
|
||||||
if (RegQueryValueEx(hSubKey,
|
if (RegQueryValueEx(hSubKey,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)szValue,
|
(LPBYTE)szValue,
|
||||||
&dwValue) != ERROR_SUCCESS)
|
&cbValue) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -482,8 +482,8 @@ ImportSoundLabel(HWND hwndDlg, HKEY hKey, TCHAR * szProfile, TCHAR * szLabelName
|
||||||
}
|
}
|
||||||
pLabelContext = FindLabelContext(pScheme, AppMap->szName, LabelMap->szName);
|
pLabelContext = FindLabelContext(pScheme, AppMap->szName, LabelMap->szName);
|
||||||
|
|
||||||
dwValue = ExpandEnvironmentStrings(szValue, szBuffer, _countof(szBuffer));
|
cchLength = ExpandEnvironmentStrings(szValue, szBuffer, _countof(szBuffer));
|
||||||
if (dwValue == 0 || dwValue > _countof(szBuffer))
|
if (cchLength == 0 || cchLength > _countof(szBuffer))
|
||||||
{
|
{
|
||||||
/* fixme */
|
/* fixme */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -562,7 +562,7 @@ ImportAppProfile(HWND hwndDlg, HKEY hKey, TCHAR * szAppName)
|
||||||
{
|
{
|
||||||
HKEY hSubKey;
|
HKEY hSubKey;
|
||||||
TCHAR szDefault[MAX_PATH];
|
TCHAR szDefault[MAX_PATH];
|
||||||
DWORD dwDefault;
|
DWORD cbValue;
|
||||||
DWORD dwCurKey;
|
DWORD dwCurKey;
|
||||||
DWORD dwResult;
|
DWORD dwResult;
|
||||||
DWORD dwNumEntry;
|
DWORD dwNumEntry;
|
||||||
|
@ -587,26 +587,26 @@ ImportAppProfile(HWND hwndDlg, HKEY hKey, TCHAR * szAppName)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwDefault = sizeof(szDefault) / sizeof(TCHAR);
|
cbValue = sizeof(szDefault);
|
||||||
if (RegQueryValueEx(hSubKey,
|
if (RegQueryValueEx(hSubKey,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)szDefault,
|
(LPBYTE)szDefault,
|
||||||
&dwDefault) != ERROR_SUCCESS)
|
&cbValue) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
RegCloseKey(hSubKey);
|
RegCloseKey(hSubKey);
|
||||||
HeapFree(GetProcessHeap(), 0, AppMap);
|
HeapFree(GetProcessHeap(), 0, AppMap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwDefault = sizeof(szIcon) / sizeof(TCHAR);
|
cbValue = sizeof(szIcon);
|
||||||
if (RegQueryValueEx(hSubKey,
|
if (RegQueryValueEx(hSubKey,
|
||||||
_T("DispFileName"),
|
_T("DispFileName"),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)szIcon,
|
(LPBYTE)szIcon,
|
||||||
&dwDefault) != ERROR_SUCCESS)
|
&cbValue) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
szIcon[0] = _T('\0');
|
szIcon[0] = _T('\0');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue