fixed chicken messages
[snoogans.git] / kernel32.h
bloba9375dbf29b2b845174b2473ec90b4e89544c972
1 /*
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/>.
20 #ifndef KERNEL32_H_
21 #define KERNEL32_H_
23 #include "types.h"
25 #define TH32CS_SNAPTHREAD 0x0004
27 #define THREAD_SUSPEND_RESUME 0x0002
29 typedef struct
31 DWORD dwSize;
32 DWORD cntUsage;
33 DWORD th32ThreadID;
34 DWORD th32OwnerProcessID;
35 LONG tpBasePri;
36 LONG tpDeltaPri;
37 DWORD dwFlags;
38 } THREADENTRY32;
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))
55 #undef FUNC
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
63 int
64 manage_threads(int __attribute__((stdcall))
65 (*manage_thread)(void *));
67 #endif /* KERNEL32_H_ */