Release 960717
[wine/multimedia.git] / win32 / struct32.c
blob629a75a0ef8f1b42e08e598321883c94220bcfde
1 /*
2 * Win32 structure conversion functions
4 * Copyright 1996 Martin von Loewis
5 */
7 #include <stdio.h>
8 #include "windows.h"
9 #include "winerror.h"
10 #include "struct32.h"
11 #include "stddebug.h"
12 #include "debug.h"
14 void STRUCT32_POINT32to16(const POINT32* p32, POINT16* p16)
16 p16->x = p32->x;
17 p16->y = p32->y;
20 void STRUCT32_POINT16to32(const POINT16* p16, POINT32* p32)
22 p32->x = p16->x;
23 p32->y = p16->y;
26 void STRUCT32_SIZE16to32(const SIZE16* p16, SIZE32* p32)
29 p32->cx = p16->cx;
30 p32->cy = p16->cy;
33 void STRUCT32_MSG16to32(const MSG16 *msg16,MSG32 *msg32)
35 msg32->hwnd=(DWORD)msg16->hwnd;
36 msg32->message=msg16->message;
37 msg32->wParam=msg16->wParam;
38 msg32->lParam=msg16->lParam;
39 msg32->time=msg16->time;
40 msg32->pt.x=msg16->pt.x;
41 msg32->pt.y=msg16->pt.y;
44 void STRUCT32_MSG32to16(const MSG32 *msg32,MSG16 *msg16)
46 msg16->hwnd=(HWND)msg32->hwnd;
47 msg16->message=msg32->message;
48 msg16->wParam=msg32->wParam;
49 msg16->lParam=msg32->lParam;
50 msg16->time=msg32->time;
51 msg16->pt.x=msg32->pt.x;
52 msg16->pt.y=msg32->pt.y;
55 void STRUCT32_RECT32to16(const RECT32* r32, RECT16 *r16)
57 r16->left = r32->left;
58 r16->right = r32->right;
59 r16->top = r32->top;
60 r16->bottom = r32->bottom;
63 void STRUCT32_RECT16to32(const RECT16* r16, RECT32 *r32)
65 r32->left = r16->left;
66 r32->right = r16->right;
67 r32->top = r16->top;
68 r32->bottom = r16->bottom;
71 void STRUCT32_MINMAXINFO32to16( const MINMAXINFO32 *from, MINMAXINFO16 *to )
73 CONV_POINT32TO16( &from->ptReserved, &to->ptReserved );
74 CONV_POINT32TO16( &from->ptMaxSize, &to->ptMaxSize );
75 CONV_POINT32TO16( &from->ptMaxPosition, &to->ptMaxPosition );
76 CONV_POINT32TO16( &from->ptMinTrackSize, &to->ptMinTrackSize );
77 CONV_POINT32TO16( &from->ptMaxTrackSize, &to->ptMaxTrackSize );
80 void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16 *from, MINMAXINFO32 *to )
82 CONV_POINT16TO32( &from->ptReserved, &to->ptReserved );
83 CONV_POINT16TO32( &from->ptMaxSize, &to->ptMaxSize );
84 CONV_POINT16TO32( &from->ptMaxPosition, &to->ptMaxPosition );
85 CONV_POINT16TO32( &from->ptMinTrackSize, &to->ptMinTrackSize );
86 CONV_POINT16TO32( &from->ptMaxTrackSize, &to->ptMaxTrackSize );
89 void STRUCT32_WINDOWPOS32to16( const WINDOWPOS32* from, WINDOWPOS16* to )
91 to->hwnd = (HWND16)from->hwnd;
92 to->hwndInsertAfter = (HWND16)from->hwndInsertAfter;
93 to->x = (INT16)from->x;
94 to->y = (INT16)from->y;
95 to->cx = (INT16)from->cx;
96 to->cy = (INT16)from->cy;
97 to->flags = (UINT16)from->flags;
100 void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16* from, WINDOWPOS32* to )
102 to->hwnd = (HWND32)from->hwnd;
103 to->hwndInsertAfter = (HWND32)from->hwndInsertAfter;
104 to->x = (INT32)from->x;
105 to->y = (INT32)from->y;
106 to->cx = (INT32)from->cx;
107 to->cy = (INT32)from->cy;
108 to->flags = (UINT32)from->flags;
111 void STRUCT32_NCCALCSIZE32to16Flat( const NCCALCSIZE_PARAMS32* from,
112 NCCALCSIZE_PARAMS16* to, int validRects )
114 CONV_RECT32TO16( &from->rgrc[0], &to->rgrc[0] );
115 if (validRects)
117 CONV_RECT32TO16( &from->rgrc[1], &to->rgrc[1] );
118 CONV_RECT32TO16( &from->rgrc[2], &to->rgrc[2] );
122 void STRUCT32_NCCALCSIZE16to32Flat( const NCCALCSIZE_PARAMS16* from,
123 NCCALCSIZE_PARAMS32* to, int validRects )
125 CONV_RECT16TO32( &from->rgrc[0], &to->rgrc[0] );
126 if (validRects)
128 CONV_RECT32TO16( &from->rgrc[1], &to->rgrc[1] );
129 CONV_RECT32TO16( &from->rgrc[2], &to->rgrc[2] );
133 /* The strings are not copied */
134 void STRUCT32_CREATESTRUCT32Ato16( const CREATESTRUCT32A* from,
135 CREATESTRUCT16* to )
137 to->lpCreateParams = from->lpCreateParams;
138 to->hInstance = (HINSTANCE16)from->hInstance;
139 to->hMenu = (HMENU16)from->hMenu;
140 to->hwndParent = (HWND16)from->hwndParent;
141 to->cy = (INT16)from->cy;
142 to->cx = (INT16)from->cx;
143 to->y = (INT16)from->y;
144 to->x = (INT16)from->x;
145 to->style = from->style;
146 to->dwExStyle = from->dwExStyle;
149 void STRUCT32_CREATESTRUCT16to32A( const CREATESTRUCT16* from,
150 CREATESTRUCT32A *to )
152 to->lpCreateParams = from->lpCreateParams;
153 to->hInstance = (HINSTANCE32)from->hInstance;
154 to->hMenu = (HMENU32)from->hMenu;
155 to->hwndParent = (HWND32)from->hwndParent;
156 to->cy = (INT32)from->cy;
157 to->cx = (INT32)from->cx;
158 to->y = (INT32)from->y;
159 to->x = (INT32)from->x;
160 to->style = from->style;
161 to->dwExStyle = from->dwExStyle;
164 /* The strings are not copied */
165 void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCT32A* from,
166 MDICREATESTRUCT16* to )
168 to->hOwner = (HINSTANCE16)from->hOwner;
169 to->x = (INT16)from->x;
170 to->y = (INT16)from->y;
171 to->cx = (INT16)from->cx;
172 to->cy = (INT16)from->cy;
173 to->style = from->style;
174 to->lParam = from->lParam;
177 void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16* from,
178 MDICREATESTRUCT32A *to )
180 to->hOwner = (HINSTANCE32)from->hOwner;
181 to->x = (INT32)from->x;
182 to->y = (INT32)from->y;
183 to->cx = (INT32)from->cx;
184 to->cy = (INT32)from->cy;
185 to->style = from->style;
186 to->lParam = from->lParam;