10#if !defined(UNIX) && defined(LINUX)
180#if defined(WINNT) || defined(WIN32)
181 #if defined(_WIN64) && !defined(KERNEL_64BIT)
184 typedef unsigned long ULONG;
185 typedef unsigned short USHORT;
186 typedef unsigned char UCHAR;
191 typedef DWORD *PDWORD;
192 typedef unsigned char *PBYTE;
196 typedef PVOID HANDLE;
207#if defined(WINNT) || defined(WIN32)
208 #define OS_needs_copy_from_user(fKernelMode) FALSE
209 #define COPY_FROM_USER(dst,src,n) memcpy(dst,src,n)
210 #define COPY_TO_USER(dst,src,n) memcpy(dst,src,n)
212 #define OS_needs_copy_from_user(fKernelMode) (!fKernelMode)
213 #define COPY_FROM_USER(dst,src,n) LINUX_copy_from_user(dst,src,n)
214 #define COPY_TO_USER(dst,src,n) LINUX_copy_to_user(dst,src,n)
239#define COPY_FROM_USER_OR_KERNEL(dst, src, n, fKernelMode) \
241 if (OS_needs_copy_from_user(fKernelMode)) \
242 COPY_FROM_USER(dst, src, n); \
244 memcpy(dst, src, n); \
251#define COPY_TO_USER_OR_KERNEL(dst, src, n, fKernelMode) \
253 if (OS_needs_copy_from_user(fKernelMode)) \
254 COPY_TO_USER(dst, src, n); \
256 memcpy(dst, src, n); \
271int __cdecl
KDBG(DWORD dwLevel, DWORD dwSection,
const char *format, ...);
274 #if defined(KERNEL_64BIT)
277 #define _INTSIZEOF(n) ((sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1))
279 typedef char * va_list;
280 #define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
281 #define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
282 #define va_end(ap) ( ap = (va_list)0 )
286 int __cdecl _snprintf(
char *buffer,
unsigned long Limit,
const char *format,
288 int __cdecl _vsnprintf(
char *buffer,
unsigned long Limit,
const char
289 *format, va_list Next);
292char* __cdecl
strcpy(
char *s1,
const char *s2);
297 #include <linux_wrappers.h>
298 #define memset LINUX_memset
299 #define strncmp LINUX_strncmp
300 #define strcpy LINUX_strcpy
301 #define strcmp LINUX_strcmp
302 #define strncpy LINUX_strncpy
303 #define strcat LINUX_strcat
304 #define strncat LINUX_strncat
305 #define strlen LINUX_strlen
306 #define memcpy LINUX_memcpy
307 #define memcmp LINUX_memcmp
308 #define sprintf LINUX_sprintf
309 #define vsprintf LINUX_vsprintf
310 #define snprintf LINUX_snprintf
311 #define vsnprintf LINUX_vsnprintf
314 #if defined(KERNEL_64BIT)
315 typedef unsigned __int64 size_t;
317 typedef unsigned int size_t;
320 void* __cdecl memcpy(
void *dest,
const void *src,
size_t count);
321 void* __cdecl memset(
void *dest,
int c,
size_t count);
322#if !defined(_STRNCPY)
323 char* _strncpy(
char* s1,
const char* s2,
size_t limit);
325 #define snprintf _snprintf
326 #define vsnprintf _vsnprintf
327 #define strncpy _strncpy
int kp_interlocked_decrement(KP_INTERLOCKED *target)
Decrements the value of a Kernel PlugIn interlocked counter by one.
int kp_interlocked_add(KP_INTERLOCKED *target, int val)
Adds a specified value to the current value of a Kernel PlugIn interlocked counter.
void kp_interlocked_set(KP_INTERLOCKED *target, int val)
Sets the value of a Kernel PlugIn interlocked counter to the specified value.
void kp_spinlock_uninit(KP_SPINLOCK *spinlock)
Uninitializes a Kernel PlugIn spinlock object.
void *__cdecl malloc(unsigned long size)
struct _KP_SPINLOCK KP_SPINLOCK
Kernel PlugIn spinlock object structure.
int kp_interlocked_increment(KP_INTERLOCKED *target)
Increments the value of a Kernel PlugIn interlocked counter by one.
volatile int KP_INTERLOCKED
a Kernel PlugIn interlocked operations counter
KP_SPINLOCK * kp_spinlock_init(void)
Initializes a new Kernel PlugIn spinlock object.
int __cdecl KDBG(DWORD dwLevel, DWORD dwSection, const char *format,...)
void kp_interlocked_uninit(KP_INTERLOCKED *target)
Uninitializes a Kernel PlugIn interlocked counter.
void kp_interlocked_init(KP_INTERLOCKED *target)
Initializes a Kernel PlugIn interlocked counter.
void __cdecl free(void *buf)
char *__cdecl strcpy(char *s1, const char *s2)
int kp_interlocked_exchange(KP_INTERLOCKED *target, int val)
Sets the value of a Kernel PlugIn interlocked counter to the specified value and returns the previous...
int kp_interlocked_read(KP_INTERLOCKED *target)
Reads to the value of a Kernel PlugIn interlocked counter.
void kp_spinlock_wait(KP_SPINLOCK *spinlock)
Waits on a Kernel PlugIn spinlock object.
void kp_spinlock_release(KP_SPINLOCK *spinlock)
Releases a Kernel PlugIn spinlock object.