[ros-diffs] [hyperion] 41664: modified base/applications/taskmgr/affinity.c modified base/applications/taskmgr/debug.c modified base/applications/taskmgr/endproc.c modified base/applications/taskmgr/priority.c Arch Blackmann has never heard of exotic features of the C language such as "subroutines" modified base/applications/taskmgr/dbgchnl.c modified base/applications/taskmgr/procpage.c modified base/applications/taskmgr/procpage.h Did you know that Task Manager killed the wrong process when using the context menu? Fixed by using a sophisticated "subroutine" that reads the process entry index from the currently selected list item's client data, replacing the copy-pasted code that used the index of the list entry as the process entry index (which only worked before due to no sorting) Save the sort column and order modified base/applications/taskmgr/taskmgr.c Sort by image name by default

hyperion at svn.reactos.org hyperion at svn.reactos.org
Sun Jun 28 16:22:10 CEST 2009


Author: hyperion
Date: Sun Jun 28 18:22:09 2009
New Revision: 41664

URL: http://svn.reactos.org/svn/reactos?rev=41664&view=rev
Log:
modified   base/applications/taskmgr/affinity.c
modified   base/applications/taskmgr/debug.c
modified   base/applications/taskmgr/endproc.c
modified   base/applications/taskmgr/priority.c
   Arch Blackmann has never heard of exotic features of the C language such as "subroutines"

modified   base/applications/taskmgr/dbgchnl.c
modified   base/applications/taskmgr/procpage.c
modified   base/applications/taskmgr/procpage.h
   Did you know that Task Manager killed the wrong process when using the context menu? Fixed by using a sophisticated "subroutine" that reads the process entry index from the currently selected list item's client data, replacing the copy-pasted code that used the index of the list entry as the process entry index (which only worked before due to no sorting)
   Save the sort column and order

modified   base/applications/taskmgr/taskmgr.c
   Sort by image name by default

Modified:
    trunk/reactos/base/applications/taskmgr/affinity.c
    trunk/reactos/base/applications/taskmgr/dbgchnl.c
    trunk/reactos/base/applications/taskmgr/debug.c
    trunk/reactos/base/applications/taskmgr/endproc.c
    trunk/reactos/base/applications/taskmgr/priority.c
    trunk/reactos/base/applications/taskmgr/procpage.c
    trunk/reactos/base/applications/taskmgr/procpage.h
    trunk/reactos/base/applications/taskmgr/taskmgr.c

Modified: trunk/reactos/base/applications/taskmgr/affinity.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/affinity.c?rev=41664&r1=41663&r2=41664&view=diff
==============================================================================
--- trunk/reactos/base/applications/taskmgr/affinity.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/affinity.c [iso-8859-1] Sun Jun 28 18:22:09 2009
@@ -40,24 +40,15 @@
 
 void ProcessPage_OnSetAffinity(void)
 {
-    LV_ITEM  lvitem;
-    ULONG    Index;
     DWORD    dwProcessId;
     WCHAR    strErrorText[260];
     WCHAR    szTitle[256];
 
-    for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++) {
-        memset(&lvitem, 0, sizeof(LV_ITEM));
-        lvitem.mask = LVIF_STATE;
-        lvitem.stateMask = LVIS_SELECTED;
-        lvitem.iItem = Index;
-        (void)ListView_GetItem(hProcessPageListCtrl, &lvitem);
-        if (lvitem.state & LVIS_SELECTED)
-            break;
-    }
-    dwProcessId = PerfDataGetProcessId(Index);
-    if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
+    dwProcessId = GetSelectedProcessId();
+
+    if (dwProcessId == 0)
         return;
+
     hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
     if (!hProcessAffinityHandle) {
         GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));

Modified: trunk/reactos/base/applications/taskmgr/dbgchnl.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/dbgchnl.c?rev=41664&r1=41663&r2=41664&view=diff
==============================================================================
--- trunk/reactos/base/applications/taskmgr/dbgchnl.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/dbgchnl.c [iso-8859-1] Sun Jun 28 18:22:09 2009
@@ -40,33 +40,6 @@
     return TRUE;
 #endif
     return FALSE;
-}
-
-static DWORD    get_selected_pid(void)
-{
-    LVITEM  lvitem;
-    ULONG   Index;
-    DWORD   dwProcessId;
-
-    for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
-    {
-        memset(&lvitem, 0, sizeof(LVITEM));
-
-        lvitem.mask = LVIF_STATE;
-        lvitem.stateMask = LVIS_SELECTED;
-        lvitem.iItem = Index;
-
-        (void)ListView_GetItem(hProcessPageListCtrl, &lvitem);
-
-        if (lvitem.state & LVIS_SELECTED)
-            break;
-    }
-
-    dwProcessId = PerfDataGetProcessId(Index);
-
-    if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
-        return 0;
-    return dwProcessId;
 }
 
 static int     list_channel_CB(HANDLE hProcess, void* addr, WCHAR* buffer, void* user)
@@ -290,7 +263,7 @@
 
     (void)ListView_DeleteAllItems(hChannelLV);
 
-    hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ, FALSE, get_selected_pid());
+    hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ, FALSE, GetSelectedProcessId());
     if (!hProcess) return; /* FIXME messagebox */
     SendMessageW(hChannelLV, WM_SETREDRAW, FALSE, 0);
     enum_channel(hProcess, list_channel_CB, (void*)hChannelLV, TRUE);
@@ -350,7 +323,7 @@
             HANDLE           hProcess;
             NMITEMACTIVATE*  nmia = (NMITEMACTIVATE*)lParam;
 
-            hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, get_selected_pid());
+            hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, GetSelectedProcessId());
             if (!hProcess) return; /* FIXME message box */
             lhti.pt = nmia->ptAction;
             hChannelLV = GetDlgItem(hDlg, IDC_DEBUG_CHANNELS_LIST);

Modified: trunk/reactos/base/applications/taskmgr/debug.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/debug.c?rev=41664&r1=41663&r2=41664&view=diff
==============================================================================
--- trunk/reactos/base/applications/taskmgr/debug.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/debug.c [iso-8859-1] Sun Jun 28 18:22:09 2009
@@ -25,8 +25,6 @@
 
 void ProcessPage_OnDebug(void)
 {
-    LVITEM               lvitem;
-    ULONG                Index;
     DWORD                dwProcessId;
     WCHAR                strErrorText[260];
     HKEY                 hKey;
@@ -39,24 +37,9 @@
     WCHAR                szTemp[256];
     WCHAR                szTempA[256];
 
+    dwProcessId = GetSelectedProcessId();
 
-    for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
-    {
-        memset(&lvitem, 0, sizeof(LVITEM));
-
-        lvitem.mask = LVIF_STATE;
-        lvitem.stateMask = LVIS_SELECTED;
-        lvitem.iItem = Index;
-
-        (void)ListView_GetItem(hProcessPageListCtrl, &lvitem);
-
-        if (lvitem.state & LVIS_SELECTED)
-            break;
-    }
-
-    dwProcessId = PerfDataGetProcessId(Index);
-
-    if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
+    if (dwProcessId == 0)
         return;
 
     LoadStringW(hInst, IDS_MSG_WARNINGDEBUG, szTemp, 256);

Modified: trunk/reactos/base/applications/taskmgr/endproc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/endproc.c?rev=41664&r1=41663&r2=41664&view=diff
==============================================================================
--- trunk/reactos/base/applications/taskmgr/endproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/endproc.c [iso-8859-1] Sun Jun 28 18:22:09 2009
@@ -25,30 +25,14 @@
 
 void ProcessPage_OnEndProcess(void)
 {
-    LVITEM  lvitem;
-    ULONG   Index;
     DWORD   dwProcessId;
     HANDLE  hProcess;
     WCHAR   szTitle[256];
     WCHAR   strErrorText[260];
 
-    for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
-    {
-        memset(&lvitem, 0, sizeof(LVITEM));
+    dwProcessId = GetSelectedProcessId();
 
-        lvitem.mask = LVIF_STATE;
-        lvitem.stateMask = LVIS_SELECTED;
-        lvitem.iItem = Index;
-
-        (void)ListView_GetItem(hProcessPageListCtrl, &lvitem);
-
-        if (lvitem.state & LVIS_SELECTED)
-            break;
-    }
-
-    dwProcessId = PerfDataGetProcessId(Index);
-
-    if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
+    if (dwProcessId == 0)
         return;
 
     LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, strErrorText, 256);
@@ -78,30 +62,14 @@
 
 void ProcessPage_OnEndProcessTree(void)
 {
-    LVITEM  lvitem;
-    ULONG   Index;
     DWORD   dwProcessId;
     HANDLE  hProcess;
     WCHAR   szTitle[256];
     WCHAR   strErrorText[260];
 
-    for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
-    {
-        memset(&lvitem, 0, sizeof(LVITEM));
+    dwProcessId = GetSelectedProcessId();
 
-        lvitem.mask = LVIF_STATE;
-        lvitem.stateMask = LVIS_SELECTED;
-        lvitem.iItem = Index;
-
-        (void)ListView_GetItem(hProcessPageListCtrl, &lvitem);
-
-        if (lvitem.state & LVIS_SELECTED)
-            break;
-    }
-
-    dwProcessId = PerfDataGetProcessId(Index);
-
-    if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
+    if (dwProcessId == 0)
         return;
 
     LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, strErrorText, 256);

Modified: trunk/reactos/base/applications/taskmgr/priority.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/priority.c?rev=41664&r1=41663&r2=41664&view=diff
==============================================================================
--- trunk/reactos/base/applications/taskmgr/priority.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/priority.c [iso-8859-1] Sun Jun 28 18:22:09 2009
@@ -25,30 +25,14 @@
 
 void DoSetPriority(DWORD priority)
 {
-    LVITEM  lvitem;
-    ULONG   Index;
     DWORD   dwProcessId;
     HANDLE  hProcess;
     WCHAR   szText[260];
     WCHAR   szTitle[256];
 
-    for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
-    {
-        ZeroMemory(&lvitem, sizeof(LVITEM));
+    dwProcessId = GetSelectedProcessId();
 
-        lvitem.mask = LVIF_STATE;
-        lvitem.stateMask = LVIS_SELECTED;
-        lvitem.iItem = Index;
-
-        (void)ListView_GetItem(hProcessPageListCtrl, &lvitem);
-
-        if (lvitem.state & LVIS_SELECTED)
-            break;
-    }
-
-    dwProcessId = PerfDataGetProcessId(Index);
-
-    if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
+    if (dwProcessId == 0)
         return;
 
     LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTitle, 256);

Modified: trunk/reactos/base/applications/taskmgr/procpage.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/procpage.c?rev=41664&r1=41663&r2=41664&view=diff
==============================================================================
--- trunk/reactos/base/applications/taskmgr/procpage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/procpage.c [iso-8859-1] Sun Jun 28 18:22:09 2009
@@ -40,10 +40,7 @@
 
 static int  nProcessPageWidth;
 static int  nProcessPageHeight;
-static BOOL    bProcessSort = FALSE;
-static BOOL    bProcessSortAscending = FALSE;
 static HANDLE  hProcessPageEvent = NULL;    /* When this event becomes signaled then we refresh the process list */
-static ULONG   ProcessSortColumnIndex = 0;
 
 int CALLBACK    ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
 void AddProcess(ULONG Index);
@@ -55,6 +52,29 @@
 BOOL PerfDataGetText(ULONG Index, ULONG ColumnIndex, LPTSTR lpText, int nMaxCount);
 DWORD WINAPI ProcessPageRefreshThread(void *lpParameter);
 
+DWORD GetSelectedProcessId(void)
+{
+    int     Index;
+    LVITEM  lvitem;
+
+    if(ListView_GetSelectedCount(hProcessPageListCtrl) == 1)
+    {
+        Index = ListView_GetSelectionMark(hProcessPageListCtrl);
+
+        memset(&lvitem, 0, sizeof(LVITEM));
+
+        lvitem.mask = LVIF_PARAM;
+        lvitem.iItem = Index;
+
+        (void)ListView_GetItem(hProcessPageListCtrl, &lvitem);
+
+        if (lvitem.lParam)
+            return PerfDataGetProcessId(((LPPROCESS_PAGE_LIST_ITEM)lvitem.lParam)->Index);
+    }
+
+    return 0;
+}
+
 INT_PTR CALLBACK
 ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 {
@@ -171,7 +191,6 @@
     LPNMLISTVIEW   pnmv;
     NMLVDISPINFO*  pnmdi;
     LPNMHEADER     pnmhdr;
-    LVITEM         lvitem;
     ULONG          Index;
     ULONG          ColumnIndex;
     LPPROCESS_PAGE_LIST_ITEM  pData;
@@ -207,26 +226,7 @@
 
         case NM_RCLICK:
 
-            for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
-            {
-                memset(&lvitem, 0, sizeof(LVITEM));
-
-                lvitem.mask = LVIF_STATE;
-                lvitem.stateMask = LVIS_SELECTED;
-                lvitem.iItem = Index;
-
-                (void)ListView_GetItem(hProcessPageListCtrl, &lvitem);
-
-                if (lvitem.state & LVIS_SELECTED)
-                    break;
-            }
-
-            if ((ListView_GetSelectedCount(hProcessPageListCtrl) == 1) &&
-                (PerfDataGetProcessId(Index) != 0))
-            {
-                ProcessPageShowContextMenu(PerfDataGetProcessId(Index));
-            }
-
+            ProcessPageShowContextMenu(GetSelectedProcessId());
             break;
 
         }
@@ -237,10 +237,9 @@
         {
         case HDN_ITEMCLICK:
 
-            ProcessSortColumnIndex = pnmhdr->iItem;
-            bProcessSortAscending = !bProcessSortAscending;
+            TaskManagerSettings.SortColumn = ColumnDataHints[pnmhdr->iItem];
+            TaskManagerSettings.SortAscending = !TaskManagerSettings.SortAscending;
             (void)ListView_SortItems(hProcessPageListCtrl, ProcessPageCompareFunc, NULL);
-            bProcessSort = TRUE;
 
             break;
 
@@ -447,7 +446,7 @@
     {
         AddProcess(l);
     }
-    if (bProcessSort)
+    if (TaskManagerSettings.SortColumn != -1)
     {
         (void)ListView_SortItems(hProcessPageListCtrl, ProcessPageCompareFunc, NULL);
     }
@@ -674,7 +673,6 @@
     int ret = 0;
     LPPROCESS_PAGE_LIST_ITEM Param1;
     LPPROCESS_PAGE_LIST_ITEM Param2;
-    ULONG ColumnIndex;
     WCHAR text1[260];
     WCHAR text2[260];
     ULONG l1;
@@ -686,130 +684,129 @@
     ULONGLONG      ull1;
     ULONGLONG      ull2;
 
-    if (bProcessSortAscending) {
+    if (TaskManagerSettings.SortAscending) {
         Param1 = (LPPROCESS_PAGE_LIST_ITEM)lParam1;
         Param2 = (LPPROCESS_PAGE_LIST_ITEM)lParam2;
     } else {
         Param1 = (LPPROCESS_PAGE_LIST_ITEM)lParam2;
         Param2 = (LPPROCESS_PAGE_LIST_ITEM)lParam1;
     }
-    ColumnIndex = ProcessSortColumnIndex;
-
-    if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME)
+
+    if (TaskManagerSettings.SortColumn == COLUMN_IMAGENAME)
     {
         PerfDataGetImageName(Param1->Index, text1, sizeof (text1) / sizeof (*text1));
         PerfDataGetImageName(Param2->Index, text2, sizeof (text2) / sizeof (*text2));
         ret = _wcsicmp(text1, text2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_PID)
+    else if (TaskManagerSettings.SortColumn == COLUMN_PID)
     {
         l1 = PerfDataGetProcessId(Param1->Index);
         l2 = PerfDataGetProcessId(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME)
+    else if (TaskManagerSettings.SortColumn == COLUMN_USERNAME)
     {
         PerfDataGetUserName(Param1->Index, text1, sizeof (text1) / sizeof (*text1));
         PerfDataGetUserName(Param2->Index, text2, sizeof (text2) / sizeof (*text2));
         ret = _wcsicmp(text1, text2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID)
+    else if (TaskManagerSettings.SortColumn == COLUMN_SESSIONID)
     {
         l1 = PerfDataGetSessionId(Param1->Index);
         l2 = PerfDataGetSessionId(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_CPUUSAGE)
+    else if (TaskManagerSettings.SortColumn == COLUMN_CPUUSAGE)
     {
         l1 = PerfDataGetCPUUsage(Param1->Index);
         l2 = PerfDataGetCPUUsage(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME)
+    else if (TaskManagerSettings.SortColumn == COLUMN_CPUTIME)
     {
         time1 = PerfDataGetCPUTime(Param1->Index);
         time2 = PerfDataGetCPUTime(Param2->Index);
         ret = largeintcmp(time1, time2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGE)
+    else if (TaskManagerSettings.SortColumn == COLUMN_MEMORYUSAGE)
     {
         l1 = PerfDataGetWorkingSetSizeBytes(Param1->Index);
         l2 = PerfDataGetWorkingSetSizeBytes(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE)
+    else if (TaskManagerSettings.SortColumn == COLUMN_PEAKMEMORYUSAGE)
     {
         l1 = PerfDataGetPeakWorkingSetSizeBytes(Param1->Index);
         l2 = PerfDataGetPeakWorkingSetSizeBytes(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA)
+    else if (TaskManagerSettings.SortColumn == COLUMN_MEMORYUSAGEDELTA)
     {
         l1 = PerfDataGetWorkingSetSizeDelta(Param1->Index);
         l2 = PerfDataGetWorkingSetSizeDelta(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS)
+    else if (TaskManagerSettings.SortColumn == COLUMN_PAGEFAULTS)
     {
         l1 = PerfDataGetPageFaultCount(Param1->Index);
         l2 = PerfDataGetPageFaultCount(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA)
+    else if (TaskManagerSettings.SortColumn == COLUMN_PAGEFAULTSDELTA)
     {
         l1 = PerfDataGetPageFaultCountDelta(Param1->Index);
         l2 = PerfDataGetPageFaultCountDelta(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE)
+    else if (TaskManagerSettings.SortColumn == COLUMN_VIRTUALMEMORYSIZE)
     {
         l1 = PerfDataGetVirtualMemorySizeBytes(Param1->Index);
         l2 = PerfDataGetVirtualMemorySizeBytes(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL)
+    else if (TaskManagerSettings.SortColumn == COLUMN_PAGEDPOOL)
     {
         l1 = PerfDataGetPagedPoolUsagePages(Param1->Index);
         l2 = PerfDataGetPagedPoolUsagePages(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL)
+    else if (TaskManagerSettings.SortColumn == COLUMN_NONPAGEDPOOL)
     {
         l1 = PerfDataGetNonPagedPoolUsagePages(Param1->Index);
         l2 = PerfDataGetNonPagedPoolUsagePages(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY)
+    else if (TaskManagerSettings.SortColumn == COLUMN_BASEPRIORITY)
     {
         l1 = PerfDataGetBasePriority(Param1->Index);
         l2 = PerfDataGetBasePriority(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_HANDLECOUNT)
+    else if (TaskManagerSettings.SortColumn == COLUMN_HANDLECOUNT)
     {
         l1 = PerfDataGetHandleCount(Param1->Index);
         l2 = PerfDataGetHandleCount(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT)
+    else if (TaskManagerSettings.SortColumn == COLUMN_THREADCOUNT)
     {
         l1 = PerfDataGetThreadCount(Param1->Index);
         l2 = PerfDataGetThreadCount(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS)
+    else if (TaskManagerSettings.SortColumn == COLUMN_USEROBJECTS)
     {
         l1 = PerfDataGetUSERObjectCount(Param1->Index);
         l2 = PerfDataGetUSERObjectCount(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS)
+    else if (TaskManagerSettings.SortColumn == COLUMN_GDIOBJECTS)
     {
         l1 = PerfDataGetGDIObjectCount(Param1->Index);
         l2 = PerfDataGetGDIObjectCount(Param2->Index);
         ret = CMP(l1, l2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
+    else if (TaskManagerSettings.SortColumn == COLUMN_IOREADS)
     {
         PerfDataGetIOCounters(Param1->Index, &iocounters1);
         PerfDataGetIOCounters(Param2->Index, &iocounters2);
@@ -817,7 +814,7 @@
         ull2 = iocounters2.ReadOperationCount;
         ret = CMP(ull1, ull2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
+    else if (TaskManagerSettings.SortColumn == COLUMN_IOWRITES)
     {
         PerfDataGetIOCounters(Param1->Index, &iocounters1);
         PerfDataGetIOCounters(Param2->Index, &iocounters2);
@@ -825,7 +822,7 @@
         ull2 = iocounters2.WriteOperationCount;
         ret = CMP(ull1, ull2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
+    else if (TaskManagerSettings.SortColumn == COLUMN_IOOTHER)
     {
         PerfDataGetIOCounters(Param1->Index, &iocounters1);
         PerfDataGetIOCounters(Param2->Index, &iocounters2);
@@ -833,7 +830,7 @@
         ull2 = iocounters2.OtherOperationCount;
         ret = CMP(ull1, ull2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
+    else if (TaskManagerSettings.SortColumn == COLUMN_IOREADBYTES)
     {
         PerfDataGetIOCounters(Param1->Index, &iocounters1);
         PerfDataGetIOCounters(Param2->Index, &iocounters2);
@@ -841,7 +838,7 @@
         ull2 = iocounters2.ReadTransferCount;
         ret = CMP(ull1, ull2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
+    else if (TaskManagerSettings.SortColumn == COLUMN_IOWRITEBYTES)
     {
         PerfDataGetIOCounters(Param1->Index, &iocounters1);
         PerfDataGetIOCounters(Param2->Index, &iocounters2);
@@ -849,7 +846,7 @@
         ull2 = iocounters2.WriteTransferCount;
         ret = CMP(ull1, ull2);
     }
-    else if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
+    else if (TaskManagerSettings.SortColumn == COLUMN_IOOTHERBYTES)
     {
         PerfDataGetIOCounters(Param1->Index, &iocounters1);
         PerfDataGetIOCounters(Param2->Index, &iocounters2);

Modified: trunk/reactos/base/applications/taskmgr/procpage.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/procpage.h?rev=41664&r1=41663&r2=41664&view=diff
==============================================================================
--- trunk/reactos/base/applications/taskmgr/procpage.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/procpage.h [iso-8859-1] Sun Jun 28 18:22:09 2009
@@ -31,5 +31,6 @@
 
 INT_PTR CALLBACK	ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
 void				RefreshProcessPage(void);
+DWORD               GetSelectedProcessId(void);
 
 #endif /* __PROCESSPAGE_H */

Modified: trunk/reactos/base/applications/taskmgr/taskmgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/taskmgr.c?rev=41664&r1=41663&r2=41664&view=diff
==============================================================================
--- trunk/reactos/base/applications/taskmgr/taskmgr.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/taskmgr.c [iso-8859-1] Sun Jun 28 18:22:09 2009
@@ -706,7 +706,7 @@
         TaskManagerSettings.ColumnSizeArray[i] = ColumnPresets[i].size;
     }
 
-    TaskManagerSettings.SortColumn = 1;
+    TaskManagerSettings.SortColumn = COLUMN_IMAGENAME;
     TaskManagerSettings.SortAscending = TRUE;
 
     /* Performance page settings */



More information about the Ros-diffs mailing list