6 * Copyright (C) 2007 Timo kreuzer <timo <dot> kreuzer <at> web.de>
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.
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.
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.
26 HandleList_Create(HWND hListCtrl
)
30 column
.mask
= LVCF_TEXT
|LVCF_FMT
|LVCF_WIDTH
;
31 column
.fmt
= LVCFMT_LEFT
;
33 column
.pszText
= L
"Number";
35 ListView_InsertColumn(hListCtrl
, 0, &column
);
37 column
.pszText
= L
"Index";
39 ListView_InsertColumn(hListCtrl
, 1, &column
);
41 column
.pszText
= L
"Handle";
43 ListView_InsertColumn(hListCtrl
, 2, &column
);
45 column
.pszText
= L
"Type";
47 ListView_InsertColumn(hListCtrl
, 3, &column
);
49 column
.pszText
= L
"Process";
51 ListView_InsertColumn(hListCtrl
, 4, &column
);
53 column
.pszText
= L
"KernelData";
55 ListView_InsertColumn(hListCtrl
, 5, &column
);
57 column
.pszText
= L
"UserData";
59 ListView_InsertColumn(hListCtrl
, 6, &column
);
61 HandleList_Update(hListCtrl
, 0);
65 HandleList_Update(HWND hHandleListCtrl
, HANDLE ProcessId
)
68 PGDI_TABLE_ENTRY pEntry
;
73 ListView_DeleteAllItems(hHandleListCtrl
);
74 item
.mask
= LVIF_TEXT
|LVIF_PARAM
;
75 item
.pszText
= strText
;
77 for (i
= 0; i
<= GDI_HANDLE_COUNT
; i
++)
79 pEntry
= &GdiHandleTable
[i
];
80 if (pEntry
->KernelData
)
82 if (ProcessId
== (HANDLE
)-1 || ProcessId
== pEntry
->ProcessId
)
84 index
= ListView_GetItemCount(hHandleListCtrl
);
88 wsprintf(strText
, L
"%d", index
);
89 ListView_InsertItem(hHandleListCtrl
, &item
);
91 wsprintf(strText
, L
"%d", i
);
92 ListView_SetItemText(hHandleListCtrl
, index
, 1, strText
);
94 wsprintf(strText
, L
"%#08x", GDI_HANDLE_CREATE(i
, pEntry
->Type
));
95 ListView_SetItemText(hHandleListCtrl
, index
, 2, strText
);
97 str2
= GetTypeName(pEntry
->Type
& GDI_HANDLE_TYPE_MASK
);
98 ListView_SetItemText(hHandleListCtrl
, index
, 3, str2
);
100 wsprintf(strText
, L
"%#08x", (UINT
)pEntry
->ProcessId
);
101 ListView_SetItemText(hHandleListCtrl
, index
, 4, strText
);
103 wsprintf(strText
, L
"%#08x", (UINT
)pEntry
->KernelData
);
104 ListView_SetItemText(hHandleListCtrl
, index
, 5, strText
);
106 wsprintf(strText
, L
"%#08x", (UINT
)pEntry
->UserData
);
107 ListView_SetItemText(hHandleListCtrl
, index
, 6, strText
);
114 GetTypeName(UINT Type
)
120 case GDI_OBJECT_TYPE_DC
:
123 case GDI_OBJECT_TYPE_REGION
:
126 case GDI_OBJECT_TYPE_BITMAP
:
129 case GDI_OBJECT_TYPE_PALETTE
:
130 strText
= L
"Palette";
132 case GDI_OBJECT_TYPE_FONT
:
135 case GDI_OBJECT_TYPE_BRUSH
:
138 case GDI_OBJECT_TYPE_EMF
:
141 case GDI_OBJECT_TYPE_PEN
:
144 case GDI_OBJECT_TYPE_EXTPEN
:
147 case GDI_OBJECT_TYPE_COLORSPACE
:
148 strText
= L
"ColSpace";
150 case GDI_OBJECT_TYPE_METADC
:
153 case GDI_OBJECT_TYPE_METAFILE
:
154 strText
= L
"Metafile";
156 case GDI_OBJECT_TYPE_ENHMETAFILE
:
159 case GDI_OBJECT_TYPE_ENHMETADC
:
162 case GDI_OBJECT_TYPE_MEMDC
:
165 case GDI_OBJECT_TYPE_DCE
:
168 case GDI_OBJECT_TYPE_DONTCARE
:
169 strText
= L
"anything";
171 case GDI_OBJECT_TYPE_SILENT
:
173 strText
= L
"unknown";