📄 sysenv.h
字号:
#define NEW new#endif#if ( ((OS_DEPENDENT == 0) || \ ( (OS_ONE_OF(OS_WIN_NT4 | OS_WIN_WDM | OS_LINUX)) ) ) && (UK_MODE == UK_KERNEL) && \ defined(__cplusplus) )#if (OS_DEPENDENT == 0) || (OS_ONE_OF(OS_WIN_NT4 | OS_LINUX))static __inline int abs( int a ) { return ( ( a < 0 ) ? -( a ) : ( a ) ); }#endif#endif#ifndef OK#define OK 0#endif#ifndef TRUE#define TRUE 1#define FALSE 0#if (PROJECT != PRJ_AMD64_WIN_R3 )typedef int BOOL;#endiftypedef int *PBOOL; /* On NT or WDM we allways need the typedef of PBOOL */#elif ( OS_ONE_OF(OS_WIN_NT4 | OS_WIN_WDM) )typedef int BOOL; /* On NT or WDM we allways need the typedef of BOOL */typedef int *PBOOL; /* On NT or WDM we allways need the typedef of PBOOL */#endif#if ( OS_TYPE == OS_LINUX ) || ((PROJECT != PRJ_HSF) && (PROJECT != PRJ_AMD64_WIN_R3))/* This definition was added for the Nile. It seems to be very problematic, since DDK & VisualC define BOOLEAN as unsigned char and BOOL as int, so they can't match each other. Must check it again!!!! */#define BOOLEAN BOOL#endif#ifndef NULL#ifdef __cplusplus#define NULL 0#else#define NULL ((void *) 0)#endif#endif #if ((0==OS_DEPENDENT) || (OS_TYPE != OS_WIN_WDM)) && (PROJECT != PRJ_SANSIRO)#if (CPU_TYPE!=CPU_AMD64)typedef unsigned long ULONG_PTR;typedef long LONG_PTR;#ifndef _SIZE_Ttypedef unsigned int size_t;#define _SIZE_T#endif#elsetypedef unsigned long ULONG_PTR;typedef long LONG_PTR;#ifndef _SIZE_Ttypedef unsigned long size_t;#define _SIZE_T#endif#endif /*!CPU_AMD64*/#endif /* ((0==OS_DEPENDENT) || (OS_TYPE != OS_WIN_WDM)) */ /* the following types are defined only for backwards compatibility and *//* should not be used by new code - *//* DWORD, PDWORD, ULONG, PULONG, BYTE, PBYTE, UCHAR, PUCHAR, WORD, PWORD, *//* USHORT, PUSHORT, etc. */#if ((DEV_TOOL != DT_VTOOLSD) || (OS_DEPENDENT == 0)) && (OS_TYPE != OS_VXWORKS)#if (OS_DEPENDENT == 1) && (OS_ONE_OF(OS_WIN_NT4 | OS_WIN_WDM))#include <windef.h>#else /*(OS_DEPENDENT == 1) && (OS_ONE_OF(OS_WIN_NT4 | OS_WIN_WDM)) */ typedef unsigned int DWORD, *PDWORD;typedef unsigned long ULONG, *PULONG;typedef unsigned long long ULONGLONG, *PULONGLONG;typedef unsigned char BYTE, *PBYTE;typedef unsigned char UCHAR, *PUCHAR;typedef unsigned short WORD, *PWORD;typedef unsigned short USHORT, *PUSHORT;typedef unsigned int UINT, *PUINT;typedef int INT, *PINT;typedef long LONG, *PLONG;typedef long long LONGLONG, *PLONGLONG;typedef char CHAR, *PCHAR, **PPCHAR;typedef LONG NTSTATUS;#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)#define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L)#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)typedef size_t SIZE_T;#endif /*(OS_DEPENDENT == 1) && (OS_ONE_OF(OS_WIN_NT4 | OS_WIN_WDM)) */#endif /* ((DEV_TOOL != DT_VTOOLSD) || (OS_DEPENDENT == 0)) */#if (OS_TYPE == OS_VXWORKS) typedef unsigned long DWORD, *PDWORD;typedef unsigned short WORD, *PWORD;typedef char CHAR, *PCHAR, **PPCHAR;typedef unsigned char BYTE, *PBYTE;typedef int INT, *PINT;typedef long LONG, *PLONG;#define SIG_CHECK(x)#if (OS_DEPENDENT == 0)typedef unsigned int UINT, *PUINT;#endif#endif /** OS_VXWORKS **/#if ( COMP_ONE_OF(CMP_DJGPP | CMP_GCC | CMP_XCC) )#define __int64 long long#define _cdecl#define __cdecl#define _stdcall#define __stdcall#define _fastcall#define __fastcall#if ( OS_TYPE == OS_LINUX ) && defined(__i386__)#define __shimcall__ __attribute__((regparm(0)))#define __kernelcall__#define __kernelcallregparm__ __attribute__((regparm(3)))#define __kernelcallstkparm__ __attribute__((regparm(0)))#else#define __shimcall__#define __kernelcall__#define __kernelcallregparm__#define __kernelcallstkparm__#endif#ifdef USE_GCC_CALLING_CONVENTION/* Usage: CDecl( int *, f( int arg1, char *arg2, etc ) ); */#define CDecl( __ret_type__, __decl__ ) \ __ret_type__ __decl__ __attribute__ ((cdecl))/* Usage: StdCall( int *, f( int arg1, char *arg2, etc ) ); */#define StdCall( __ret_type__, __decl__ ) \ __ret_type__ __decl__ __attribute__ ((stdcall))/* Usage: FastCall( int *, f( int arg1, char *arg2, etc ) ); */#define FastCall( __ret_type__, __decl__ ) \ __ret_type__ __decl__ __attribute__ ((regparm(3)))#else /* No calling conventions: *//* Usage: CDecl( int *, f( int arg1, char *arg2, etc ) ); */#define CDecl( __ret_type__, __decl__ ) __ret_type__ __decl__ /* Usage: StdCall( int *, f( int arg1, char *arg2, etc ) ); */#define StdCall( __ret_type__, __decl__ ) __ret_type__ __decl__ /* Usage: FastCall( int *, f( int arg1, char *arg2, etc ) ); */#define FastCall( __ret_type__, __decl__ ) __ret_type__ __decl__ #endif /* USE_GCC_CALLING_CONVENTION */ /* To make structures packed (with no padding), do: typedef struct PACKED_ATTRIB st_TAG { ... } st_T; */#define PACKED_ATTRIB __attribute__ ((packed)) #define Naked#define _inline __inline#define __null 0#define FARPROC#elif ( COMPILER == CMP_MSDEV )/* Usage: CDecl( int *, f( int arg1, char *arg2, etc ) ); */#define CDecl( __ret_type__, __decl__ ) __ret_type__ __cdecl __decl__/* Usage: StdCall( int *, f( int arg1, char *arg2, etc ) ); */#define StdCall( __ret_type__, __decl__ ) __ret_type__ __stdcall __decl__/* Usage: FastCall( int *, f( int arg1, char *arg2, etc ) ); */#define FastCall( __ret_type__, __decl__ ) __ret_type__ __fastcall __decl__ /* To make structures packed (with no padding), do: typedef struct PACKED_ATTRIB st_TAG { ... } st_T; */#define PACKED_ATTRIB /* Usage: Naked int *f( int arg1, char *arg2, etc ); */#define Naked __declspec( naked ) #elif ( COMPILER == CMP_BORLAND )#define PACKED_ATTRIB #elif ( COMPILER == CMP_ADS ) #define _cdecl#define __cdecl#define _stdcall#define __stdcall#define _fastcall#define __fastcall /* Usage: CDecl( int *, f( int arg1, char *arg2, etc ) ); */#define CDecl( __ret_type__, __decl__ ) __ret_type__ __decl__ /* Usage: StdCall( int *, f( int arg1, char *arg2, etc ) ); */#define StdCall( __ret_type__, __decl__ ) __ret_type__ __decl__ /* Usage: FastCall( int *, f( int arg1, char *arg2, etc ) ); */#define FastCall( __ret_type__, __decl__ ) __ret_type__ __decl__ /* To make structures packed (with no padding), do: typedef struct PACKED_ATTRIB st_TAG { ... } st_T; */#define PACKED_ATTRIB /* Usage: Naked int *f( int arg1, char *arg2, etc ); */#define Naked __declspec( naked ) #endif/* New typedefs that should be used: */#if (OS_TYPE != OS_VXWORKS) || (OS_DEPENDENT == 0)typedef unsigned short UINT16; typedef unsigned char UINT8; typedef signed short INT16; #if !((OS_TYPE == OS_WIN_WDM) && (OS_DEPENDENT == 1))typedef signed char INT8;#endif#endiftypedef unsigned short *PUINT16;typedef unsigned char *PUINT8;typedef signed short *PINT16; #if (OS_TYPE != OS_WIN_WDM)typedef signed char *PINT8;#endif#if (OS_TYPE == OS_LINUX)typedef unsigned int UINT32; typedef unsigned int *PUINT32;typedef volatile unsigned int *PVUINT32;typedef int INT32; typedef int *PINT32;typedef char * STRING;#elif ( (OS_DEPENDENT == 0) || ((OS_TYPE == OS_WIN_9X) && (UK_MODE == UK_KERNEL) ) || (OS_TYPE == OS_DOS) ) typedef unsigned long UINT32; typedef unsigned long *PUINT32;typedef volatile unsigned long *PVUINT32;typedef long INT32; typedef long *PINT32;typedef char * STRING;#endif#if ((OS_TYPE == OS_WIN_NT4) && (UK_MODE == UK_KERNEL) )typedef unsigned long UINT32;typedef unsigned long *PUINT32;typedef long INT32;typedef long *PINT32;#endif#if (OS_DEPENDENT == 1) && (OS_TYPE == OS_VXWORKS)typedef unsigned long *PUINT32;typedef long *PINT32;typedef char * STRING;#endif /** OS_VXWORKS **/#define INT64 __int64typedef enum OBJECT_INIT_STATE_TAG{ VALID_STATE = 0x1357, INITIALIZED_STATE } OBJECT_INIT_STATE_T;/* The following definitions should be used for each parameter in a *//* function's parameters list. */#if ( OS_DEPENDENT == 0 ) && !defined(IN)#define IN const#endif#define OUT#define IO#define I_O#define MODULAR /* Used only in the current module *//* The following definitions should be used with each function's definition: */#define GLOBAL#define STATIC static#define INT3#ifdef UNDEF_OS_DEPENDENT#undef OS_DEPENDENT#undef UNDEF_OS_DEPENDENT#endif #ifndef DPRINTF#define DPRINTF(x) #endif #ifndef NOASSERTS #if ( UK_MODE == UK_USER ) #include <assert.h> #ifdef ASSERT#undef ASSERT#endif#define ASSERT(x) assert(x) #else #if ( OS_TYPE == OS_LINUX )#undef ASSERT#define ASSERT(assert) \do { \ if (!(assert)) { \ UINT32 dwTime = OsGetSystemTime(); \ OsDebugPrintf ( \ "%07lu.%03lu: Assertion failure in %s() at %s:%d: \"%s\"\n", \ dwTime/1000, dwTime%1000, __FUNCTION__, __FILE__, __LINE__, # assert); \ /*OsDebugBreakpoint("");*/ \ } \} while (0); #define assert ASSERT#define osAssert ASSERT#endif /* OS_LINUX */ #endif /* UK_USER */ #endif /* NO_ASSERTS */ #if ( defined(NOASSERTS) || !defined(ASSERT) )#undef ASSERT#define ASSERT(a)#endif #if ( defined(NOASSERTS) || !defined(assert) )#undef assert#define assert(a)#endif #if ( defined(NOASSERTS) || !defined(osAssert) )#undef osAssert#define osAssert(a)#endif#endif /** USE_DDK **/#include "std_defines.h"#include "osservices.h"#endif /* __SYSENV_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -