View GDI handles/resources list and detect GDI leaks
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: View GDI handles/resources list and detect GDI leaks
Buscando he llegado hasta esto con código muy interesante
http://drmemory.googlecode.com/svn/trun ... handle.cpp
y desde ahi a su página:
https://code.google.com/p/drmemory/
http://drmemory.googlecode.com/svn/trun ... handle.cpp
y desde ahi a su página:
https://code.google.com/p/drmemory/
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: View GDI handles/resources list and detect GDI leaks
I was curious to know how they get such info, so I started googling and it seems as first of all we need to identify the running processes. Here you can test it from FWH
Code: Select all
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "Right click me"
ACTIVATE WINDOW oWnd ;
ON RIGHT CLICK XBrowse( GetProcesses(), "Processes" )
return nil
//----------------------------------------------------------------------------//
#pragma BEGINDUMP
#include <windows.h>
#include <tlhelp32.h>
#include <hbapi.h>
#include <hbapiitm.h>
HB_FUNC( GETPROCESSES )
{
HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPALL, 0 );
HANDLE hProcess;
PROCESSENTRY32 pe;
PHB_ITEM pProcesses = hb_itemArrayNew( 0 );
PHB_ITEM pProcess = hb_itemNew( NULL );
pe.dwSize = sizeof( pe );
Process32First( hSnapshot, &pe );
do
{
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID );
hb_arrayNew( pProcess, 2 );
hb_arraySetNLL( pProcess, 1, pe.th32ProcessID );
hb_arraySetC( pProcess, 2, pe.szExeFile );
hb_arrayAddForward( pProcesses, pProcess );
} while( Process32Next( hSnapshot, &pe ) );
hb_itemRelease( pProcess );
hb_itemReturnRelease( pProcesses );
CloseHandle( hProcess );
CloseHandle( hSnapshot );
}
#pragma ENDDUMP
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: View GDI handles/resources list and detect GDI leaks
It seems as this way would be the next step:
http://msdn.microsoft.com/en-us/magazine/cc188782.aspx
https://github.com/dzzie/MAP/blob/maste ... iProcs.cpp
http://msdn.microsoft.com/en-us/magazine/cc188782.aspx
https://github.com/dzzie/MAP/blob/maste ... iProcs.cpp
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: