- Fix calculation of handle

- Add Type column

svn path=/trunk/; revision=26507
This commit is contained in:
Timo Kreuzer 2007-04-25 22:09:23 +00:00
parent b0c5d40269
commit 96d2b5521b
6 changed files with 20 additions and 10 deletions

View file

@ -18,11 +18,11 @@ typedef PGDI_TABLE_ENTRY (CALLBACK * GDIQUERYPROC) (void);
#define GDI_HANDLE_STOCK_MASK 0x00800000 #define GDI_HANDLE_STOCK_MASK 0x00800000
#define GDI_HANDLE_REUSE_MASK 0xff000000 #define GDI_HANDLE_REUSE_MASK 0xff000000
#define GDI_HANDLE_REUSECNT_SHIFT 24 #define GDI_HANDLE_REUSECNT_SHIFT 24
#define GDI_HANDLE_UPPER_MASK 0xffff0000 #define GDI_HANDLE_UPPER_MASK 0x0000ffff
/* Handle macros */ /* Handle macros */
#define GDI_HANDLE_CREATE(i, t) \ #define GDI_HANDLE_CREATE(i, t) \
((HANDLE)(((i) & GDI_HANDLE_INDEX_MASK) | ((t) & GDI_HANDLE_UPPER_MASK))) ((HANDLE)(((i) & GDI_HANDLE_INDEX_MASK) | ((t) << 16)))
#define GDI_HANDLE_GET_INDEX(h) \ #define GDI_HANDLE_GET_INDEX(h) \
(((ULONG_PTR)(h)) & GDI_HANDLE_INDEX_MASK) (((ULONG_PTR)(h)) & GDI_HANDLE_INDEX_MASK)

View file

@ -3,7 +3,7 @@
* *
* gdihv.c * gdihv.c
* *
* Copyright (C) 2007 Timo kreuzer <timo <dot> kreuzer <at> web.de> * Copyright (C) 2007 Timo Kreuzer <timo <dot> kreuzer <at> web.de>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -3,7 +3,7 @@
* *
* handlelist.c * handlelist.c
* *
* Copyright (C) 2007 Timo kreuzer <timo <dot> kreuzer <at> web.de> * Copyright (C) 2007 Timo Kreuzer <timo <dot> kreuzer <at> web.de>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -58,6 +58,10 @@ HandleList_Create(HWND hListCtrl)
column.cx = 80; column.cx = 80;
(void)ListView_InsertColumn(hListCtrl, 6, &column); (void)ListView_InsertColumn(hListCtrl, 6, &column);
column.pszText = L"Type";
column.cx = 80;
(void)ListView_InsertColumn(hListCtrl, 7, &column);
HandleList_Update(hListCtrl, 0); HandleList_Update(hListCtrl, 0);
} }
@ -65,6 +69,7 @@ VOID
HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId) HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId)
{ {
INT i, index; INT i, index;
HANDLE handle;
PGDI_TABLE_ENTRY pEntry; PGDI_TABLE_ENTRY pEntry;
LV_ITEM item; LV_ITEM item;
TCHAR strText[80]; TCHAR strText[80];
@ -91,10 +96,11 @@ HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId)
wsprintf(strText, L"%d", i); wsprintf(strText, L"%d", i);
ListView_SetItemText(hHandleListCtrl, index, 1, strText); ListView_SetItemText(hHandleListCtrl, index, 1, strText);
wsprintf(strText, L"%#08x", GDI_HANDLE_CREATE(i, pEntry->Type)); handle = GDI_HANDLE_CREATE(i, pEntry->Type);
wsprintf(strText, L"%#08x", handle);
ListView_SetItemText(hHandleListCtrl, index, 2, strText); ListView_SetItemText(hHandleListCtrl, index, 2, strText);
str2 = GetTypeName(pEntry->Type & GDI_HANDLE_TYPE_MASK); str2 = GetTypeName(handle);
ListView_SetItemText(hHandleListCtrl, index, 3, str2); ListView_SetItemText(hHandleListCtrl, index, 3, str2);
wsprintf(strText, L"%#08x", (UINT)pEntry->ProcessId); wsprintf(strText, L"%#08x", (UINT)pEntry->ProcessId);
@ -105,15 +111,19 @@ HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId)
wsprintf(strText, L"%#08x", (UINT)pEntry->UserData); wsprintf(strText, L"%#08x", (UINT)pEntry->UserData);
ListView_SetItemText(hHandleListCtrl, index, 6, strText); ListView_SetItemText(hHandleListCtrl, index, 6, strText);
wsprintf(strText, L"%#08x", (UINT)pEntry->Type);
ListView_SetItemText(hHandleListCtrl, index, 7, strText);
} }
} }
} }
} }
TCHAR* TCHAR*
GetTypeName(UINT Type) GetTypeName(HANDLE handle)
{ {
TCHAR* strText; TCHAR* strText;
UINT Type = GDI_HANDLE_GET_TYPE(handle);
switch (Type) switch (Type)
{ {

View file

@ -1,4 +1,4 @@
VOID HandleList_Create(HWND hListCtrl); VOID HandleList_Create(HWND hListCtrl);
VOID HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessID); VOID HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessID);
TCHAR* GetTypeName(UINT Type); TCHAR* GetTypeName(HANDLE handle);

View file

@ -3,7 +3,7 @@
* *
* mainwnd.c * mainwnd.c
* *
* Copyright (C) 2007 Timo kreuzer <timo <dot> kreuzer <at> web.de> * Copyright (C) 2007 Timo Kreuzer <timo <dot> kreuzer <at> web.de>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -3,7 +3,7 @@
* *
* proclist.c * proclist.c
* *
* Copyright (C) 2007 Timo kreuzer <timo <dot> kreuzer <at> web.de> * Copyright (C) 2007 Timo Kreuzer <timo <dot> kreuzer <at> web.de>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by