Release 980301
[wine/hacks.git] / win32 / struct32.c
blob19b7a369e38f4a79ef132b5edc98db7d439f3c53
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 "debug.h"
13 void STRUCT32_MSG16to32(const MSG16 *msg16,MSG32 *msg32)
15 msg32->hwnd=(HWND32)msg16->hwnd;
16 msg32->message=msg16->message;
17 msg32->wParam=msg16->wParam;
18 msg32->lParam=msg16->lParam;
19 msg32->time=msg16->time;
20 msg32->pt.x=msg16->pt.x;
21 msg32->pt.y=msg16->pt.y;
24 void STRUCT32_MSG32to16(const MSG32 *msg32,MSG16 *msg16)
26 msg16->hwnd=(HWND16)msg32->hwnd;
27 msg16->message=msg32->message;
28 msg16->wParam=msg32->wParam;
29 msg16->lParam=msg32->lParam;
30 msg16->time=msg32->time;
31 msg16->pt.x=msg32->pt.x;
32 msg16->pt.y=msg32->pt.y;
35 void STRUCT32_MINMAXINFO32to16( const MINMAXINFO32 *from, MINMAXINFO16 *to )
37 CONV_POINT32TO16( &from->ptReserved, &to->ptReserved );
38 CONV_POINT32TO16( &from->ptMaxSize, &to->ptMaxSize );
39 CONV_POINT32TO16( &from->ptMaxPosition, &to->ptMaxPosition );
40 CONV_POINT32TO16( &from->ptMinTrackSize, &to->ptMinTrackSize );
41 CONV_POINT32TO16( &from->ptMaxTrackSize, &to->ptMaxTrackSize );
44 void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16 *from, MINMAXINFO32 *to )
46 CONV_POINT16TO32( &from->ptReserved, &to->ptReserved );
47 CONV_POINT16TO32( &from->ptMaxSize, &to->ptMaxSize );
48 CONV_POINT16TO32( &from->ptMaxPosition, &to->ptMaxPosition );
49 CONV_POINT16TO32( &from->ptMinTrackSize, &to->ptMinTrackSize );
50 CONV_POINT16TO32( &from->ptMaxTrackSize, &to->ptMaxTrackSize );
53 void STRUCT32_WINDOWPOS32to16( const WINDOWPOS32* from, WINDOWPOS16* to )
55 to->hwnd = (HWND16)from->hwnd;
56 to->hwndInsertAfter = (HWND16)from->hwndInsertAfter;
57 to->x = (INT16)from->x;
58 to->y = (INT16)from->y;
59 to->cx = (INT16)from->cx;
60 to->cy = (INT16)from->cy;
61 to->flags = (UINT16)from->flags;
64 void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16* from, WINDOWPOS32* to )
66 to->hwnd = (HWND32)from->hwnd;
67 to->hwndInsertAfter = (HWND32)from->hwndInsertAfter;
68 to->x = (INT32)from->x;
69 to->y = (INT32)from->y;
70 to->cx = (INT32)from->cx;
71 to->cy = (INT32)from->cy;
72 to->flags = (UINT32)from->flags;
75 void STRUCT32_NCCALCSIZE32to16Flat( const NCCALCSIZE_PARAMS32* from,
76 NCCALCSIZE_PARAMS16* to, int validRects )
78 CONV_RECT32TO16( &from->rgrc[0], &to->rgrc[0] );
79 if (validRects)
81 CONV_RECT32TO16( &from->rgrc[1], &to->rgrc[1] );
82 CONV_RECT32TO16( &from->rgrc[2], &to->rgrc[2] );
86 void STRUCT32_NCCALCSIZE16to32Flat( const NCCALCSIZE_PARAMS16* from,
87 NCCALCSIZE_PARAMS32* to, int validRects )
89 CONV_RECT16TO32( &from->rgrc[0], &to->rgrc[0] );
90 if (validRects)
92 CONV_RECT32TO16( &from->rgrc[1], &to->rgrc[1] );
93 CONV_RECT32TO16( &from->rgrc[2], &to->rgrc[2] );
97 /* The strings are not copied */
98 void STRUCT32_CREATESTRUCT32Ato16( const CREATESTRUCT32A* from,
99 CREATESTRUCT16* to )
101 to->lpCreateParams = from->lpCreateParams;
102 to->hInstance = (HINSTANCE16)from->hInstance;
103 to->hMenu = (HMENU16)from->hMenu;
104 to->hwndParent = (HWND16)from->hwndParent;
105 to->cy = (INT16)from->cy;
106 to->cx = (INT16)from->cx;
107 to->y = (INT16)from->y;
108 to->x = (INT16)from->x;
109 to->style = from->style;
110 to->dwExStyle = from->dwExStyle;
113 void STRUCT32_CREATESTRUCT16to32A( const CREATESTRUCT16* from,
114 CREATESTRUCT32A *to )
116 to->lpCreateParams = from->lpCreateParams;
117 to->hInstance = (HINSTANCE32)from->hInstance;
118 to->hMenu = (HMENU32)from->hMenu;
119 to->hwndParent = (HWND32)from->hwndParent;
120 to->cy = (INT32)from->cy;
121 to->cx = (INT32)from->cx;
122 to->y = (INT32)from->y;
123 to->x = (INT32)from->x;
124 to->style = from->style;
125 to->dwExStyle = from->dwExStyle;
128 /* The strings are not copied */
129 void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCT32A* from,
130 MDICREATESTRUCT16* to )
132 to->hOwner = (HINSTANCE16)from->hOwner;
133 to->x = (INT16)from->x;
134 to->y = (INT16)from->y;
135 to->cx = (INT16)from->cx;
136 to->cy = (INT16)from->cy;
137 to->style = from->style;
138 to->lParam = from->lParam;
141 void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16* from,
142 MDICREATESTRUCT32A *to )
144 to->hOwner = (HINSTANCE32)from->hOwner;
145 to->x = (INT32)from->x;
146 to->y = (INT32)from->y;
147 to->cx = (INT32)from->cx;
148 to->cy = (INT32)from->cy;
149 to->style = from->style;
150 to->lParam = from->lParam;