ReactOS  0.4.14-dev-358-gbef841c
handlelist.c File Reference
#include "gdihv.h"
Include dependency graph for handlelist.c:

Go to the source code of this file.

Functions

VOID HandleList_Create (HWND hListCtrl)
 
VOID HandleList_Update (HWND hHandleListCtrl, HANDLE ProcessId)
 
TCHARGetTypeName (HANDLE handle)
 

Function Documentation

◆ GetTypeName()

TCHAR* GetTypeName ( HANDLE  handle)

Definition at line 127 of file handlelist.c.

128 {
129  TCHAR* strText;
131 
132  switch (Type)
133  {
134  case GDI_OBJECT_TYPE_DC:
135  strText = L"DC";
136  break;
138  strText = L"Region";
139  break;
141  strText = L"Bitmap";
142  break;
144  strText = L"Palette";
145  break;
147  strText = L"Font";
148  break;
150  strText = L"Brush";
151  break;
152  case GDI_OBJECT_TYPE_EMF:
153  strText = L"EMF";
154  break;
155  case GDI_OBJECT_TYPE_PEN:
156  strText = L"Pen";
157  break;
159  strText = L"ExtPen";
160  break;
162  strText = L"ColSpace";
163  break;
165  strText = L"MetaDC";
166  break;
168  strText = L"Metafile";
169  break;
171  strText = L"EMF";
172  break;
174  strText = L"EMDC";
175  break;
177  strText = L"MemDC";
178  break;
179  case GDI_OBJECT_TYPE_DCE:
180  strText = L"DCE";
181  break;
182  case GDI_OBJECT_TYPE_PFE:
183  strText = L"PFE";
184  break;
186  strText = L"anything";
187  break;
189  default:
190  strText = L"unknown";
191  break;
192  }
193  return strText;
194 }
#define GDI_OBJECT_TYPE_DCE
Definition: gdi.h:63
Type
Definition: Type.h:6
#define GDI_OBJECT_TYPE_ENHMETAFILE
Definition: gdi.h:59
#define GDI_OBJECT_TYPE_REGION
Definition: gdi.h:47
#define GDI_OBJECT_TYPE_EXTPEN
Definition: gdi.h:55
#define GDI_OBJECT_TYPE_COLORSPACE
Definition: gdi.h:56
#define GDI_OBJECT_TYPE_ENHMETADC
Definition: gdi.h:61
#define GDI_OBJECT_TYPE_BRUSH
Definition: gdi.h:52
#define GDI_OBJECT_TYPE_PALETTE
Definition: gdi.h:49
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define GDI_OBJECT_TYPE_PFE
Definition: gdi.h:51
char TCHAR
Definition: xmlstorage.h:189
#define GDI_OBJECT_TYPE_PEN
Definition: gdi.h:54
#define GDI_OBJECT_TYPE_METADC
Definition: gdi.h:57
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
#define GDI_OBJECT_TYPE_METAFILE
Definition: gdi.h:58
static const WCHAR L[]
Definition: oid.c:1250
#define GDI_OBJECT_TYPE_BITMAP
Definition: gdi.h:48
#define GDI_OBJECT_TYPE_DONTCARE
Definition: gdi.h:64
#define GDI_OBJECT_TYPE_SILENT
Definition: gdi.h:66
#define GDI_OBJECT_TYPE_EMF
Definition: gdi.h:53
unsigned int UINT
Definition: ndis.h:50
#define GDI_OBJECT_TYPE_MEMDC
Definition: gdi.h:62
#define GDI_OBJECT_TYPE_FONT
Definition: gdi.h:50

Referenced by HandleList_Update().

◆ HandleList_Create()

VOID HandleList_Create ( HWND  hListCtrl)

Definition at line 26 of file handlelist.c.

27 {
29 
31  column.fmt = LVCFMT_LEFT;
32 
33  column.pszText = L"Number";
34  column.cx = 50;
35  (void)ListView_InsertColumn(hListCtrl, 0, &column);
36 
37  column.pszText = L"Index";
38  column.cx = 45;
39  (void)ListView_InsertColumn(hListCtrl, 1, &column);
40 
41  column.pszText = L"Handle";
42  column.cx = 90;
43  (void)ListView_InsertColumn(hListCtrl, 2, &column);
44 
45  column.pszText = L"Type";
46  column.cx = 80;
47  (void)ListView_InsertColumn(hListCtrl, 3, &column);
48 
49  column.pszText = L"Process";
50  column.cx = 80;
51  (void)ListView_InsertColumn(hListCtrl, 4, &column);
52 
53  column.pszText = L"KernelData";
54  column.cx = 80;
55  (void)ListView_InsertColumn(hListCtrl, 5, &column);
56 
57  column.pszText = L"UserData";
58  column.cx = 80;
59  (void)ListView_InsertColumn(hListCtrl, 6, &column);
60 
61  column.pszText = L"Type";
62  column.cx = 80;
63  (void)ListView_InsertColumn(hListCtrl, 7, &column);
64 
65  HandleList_Update(hListCtrl, 0);
66 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define LVCF_TEXT
Definition: commctrl.h:2584
#define LVCFMT_LEFT
Definition: commctrl.h:2594
#define LVCOLUMN
Definition: commctrl.h:2577
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2632
VOID HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId)
Definition: handlelist.c:69
static const WCHAR L[]
Definition: oid.c:1250
#define LVCF_FMT
Definition: commctrl.h:2582
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664

Referenced by MainWindow_WndProc().

◆ HandleList_Update()

VOID HandleList_Update ( HWND  hHandleListCtrl,
HANDLE  ProcessId 
)

Definition at line 69 of file handlelist.c.

70 {
71  INT i, index;
72  HANDLE handle;
73  PGDI_TABLE_ENTRY pEntry;
74  LVITEM item;
75  TCHAR strText[80];
76  TCHAR* str2;
77 
78  (void)ListView_DeleteAllItems(hHandleListCtrl);
79  item.mask = LVIF_TEXT|LVIF_PARAM;
80  item.pszText = strText;
81  item.cchTextMax = 80;
82  for (i = 0; i<= GDI_HANDLE_COUNT; i++)
83  {
84  pEntry = &GdiHandleTable[i];
85  if ( ((ProcessId != (HANDLE)1) && ((pEntry->Type & GDI_HANDLE_BASETYPE_MASK) != 0)) ||
86  ((ProcessId == (HANDLE)1) && ((pEntry->Type & GDI_HANDLE_BASETYPE_MASK) == 0)) ||
87  (ProcessId == (HANDLE)2) )
88  {
89  if (ProcessId == (HANDLE)1 || ProcessId == (HANDLE)2 ||
90  ((LONG_PTR)ProcessId & 0xfffc) == ((LONG_PTR)pEntry->ProcessId & 0xfffc))
91  {
92  handle = GDI_HANDLE_CREATE(i, pEntry->Type);
93  index = ListView_GetItemCount(hHandleListCtrl);
94  item.iItem = index;
95  item.iSubItem = 0;
96  item.lParam = (LPARAM)handle;
97 
98  wsprintf(strText, L"%d", index);
99  (void)ListView_InsertItem(hHandleListCtrl, &item);
100 
101  wsprintf(strText, L"%d", i);
102  ListView_SetItemText(hHandleListCtrl, index, 1, strText);
103 
104  wsprintf(strText, L"%#08Ix", handle);
105  ListView_SetItemText(hHandleListCtrl, index, 2, strText);
106 
107  str2 = GetTypeName(handle);
108  ListView_SetItemText(hHandleListCtrl, index, 3, str2);
109 
110  wsprintf(strText, L"%#08Ix", (UINT_PTR)pEntry->ProcessId);
111  ListView_SetItemText(hHandleListCtrl, index, 4, strText);
112 
113  wsprintf(strText, L"%#08Ix", (UINT_PTR)pEntry->KernelData);
114  ListView_SetItemText(hHandleListCtrl, index, 5, strText);
115 
116  wsprintf(strText, L"%#08Ix", (UINT_PTR)pEntry->UserData);
117  ListView_SetItemText(hHandleListCtrl, index, 6, strText);
118 
119  wsprintf(strText, L"%#08x", (UINT)pEntry->Type);
120  ListView_SetItemText(hHandleListCtrl, index, 7, strText);
121  }
122  }
123  }
124 }
PVOID UserData
Definition: gdi.h:6
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define GDI_HANDLE_CREATE(i, t)
Definition: gdi.h:25
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2404
HANDLE ProcessId
Definition: gdi.h:4
int32_t INT
Definition: typedefs.h:56
#define GDI_HANDLE_BASETYPE_MASK
Definition: gdi.h:18
#define LVIF_TEXT
Definition: commctrl.h:2305
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
GLuint index
Definition: glext.h:6031
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2687
char TCHAR
Definition: xmlstorage.h:189
#define GdiHandleTable
Definition: win32nt.h:35
LONG Type
Definition: gdi.h:5
PVOID HANDLE
Definition: typedefs.h:71
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
Definition: gdi.h:1
static ATOM item
Definition: dde.c:856
#define GDI_HANDLE_COUNT
Definition: gdi.h:12
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
PVOID KernelData
Definition: gdi.h:3
unsigned int UINT
Definition: ndis.h:50
#define LVIF_PARAM
Definition: commctrl.h:2307
#define LVITEM
Definition: commctrl.h:2371
TCHAR * GetTypeName(HANDLE handle)
Definition: handlelist.c:127
#define wsprintf
Definition: winuser.h:5766
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2410

Referenced by HandleList_Create(), MainWindow_WndProc(), and MainWnd_OnNotify().