Package lib :: Package common :: Module defines
[hide private]
[frames] | no frames]

Source Code for Module lib.common.defines

  1  # Copyright (C) 2010-2014 Cuckoo Foundation.
 
  2  # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
 
  3  # See the file 'docs/LICENSE' for copying permission.
 
  4  
 
  5  from ctypes import * 
  6  
 
  7  NTDLL    = windll.ntdll 
  8  KERNEL32 = windll.kernel32 
  9  ADVAPI32 = windll.advapi32 
 10  USER32   = windll.user32 
 11  
 
 12  BYTE      = c_ubyte 
 13  WORD      = c_ushort 
 14  DWORD     = c_ulong 
 15  LONG      = c_ulong 
 16  LPBYTE    = POINTER(c_ubyte) 
 17  LPTSTR    = POINTER(c_char)  
 18  HANDLE    = c_void_p 
 19  PVOID     = c_void_p 
 20  LPVOID    = c_void_p 
 21  UINT_PTR  = c_ulong 
 22  SIZE_T    = c_ulong 
 23  HMODULE   = c_void_p 
 24  NULL      = c_int(0) 
 25  
 
 26  DEBUG_PROCESS             = 0x00000001 
 27  CREATE_NEW_CONSOLE        = 0x00000010 
 28  CREATE_SUSPENDED          = 0x00000004 
 29  DBG_CONTINUE              = 0x00010002 
 30  INFINITE                  = 0xFFFFFFFF 
 31  PROCESS_ALL_ACCESS        = 0x001F0FFF 
 32  THREAD_ALL_ACCESS         = 0x001f03ff 
 33  TOKEN_ALL_ACCESS          = 0x000F01FF 
 34  SE_PRIVILEGE_ENABLED      = 0x00000002 
 35  STILL_ACTIVE              = 0x00000103 
 36  
 
 37  PAGE_EXECUTE_READWRITE    = 0x00000040 
 38  PAGE_EXECUTE              = 0x00000010 
 39  PAGE_EXECUTE_READ         = 0x00000020 
 40  PAGE_READONLY             = 0x00000002 
 41  PAGE_READWRITE            = 0x00000004 
 42  
 
 43  MEM_COMMIT                = 0x00001000 
 44  MEM_RESERVE               = 0x00002000 
 45  MEM_DECOMMIT              = 0x00004000 
 46  MEM_RELEASE               = 0x00008000 
 47  MEM_RESET                 = 0x00080000 
 48  
 
 49  PAGE_NOACCESS             = 0x00000001 
 50  PAGE_READONLY             = 0x00000002 
 51  PAGE_READWRITE            = 0x00000004 
 52  PAGE_WRITECOPY            = 0x00000008 
 53  PAGE_EXECUTE              = 0x00000010 
 54  PAGE_EXECUTE_READ         = 0x00000020 
 55  PAGE_EXECUTE_READWRITE    = 0x00000040 
 56  PAGE_EXECUTE_WRITECOPY    = 0x00000080 
 57  PAGE_GUARD                = 0x00000100 
 58  PAGE_NOCACHE              = 0x00000200 
 59  PAGE_WRITECOMBINE         = 0x00000400 
 60  
 
 61  PIPE_ACCESS_DUPLEX        = 0x00000003 
 62  PIPE_TYPE_MESSAGE         = 0x00000004 
 63  PIPE_READMODE_MESSAGE     = 0x00000002 
 64  PIPE_WAIT                 = 0x00000000 
 65  PIPE_UNLIMITED_INSTANCES  = 0x000000ff 
 66  INVALID_HANDLE_VALUE      = 0xffffffff 
 67  ERROR_BROKEN_PIPE         = 0x0000006d 
 68  ERROR_MORE_DATA           = 0x000000EA 
 69  ERROR_PIPE_CONNECTED      = 0x00000217 
 70  
 
 71  FILE_ATTRIBUTE_HIDDEN     = 0x00000002 
 72  
 
 73  WM_GETTEXT                = 0x0000000D 
 74  WM_GETTEXTLENGTH          = 0x0000000E 
 75  BM_CLICK                  = 0x000000F5 
 76  
 
77 -class STARTUPINFO(Structure):
78 _fields_ = [ 79 ("cb", DWORD), 80 ("lpReserved", LPTSTR), 81 ("lpDesktop", LPTSTR), 82 ("lpTitle", LPTSTR), 83 ("dwX", DWORD), 84 ("dwY", DWORD), 85 ("dwXSize", DWORD), 86 ("dwYSize", DWORD), 87 ("dwXCountChars", DWORD), 88 ("dwYCountChars", DWORD), 89 ("dwFillAttribute",DWORD), 90 ("dwFlags", DWORD), 91 ("wShowWindow", WORD), 92 ("cbReserved2", WORD), 93 ("lpReserved2", LPBYTE), 94 ("hStdInput", HANDLE), 95 ("hStdOutput", HANDLE), 96 ("hStdError", HANDLE), 97 ]
98
99 -class PROCESS_INFORMATION(Structure):
100 _fields_ = [ 101 ("hProcess", HANDLE), 102 ("hThread", HANDLE), 103 ("dwProcessId", DWORD), 104 ("dwThreadId", DWORD), 105 ]
106
107 -class LUID(Structure):
108 _fields_ = [ 109 ("LowPart", DWORD), 110 ("HighPart", LONG), 111 ]
112
113 -class LUID_AND_ATTRIBUTES(Structure):
114 _fields_ = [ 115 ("Luid", LUID), 116 ("Attributes", DWORD), 117 ]
118
119 -class TOKEN_PRIVILEGES(Structure):
120 _fields_ = [ 121 ("PrivilegeCount", DWORD), 122 ("Privileges", LUID_AND_ATTRIBUTES), 123 ]
124
125 -class MEMORY_BASIC_INFORMATION(Structure):
126 _fields_ = [ 127 ("BaseAddress", PVOID), 128 ("AllocationBase", PVOID), 129 ("AllocationProtect", DWORD), 130 ("RegionSize", SIZE_T), 131 ("State", DWORD), 132 ("Protect", DWORD), 133 ("Type", DWORD), 134 ]
135
136 -class PROC_STRUCT(Structure):
137 _fields_ = [ 138 ("wProcessorArchitecture", WORD), 139 ("wReserved", WORD), 140 ]
141
142 -class SYSTEM_INFO_UNION(Union):
143 _fields_ = [ 144 ("dwOemId", DWORD), 145 ("sProcStruc", PROC_STRUCT), 146 ]
147
148 -class SYSTEM_INFO(Structure):
149 _fields_ = [ 150 ("uSysInfo", SYSTEM_INFO_UNION), 151 ("dwPageSize", DWORD), 152 ("lpMinimumApplicationAddress", LPVOID), 153 ("lpMaximumApplicationAddress", LPVOID), 154 ("dwActiveProcessorMask", DWORD), 155 ("dwNumberOfProcessors", DWORD), 156 ("dwProcessorType", DWORD), 157 ("dwAllocationGranularity", DWORD), 158 ("wProcessorLevel", WORD), 159 ("wProcessorRevision", WORD), 160 ]
161
162 -class MEMORY_BASIC_INFORMATION(Structure):
163 _fields_ = [ 164 ("BaseAddress", PVOID), 165 ("AllocationBase", PVOID), 166 ("AllocationProtect", DWORD), 167 ("RegionSize", SIZE_T), 168 ("State", DWORD), 169 ("Protect", DWORD), 170 ("Type", DWORD), 171 ]
172