Index: reactos/dll/cpl/mmsys/audio.c =================================================================== --- reactos/dll/cpl/mmsys/audio.c (revision 74184) +++ reactos/dll/cpl/mmsys/audio.c (working copy) @@ -16,13 +16,13 @@ WAVEOUTCAPSW waveOutputPaps; WAVEINCAPS waveInputPaps; MIDIOUTCAPS midiOutCaps; - TCHAR szNoDevices[256]; + TCHAR szNoDevices[MAX_STRING]; UINT DevsNum; UINT uIndex; HWND hCB; LRESULT Res; - LoadString(hApplet, IDS_NO_DEVICES, szNoDevices, sizeof(szNoDevices) / sizeof(TCHAR)); + LoadString(hApplet, IDS_NO_DEVICES, szNoDevices, _countof(szNoDevices)); // Init sound playback devices list hCB = GetDlgItem(hwnd, IDC_DEVICE_PLAY_LIST); Index: reactos/dll/cpl/mmsys/lang/bg-BG.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/bg-BG.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/bg-BG.rc (working copy) @@ -264,4 +264,6 @@ 5852 "Излизане от РеактОС" 5853 "Влизане в РеактОС" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/cs-CZ.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/cs-CZ.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/cs-CZ.rc (working copy) @@ -269,4 +269,6 @@ 5852 "Odhlášení od systému ReactOS" 5853 "Přihlášení k systému ReactOS" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/de-DE.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/de-DE.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/de-DE.rc (working copy) @@ -264,4 +264,6 @@ 5852 "ReactOS-Abmeldung" 5853 "ReactOS-Anmeldung" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/el-GR.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/el-GR.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/el-GR.rc (working copy) @@ -264,4 +264,6 @@ 5852 "ReactOS Logoff" 5853 "ReactOS Logon" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/en-US.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/en-US.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/en-US.rc (working copy) @@ -264,4 +264,6 @@ 5852 "ReactOS Logoff" 5853 "ReactOS Logon" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/es-ES.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/es-ES.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/es-ES.rc (working copy) @@ -264,4 +264,6 @@ 5852 "Cierre de sesión de ReactOS" 5853 "Inicio de sesión en ReactOS" 5854 "Explorador de ReactOS" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/fr-FR.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/fr-FR.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/fr-FR.rc (working copy) @@ -264,4 +264,6 @@ 5852 "Déconnexion ReactOS" 5853 "Connexion ReactOS" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/he-IL.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/he-IL.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/he-IL.rc (working copy) @@ -266,4 +266,6 @@ 5852 "ReactOS ניתוק" 5853 "ReactOS התחברות" 5854 "ReactOS סייר" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/id-ID.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/id-ID.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/id-ID.rc (working copy) @@ -264,4 +264,6 @@ 5852 "ReactOS Logoff" 5853 "ReactOS Logon" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/it-IT.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/it-IT.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/it-IT.rc (working copy) @@ -264,4 +264,6 @@ 5852 "Fine sessione di ReactOS" 5853 "Inizio sessione di ReactOS" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/ja-JP.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/ja-JP.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/ja-JP.rc (working copy) @@ -264,4 +264,6 @@ 5852 "ReactOSログオフ" 5853 "ReactOSログオン" 5854 "ReactOSエクスプローラー" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/nl-NL.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/nl-NL.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/nl-NL.rc (working copy) @@ -264,4 +264,6 @@ 5852 "ReactOS Logoff" 5853 "ReactOS Logon" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/no-NO.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/no-NO.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/no-NO.rc (working copy) @@ -264,4 +264,6 @@ 5852 "ReactOS Logg av" 5853 "ReactOS Logg på" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/pl-PL.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/pl-PL.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/pl-PL.rc (working copy) @@ -277,4 +277,6 @@ 5852 "Wylogowanie z ReactOS" 5853 "Logowanie do ReactOS" 5854 "Eksplorator ReactOS" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/pt-BR.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/pt-BR.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/pt-BR.rc (working copy) @@ -264,4 +264,6 @@ 5852 "ReactOS Logoff" 5853 "ReactOS Logon" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/ro-RO.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/ro-RO.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/ro-RO.rc (working copy) @@ -269,4 +269,6 @@ 5852 "Ieșire din ReactOS" 5853 "Intrare în ReactOS" 5854 "Explorator ReactOS" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/ru-RU.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/ru-RU.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/ru-RU.rc (working copy) @@ -264,4 +264,6 @@ 5852 "Выход из ReactOS" 5853 "Вход в ReactOS" 5854 "Проводник ReactOS" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/sk-SK.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/sk-SK.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/sk-SK.rc (working copy) @@ -269,4 +269,6 @@ 5852 "Odhlásenie zo systému ReactOS" 5853 "Prihlásenie do systému ReactOS" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/sq-AL.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/sq-AL.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/sq-AL.rc (working copy) @@ -268,4 +268,6 @@ 5852 "Dil ReactOS" 5853 "Hyr ReactOS" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/tr-TR.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/tr-TR.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/tr-TR.rc (working copy) @@ -266,4 +266,6 @@ 5852 "Oturumu Kapat" 5853 "Oturum Aç" 5854 "ReactOS Gezgini" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/uk-UA.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/uk-UA.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/uk-UA.rc (working copy) @@ -272,4 +272,6 @@ 5852 "Вихід із ReactOS" 5853 "Вхід до ReactOS" 5854 "ReactOS Explorer" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/zh-CN.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/zh-CN.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/zh-CN.rc (working copy) @@ -271,4 +271,6 @@ 5852 "ReactOS 注销" 5853 "ReactOS 登录" 5854 "ReactOS 浏览器" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/lang/zh-TW.rc =================================================================== --- reactos/dll/cpl/mmsys/lang/zh-TW.rc (revision 74184) +++ reactos/dll/cpl/mmsys/lang/zh-TW.rc (working copy) @@ -270,4 +270,6 @@ 5852 "ReactOS 登出" 5853 "ReactOS 登入" 5854 "ReactOS 瀏覽器" + 5855 "Wave Files (*.wav)|*.wav|" + 5856 "Search for new sounds" END Index: reactos/dll/cpl/mmsys/mmsys.c =================================================================== --- reactos/dll/cpl/mmsys/mmsys.c (revision 74184) +++ reactos/dll/cpl/mmsys/mmsys.c (working copy) @@ -697,16 +697,13 @@ { PROPSHEETPAGE psp[5]; PROPSHEETHEADER psh; // = { 0 }; - TCHAR Caption[256]; + TCHAR Caption[MAX_STRING]; UNREFERENCED_PARAMETER(lParam); UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(uMsg); - LoadString(hApplet, - IDS_CPLNAME, - Caption, - sizeof(Caption) / sizeof(TCHAR)); + LoadString(hApplet, IDS_CPLNAME, Caption, _countof(Caption)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE; Index: reactos/dll/cpl/mmsys/mmsys.h =================================================================== --- reactos/dll/cpl/mmsys/mmsys.h (revision 74184) +++ reactos/dll/cpl/mmsys/mmsys.h (working copy) @@ -37,6 +37,8 @@ #define DRVM_MAPPER_PREFERRED_GET (DRVM_MAPPER+21) #define DRVM_MAPPER_PREFERRED_SET (DRVM_MAPPER+22) +#define MAX_STRING 256 + /* main.c */ VOID Index: reactos/dll/cpl/mmsys/sounds.c =================================================================== --- reactos/dll/cpl/mmsys/sounds.c (revision 74184) +++ reactos/dll/cpl/mmsys/sounds.c (working copy) @@ -6,11 +6,13 @@ * Johannes Anderwald * Dmitry Chapyshev * Victor Martinez Calvo + * Katayama Hirofumi MZ */ #include "mmsys.h" #include +#include #include #include @@ -56,6 +58,23 @@ TCHAR szDefault[MAX_PATH]; +/* A filter string is a list separated by NULL and ends with double NULLs. */ +LPWSTR MakeFilter(LPWSTR psz) +{ + WCHAR *pch; + ASSERT(psz); + ASSERT(*psz != UNICODE_NULL); + ASSERT(psz[lstrlenW(psz) - 1] == L'|'); + for (pch = psz; *pch != UNICODE_NULL; ++pch) + { + /* replace vertical bar with NULL */ + if (*pch == L'|') + { + *pch = UNICODE_NULL; + } + } + return psz; +} PLABEL_MAP FindLabel(PAPP_MAP pAppMap, TCHAR * szName) { @@ -134,7 +153,6 @@ return pMap; pMap = pMap->Next; - } return NULL; } @@ -178,7 +196,7 @@ LoadEventLabel(HKEY hKey, TCHAR * szSubKey) { HKEY hSubKey; - DWORD dwData; + DWORD dwSize; DWORD dwDesc; TCHAR szDesc[MAX_PATH]; TCHAR szData[MAX_PATH]; @@ -193,7 +211,7 @@ return FALSE; } - dwDesc = sizeof(szDesc) / sizeof(TCHAR); + dwDesc = sizeof(szDesc); if (RegQueryValueEx(hSubKey, NULL, NULL, @@ -205,13 +223,13 @@ return FALSE; } - dwData = sizeof(szDesc) / sizeof(TCHAR); + dwSize = sizeof(szDesc); if (RegQueryValueEx(hSubKey, _T("DispFileName"), NULL, NULL, (LPBYTE)szData, - &dwData) != ERROR_SUCCESS) + &dwSize) != ERROR_SUCCESS) { RegCloseKey(hSubKey); return FALSE; @@ -262,7 +280,7 @@ dwCount = 0; do { - dwName = sizeof(szName) / sizeof(szName[0]); + dwName = _countof(szName); dwResult = RegEnumKeyEx(hSubKey, dwCurKey, szName, @@ -306,7 +324,7 @@ return FALSE; } - dwValue = sizeof(szValue) / sizeof(TCHAR); + dwValue = sizeof(szValue); dwResult = RegQueryValueEx(hSubKey, NULL, NULL, @@ -319,7 +337,7 @@ return FALSE; /* Try to add the new profile */ - lResult = SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_ADDSTRING, (WPARAM)0, (LPARAM)szValue); + lResult = ComboBox_AddString(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), szValue); if (lResult == CB_ERR) return FALSE; @@ -328,7 +346,7 @@ if (pScheme == NULL) { /* We failed to allocate the buffer, no need to keep a dangling string in the combobox */ - SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_DELETESTRING, (WPARAM)lResult, (LPARAM)0); + ComboBox_DeleteString(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), lResult); return FALSE; } @@ -336,11 +354,13 @@ StringCchCopy(pScheme->szName, MAX_PATH, szSubKey); /* Associate the value with the item in the combobox */ - SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_SETITEMDATA, (WPARAM)lResult, (LPARAM)pScheme); + ComboBox_SetItemData(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), lResult, pScheme); /* Optionally, select the profile */ if (SetDefault) - SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_SETCURSEL, (WPARAM)lResult, (LPARAM)0); + { + ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), lResult); + } return TRUE; } @@ -353,7 +373,7 @@ DWORD dwName, dwCurKey, dwResult, dwNumSchemes; TCHAR szName[MAX_PATH]; - dwName = sizeof(szDefault) / sizeof(TCHAR); + dwName = sizeof(szDefault); if (RegQueryValueEx(hKey, NULL, NULL, @@ -379,7 +399,7 @@ dwCurKey = 0; do { - dwName = sizeof(szName) / sizeof(szName[0]); + dwName = _countof(szName); dwResult = RegEnumKeyEx(hSubKey, dwCurKey, szName, @@ -410,7 +430,7 @@ LRESULT lCount, lIndex, lResult; PSOUND_SCHEME_CONTEXT pScheme; - lCount = SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_GETCOUNT, (WPARAM)0, (LPARAM)0); + lCount = ComboBox_GetCount(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME)); if (lCount == CB_ERR) { return NULL; @@ -418,7 +438,7 @@ for(lIndex = 0; lIndex < lCount; lIndex++) { - lResult = SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0); + lResult = ComboBox_GetItemData(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), lIndex); if (lResult == CB_ERR) { continue; @@ -459,7 +479,7 @@ return FALSE; } - dwValue = sizeof(szValue) / sizeof(TCHAR); + dwValue = sizeof(szValue); if (RegQueryValueEx(hSubKey, NULL, NULL, @@ -482,8 +502,8 @@ } pLabelContext = FindLabelContext(pScheme, AppMap->szName, LabelMap->szName); - dwValue = ExpandEnvironmentStrings(szValue, szBuffer, sizeof(szBuffer) / sizeof(TCHAR)); - if (dwValue == 0 || dwValue > (sizeof(szBuffer) / sizeof(TCHAR))) + dwValue = ExpandEnvironmentStrings(szValue, szBuffer, _countof(szBuffer)); + if (dwValue == 0 || dwValue > _countof(szBuffer)) { /* fixme */ return FALSE; @@ -530,7 +550,7 @@ dwCurKey = 0; do { - dwProfile = sizeof(szProfile) / sizeof(TCHAR); + dwProfile = _countof(szProfile); dwResult = RegEnumKeyEx(hSubKey, dwCurKey, szProfile, @@ -587,7 +607,7 @@ return 0; } - dwDefault = sizeof(szDefault) / sizeof(TCHAR); + dwDefault = sizeof(szDefault); if (RegQueryValueEx(hSubKey, NULL, NULL, @@ -600,7 +620,7 @@ return 0; } - dwDefault = sizeof(szIcon) / sizeof(TCHAR); + dwDefault = sizeof(szIcon); if (RegQueryValueEx(hSubKey, _T("DispFileName"), NULL, @@ -624,7 +644,7 @@ dwNumEntry = 0; do { - dwName = sizeof(szName) / sizeof(TCHAR); + dwName = _countof(szName); dwResult = RegEnumKeyEx(hSubKey, dwCurKey, szName, @@ -673,7 +693,7 @@ dwResult = RegEnumKey(hSubKey, dwCurKey, szName, - sizeof(szName) / sizeof(TCHAR)); + _countof(szName)); if (dwResult == ERROR_SUCCESS) { @@ -723,8 +743,8 @@ BOOL LoadSoundFiles(HWND hwndDlg) { - WCHAR szPath[MAX_PATH]; - WCHAR * ptr; + WCHAR szList[MAX_STRING], szPath[MAX_PATH]; + WCHAR *ptr; WIN32_FIND_DATAW FileData; HANDLE hFile; LRESULT lResult; @@ -731,11 +751,8 @@ UINT length; /* Add no sound listview item */ - if (LoadString(hApplet, IDS_NO_SOUND, szPath, MAX_PATH)) - { - szPath[(sizeof(szPath)/sizeof(WCHAR))-1] = L'\0'; - SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_ADDSTRING, (WPARAM)0, (LPARAM)szPath); - } + LoadStringW(hApplet, IDS_NO_SOUND, szList, _countof(szList)); + ComboBox_AddString(GetDlgItem(hwndDlg, IDC_SOUND_LIST), szList); /* Load sound files */ length = GetWindowsDirectoryW(szPath, MAX_PATH); @@ -771,11 +788,11 @@ { ptr = FileData.cFileName; } - lResult = SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_ADDSTRING, (WPARAM)0, (LPARAM)ptr); + lResult = ComboBox_AddString(GetDlgItem(hwndDlg, IDC_SOUND_LIST), ptr); if (lResult != CB_ERR) { wcscpy(&szPath[length-1], FileData.cFileName); - SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_SETITEMDATA, (WPARAM)lResult, (LPARAM)_wcsdup(szPath)); + ComboBox_SetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lResult, _wcsdup(szPath)); } } while (FindNextFileW(hFile, &FileData) != 0); @@ -815,7 +832,7 @@ /* add column for app */ GetClientRect(hList, &rect); - ZeroMemory(&dummy, sizeof(LV_COLUMN)); + ZeroMemory(&dummy, sizeof(dummy)); dummy.mask = LVCF_WIDTH; dummy.iSubItem = 0; dummy.cx = rect.right - rect.left - GetSystemMetrics(SM_CXVSCROLL); @@ -828,7 +845,7 @@ PLABEL_MAP pLabelMap = pAppMap->LabelMap; while (pLabelMap) { - ZeroMemory(&listItem, sizeof(LV_ITEM)); + ZeroMemory(&listItem, sizeof(listItem)); listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE; listItem.pszText = pLabelMap->szDesc; listItem.lParam = (LPARAM)FindLabelContext(pScheme, pAppMap->szName, pLabelMap->szName); @@ -853,7 +870,8 @@ PSOUND_SCHEME_CONTEXT pScheme; HWND hDlgCtrl; PLABEL_CONTEXT pLabelContext; - TCHAR Buffer[100]; + TCHAR Buffer[MAX_STRING]; + DWORD dwSize; hDlgCtrl = GetDlgItem(hwndDlg, IDC_SOUND_SCHEME); @@ -879,7 +897,8 @@ return FALSE; } - RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)pScheme->szName, (_tcslen(pScheme->szName) +1) * sizeof(TCHAR)); + dwSize = (_tcslen(pScheme->szName) + 1) * sizeof(TCHAR); + RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)pScheme->szName, dwSize); RegCloseKey(hKey); if (RegOpenKeyEx(HKEY_CURRENT_USER, @@ -899,7 +918,8 @@ if (RegOpenKeyEx(hKey, Buffer, 0, KEY_WRITE, &hSubKey) == ERROR_SUCCESS) { - RegSetValueEx(hSubKey, NULL, 0, REG_EXPAND_SZ, (LPBYTE)pLabelContext->szValue, (_tcslen(pLabelContext->szValue) +1) * sizeof(TCHAR)); + dwSize = (_tcslen(pLabelContext->szValue) + 1) * sizeof(TCHAR); + RegSetValueEx(hSubKey, NULL, 0, REG_EXPAND_SZ, (LPBYTE)pLabelContext->szValue, dwSize); RegCloseKey(hSubKey); } @@ -921,7 +941,7 @@ LPARAM lParam) { OPENFILENAMEW ofn; - WCHAR filename[MAX_PATH]; + WCHAR filename[MAX_PATH], szFilter[MAX_STRING], szTitle[MAX_STRING]; LPWSTR pFileName; LRESULT lResult; @@ -959,22 +979,22 @@ { case IDC_BROWSE_SOUND: { - ZeroMemory(&ofn, sizeof(OPENFILENAMEW)); - ofn.lStructSize = sizeof(OPENFILENAMEW); + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400W; ofn.hwndOwner = hwndDlg; + filename[0] = UNICODE_NULL; ofn.lpstrFile = filename; - ofn.lpstrFile[0] = L'\0'; - ofn.nMaxFile = MAX_PATH; - ofn.lpstrFilter = L"Wave Files (*.wav)\0*.wav\0"; //FIXME non-nls - ofn.nFilterIndex = 0; - ofn.lpstrFileTitle = L"Search for new sounds"; //FIXME non-nls - ofn.nMaxFileTitle = wcslen(ofn.lpstrFileTitle); - ofn.lpstrInitialDir = NULL; - ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - + ofn.nMaxFile = _countof(filename); + LoadStringW(hApplet, 5855, szFilter, _countof(szFilter)); + ofn.lpstrFilter = MakeFilter(szFilter); + LoadStringW(hApplet, 5856, szTitle, _countof(szTitle)); + ofn.lpstrTitle = szTitle; + ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | + OFN_HIDEREADONLY | OFN_ENABLESIZING | + OFN_DONTADDTORECENT; if (GetOpenFileNameW(&ofn) == TRUE) { - // FIXME search if list already contains that sound + // FIXME search if list already contains that sound // extract file name pFileName = wcsrchr(filename, L'\\'); @@ -982,26 +1002,27 @@ pFileName++; // add to list - lResult = SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_ADDSTRING, (WPARAM)0, (LPARAM)pFileName); + lResult = ComboBox_AddString(GetDlgItem(hwndDlg, IDC_SOUND_LIST), pFileName); if (lResult != CB_ERR) { // add path and select item - SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_SETITEMDATA, (WPARAM)lResult, (LPARAM)_wcsdup(filename)); - SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_SETCURSEL, (WPARAM)lResult, (LPARAM)0); + ComboBox_SetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lResult, _wcsdup(filename)); + ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lResult); } } break; } + case IDC_PLAY_SOUND: { LRESULT lIndex; - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETCURSEL, (WPARAM)0, (LPARAM)0); + lIndex = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST)); if (lIndex == CB_ERR) { break; } - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0); + lIndex = ComboBox_GetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); if (lIndex != CB_ERR) { PlaySound((TCHAR*)lIndex, NULL, SND_FILENAME); @@ -1012,7 +1033,7 @@ { if (HIWORD(wParam) == CBN_SELENDOK) { - (void)ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_SCHEME_LIST)); + ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_SCHEME_LIST)); ShowSoundScheme(hwndDlg); EnableWindow(GetDlgItem(hwndDlg, IDC_SOUND_LIST), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_TEXT_SOUND), FALSE); @@ -1035,12 +1056,12 @@ { break; } - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETCURSEL, (WPARAM)0, (LPARAM)0); + lIndex = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST)); if (lIndex == CB_ERR) { break; } - ZeroMemory(&item, sizeof(LVITEM)); + ZeroMemory(&item, sizeof(item)); item.mask = LVIF_PARAM; item.iItem = SelCount; if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_SCHEME_LIST), &item)) @@ -1048,7 +1069,7 @@ LRESULT lResult; pLabelContext = (PLABEL_CONTEXT)item.lParam; - lResult = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0); + lResult = ComboBox_GetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); if (lResult == CB_ERR || lResult == 0) { if (lIndex != pLabelContext->szValue[0]) @@ -1104,7 +1125,7 @@ { return FALSE; } - ZeroMemory(&item, sizeof(LVITEM)); + ZeroMemory(&item, sizeof(item)); item.mask = LVIF_PARAM; item.iItem = nm->iItem; @@ -1121,22 +1142,21 @@ EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_SOUND), TRUE); if (_tcslen(pLabelContext->szValue) == 0) { - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_SETCURSEL, (WPARAM)0, (LPARAM)0); + lIndex = ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST), 0); EnableWindow(GetDlgItem(hwndDlg, IDC_PLAY_SOUND), FALSE); break; - } EnableWindow(GetDlgItem(hwndDlg, IDC_PLAY_SOUND), TRUE); - lCount = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETCOUNT, (WPARAM)0, (LPARAM)0); + lCount = ComboBox_GetCount(GetDlgItem(hwndDlg, IDC_SOUND_LIST)); for (lIndex = 0; lIndex < lCount; lIndex++) { - lResult = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0); + lResult = ComboBox_GetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); if (lResult == CB_ERR || lResult == 0) continue; if (!_tcscmp((TCHAR*)lResult, pLabelContext->szValue)) { - SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_SETCURSEL, (WPARAM)lIndex, (LPARAM)0); + ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); return FALSE; } } @@ -1149,11 +1169,11 @@ { ptr = pLabelContext->szValue; } - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_ADDSTRING, (WPARAM)0, (LPARAM)ptr); + lIndex = ComboBox_AddString(GetDlgItem(hwndDlg, IDC_SOUND_LIST), ptr); if (lIndex != CB_ERR) { - SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_SETITEMDATA, (WPARAM)lIndex, (LPARAM)_tcsdup(pLabelContext->szValue)); - SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_SETCURSEL, (WPARAM)lIndex, (LPARAM)0); + ComboBox_SetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex, _tcsdup(pLabelContext->szValue)); + ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); } } break; Index: reactos/dll/cpl/mmsys/volume.c =================================================================== --- reactos/dll/cpl/mmsys/volume.c (revision 74184) +++ reactos/dll/cpl/mmsys/volume.c (working copy) @@ -224,7 +224,7 @@ { UINT NumMixers; MIXERCAPS mxc; - TCHAR szNoDevices[256]; + TCHAR szNoDevices[MAX_STRING]; LoadString(hApplet, IDS_NO_DEVICES, szNoDevices, _countof(szNoDevices));