mirror of
https://github.com/reactos/wine.git
synced 2024-11-30 07:00:30 +00:00
351 lines
7.6 KiB
C
351 lines
7.6 KiB
C
/*
|
|
* Basic types definitions
|
|
*
|
|
* Copyright 1996 Alexandre Julliard
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifndef __WINE_WINDEF_H
|
|
#define __WINE_WINDEF_H
|
|
|
|
#ifdef __WINESRC__
|
|
# undef UNICODE
|
|
#endif /* __WINESRC__ */
|
|
|
|
#ifndef WINVER
|
|
#define WINVER 0x0500
|
|
#endif
|
|
|
|
#ifndef NO_STRICT
|
|
# ifndef STRICT
|
|
# define STRICT
|
|
# endif /* STRICT */
|
|
#endif /* NO_STRICT */
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Calling conventions definitions */
|
|
|
|
#ifdef __i386__
|
|
# ifndef _X86_
|
|
# define _X86_
|
|
# endif
|
|
# if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
|
|
# define __stdcall __attribute__((__stdcall__))
|
|
# define __cdecl __attribute__((__cdecl__))
|
|
# elif defined(_MSC_VER)
|
|
/* Nothing needs to be done. __cdecl/__stdcall already exists */
|
|
# else
|
|
# error You need gcc >= 2.7 to build Wine on a 386
|
|
# endif /* __GNUC__ */
|
|
#else /* __i386__ */
|
|
# define __stdcall
|
|
# define __cdecl
|
|
#endif /* __i386__ */
|
|
|
|
#ifndef __WINESRC__
|
|
|
|
#ifndef pascal
|
|
#define pascal __stdcall
|
|
#endif
|
|
#ifndef _pascal
|
|
#define _pascal __stdcall
|
|
#endif
|
|
#ifndef _stdcall
|
|
#define _stdcall __stdcall
|
|
#endif
|
|
#ifndef _fastcall
|
|
#define _fastcall __stdcall
|
|
#endif
|
|
#ifndef __fastcall
|
|
#define __fastcall __stdcall
|
|
#endif
|
|
#ifndef __export
|
|
#define __export __stdcall
|
|
#endif
|
|
#ifndef cdecl
|
|
#define cdecl __cdecl
|
|
#endif
|
|
#ifndef _cdecl
|
|
#define _cdecl __cdecl
|
|
#endif
|
|
|
|
#ifndef near
|
|
#define near
|
|
#endif
|
|
#ifndef far
|
|
#define far
|
|
#endif
|
|
#ifndef _near
|
|
#define _near
|
|
#endif
|
|
#ifndef _far
|
|
#define _far
|
|
#endif
|
|
#ifndef NEAR
|
|
#define NEAR
|
|
#endif
|
|
#ifndef FAR
|
|
#define FAR
|
|
#endif
|
|
|
|
#ifndef _declspec
|
|
#define _declspec(x)
|
|
#endif
|
|
#ifndef __declspec
|
|
#define __declspec(x)
|
|
#endif
|
|
|
|
#endif /* __WINESRC__ */
|
|
|
|
#define CALLBACK __stdcall
|
|
#define WINAPI __stdcall
|
|
#define APIPRIVATE __stdcall
|
|
#define PASCAL __stdcall
|
|
#define CDECL __cdecl
|
|
#define _CDECL __cdecl
|
|
#define WINAPIV __cdecl
|
|
#define APIENTRY WINAPI
|
|
#define CONST const
|
|
|
|
/* Misc. constants. */
|
|
|
|
#undef NULL
|
|
#ifdef __cplusplus
|
|
#define NULL 0
|
|
#else
|
|
#define NULL ((void*)0)
|
|
#endif
|
|
|
|
#ifdef FALSE
|
|
#undef FALSE
|
|
#endif
|
|
#define FALSE 0
|
|
|
|
#ifdef TRUE
|
|
#undef TRUE
|
|
#endif
|
|
#define TRUE 1
|
|
|
|
#ifndef IN
|
|
#define IN
|
|
#endif
|
|
|
|
#ifndef OUT
|
|
#define OUT
|
|
#endif
|
|
|
|
#ifndef OPTIONAL
|
|
#define OPTIONAL
|
|
#endif
|
|
|
|
/* Standard data types */
|
|
|
|
typedef void *LPVOID;
|
|
typedef const void *LPCVOID;
|
|
typedef int BOOL, *PBOOL, *LPBOOL;
|
|
typedef unsigned char BYTE, *PBYTE, *LPBYTE;
|
|
typedef unsigned char UCHAR, *PUCHAR;
|
|
typedef unsigned short WORD, *PWORD, *LPWORD;
|
|
typedef unsigned short USHORT, *PUSHORT;
|
|
typedef int INT, *PINT, *LPINT;
|
|
typedef unsigned int UINT, *PUINT;
|
|
typedef long *LPLONG;
|
|
typedef unsigned long DWORD, *PDWORD, *LPDWORD;
|
|
typedef unsigned long ULONG, *PULONG;
|
|
typedef float FLOAT, *PFLOAT;
|
|
typedef double DOUBLE;
|
|
typedef double DATE;
|
|
|
|
#include "winnt.h"
|
|
|
|
/* Macros to map Winelib names to the correct implementation name */
|
|
/* depending on __WINESRC__ and UNICODE macros. */
|
|
/* Note that Winelib is purely Win32. */
|
|
|
|
#ifdef __WINESRC__
|
|
# define WINELIB_NAME_AW(func) \
|
|
func##_must_be_suffixed_with_W_or_A_in_this_context \
|
|
func##_must_be_suffixed_with_W_or_A_in_this_context
|
|
#else /* __WINESRC__ */
|
|
# ifdef UNICODE
|
|
# define WINELIB_NAME_AW(func) func##W
|
|
# else
|
|
# define WINELIB_NAME_AW(func) func##A
|
|
# endif /* UNICODE */
|
|
#endif /* __WINESRC__ */
|
|
|
|
#ifdef __WINESRC__
|
|
# define DECL_WINELIB_TYPE_AW(type) /* nothing */
|
|
#else /* __WINESRC__ */
|
|
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
|
|
#endif /* __WINESRC__ */
|
|
|
|
|
|
/* Polymorphic types */
|
|
|
|
typedef UINT_PTR WPARAM;
|
|
typedef LONG_PTR LPARAM;
|
|
typedef LONG_PTR LRESULT;
|
|
|
|
/* Integer types */
|
|
|
|
typedef WORD ATOM;
|
|
typedef WORD CATCHBUF[9];
|
|
typedef WORD *LPCATCHBUF;
|
|
typedef DWORD COLORREF, *LPCOLORREF;
|
|
|
|
|
|
/* Handle types */
|
|
|
|
typedef int HFILE;
|
|
DECLARE_HANDLE(HACCEL);
|
|
DECLARE_HANDLE(HBITMAP);
|
|
DECLARE_HANDLE(HBRUSH);
|
|
DECLARE_HANDLE(HCOLORSPACE);
|
|
DECLARE_HANDLE(HDC);
|
|
DECLARE_HANDLE(HDESK);
|
|
DECLARE_HANDLE(HENHMETAFILE);
|
|
DECLARE_HANDLE(HFONT);
|
|
DECLARE_HANDLE(HHOOK);
|
|
DECLARE_HANDLE(HICON);
|
|
DECLARE_HANDLE(HINSTANCE);
|
|
DECLARE_HANDLE(HKEY);
|
|
typedef HKEY *PHKEY;
|
|
DECLARE_HANDLE(HKL);
|
|
DECLARE_HANDLE(HMENU);
|
|
DECLARE_HANDLE(HMETAFILE);
|
|
DECLARE_HANDLE(HMONITOR);
|
|
DECLARE_HANDLE(HPALETTE);
|
|
DECLARE_HANDLE(HPEN);
|
|
DECLARE_HANDLE(HRGN);
|
|
DECLARE_HANDLE(HRSRC);
|
|
DECLARE_HANDLE(HTASK);
|
|
DECLARE_HANDLE(HWINEVENTHOOK);
|
|
DECLARE_HANDLE(HWINSTA);
|
|
DECLARE_HANDLE(HWND);
|
|
|
|
/* Handle types that must remain interchangeable even with strict on */
|
|
|
|
typedef HINSTANCE HMODULE;
|
|
typedef HANDLE HGDIOBJ;
|
|
typedef HANDLE HGLOBAL;
|
|
typedef HANDLE HLOCAL;
|
|
typedef HANDLE GLOBALHANDLE;
|
|
typedef HANDLE LOCALHANDLE;
|
|
typedef HICON HCURSOR;
|
|
|
|
/* Callback function pointers types */
|
|
|
|
typedef INT (CALLBACK *FARPROC)();
|
|
typedef INT (CALLBACK *PROC)();
|
|
|
|
|
|
/* Macros to split words and longs. */
|
|
|
|
#define LOBYTE(w) ((BYTE)(WORD)(w))
|
|
#define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
|
|
|
|
#define LOWORD(l) ((WORD)(DWORD)(l))
|
|
#define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
|
|
|
|
#define SLOWORD(l) ((SHORT)(LONG)(l))
|
|
#define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
|
|
|
|
#define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
|
|
#define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
|
|
#define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
|
|
#define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
|
|
#define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
|
|
|
|
#define SELECTOROF(ptr) (HIWORD(ptr))
|
|
#define OFFSETOF(ptr) (LOWORD(ptr))
|
|
|
|
/* min and max macros */
|
|
#ifndef NOMINMAX
|
|
#ifndef max
|
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
|
#endif
|
|
#ifndef min
|
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
|
#endif
|
|
#endif /* NOMINMAX */
|
|
|
|
#ifdef MAX_PATH /* Work-around for Mingw */
|
|
#undef MAX_PATH
|
|
#endif /* MAX_PATH */
|
|
|
|
#define MAX_PATH 260
|
|
#define HFILE_ERROR ((HFILE)-1)
|
|
|
|
/* The SIZE structure */
|
|
typedef struct tagSIZE
|
|
{
|
|
LONG cx;
|
|
LONG cy;
|
|
} SIZE, *PSIZE, *LPSIZE;
|
|
|
|
typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
|
|
|
|
/* The POINT structure */
|
|
typedef struct tagPOINT
|
|
{
|
|
LONG x;
|
|
LONG y;
|
|
} POINT, *PPOINT, *LPPOINT;
|
|
|
|
typedef struct _POINTL
|
|
{
|
|
LONG x;
|
|
LONG y;
|
|
} POINTL;
|
|
|
|
/* The POINTS structure */
|
|
|
|
typedef struct tagPOINTS
|
|
{
|
|
SHORT x;
|
|
SHORT y;
|
|
} POINTS, *PPOINTS, *LPPOINTS;
|
|
|
|
/* The RECT structure */
|
|
typedef struct tagRECT
|
|
{
|
|
LONG left;
|
|
LONG top;
|
|
LONG right;
|
|
LONG bottom;
|
|
} RECT, *PRECT, *LPRECT;
|
|
typedef const RECT *LPCRECT;
|
|
|
|
typedef struct tagRECTL
|
|
{
|
|
LONG left;
|
|
LONG top;
|
|
LONG right;
|
|
LONG bottom;
|
|
} RECTL, *PRECTL, *LPRECTL;
|
|
|
|
typedef const RECTL *LPCRECTL;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __WINE_WINDEF_H */
|