mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:03:00 +00:00
gdihv:
- add base type mask - change my email - add deleted entries - full row selection svn path=/trunk/; revision=29261
This commit is contained in:
parent
945a85f7cb
commit
5b816f2612
7 changed files with 86 additions and 55 deletions
|
@ -9,12 +9,13 @@ typedef struct _GDI_TABLE_ENTRY
|
||||||
typedef PGDI_TABLE_ENTRY (CALLBACK * GDIQUERYPROC) (void);
|
typedef PGDI_TABLE_ENTRY (CALLBACK * GDIQUERYPROC) (void);
|
||||||
|
|
||||||
/* GDI handle table can hold 0x4000 handles */
|
/* GDI handle table can hold 0x4000 handles */
|
||||||
#define GDI_HANDLE_COUNT 0x4000
|
#define GDI_HANDLE_COUNT 0x10000
|
||||||
#define GDI_GLOBAL_PROCESS (0x0)
|
#define GDI_GLOBAL_PROCESS (0x0)
|
||||||
|
|
||||||
/* Handle Masks and shifts */
|
/* Handle Masks and shifts */
|
||||||
#define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
|
#define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
|
||||||
#define GDI_HANDLE_TYPE_MASK 0x007f0000
|
#define GDI_HANDLE_TYPE_MASK 0x007f0000
|
||||||
|
#define GDI_HANDLE_BASETYPE_MASK 0x001f0000
|
||||||
#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
|
||||||
|
|
|
@ -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> reactos <dot> org>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|
|
@ -14,5 +14,3 @@ BEGIN
|
||||||
PUSHBUTTON "Refresh processes", IDC_REFRESHPROCESS, 50, 230, 80, 14, WS_CLIPSIBLINGS | WS_TABSTOP
|
PUSHBUTTON "Refresh processes", IDC_REFRESHPROCESS, 50, 230, 80, 14, WS_CLIPSIBLINGS | WS_TABSTOP
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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> reactos <dot> org>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -71,7 +71,7 @@ HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId)
|
||||||
INT i, index;
|
INT i, index;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
PGDI_TABLE_ENTRY pEntry;
|
PGDI_TABLE_ENTRY pEntry;
|
||||||
LV_ITEM item;
|
LVITEM item;
|
||||||
TCHAR strText[80];
|
TCHAR strText[80];
|
||||||
TCHAR* str2;
|
TCHAR* str2;
|
||||||
|
|
||||||
|
@ -82,13 +82,17 @@ HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId)
|
||||||
for (i = 0; i<= GDI_HANDLE_COUNT; i++)
|
for (i = 0; i<= GDI_HANDLE_COUNT; i++)
|
||||||
{
|
{
|
||||||
pEntry = &GdiHandleTable[i];
|
pEntry = &GdiHandleTable[i];
|
||||||
if (pEntry->KernelData)
|
if ( ((ProcessId != (HANDLE)1) && ((pEntry->Type & GDI_HANDLE_BASETYPE_MASK) != 0)) ||
|
||||||
|
((ProcessId == (HANDLE)1) && ((pEntry->Type & GDI_HANDLE_BASETYPE_MASK) == 0)) )
|
||||||
{
|
{
|
||||||
if (ProcessId == (HANDLE)-1 || ProcessId == pEntry->ProcessId)
|
if (ProcessId == (HANDLE)1 ||
|
||||||
|
ProcessId == (HANDLE)((ULONG)pEntry->ProcessId & 0xfffc))
|
||||||
{
|
{
|
||||||
|
handle = GDI_HANDLE_CREATE(i, pEntry->Type);
|
||||||
index = ListView_GetItemCount(hHandleListCtrl);
|
index = ListView_GetItemCount(hHandleListCtrl);
|
||||||
item.iItem = index;
|
item.iItem = index;
|
||||||
item.iSubItem = 0;
|
item.iSubItem = 0;
|
||||||
|
item.lParam = (LPARAM)handle;
|
||||||
|
|
||||||
wsprintf(strText, L"%d", index);
|
wsprintf(strText, L"%d", index);
|
||||||
(void)ListView_InsertItem(hHandleListCtrl, &item);
|
(void)ListView_InsertItem(hHandleListCtrl, &item);
|
||||||
|
@ -96,7 +100,6 @@ 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);
|
||||||
|
|
||||||
handle = GDI_HANDLE_CREATE(i, pEntry->Type);
|
|
||||||
wsprintf(strText, L"%#08x", handle);
|
wsprintf(strText, L"%#08x", handle);
|
||||||
ListView_SetItemText(hHandleListCtrl, index, 2, strText);
|
ListView_SetItemText(hHandleListCtrl, index, 2, strText);
|
||||||
|
|
||||||
|
|
|
@ -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> reactos <dot> org>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -24,6 +24,59 @@
|
||||||
|
|
||||||
INT g_Separator;
|
INT g_Separator;
|
||||||
|
|
||||||
|
|
||||||
|
static LRESULT
|
||||||
|
MainWindow_OnSize(HWND hMainWnd)
|
||||||
|
{
|
||||||
|
HWND hProcessListctrl, hHandleListCtrl, hProcessRefresh, hHandleRefresh;
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
hProcessListctrl = GetDlgItem(hMainWnd, IDC_PROCESSLIST);
|
||||||
|
hHandleListCtrl = GetDlgItem(hMainWnd, IDC_HANDLELIST);
|
||||||
|
hProcessRefresh = GetDlgItem(hMainWnd, IDC_REFRESHPROCESS);
|
||||||
|
hHandleRefresh = GetDlgItem(hMainWnd, IDC_REFRESHHANDLE);
|
||||||
|
|
||||||
|
GetClientRect(hMainWnd, &rect);
|
||||||
|
|
||||||
|
//g_Separator = (rect.right / 2);
|
||||||
|
MoveWindow(hProcessListctrl, 5, 5, g_Separator - 5, rect.bottom - 40, TRUE);
|
||||||
|
MoveWindow(hHandleListCtrl, g_Separator + 5, 5, rect.right - g_Separator - 5, rect.bottom - 40, TRUE);
|
||||||
|
MoveWindow(hProcessRefresh, g_Separator - 90, rect.bottom - 30, 90, 25, TRUE);
|
||||||
|
MoveWindow(hHandleRefresh, rect.right - 90, rect.bottom - 30, 90, 25, TRUE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static LRESULT
|
||||||
|
MainWnd_OnNotify(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
LPNMHDR pnmh = (LPNMHDR)lParam;
|
||||||
|
|
||||||
|
switch(pnmh->code)
|
||||||
|
{
|
||||||
|
case LVN_ITEMCHANGED:
|
||||||
|
{
|
||||||
|
LPNMLISTVIEW pnmlv = (LPNMLISTVIEW)pnmh;
|
||||||
|
if ((wParam == IDC_PROCESSLIST)
|
||||||
|
&& (pnmlv->uNewState & LVIS_SELECTED)
|
||||||
|
&& !(pnmlv->uOldState & LVIS_SELECTED))
|
||||||
|
{
|
||||||
|
LV_ITEM item;
|
||||||
|
memset(&item, 0, sizeof(LV_ITEM));
|
||||||
|
item.mask = LVIF_PARAM;
|
||||||
|
item.iItem = pnmlv->iItem;
|
||||||
|
(void)ListView_GetItem(GetDlgItem(hWnd, IDC_PROCESSLIST), &item);
|
||||||
|
HandleList_Update(GetDlgItem(hWnd, IDC_HANDLELIST), (HANDLE)item.lParam);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
INT_PTR CALLBACK
|
INT_PTR CALLBACK
|
||||||
MainWindow_WndProc(HWND hMainWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
MainWindow_WndProc(HWND hMainWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -34,6 +87,8 @@ MainWindow_WndProc(HWND hMainWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
SendMessage(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MAIN)));
|
SendMessage(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MAIN)));
|
||||||
|
(void)ListView_SetExtendedListViewStyle(GetDlgItem(hMainWnd, IDC_PROCESSLIST), LVS_EX_FULLROWSELECT);
|
||||||
|
(void)ListView_SetExtendedListViewStyle(GetDlgItem(hMainWnd, IDC_HANDLELIST), LVS_EX_FULLROWSELECT);
|
||||||
GetClientRect(hMainWnd, &rect);
|
GetClientRect(hMainWnd, &rect);
|
||||||
g_Separator = (rect.right / 2);
|
g_Separator = (rect.right / 2);
|
||||||
HandleList_Create(GetDlgItem(hMainWnd, IDC_HANDLELIST));
|
HandleList_Create(GetDlgItem(hMainWnd, IDC_HANDLELIST));
|
||||||
|
@ -43,10 +98,8 @@ MainWindow_WndProc(HWND hMainWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
return MainWindow_OnSize(hMainWnd);
|
||||||
MainWindow_OnSize(hMainWnd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
|
@ -80,23 +133,10 @@ MainWindow_WndProc(HWND hMainWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
return MainWnd_OnNotify(hMainWnd, wParam, lParam);
|
||||||
if (((LPNMLISTVIEW)lParam)->hdr.code == LVN_ITEMCHANGED
|
|
||||||
&& (wParam == IDC_PROCESSLIST)
|
|
||||||
&& (((LPNMLISTVIEW)lParam)->uNewState & LVIS_SELECTED)
|
|
||||||
&& !(((LPNMLISTVIEW)lParam)->uOldState & LVIS_SELECTED))
|
|
||||||
{
|
|
||||||
LV_ITEM item;
|
|
||||||
memset(&item, 0, sizeof(LV_ITEM));
|
|
||||||
item.mask = LVIF_PARAM;
|
|
||||||
item.iItem = ((LPNMLISTVIEW)lParam)->iItem;
|
|
||||||
(void)ListView_GetItem(GetDlgItem(hMainWnd, IDC_PROCESSLIST), &item);
|
|
||||||
HandleList_Update(GetDlgItem(hMainWnd, IDC_HANDLELIST), (HANDLE)item.lParam);
|
|
||||||
return TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -105,23 +145,3 @@ MainWindow_WndProc(HWND hMainWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
|
||||||
MainWindow_OnSize(HWND hMainWnd)
|
|
||||||
{
|
|
||||||
HWND hProcessListctrl, hHandleListCtrl, hProcessRefresh, hHandleRefresh;
|
|
||||||
RECT rect;
|
|
||||||
|
|
||||||
hProcessListctrl = GetDlgItem(hMainWnd, IDC_PROCESSLIST);
|
|
||||||
hHandleListCtrl = GetDlgItem(hMainWnd, IDC_HANDLELIST);
|
|
||||||
hProcessRefresh = GetDlgItem(hMainWnd, IDC_REFRESHPROCESS);
|
|
||||||
hHandleRefresh = GetDlgItem(hMainWnd, IDC_REFRESHHANDLE);
|
|
||||||
|
|
||||||
GetClientRect(hMainWnd, &rect);
|
|
||||||
|
|
||||||
//g_Separator = (rect.right / 2);
|
|
||||||
MoveWindow(hProcessListctrl, 5, 5, g_Separator - 5, rect.bottom - 40, TRUE);
|
|
||||||
MoveWindow(hHandleListCtrl, g_Separator + 5, 5, rect.right - g_Separator - 5, rect.bottom - 40, TRUE);
|
|
||||||
MoveWindow(hProcessRefresh, g_Separator - 90, rect.bottom - 30, 90, 25, TRUE);
|
|
||||||
MoveWindow(hHandleRefresh, rect.right - 90, rect.bottom - 30, 90, 25, TRUE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
|
|
||||||
INT_PTR CALLBACK MainWindow_WndProc(HWND, UINT, WPARAM, LPARAM);
|
INT_PTR CALLBACK MainWindow_WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
VOID MainWindow_OnSize(HWND hMainWnd);
|
|
||||||
|
|
|
@ -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> reactos <dot> org>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -44,7 +44,8 @@ VOID
|
||||||
ProcessList_Update(HWND hListCtrl)
|
ProcessList_Update(HWND hListCtrl)
|
||||||
{
|
{
|
||||||
LV_ITEM item;
|
LV_ITEM item;
|
||||||
DWORD ProcessIds[1024], BytesReturned, cProcesses;
|
DWORD ProcessIds[1024], BytesReturned;
|
||||||
|
UINT cProcesses;
|
||||||
HANDLE hProcess;
|
HANDLE hProcess;
|
||||||
WCHAR strText[MAX_PATH] = L"<unknown>";
|
WCHAR strText[MAX_PATH] = L"<unknown>";
|
||||||
INT i;
|
INT i;
|
||||||
|
@ -63,12 +64,21 @@ ProcessList_Update(HWND hListCtrl)
|
||||||
wsprintf(strText, L"%#08x", 0);
|
wsprintf(strText, L"%#08x", 0);
|
||||||
ListView_SetItemText(hListCtrl, 0, 1, strText);
|
ListView_SetItemText(hListCtrl, 0, 1, strText);
|
||||||
|
|
||||||
|
/* Insert "deleted" */
|
||||||
|
item.iItem = 1;
|
||||||
|
item.lParam = 1;
|
||||||
|
item.pszText = L"<deleted>";
|
||||||
|
(void)ListView_InsertItem(hListCtrl, &item);
|
||||||
|
item.pszText = strText;
|
||||||
|
wsprintf(strText, L"%#08x",1);
|
||||||
|
ListView_SetItemText(hListCtrl, 1, 1, strText);
|
||||||
|
|
||||||
if (!EnumProcesses(ProcessIds, sizeof(ProcessIds), &BytesReturned ))
|
if (!EnumProcesses(ProcessIds, sizeof(ProcessIds), &BytesReturned ))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cProcesses = BytesReturned / sizeof(DWORD);
|
cProcesses = BytesReturned / sizeof(DWORD);
|
||||||
if (cProcesses == 0)
|
if (cProcesses <= 1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +90,7 @@ ProcessList_Update(HWND hListCtrl)
|
||||||
|
|
||||||
hProcess = 0;
|
hProcess = 0;
|
||||||
/* FIXME: HACK: ROS crashes when using OpenProcess with PROCESS_VM_READ */
|
/* FIXME: HACK: ROS crashes when using OpenProcess with PROCESS_VM_READ */
|
||||||
// hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, ProcessIds[i]);
|
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, ProcessIds[i]);
|
||||||
if (hProcess)
|
if (hProcess)
|
||||||
{
|
{
|
||||||
GetModuleBaseName(hProcess, NULL, (LPWSTR)strText, MAX_PATH );
|
GetModuleBaseName(hProcess, NULL, (LPWSTR)strText, MAX_PATH );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue