ReactOS  0.4.14-dev-1233-gf5658fd
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 
23 void *_lfind(const void* match, const void* start,unsigned int* array_size, unsigned int elem_size,int (*cf)(const void*,const void*));
24 
25 static 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 
40 typedef struct tagFOO
41 {
44 } FOO, *PFOO, FAR *LPFOO;
45 
46 /* INCLUDES */
47 #define NTOS_MODE_USER
48 #include <ntos.h>
49 
50 /* OBJECTS */
51 typedef 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 (
73 );
74 
76 (
77  IN PSYSTEM_THREADS CurrentThread,
79 );
80 
82 (
83  IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule,
85 );
86 
88 (
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 */
100 NTSTATUS
101 NTAPI
103 (
104  IN PPROC_ENUM_ROUTINE ProcessCallback,
105  IN OUT PVOID ProcessCallbackContext,
107  IN OUT PVOID ThreadCallbackContext
108 );
109 
110 NTSTATUS
111 NTAPI
113 (
116 );
117 
118 NTSTATUS
119 NTAPI
121 (
124 );
125 
126 /* capturing & walking */
127 NTSTATUS
128 NTAPI
130 (
131  OUT PSYSTEM_PROCESSES * ProcessesAndThreads
132 );
133 
134 NTSTATUS
135 NTAPI
137 (
138  IN PSYSTEM_PROCESSES ProcessesAndThreads,
139  IN PPROC_ENUM_ROUTINE ProcessCallback,
140  IN OUT PVOID ProcessCallbackContext,
142  IN OUT PVOID ThreadCallbackContext
143 );
144 
145 NTSTATUS
146 NTAPI
148 (
149  IN PSYSTEM_PROCESSES ProcessesAndThreads,
152 );
153 
154 NTSTATUS
155 NTAPI
157 (
158  IN PSYSTEM_PROCESSES ProcessesAndThreads,
161 );
162 
164 FASTCALL
166 (
167  IN PSYSTEM_PROCESSES ProcessesAndThreads
168 );
169 
171 FASTCALL
173 (
175 );
176 
178 FASTCALL
180 (
182 );
183 
185 FASTCALL
187 (
188  IN PSYSTEM_THREADS CurrentThread
189 );
190 
191 /* System modules */
192 /* enumeration */
193 NTSTATUS
194 NTAPI
196 (
199 );
200 
201 /* capturing & walking */
202 NTSTATUS
203 NTAPI
205 (
206  OUT PSYSTEM_MODULE_INFORMATION * SystemModules
207 );
208 
209 NTSTATUS
210 NTAPI
212 (
213  IN PSYSTEM_MODULE_INFORMATION SystemModules,
216 );
217 
218 PSYSTEM_MODULE_INFORMATION_ENTRY
219 FASTCALL
221 (
222  IN PSYSTEM_MODULE_INFORMATION SystemModules
223 );
224 
225 PSYSTEM_MODULE_INFORMATION_ENTRY
226 FASTCALL
228 (
229  IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule
230 );
231 
232 /* Process modules */
233 NTSTATUS
234 NTAPI
236 (
240 );
241 
242 /* Miscellaneous */
243 VOID
244 NTAPI
246 (
247  IN PVOID Capture
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 */
252 void *PsaiMalloc(SIZE_T size);
253 void *PsaiRealloc(void *ptr, SIZE_T size);
254 void 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 */
#define IN
Definition: typedefs.h:39
void * PsaiRealloc(void *ptr, SIZE_T size)
Definition: ctm.c:102
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR _Inout_opt_ PVOID CallbackContext
Definition: wmitypes.h:55
Type
Definition: Type.h:6
struct tagFOO FOO
Definition: match.c:28
struct tagFOO * PFOO
NTSTATUS NTAPI PsaWalkProcesses(IN PSYSTEM_PROCESSES ProcessesAndThreads, IN PPROC_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
DeviceType
Definition: mmdrv.h:41
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI PsaWalkThreads(IN PSYSTEM_PROCESSES ProcessesAndThreads, IN PTHREAD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
PSYSTEM_PROCESSES FASTCALL PsaWalkNextProcess(IN PSYSTEM_PROCESSES CurrentProcess)
INT hinibble
Definition: test.h:43
PSYSTEM_MODULE_INFORMATION_ENTRY FASTCALL PsaWalkNextSystemModule(IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule)
char * LPSTR
Definition: xmlstorage.h:182
PSYSTEM_THREADS FASTCALL PsaWalkNextThread(IN PSYSTEM_THREADS CurrentThread)
#define FASTCALL
Definition: nt_native.h:50
int32_t INT
Definition: typedefs.h:57
static UINT array_size
Definition: msctf.c:67
PSYSTEM_THREADS FASTCALL PsaWalkFirstThread(IN PSYSTEM_PROCESSES CurrentProcess)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
#define FAR
Definition: guiddef.h:36
static PVOID ptr
Definition: dispmode.c:27
void * _lfind(const void *match, const void *start, unsigned int *array_size, unsigned int elem_size, int(*cf)(const void *, const void *))
NTSTATUS NTAPI PsaEnumerateProcessModules(IN HANDLE ProcessHandle, IN PPROCMOD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
Definition: modules.c:30
NTSTATUS NTAPI PsaEnumerateProcesses(IN PPROC_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
Definition: processes.c:218
NTSTATUS NTAPI PsaCaptureSystemModules(OUT PSYSTEM_MODULE_INFORMATION *SystemModules)
PLOADER_MODULE CurrentModule
Definition: mboot.c:66
PSYSTEM_PROCESSES FASTCALL PsaWalkFirstProcess(IN PSYSTEM_PROCESSES ProcessesAndThreads)
ULONG CurrentProcess
Definition: shell.c:125
GLsizeiptr size
Definition: glext.h:5919
NTSTATUS NTAPI PsaWalkSystemModules(IN PSYSTEM_MODULE_INFORMATION SystemModules, IN PSYSMOD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
VOID NTAPI PsaFreeCapture(IN PVOID Capture)
Definition: processes.c:188
NTSTATUS NTAPI PsaCaptureProcessesAndThreads(OUT PSYSTEM_PROCESSES *ProcessesAndThreads)
NTSTATUS NTAPI PsaEnumerateThreads(IN PTHREAD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
Definition: processes.c:228
NTSTATUS NTAPI PsaEnumerateSystemModules(IN PSYSMOD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext)
Definition: drivers.c:21
Definition: btrfs_drv.h:1853
void * PsaiMalloc(SIZE_T size)
Definition: ctm.c:101
INT lonibble
Definition: test.h:42
NTSTATUS NTAPI(* PSYSMOD_ENUM_ROUTINE)(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule, IN OUT PVOID CallbackContext)
Definition: test.h:82
struct tagFOO * LPFOO
ULONG_PTR SIZE_T
Definition: typedefs.h:79
Definition: compat.h:492
Definition: test.h:40
GLuint start
Definition: gl.h:1545
PSYSTEM_MODULE_INFORMATION_ENTRY FASTCALL PsaWalkFirstSystemModule(IN PSYSTEM_MODULE_INFORMATION SystemModules)
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
NTSTATUS NTAPI(* PTHREAD_ENUM_ROUTINE)(IN PSYSTEM_THREADS CurrentThread, IN OUT PVOID CallbackContext)
Definition: test.h:76
void PsaiFree(void *ptr)
Definition: ctm.c:103
NTSTATUS NTAPI(* PPROC_ENUM_ROUTINE)(IN PSYSTEM_PROCESSES CurrentProcess, IN OUT PVOID CallbackContext)
Definition: test.h:70
#define OUT
Definition: typedefs.h:40
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)
unsigned int ULONG
Definition: retypes.h:1
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
static struct _TEB * NtCurrentTeb(void)
Definition: test.h:25
LPFNPSPCALLBACK Callback
Definition: desk.c:112
NTSTATUS NTAPI(* PPROCMOD_ENUM_ROUTINE)(IN HANDLE ProcessHandle, IN PLDR_DATA_TABLE_ENTRY CurrentModule, IN OUT PVOID CallbackContext)
Definition: test.h:88