Package src :: Module pyfault_defines
[hide private]
[frames] | no frames]

Source Code for Module src.pyfault_defines

 1  # 
 2  # PyFault 
 3  # Copyright (C) 2007 Justin Seitz <jms@bughunter.ca> 
 4  # 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public 
 7  # License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 
 8  # version. 
 9  # 
10  # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
11  # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 
12  # 
13  # You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 
14  # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
15  # 
16   
17   
18  ''' 
19  This provides the constants the main pyfault class uses for process access, memory writes, etc. 
20  Some of these were gleaned from MSDN (http://msdn.microsoft.com) and the module structure is  
21  referring to a code snippet in the PaiMei framework (http://paimei.openrce.org) by Pedram Amini, although I  
22  changed the ctypes type of hModule to be slightly different. 
23  ''' 
24   
25  import ctypes 
26   
27  INVALID_HANDLE_VALUE   =     0xFFFFFFFF 
28  PAGE_READWRITE         =     0x04 
29  PROCESS_ALL_ACCESS     =     ( 0x000F0000 | 0x00100000 | 0xFFF ) 
30  TH32CS_SNAPMODULE      =     0x00000008 
31  VIRTUAL_MEM            =     ( 0x1000 | 0x2000 ) 
32   
33   
34   
35 -class MODULEENTRY32(ctypes.Structure):
36 _fields_ = [ 37 ("dwSize", ctypes.c_ulong), 38 ("th32ModuleID", ctypes.c_ulong), 39 ("th32ProcessID", ctypes.c_ulong), 40 ("GlblcntUsage", ctypes.c_ulong), 41 ("ProccntUsage", ctypes.c_ulong), 42 ("modBaseAddr", ctypes.c_ulong), 43 ("modBaseSize", ctypes.c_ulong), 44 ("hModule", ctypes.c_void_p), 45 ("szModule", ctypes.c_char * 256), 46 ("szExePath", ctypes.c_char * 260), 47 ]
48