dinput: Check array indexes to avoid exceeding array bounds.
[wine/multimedia.git] / include / wownt32.h
blob51b1108d1c96b8bfcd481ced6865c587947637a1
1 /*
2 * WOW Generic Thunk API
4 * Copyright (C) 1999 Ulrich Weigand
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef _WOWNT32_H_
22 #define _WOWNT32_H_
24 #ifdef __WINESRC__
25 /* under Wine use the kernel functions directly so we don't have to import wow32 */
26 #define WOWCallback16 K32WOWCallback16
27 #define WOWCallback16Ex K32WOWCallback16Ex
28 #define WOWDirectedYield16 K32WOWDirectedYield16
29 #define WOWGetVDMPointer K32WOWGetVDMPointer
30 #define WOWGetVDMPointerFix K32WOWGetVDMPointerFix
31 #define WOWGetVDMPointerUnfix K32WOWGetVDMPointerUnfix
32 #define WOWGlobalAlloc16 K32WOWGlobalAlloc16
33 #define WOWGlobalAllocLock16 K32WOWGlobalAllocLock16
34 #define WOWGlobalFree16 K32WOWGlobalFree16
35 #define WOWGlobalLock16 K32WOWGlobalLock16
36 #define WOWGlobalLockSize16 K32WOWGlobalLockSize16
37 #define WOWGlobalUnlock16 K32WOWGlobalUnlock16
38 #define WOWGlobalUnlockFree16 K32WOWGlobalUnlockFree16
39 #define WOWHandle16 K32WOWHandle16
40 #define WOWHandle32 K32WOWHandle32
41 #define WOWYield16 K32WOWYield16
42 #endif
44 LPVOID WINAPI WOWGetVDMPointer(DWORD,DWORD,BOOL);
45 LPVOID WINAPI WOWGetVDMPointerFix(DWORD,DWORD,BOOL);
46 VOID WINAPI WOWGetVDMPointerUnfix(DWORD);
48 WORD WINAPI WOWGlobalAlloc16(WORD,DWORD);
49 WORD WINAPI WOWGlobalFree16(WORD);
50 DWORD WINAPI WOWGlobalLock16(WORD);
51 BOOL WINAPI WOWGlobalUnlock16(WORD);
52 DWORD WINAPI WOWGlobalAllocLock16(WORD,DWORD,WORD *);
53 WORD WINAPI WOWGlobalUnlockFree16(DWORD);
54 DWORD WINAPI WOWGlobalLockSize16(WORD,PDWORD);
56 VOID WINAPI WOWYield16(VOID);
57 VOID WINAPI WOWDirectedYield16(WORD);
59 typedef enum
61 WOW_TYPE_HWND,
62 WOW_TYPE_HMENU,
63 WOW_TYPE_HDWP,
64 WOW_TYPE_HDROP,
65 WOW_TYPE_HDC,
66 WOW_TYPE_HFONT,
67 WOW_TYPE_HMETAFILE,
68 WOW_TYPE_HRGN,
69 WOW_TYPE_HBITMAP,
70 WOW_TYPE_HBRUSH,
71 WOW_TYPE_HPALETTE,
72 WOW_TYPE_HPEN,
73 WOW_TYPE_HACCEL,
74 WOW_TYPE_HTASK,
75 WOW_TYPE_FULLHWND
77 } WOW_HANDLE_TYPE;
79 HANDLE WINAPI WOWHandle32(WORD,WOW_HANDLE_TYPE);
80 WORD WINAPI WOWHandle16(HANDLE,WOW_HANDLE_TYPE);
82 #ifdef __WINESRC__
83 /* under Wine we use optimized versions where we can */
84 #define HWND_32(h16) ((HWND) (ULONG_PTR)(h16))
85 #define HMENU_32(h16) ((HMENU) (ULONG_PTR)(h16))
86 #define HDWP_32(h16) ((HDWP) (ULONG_PTR)(h16))
87 #define HDROP_32(h16) ((HDROP) (ULONG_PTR)(h16))
88 #define HDC_32(h16) ((HDC) (ULONG_PTR)(h16))
89 #define HFONT_32(h16) ((HFONT) (ULONG_PTR)(h16))
90 #define HRGN_32(h16) ((HRGN) (ULONG_PTR)(h16))
91 #define HBITMAP_32(h16) ((HBITMAP) (ULONG_PTR)(h16))
92 #define HBRUSH_32(h16) ((HBRUSH) (ULONG_PTR)(h16))
93 #define HPALETTE_32(h16) ((HPALETTE) (ULONG_PTR)(h16))
94 #define HPEN_32(h16) ((HPEN) (ULONG_PTR)(h16))
95 #define HACCEL_32(h16) ((HACCEL) (ULONG_PTR)(h16))
97 #define HWND_16(h32) (LOWORD(h32))
98 #define HMENU_16(h32) (LOWORD(h32))
99 #define HDWP_16(h32) (LOWORD(h32))
100 #define HDROP_16(h32) (LOWORD(h32))
101 #define HDC_16(h32) (LOWORD(h32))
102 #define HFONT_16(h32) (LOWORD(h32))
103 #define HRGN_16(h32) (LOWORD(h32))
104 #define HBITMAP_16(h32) (LOWORD(h32))
105 #define HBRUSH_16(h32) (LOWORD(h32))
106 #define HPALETTE_16(h32) (LOWORD(h32))
107 #define HPEN_16(h32) (LOWORD(h32))
108 #define HACCEL_16(h32) (LOWORD(h32))
110 #else /* __WINESRC__ */
112 #define HWND_32(h16) ((HWND) (WOWHandle32(h16, WOW_TYPE_HWND)))
113 #define HMENU_32(h16) ((HMENU) (WOWHandle32(h16, WOW_TYPE_HMENU)))
114 #define HDWP_32(h16) ((HDWP) (WOWHandle32(h16, WOW_TYPE_HDWP)))
115 #define HDROP_32(h16) ((HDROP) (WOWHandle32(h16, WOW_TYPE_HDROP)))
116 #define HDC_32(h16) ((HDC) (WOWHandle32(h16, WOW_TYPE_HDC)))
117 #define HFONT_32(h16) ((HFONT) (WOWHandle32(h16, WOW_TYPE_HFONT)))
118 #define HRGN_32(h16) ((HRGN) (WOWHandle32(h16, WOW_TYPE_HRGN)))
119 #define HBITMAP_32(h16) ((HBITMAP) (WOWHandle32(h16, WOW_TYPE_HBITMAP)))
120 #define HBRUSH_32(h16) ((HBRUSH) (WOWHandle32(h16, WOW_TYPE_HBRUSH)))
121 #define HPALETTE_32(h16) ((HPALETTE) (WOWHandle32(h16, WOW_TYPE_HPALETTE)))
122 #define HPEN_32(h16) ((HPEN) (WOWHandle32(h16, WOW_TYPE_HPEN)))
123 #define HACCEL_32(h16) ((HACCEL) (WOWHandle32(h16, WOW_TYPE_HACCEL)))
125 #define HWND_16(h32) (WOWHandle16(h32, WOW_TYPE_HWND))
126 #define HMENU_16(h32) (WOWHandle16(h32, WOW_TYPE_HMENU))
127 #define HDWP_16(h32) (WOWHandle16(h32, WOW_TYPE_HDWP))
128 #define HDROP_16(h32) (WOWHandle16(h32, WOW_TYPE_HDROP))
129 #define HDC_16(h32) (WOWHandle16(h32, WOW_TYPE_HDC))
130 #define HFONT_16(h32) (WOWHandle16(h32, WOW_TYPE_HFONT))
131 #define HRGN_16(h32) (WOWHandle16(h32, WOW_TYPE_HRGN))
132 #define HBITMAP_16(h32) (WOWHandle16(h32, WOW_TYPE_HBITMAP))
133 #define HBRUSH_16(h32) (WOWHandle16(h32, WOW_TYPE_HBRUSH))
134 #define HPALETTE_16(h32) (WOWHandle16(h32, WOW_TYPE_HPALETTE))
135 #define HPEN_16(h32) (WOWHandle16(h32, WOW_TYPE_HPEN))
136 #define HACCEL_16(h32) (WOWHandle16(h32, WOW_TYPE_HACCEL))
138 #endif /* __WINESRC__ */
140 #define HMETAFILE_32(h16) ((HMETAFILE)(WOWHandle32(h16, WOW_TYPE_HMETAFILE)))
141 #define HTASK_32(h16) ((DWORD)(WOWHandle32(h16, WOW_TYPE_HTASK)))
142 #define FULLHWND_32(h16) ((HWND)(WOWHandle32(h16, WOW_TYPE_FULLHWND)))
144 #define HMETAFILE_16(h32) (WOWHandle16(h32, WOW_TYPE_HMETAFILE))
145 #define HTASK_16(h32) (WOWHandle16((HANDLE)(h32), WOW_TYPE_HTASK))
147 #define WCB16_PASCAL 0
148 #define WCB16_CDECL 1
149 #define WCB16_MAX_CBARGS 16
151 /* Wine extensions: call register function, context ptr is passed in the return value LPDWORD */
152 #define WCB16_REGS 2
153 #define WCB16_REGS_LONG 4 /* function uses 32-bit lret */
155 DWORD WINAPI WOWCallback16(DWORD,DWORD);
156 BOOL WINAPI WOWCallback16Ex(DWORD,DWORD,DWORD,LPVOID,LPDWORD);
158 #endif /* _WOWNT32_H_ */