Author: khornicek
Date: Wed Oct 22 16:01:24 2014
New Revision: 64890
URL:
http://svn.reactos.org/svn/reactos?rev=64890&view=rev
Log:
[TASKMGR]
- fix CIDs 731628 (unlikely buffer overrun), 500038 (dead code), 1101977 (unchecked return
value)
Modified:
trunk/reactos/base/applications/taskmgr/column.c
trunk/reactos/base/applications/taskmgr/graphctl.c
trunk/reactos/base/applications/taskmgr/graphctl.h
trunk/reactos/base/applications/taskmgr/taskmgr.c
Modified: trunk/reactos/base/applications/taskmgr/column.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/column.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/column.c [iso-8859-1] Wed Oct 22 16:01:24
2014
@@ -204,10 +204,13 @@
HDITEM hditem;
WCHAR text[260];
ULONG Index;
+ ULONG uItems;
WCHAR szTemp[256];
- unsigned int i;
-
- for (Index=0; Index<(ULONG)SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT,
0, 0); Index++)
+ UINT i;
+
+ uItems = min(SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0),
COLUMN_NMAX);
+
+ for (Index=0; Index<uItems; Index++)
{
memset(&hditem, 0, sizeof(HDITEM));
Modified: trunk/reactos/base/applications/taskmgr/graphctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/graphctl.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/graphctl.c [iso-8859-1] Wed Oct 22 16:01:24
2014
@@ -120,17 +120,15 @@
if (this->m_brushBack != NULL) DeleteObject(this->m_brushBack);
}
-BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
-{
- BOOL result = 0;
-
+void GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
+{
GraphCtrl_Init(this);
this->m_hParentWnd = hParentWnd;
this->m_hWnd = hWnd;
+
GraphCtrl_Resize(this);
- if (result != 0)
- GraphCtrl_InvalidateCtrl(this, FALSE);
- return result;
+
+ return;
}
void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double dUpper, int
nDecimalPlaces)
Modified: trunk/reactos/base/applications/taskmgr/graphctl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/graphctl.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/graphctl.h [iso-8859-1] Wed Oct 22 16:01:24
2014
@@ -88,7 +88,7 @@
double GraphCtrl_AppendPoint(TGraphCtrl* this,
double dNewPoint0, double dNewPoint1,
double dNewPoint2, double dNewPoint3);
-BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd,
+void GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd,
UINT nID);
void GraphCtrl_Dispose(TGraphCtrl* this);
void GraphCtrl_DrawPoint(TGraphCtrl* this);
Modified: trunk/reactos/base/applications/taskmgr/taskmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/taskmgr.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/taskmgr.c [iso-8859-1] Wed Oct 22 16:01:24
2014
@@ -154,13 +154,14 @@
/* Get a token for this process. */
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
&hToken)) {
/* Get the LUID for the debug privilege. */
- LookupPrivilegeValueW(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid);
-
- tkp.PrivilegeCount = 1; /* one privilege to set */
- tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
-
- /* Get the debug privilege for this process. */
- AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
+ if(LookupPrivilegeValueW(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid))
+ {
+ tkp.PrivilegeCount = 1; /* one privilege to set */
+ tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+
+ /* Get the debug privilege for this process. */
+ AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL,
0);
+ }
CloseHandle(hToken);
}