ReactOS 0.4.15-dev-8231-g29a56f3
test.h
Go to the documentation of this file.
1/*
2 * test.h
3 *
4 * This file is a combination of a couple different headers
5 * from ReactOS's include/ folder, and a little bit of custom
6 * hacking as well for the purpose of testing sdkparse.
7 *
8 * THIS SOFTWARE IS NOT COPYRIGHTED
9 *
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
12 *
13 * This code is distributed in the hope that it will be useful but
14 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
15 * DISCLAMED. This includes but is not limited to warranties of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 *
18 */
19
20#ifndef __INTERNAL_PSAPI_H_INCLUDED__
21#define __INTERNAL_PSAPI_H_INCLUDED__
22
23void *_lfind(const void* match, const void* start,unsigned int* array_size, unsigned int elem_size,int (*cf)(const void*,const void*));
24
25static inline struct _TEB * NtCurrentTeb(void)
26{
27 struct _TEB * pTeb;
28
29 /* FIXME: instead of hardcoded offsets, use offsetof() - if possible */
30 __asm__ __volatile__
31 (
32 "movl %%fs:0x18, %0\n" /* fs:18h == Teb->Tib.Self */
33 : "=r" (pTeb) /* can't have two memory operands */
34 : /* no inputs */
35 );
36
37 return pTeb;
38}
39
40typedef struct tagFOO
41{
45
46/* INCLUDES */
47#define NTOS_MODE_USER
48#include <ntos.h>
49
50/* OBJECTS */
51typedef struct
52{
53 LPSTR LeftVolumeName;
54 LPSTR RightVolumeName;
55 ULONG DefaultVolume;
56 ULONG Type;
58 char Key[4];
59 LPSTR PrototypeName;
60 PVOID DeferredRoutine;
61 PVOID ExclusionRoutine;
62 PVOID DispatchRoutine;
63 PVOID DevCapsRoutine;
64 PVOID HwSetVolume;
65 ULONG IoMethod;
67
68/* TYPES */
70(
71 IN PSYSTEM_PROCESSES CurrentProcess,
73);
74
76(
77 IN PSYSTEM_THREADS CurrentThread,
79);
80
82(
83 IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule,
85);
86
88(
90 IN PLDR_DATA_TABLE_ENTRY CurrentModule,
92);
93
94/* CONSTANTS */
95#define FAILED_WITH_STATUS DEFINE_DBG_MSG("%s() failed, status 0x%08X")
96
97/* PROTOTYPES */
98/* Processes and threads */
99/* enumeration */
101NTAPI
103(
104 IN PPROC_ENUM_ROUTINE ProcessCallback,
105 IN OUT PVOID ProcessCallbackContext,
107 IN OUT PVOID ThreadCallbackContext
108);
109
111NTAPI
113(
116);
117
119NTAPI
121(
124);
125
126/* capturing & walking */
128NTAPI
130(
131 OUT PSYSTEM_PROCESSES * ProcessesAndThreads
132);
133
135NTAPI
137(
138 IN PSYSTEM_PROCESSES ProcessesAndThreads,
139 IN PPROC_ENUM_ROUTINE ProcessCallback,
140 IN OUT PVOID ProcessCallbackContext,
142 IN OUT PVOID ThreadCallbackContext
143);
144
146NTAPI
148(
149 IN PSYSTEM_PROCESSES ProcessesAndThreads,
152);
153
155NTAPI
157(
158 IN PSYSTEM_PROCESSES ProcessesAndThreads,
161);
162
166(
167 IN PSYSTEM_PROCESSES ProcessesAndThreads
168);
169
173(
174 IN PSYSTEM_PROCESSES CurrentProcess
175);
176
180(
181 IN PSYSTEM_PROCESSES CurrentProcess
182);
183
187(
188 IN PSYSTEM_THREADS CurrentThread
189);
190
191/* System modules */
192/* enumeration */
194NTAPI
196(
199);
200
201/* capturing & walking */
203NTAPI
205(
206 OUT PSYSTEM_MODULE_INFORMATION * SystemModules
207);
208
210NTAPI
212(
213 IN PSYSTEM_MODULE_INFORMATION SystemModules,
216);
217
218PSYSTEM_MODULE_INFORMATION_ENTRY
221(
222 IN PSYSTEM_MODULE_INFORMATION SystemModules
223);
224
225PSYSTEM_MODULE_INFORMATION_ENTRY
228(
229 IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule
230);
231
232/* Process modules */
234NTAPI
236(
240);
241
242/* Miscellaneous */
243VOID
244NTAPI
246(
248);
249
250/* The user must define these functions. They are called by PSAPI to allocate
251 memory. This allows PSAPI to be called from any environment */
252void *PsaiMalloc(SIZE_T size);
253void *PsaiRealloc(void *ptr, SIZE_T size);
254void PsaiFree(void *ptr);
255
256/* MACROS */
257#define DEFINE_DBG_MSG(__str__) "PSAPI: " __str__ "\n"
258
259#endif /* __INTERNAL_PSAPI_H_INCLUDED__ */
260
261/* EOF */
Type
Definition: Type.h:7
LONG NTSTATUS
Definition: precomp.h:26
struct _Capture Capture
Definition: capture.h:24
@ ThreadCallback
Definition: dbghelp.h:626
#define FAR
Definition: zlib.h:34
GLuint start
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
DeviceType
Definition: mmdrv.h:42
NTSTATUS NTAPI PsaEnumerateThreads(IN PTHREAD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
Definition: processes.c:228
NTSTATUS NTAPI(* PTHREAD_ENUM_ROUTINE)(IN PSYSTEM_THREADS CurrentThread, IN OUT PVOID CallbackContext)
Definition: test.h:76
VOID NTAPI PsaFreeCapture(IN PVOID Capture)
Definition: processes.c:188
void PsaiFree(void *ptr)
Definition: ctm.c:103
PSYSTEM_THREADS FASTCALL PsaWalkNextThread(IN PSYSTEM_THREADS CurrentThread)
void * PsaiMalloc(SIZE_T size)
Definition: ctm.c:101
NTSTATUS NTAPI PsaEnumerateProcesses(IN PPROC_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
Definition: processes.c:218
NTSTATUS NTAPI PsaWalkThreads(IN PSYSTEM_PROCESSES ProcessesAndThreads, IN PTHREAD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
NTSTATUS NTAPI(* PPROCMOD_ENUM_ROUTINE)(IN HANDLE ProcessHandle, IN PLDR_DATA_TABLE_ENTRY CurrentModule, IN OUT PVOID CallbackContext)
Definition: test.h:88
struct tagFOO * LPFOO
PSYSTEM_PROCESSES FASTCALL PsaWalkNextProcess(IN PSYSTEM_PROCESSES CurrentProcess)
NTSTATUS NTAPI PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESSES *ProcessesAndThreads)
void * PsaiRealloc(void *ptr, SIZE_T size)
Definition: ctm.c:102
NTSTATUS NTAPI PsaWalkSystemModules(IN PSYSTEM_MODULE_INFORMATION SystemModules, IN PSYSMOD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
NTSTATUS NTAPI PsaWalkProcesses(IN PSYSTEM_PROCESSES ProcessesAndThreads, IN PPROC_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
struct tagFOO FOO
PSYSTEM_THREADS FASTCALL PsaWalkFirstThread(IN PSYSTEM_PROCESSES CurrentProcess)
NTSTATUS NTAPI(* PPROC_ENUM_ROUTINE)(IN PSYSTEM_PROCESSES CurrentProcess, IN OUT PVOID CallbackContext)
Definition: test.h:70
NTSTATUS NTAPI PsaEnumerateProcessesAndThreads(IN PPROC_ENUM_ROUTINE ProcessCallback, IN OUT PVOID ProcessCallbackContext, IN PTHREAD_ENUM_ROUTINE ThreadCallback, IN OUT PVOID ThreadCallbackContext)
Definition: processes.c:153
struct tagFOO * PFOO
NTSTATUS NTAPI(* PSYSMOD_ENUM_ROUTINE)(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule, IN OUT PVOID CallbackContext)
Definition: test.h:82
NTSTATUS NTAPI PsaCaptureSystemModules(OUT PSYSTEM_MODULE_INFORMATION *SystemModules)
PSYSTEM_MODULE_INFORMATION_ENTRY FASTCALL PsaWalkFirstSystemModule(IN PSYSTEM_MODULE_INFORMATION SystemModules)
NTSTATUS NTAPI PsaWalkProcessesAndThreads(IN PSYSTEM_PROCESSES ProcessesAndThreads, IN PPROC_ENUM_ROUTINE ProcessCallback, IN OUT PVOID ProcessCallbackContext, IN PTHREAD_ENUM_ROUTINE ThreadCallback, IN OUT PVOID ThreadCallbackContext)
PSYSTEM_MODULE_INFORMATION_ENTRY FASTCALL PsaWalkNextSystemModule(IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule)
NTSTATUS NTAPI PsaEnumerateSystemModules(IN PSYSMOD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
Definition: drivers.c:21
NTSTATUS NTAPI PsaEnumerateProcessModules(IN HANDLE ProcessHandle, IN PPROCMOD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
Definition: modules.c:30
void * _lfind(const void *match, const void *start, unsigned int *array_size, unsigned int elem_size, int(*cf)(const void *, const void *))
static struct _TEB * NtCurrentTeb(void)
Definition: test.h:25
PSYSTEM_PROCESSES FASTCALL PsaWalkFirstProcess(IN PSYSTEM_PROCESSES ProcessesAndThreads)
static PVOID ptr
Definition: dispmode.c:27
static UINT array_size
Definition: msctf.c:67
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
#define FASTCALL
Definition: nt_native.h:50
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
Definition: btrfs_drv.h:1876
Definition: compat.h:836
Definition: match.c:28
Definition: test.h:41
INT hinibble
Definition: test.h:43
INT lonibble
Definition: test.h:42
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR _Inout_opt_ PVOID CallbackContext
Definition: wmitypes.h:60
char * LPSTR
Definition: xmlstorage.h:182