119 lines
2.5 KiB
C
119 lines
2.5 KiB
C
#ifndef _TYPE_DEF_H_
|
|
#define _TYPE_DEF_H_
|
|
|
|
#ifdef _WIN32
|
|
#define DLLAPI __stdcall
|
|
|
|
#ifndef WIN32_LEAN_AND_MEAN
|
|
#include <wtypes.h>
|
|
#endif
|
|
|
|
typedef unsigned __int64 QWORD;
|
|
#else //!_WIN32
|
|
#include <stdint.h>
|
|
#include <errno.h>
|
|
|
|
#define DLLAPI
|
|
|
|
#define WINAPI
|
|
#define WINAPIV
|
|
#define CALLBACK
|
|
|
|
typedef uint8_t BYTE;
|
|
typedef uint16_t WORD, USHORT;
|
|
typedef uint32_t DWORD;
|
|
typedef uint64_t QWORD;
|
|
typedef uint32_t UINT, UINT_PTR;
|
|
typedef int INT;
|
|
typedef long LONG;
|
|
typedef double DOUBLE;
|
|
|
|
typedef BYTE *PBYTE, *LPBYTE;
|
|
typedef void VOID, *PVOID, *LPVOID;
|
|
|
|
#ifndef __OBJC__
|
|
typedef int BOOL;
|
|
#endif //_OBJC_
|
|
|
|
#define LOBYTE(a) (BYTE)(a)
|
|
#define HIBYTE(a) (BYTE)((a)>>8)
|
|
#define LOWORD(a) (WORD)(a)
|
|
#define HIWORD(a) (WORD)((a)>>16)
|
|
#define MAKEWORD(a,b) (WORD)(((a)&0xff)|((b)<<8))
|
|
#define MAKELONG(a,b) (DWORD)(((a)&0xffff)|((b)<<16))
|
|
|
|
#ifndef FALSE
|
|
#define FALSE 0
|
|
#define TRUE 1
|
|
#endif //FALSE
|
|
|
|
#ifndef S_OK
|
|
#define S_OK ((HRESULT)0x00000000L)
|
|
#define S_FALSE ((HRESULT)0x00000001L)
|
|
#define E_FAIL ((HRESULT)0x80004005L)
|
|
#endif //S_OK
|
|
|
|
#ifndef IN
|
|
#define IN
|
|
#define OUT
|
|
#endif //IN
|
|
|
|
#ifndef WM_USER
|
|
#define WM_USER 0x0400
|
|
#endif //WN_USER
|
|
|
|
typedef void *HANDLE;
|
|
typedef HANDLE HWND;
|
|
typedef LONG HRESULT;
|
|
|
|
#ifndef _HFILE_DEFINED
|
|
#define _HFILE_DEFINED
|
|
typedef INT HFILE;
|
|
#endif // !_HFILE_DEFINED
|
|
|
|
#ifndef _LPWORD_DEFINED
|
|
#define _LPWORD_DEFINED
|
|
typedef WORD *LPWORD;
|
|
#endif // !_LPWORD_DEFINED
|
|
|
|
#ifndef _LPDWORD_DEFINED
|
|
#define _LPDWORD_DEFINED
|
|
typedef DWORD *LPDWORD;
|
|
#endif // !_LPDWORD_DEFINED
|
|
|
|
#ifndef _WPARAM_DEFINED
|
|
#define _WPARAM_DEFINED
|
|
typedef uint32_t WPARAM;
|
|
typedef long LPARAM;
|
|
typedef long LRESULT;
|
|
#endif //_WPARAM_DEFINED
|
|
|
|
//NDK下统一用UTF8编码
|
|
typedef char CHAR;
|
|
typedef /* [string] */ CHAR *LPSTR;
|
|
typedef /* [string] */ const CHAR *LPCSTR;
|
|
|
|
typedef char WCHAR;
|
|
typedef WCHAR *LPWSTR, *PWSTR;
|
|
typedef const WCHAR *LPCWSTR, *PCWSTR;
|
|
|
|
typedef unsigned char UCHAR;
|
|
|
|
void PostMessage( HWND hWnd, int uMsg, WPARAM wParam, LPARAM lParam );
|
|
//void GetRootPath( char* path, int& size );
|
|
inline int GetLastError(){ return errno; };
|
|
#ifndef WSAGetLastError
|
|
#define WSAGetLastError GetLastError
|
|
#endif
|
|
|
|
#endif //_WIN32
|
|
|
|
#ifndef MAX
|
|
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
|
#endif
|
|
|
|
#ifndef MIN
|
|
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
|
#endif
|
|
|
|
#endif //_TYPE_DEF_H_
|