xref: /reactos/sdk/include/reactos/wine/windef16.h (revision c2c66aff)
1 /*
2  * Basic type definitions for 16 bit variations on Windows types.
3  * These types are provided mostly to insure compatibility with
4  * 16 bit windows code.
5  *
6  * Copyright (C) the Wine project
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22 
23 #ifndef __WINE_WINDEF16_H
24 #define __WINE_WINDEF16_H
25 
26 #ifndef RC_INVOKED
27 #include <stdarg.h>
28 #endif
29 #include <windef.h>
30 #include <winbase.h>
31 #ifndef _NTNDK_
32 #include <exception.h> // ROS Hack
33 #endif
34 /* Standard data types */
35 
36 typedef unsigned short  BOOL16;
37 typedef DWORD           SEGPTR;
38 
39 typedef UINT16          HANDLE16;
40 typedef HANDLE16       *LPHANDLE16;
41 
42 typedef UINT16          WPARAM16;
43 typedef INT16          *LPINT16;
44 typedef UINT16         *LPUINT16;
45 
46 typedef WORD            CATCHBUF[9];
47 typedef WORD           *LPCATCHBUF;
48 
49 #define MAKESEGPTR(seg,off) ((SEGPTR)MAKELONG(off,seg))
50 #define SELECTOROF(ptr)     (HIWORD(ptr))
51 #define OFFSETOF(ptr)       (LOWORD(ptr))
52 
53 typedef WORD *VA_LIST16;
54 
55 #define __VA_ROUNDED16(type) \
56     ((sizeof(type) + sizeof(WORD) - 1) / sizeof(WORD) * sizeof(WORD))
57 #define VA_ARG16(list,type) \
58     (((list) = (VA_LIST16)((char *)(list) + __VA_ROUNDED16(type))), \
59      *((type *)(void *)((char *)(list) - __VA_ROUNDED16(type))))
60 
61 #define HFILE_ERROR16   ((HFILE16)-1)
62 
63 #define DECLARE_HANDLE16(a) \
64 	typedef HANDLE16 a##16; \
65 	typedef a##16 *P##a##16; \
66 	typedef a##16 *NP##a##16; \
67 	typedef a##16 *LP##a##16
68 
69 DECLARE_HANDLE16(HACMDRIVERID);
70 DECLARE_HANDLE16(HACMDRIVER);
71 DECLARE_HANDLE16(HACMOBJ);
72 DECLARE_HANDLE16(HACMSTREAM);
73 DECLARE_HANDLE16(HMETAFILEPICT);
74 
75 DECLARE_HANDLE16(HACCEL);
76 DECLARE_HANDLE16(HBITMAP);
77 DECLARE_HANDLE16(HBRUSH);
78 DECLARE_HANDLE16(HCOLORSPACE);
79 DECLARE_HANDLE16(HCURSOR);
80 DECLARE_HANDLE16(HDC);
81 DECLARE_HANDLE16(HDROP);
82 DECLARE_HANDLE16(HDRVR);
83 DECLARE_HANDLE16(HDWP);
84 DECLARE_HANDLE16(HENHMETAFILE);
85 DECLARE_HANDLE16(HFILE);
86 DECLARE_HANDLE16(HFONT);
87 DECLARE_HANDLE16(HICON);
88 DECLARE_HANDLE16(HINSTANCE);
89 DECLARE_HANDLE16(HKEY);
90 DECLARE_HANDLE16(HMENU);
91 DECLARE_HANDLE16(HMETAFILE);
92 DECLARE_HANDLE16(HMIDI);
93 DECLARE_HANDLE16(HMIDIIN);
94 DECLARE_HANDLE16(HMIDIOUT);
95 DECLARE_HANDLE16(HMIDISTRM);
96 DECLARE_HANDLE16(HMIXER);
97 DECLARE_HANDLE16(HMIXEROBJ);
98 DECLARE_HANDLE16(HMMIO);
99 DECLARE_HANDLE16(HPALETTE);
100 DECLARE_HANDLE16(HPEN);
101 DECLARE_HANDLE16(HQUEUE);
102 DECLARE_HANDLE16(HRGN);
103 DECLARE_HANDLE16(HRSRC);
104 DECLARE_HANDLE16(HTASK);
105 DECLARE_HANDLE16(HWAVE);
106 DECLARE_HANDLE16(HWAVEIN);
107 DECLARE_HANDLE16(HWAVEOUT);
108 DECLARE_HANDLE16(HWINSTA);
109 DECLARE_HANDLE16(HDESK);
110 DECLARE_HANDLE16(HWND);
111 DECLARE_HANDLE16(HKL);
112 DECLARE_HANDLE16(HIC);
113 DECLARE_HANDLE16(HRASCONN);
114 #undef DECLARE_HANDLE16
115 
116 typedef HINSTANCE16 HMODULE16;
117 typedef HANDLE16 HGDIOBJ16;
118 typedef HANDLE16 HGLOBAL16;
119 typedef HANDLE16 HLOCAL16;
120 
121 #include <pshpack1.h>
122 
123 /* The SIZE structure */
124 
125 typedef struct
126 {
127     INT16  cx;
128     INT16  cy;
129 } SIZE16, *PSIZE16, *LPSIZE16;
130 
131 /* The POINT structure */
132 
133 typedef struct
134 {
135     INT16  x;
136     INT16  y;
137 } POINT16, *PPOINT16, *LPPOINT16;
138 
139 /* The RECT structure */
140 
141 typedef struct
142 {
143     INT16  left;
144     INT16  top;
145     INT16  right;
146     INT16  bottom;
147 } RECT16, *LPRECT16;
148 
149 #include <poppack.h>
150 
151 /* Callback function pointers types */
152 
153 typedef LRESULT (CALLBACK *DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
154 typedef BOOL16  (CALLBACK *DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
155 typedef INT16   (CALLBACK *EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
156 typedef LRESULT (CALLBACK *FARPROC16)();
157 typedef INT16   (CALLBACK *PROC16)();
158 typedef BOOL16  (CALLBACK *GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
159 typedef LRESULT (CALLBACK *HOOKPROC16)(INT16,WPARAM16,LPARAM);
160 typedef BOOL16  (CALLBACK *PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
161 typedef VOID    (CALLBACK *TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
162 typedef LRESULT (CALLBACK *WNDENUMPROC16)(HWND16,LPARAM);
163 typedef LRESULT (CALLBACK *WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
164 
165 #endif /* __WINE_WINDEF16_H */
166