ReactOS 0.4.16-dev-297-gc569aee
handlelist.c
Go to the documentation of this file.
1/*
2 * Gdi handle viewer
3 *
4 * handlelist.c
5 *
6 * Copyright (C) 2007 Timo Kreuzer <timo <dot> kreuzer <at> reactos <dot> org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include "gdihv.h"
24
25VOID
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}
67
68VOID
70{
71 INT i, index;
75 TCHAR strText[80];
76 TCHAR* str2;
77
78 (void)ListView_DeleteAllItems(hHandleListCtrl);
80 item.pszText = strText;
81 item.cchTextMax = 80;
82 for (i = 0; i<= GDI_HANDLE_COUNT; i++)
83 {
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 {
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}
125
126TCHAR*
128{
129 TCHAR* strText;
131
132 switch (Type)
133 {
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;
153 strText = L"EMF";
154 break;
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;
180 strText = L"DCE";
181 break;
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}
Type
Definition: Type.h:7
#define index(s, c)
Definition: various.h:29
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2712
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
#define GDI_OBJECT_TYPE_REGION
Definition: gdi.h:47
#define GDI_OBJECT_TYPE_DCE
Definition: gdi.h:63
#define GDI_OBJECT_TYPE_DONTCARE
Definition: gdi.h:64
#define GDI_OBJECT_TYPE_ENHMETADC
Definition: gdi.h:61
#define GDI_HANDLE_CREATE(i, t)
Definition: gdi.h:25
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
#define GDI_OBJECT_TYPE_BRUSH
Definition: gdi.h:52
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define GDI_HANDLE_BASETYPE_MASK
Definition: gdi.h:18
#define GDI_OBJECT_TYPE_ENHMETAFILE
Definition: gdi.h:59
#define GDI_HANDLE_COUNT
Definition: gdi.h:12
#define GDI_OBJECT_TYPE_COLORSPACE
Definition: gdi.h:56
#define GDI_OBJECT_TYPE_SILENT
Definition: gdi.h:66
#define GDI_OBJECT_TYPE_BITMAP
Definition: gdi.h:48
#define GDI_OBJECT_TYPE_PALETTE
Definition: gdi.h:49
#define GDI_OBJECT_TYPE_EXTPEN
Definition: gdi.h:55
#define GDI_OBJECT_TYPE_FONT
Definition: gdi.h:50
#define GDI_OBJECT_TYPE_EMF
Definition: gdi.h:53
#define GDI_OBJECT_TYPE_METADC
Definition: gdi.h:57
#define GDI_OBJECT_TYPE_MEMDC
Definition: gdi.h:62
#define GDI_OBJECT_TYPE_PEN
Definition: gdi.h:54
#define GDI_OBJECT_TYPE_PFE
Definition: gdi.h:51
#define GDI_OBJECT_TYPE_METAFILE
Definition: gdi.h:58
GLuint index
Definition: glext.h:6031
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
VOID HandleList_Create(HWND hListCtrl)
Definition: handlelist.c:26
TCHAR * GetTypeName(HANDLE handle)
Definition: handlelist.c:127
VOID HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId)
Definition: handlelist.c:69
static ATOM item
Definition: dde.c:856
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2413
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2641
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#define LVITEM
Definition: commctrl.h:2380
#define LVIF_PARAM
Definition: commctrl.h:2316
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2419
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2696
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LVCOLUMN
Definition: commctrl.h:2586
Definition: gdi.h:2
PVOID HANDLE
Definition: typedefs.h:73
int32_t INT
Definition: typedefs.h:58
#define GdiHandleTable
Definition: win32nt.h:37
LONG_PTR LPARAM
Definition: windef.h:208
#define wsprintf
Definition: winuser.h:5877
char TCHAR
Definition: xmlstorage.h:189