From a276740842fc9c98289127d9c5532e49d31ac1fd Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Thu, 26 Jul 2007 14:48:47 +0000 Subject: [PATCH] - update italian translation and a few code simplifications by Carlo Bramini (carlo dot bramix at libero dot it) - fix a few issues (remove SIZEOF macro + SUBLANG_ITALIAN...) See issue #2365 for more details. svn path=/trunk/; revision=27843 --- reactos/base/applications/taskmgr/affinity.c | 256 +++--------------- .../base/applications/taskmgr/lang/it-IT.rc | 61 +++-- 2 files changed, 73 insertions(+), 244 deletions(-) diff --git a/reactos/base/applications/taskmgr/affinity.c b/reactos/base/applications/taskmgr/affinity.c index 7cae97cd421..bf8b55d0e0c 100644 --- a/reactos/base/applications/taskmgr/affinity.c +++ b/reactos/base/applications/taskmgr/affinity.c @@ -27,7 +27,18 @@ HANDLE hProcessAffinityHandle; TCHAR szTemp[256]; TCHAR szTempA[256]; -INT_PTR CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +static const DWORD dwCpuTable[] = { + IDC_CPU0, IDC_CPU1, IDC_CPU2, IDC_CPU3, + IDC_CPU4, IDC_CPU5, IDC_CPU6, IDC_CPU7, + IDC_CPU8, IDC_CPU9, IDC_CPU10, IDC_CPU11, + IDC_CPU12, IDC_CPU13, IDC_CPU14, IDC_CPU15, + IDC_CPU16, IDC_CPU17, IDC_CPU18, IDC_CPU19, + IDC_CPU20, IDC_CPU21, IDC_CPU22, IDC_CPU23, + IDC_CPU24, IDC_CPU25, IDC_CPU26, IDC_CPU27, + IDC_CPU28, IDC_CPU29, IDC_CPU30, IDC_CPU31, +}; + +static INT_PTR CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); void ProcessPage_OnSetAffinity(void) { @@ -50,8 +61,8 @@ void ProcessPage_OnSetAffinity(void) return; hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId); if (!hProcessAffinityHandle) { - GetLastErrorText(strErrorText, 260); - LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, 256); + GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(TCHAR)); + LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(TCHAR)); MessageBox(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); return; } @@ -68,6 +79,7 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) DWORD dwProcessAffinityMask = 0; DWORD dwSystemAffinityMask = 0; TCHAR strErrorText[260]; + BYTE nCpu; switch (message) { case WM_INITDIALOG: @@ -77,149 +89,25 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) * the number of CPUs present in the system */ if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask, &dwSystemAffinityMask)) { - GetLastErrorText(strErrorText, 260); + GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(TCHAR)); EndDialog(hDlg, 0); - LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, 256); + LoadString(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) / sizeof(TCHAR)); MessageBox(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP); } - /* - * Enable a checkbox for each processor present in the system - */ - if (dwSystemAffinityMask & 0x00000001) - EnableWindow(GetDlgItem(hDlg, IDC_CPU0), TRUE); - if (dwSystemAffinityMask & 0x00000002) - EnableWindow(GetDlgItem(hDlg, IDC_CPU1), TRUE); - if (dwSystemAffinityMask & 0x00000004) - EnableWindow(GetDlgItem(hDlg, IDC_CPU2), TRUE); - if (dwSystemAffinityMask & 0x00000008) - EnableWindow(GetDlgItem(hDlg, IDC_CPU3), TRUE); - if (dwSystemAffinityMask & 0x00000010) - EnableWindow(GetDlgItem(hDlg, IDC_CPU4), TRUE); - if (dwSystemAffinityMask & 0x00000020) - EnableWindow(GetDlgItem(hDlg, IDC_CPU5), TRUE); - if (dwSystemAffinityMask & 0x00000040) - EnableWindow(GetDlgItem(hDlg, IDC_CPU6), TRUE); - if (dwSystemAffinityMask & 0x00000080) - EnableWindow(GetDlgItem(hDlg, IDC_CPU7), TRUE); - if (dwSystemAffinityMask & 0x00000100) - EnableWindow(GetDlgItem(hDlg, IDC_CPU8), TRUE); - if (dwSystemAffinityMask & 0x00000200) - EnableWindow(GetDlgItem(hDlg, IDC_CPU9), TRUE); - if (dwSystemAffinityMask & 0x00000400) - EnableWindow(GetDlgItem(hDlg, IDC_CPU10), TRUE); - if (dwSystemAffinityMask & 0x00000800) - EnableWindow(GetDlgItem(hDlg, IDC_CPU11), TRUE); - if (dwSystemAffinityMask & 0x00001000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU12), TRUE); - if (dwSystemAffinityMask & 0x00002000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU13), TRUE); - if (dwSystemAffinityMask & 0x00004000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU14), TRUE); - if (dwSystemAffinityMask & 0x00008000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU15), TRUE); - if (dwSystemAffinityMask & 0x00010000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU16), TRUE); - if (dwSystemAffinityMask & 0x00020000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU17), TRUE); - if (dwSystemAffinityMask & 0x00040000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU18), TRUE); - if (dwSystemAffinityMask & 0x00080000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU19), TRUE); - if (dwSystemAffinityMask & 0x00100000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU20), TRUE); - if (dwSystemAffinityMask & 0x00200000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU21), TRUE); - if (dwSystemAffinityMask & 0x00400000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU22), TRUE); - if (dwSystemAffinityMask & 0x00800000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU23), TRUE); - if (dwSystemAffinityMask & 0x01000000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU24), TRUE); - if (dwSystemAffinityMask & 0x02000000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU25), TRUE); - if (dwSystemAffinityMask & 0x04000000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU26), TRUE); - if (dwSystemAffinityMask & 0x08000000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU27), TRUE); - if (dwSystemAffinityMask & 0x10000000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU28), TRUE); - if (dwSystemAffinityMask & 0x20000000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU29), TRUE); - if (dwSystemAffinityMask & 0x40000000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU30), TRUE); - if (dwSystemAffinityMask & 0x80000000) - EnableWindow(GetDlgItem(hDlg, IDC_CPU31), TRUE); - - - /* - * Check each checkbox that the current process - * has affinity with - */ - if (dwProcessAffinityMask & 0x00000001) - SendMessage(GetDlgItem(hDlg, IDC_CPU0), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000002) - SendMessage(GetDlgItem(hDlg, IDC_CPU1), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000004) - SendMessage(GetDlgItem(hDlg, IDC_CPU2), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000008) - SendMessage(GetDlgItem(hDlg, IDC_CPU3), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000010) - SendMessage(GetDlgItem(hDlg, IDC_CPU4), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000020) - SendMessage(GetDlgItem(hDlg, IDC_CPU5), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000040) - SendMessage(GetDlgItem(hDlg, IDC_CPU6), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000080) - SendMessage(GetDlgItem(hDlg, IDC_CPU7), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000100) - SendMessage(GetDlgItem(hDlg, IDC_CPU8), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000200) - SendMessage(GetDlgItem(hDlg, IDC_CPU9), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000400) - SendMessage(GetDlgItem(hDlg, IDC_CPU10), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00000800) - SendMessage(GetDlgItem(hDlg, IDC_CPU11), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00001000) - SendMessage(GetDlgItem(hDlg, IDC_CPU12), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00002000) - SendMessage(GetDlgItem(hDlg, IDC_CPU13), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00004000) - SendMessage(GetDlgItem(hDlg, IDC_CPU14), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00008000) - SendMessage(GetDlgItem(hDlg, IDC_CPU15), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00010000) - SendMessage(GetDlgItem(hDlg, IDC_CPU16), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00020000) - SendMessage(GetDlgItem(hDlg, IDC_CPU17), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00040000) - SendMessage(GetDlgItem(hDlg, IDC_CPU18), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00080000) - SendMessage(GetDlgItem(hDlg, IDC_CPU19), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00100000) - SendMessage(GetDlgItem(hDlg, IDC_CPU20), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00200000) - SendMessage(GetDlgItem(hDlg, IDC_CPU21), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00400000) - SendMessage(GetDlgItem(hDlg, IDC_CPU22), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x00800000) - SendMessage(GetDlgItem(hDlg, IDC_CPU23), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x01000000) - SendMessage(GetDlgItem(hDlg, IDC_CPU24), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x02000000) - SendMessage(GetDlgItem(hDlg, IDC_CPU25), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x04000000) - SendMessage(GetDlgItem(hDlg, IDC_CPU26), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x08000000) - SendMessage(GetDlgItem(hDlg, IDC_CPU27), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x10000000) - SendMessage(GetDlgItem(hDlg, IDC_CPU28), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x20000000) - SendMessage(GetDlgItem(hDlg, IDC_CPU29), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x40000000) - SendMessage(GetDlgItem(hDlg, IDC_CPU30), BM_SETCHECK, BST_CHECKED, 0); - if (dwProcessAffinityMask & 0x80000000) - SendMessage(GetDlgItem(hDlg, IDC_CPU31), BM_SETCHECK, BST_CHECKED, 0); + for (nCpu=0; nCpu