ReactOS 0.4.15-dev-7918-g2a2556c
compat.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define assert(x)
 
#define offsetof(x, y)   FIELD_OFFSET(x,y)
 
#define nil   (0)
 
#define nelem(arr)   (sizeof((arr)[0]) / sizeof((arr)))
 
#define werrstr(str, ...)   DPRINT(str "\n" ,##__VA_ARGS__)
 
#define malloc(x)   RosSymAllocMem(x)
 
#define mallocz(x, y)   RosSymAllocMemZero(x,y)
 
#define free(x)   xfree(x)
 
#define USED(x)   (*((char *)&(x)) ^= 0)
 
#define memset(x, y, z)   RtlZeroMemory(x,z)
 

Typedefs

typedef signed char schar
 
typedef unsigned char uchar
 
typedef unsigned int uint
 
typedef unsigned long ulong
 
typedef unsigned long long uvlong
 
typedef unsigned short u16int
 
typedef short s16int
 
typedef unsigned int u32int
 
typedef int s32int
 
typedef unsigned long long u64int
 
typedef long long s64int
 
typedef ulong size_t
 

Functions

DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus (IN NTSTATUS Status)
 
int readn (void *fd, char *buf, ulong len)
 
int seek (void *fd, ulong off, int mode)
 
voidRosSymAllocMemZero (ulong num, ulong size)
 
voidRosSymRealloc (void *mem, ulong newsize)
 
void xfree (void *v)
 

Macro Definition Documentation

◆ assert

#define assert (   x)
Value:
do { \
if (!(x)) { \
werrstr("(%s:%d) assertion " #x " failed\n", __FILE__, __LINE__); \
RtlRaiseStatus(STATUS_ASSERTION_FAILURE); \
} \
} while (0)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define STATUS_ASSERTION_FAILURE
Definition: ntstatus.h:960

Definition at line 29 of file compat.h.

◆ free

#define free (   x)    xfree(x)

Definition at line 58 of file compat.h.

◆ malloc

#define malloc (   x)    RosSymAllocMem(x)

Definition at line 56 of file compat.h.

◆ mallocz

#define mallocz (   x,
  y 
)    RosSymAllocMemZero(x,y)

Definition at line 57 of file compat.h.

◆ memset

#define memset (   x,
  y,
  z 
)    RtlZeroMemory(x,z)

Definition at line 60 of file compat.h.

◆ nelem

#define nelem (   arr)    (sizeof((arr)[0]) / sizeof((arr)))

Definition at line 38 of file compat.h.

◆ nil

#define nil   (0)

Definition at line 36 of file compat.h.

◆ offsetof

#define offsetof (   x,
  y 
)    FIELD_OFFSET(x,y)

Definition at line 35 of file compat.h.

◆ USED

#define USED (   x)    (*((char *)&(x)) ^= 0)

Definition at line 59 of file compat.h.

◆ werrstr

#define werrstr (   str,
  ... 
)    DPRINT(str "\n" ,##__VA_ARGS__)

Definition at line 47 of file compat.h.

Typedef Documentation

◆ s16int

typedef short s16int

Definition at line 12 of file compat.h.

◆ s32int

typedef int s32int

Definition at line 14 of file compat.h.

◆ s64int

typedef long long s64int

Definition at line 16 of file compat.h.

◆ schar

typedef signed char schar

Definition at line 5 of file compat.h.

◆ size_t

typedef ulong size_t

Definition at line 19 of file compat.h.

◆ u16int

Definition at line 11 of file compat.h.

◆ u32int

typedef unsigned int u32int

Definition at line 13 of file compat.h.

◆ u64int

Definition at line 15 of file compat.h.

◆ uchar

typedef unsigned char uchar

Definition at line 6 of file compat.h.

◆ uint

typedef unsigned int uint

Definition at line 7 of file compat.h.

◆ ulong

typedef unsigned long ulong

Definition at line 8 of file compat.h.

◆ uvlong

Definition at line 9 of file compat.h.

Function Documentation

◆ readn()

int readn ( void fd,
char buf,
ulong  len 
)

Definition at line 47 of file pe.c.

47 {
48 return RosSymReadFile(filectx, buffer, size);
49}
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
#define RosSymReadFile(FileContext, Buffer, Size)
Definition: rossympriv.h:16

Referenced by readblock().

◆ RosSymAllocMemZero()

void * RosSymAllocMemZero ( ulong  num,
ulong  size 
)

Definition at line 97 of file pe.c.

97 {
98 void *res = RosSymAllocMem(size * count);
99 if (res) memset(res, 0, size * count);
100 return res;
101}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint res
Definition: glext.h:9613
#define RosSymAllocMem(Size)
Definition: rossympriv.h:14
#define memset(x, y, z)
Definition: compat.h:39

◆ RosSymRealloc()

void * RosSymRealloc ( void mem,
ulong  newsize 
)

◆ RtlRaiseStatus()

DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus ( IN NTSTATUS  Status)

Definition at line 85 of file exception.c.

86{
87 EXCEPTION_RECORD ExceptionRecord;
89
90 /* Capture the context */
92
93 /* Create an exception record */
94 ExceptionRecord.ExceptionAddress = _ReturnAddress();
95 ExceptionRecord.ExceptionCode = Status;
96 ExceptionRecord.ExceptionRecord = NULL;
97 ExceptionRecord.NumberParameters = 0;
99
100 /* Write the context flag */
101 Context.ContextFlags = CONTEXT_FULL;
102
103 /* Check if user mode debugger is active */
105 {
106 /* Raise an exception immediately */
107 ZwRaiseException(&ExceptionRecord, &Context, TRUE);
108 }
109 else
110 {
111 /* Dispatch the exception */
112 RtlDispatchException(&ExceptionRecord, &Context);
113
114 /* Raise exception if we got here */
115 Status = ZwRaiseException(&ExceptionRecord, &Context, FALSE);
116 }
117
118 /* If we returned, raise a status */
120}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOLEAN NTAPI RtlpCheckForActiveDebugger(VOID)
Definition: libsupp.c:25
Status
Definition: gdiplustypes.h:25
#define _ReturnAddress()
Definition: intrin_arm.h:35
NTSYSAPI NTSTATUS NTAPI ZwRaiseException(_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context, _In_ BOOLEAN SearchFrames)
NTSYSAPI BOOLEAN NTAPI RtlDispatchException(_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context)
Definition: except.c:43
NTSYSAPI VOID NTAPI RtlCaptureContext(_Out_ PCONTEXT ContextRecord)
#define CONTEXT_FULL
Definition: nt_native.h:1375
VOID NTAPI RtlRaiseStatus(IN NTSTATUS Status)
Definition: exception.c:85
struct _EXCEPTION_RECORD * ExceptionRecord
Definition: compat.h:210
DWORD ExceptionCode
Definition: compat.h:208
DWORD NumberParameters
Definition: compat.h:212
DWORD ExceptionFlags
Definition: compat.h:209
PVOID ExceptionAddress
Definition: compat.h:211
#define EXCEPTION_NONCONTINUABLE
Definition: stubs.h:23

Referenced by RtlRaiseException(), and RtlRaiseStatus().

◆ seek()

int seek ( void fd,
ulong  off,
int  mode 
)

Definition at line 51 of file pe.c.

51 {
52 assert(origin == 0);
53 return RosSymSeekFile(filectx, position);
54}
#define assert(x)
Definition: debug.h:53
voidpf uLong int origin
Definition: ioapi.h:144
#define RosSymSeekFile(FileContext, Position)
Definition: rossympriv.h:17

Referenced by readblock().

◆ xfree()