2 * Copyright (C) 2010 gonzoj
4 * Please check the CREDITS file for further information.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #define TH32CS_SNAPTHREAD 0x0004
27 #define THREAD_SUSPEND_RESUME 0x0002
34 DWORD th32OwnerProcessID
;
40 #define FUNC(r, a, f, p) extern r (*f)p a; extern char *str_##f;
42 FUNC(void *, __attribute__((stdcall)), GetProcAddress
, (void *module
, int function
))
43 FUNC(void *, __attribute__((stdcall)), GetModuleHandleA
, (const char *module
))
44 FUNC(void *, __attribute__((stdcall)), LoadLibraryA
, (const char *module
))
45 FUNC(void *, __attribute__((stdcall)), CreateToolhelp32Snapshot
, (int flags
, long pid
))
46 FUNC(void *, __attribute__((stdcall)), OpenThread
, (int access
, int inherit_handle
, int thread_id
))
47 FUNC(int, __attribute__((stdcall)), SuspendThread
, (void *thread
))
48 FUNC(int, __attribute__((stdcall)), ResumeThread
, (void *thread
))
49 FUNC(int, __attribute__((stdcall)), Thread32First
, (void *snap_thread
, THREADENTRY32
*thread_entry
))
50 FUNC(int, __attribute__((stdcall)), Thread32Next
, (void *snap_thread
, THREADENTRY32
*thread_entry
))
51 FUNC(int, __attribute__((stdcall)), GetCurrentThreadId
, ())
52 FUNC(int, __attribute__((stdcall)), GetCurrentProcessId
, ())
53 FUNC(void *, __attribute__((stdcall)), CreateThread
, (void *sa
, size_t stack
, void *func
, void *param
, int flags
, void *tid
))
57 #define _KERNEL32_FUNC_START GetProcAddress
58 #define _KERNEL32_FUNC_END CreateThread
60 #define _KERNEL32_STR_START str_GetProcAddress
61 #define _KERNEL32_STR_END str_CreateThread
64 manage_threads(int __attribute__((stdcall))
65 (*manage_thread
)(void *));
67 #endif /* KERNEL32_H_ */