blob: 35cc01b946913baa1f1b748d68c3c813d543111c [file] [log] [blame]
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +00001/*
2 * Win32 structure conversion functions
3 *
4 * Copyright 1996 Martin von Loewis
5 */
6
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +00007#include "windows.h"
8#include "winerror.h"
9#include "struct32.h"
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000010#include "debug.h"
11
Alexandre Julliardd90840e1996-06-11 16:02:08 +000012void STRUCT32_MSG16to32(const MSG16 *msg16,MSG32 *msg32)
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000013{
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +000014 msg32->hwnd=(HWND32)msg16->hwnd;
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000015 msg32->message=msg16->message;
16 msg32->wParam=msg16->wParam;
17 msg32->lParam=msg16->lParam;
18 msg32->time=msg16->time;
19 msg32->pt.x=msg16->pt.x;
20 msg32->pt.y=msg16->pt.y;
21}
22
Alexandre Julliardd90840e1996-06-11 16:02:08 +000023void STRUCT32_MSG32to16(const MSG32 *msg32,MSG16 *msg16)
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000024{
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +000025 msg16->hwnd=(HWND16)msg32->hwnd;
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000026 msg16->message=msg32->message;
27 msg16->wParam=msg32->wParam;
28 msg16->lParam=msg32->lParam;
29 msg16->time=msg32->time;
30 msg16->pt.x=msg32->pt.x;
31 msg16->pt.y=msg32->pt.y;
32}
33
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000034void STRUCT32_MINMAXINFO32to16( const MINMAXINFO32 *from, MINMAXINFO16 *to )
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000035{
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000036 CONV_POINT32TO16( &from->ptReserved, &to->ptReserved );
37 CONV_POINT32TO16( &from->ptMaxSize, &to->ptMaxSize );
38 CONV_POINT32TO16( &from->ptMaxPosition, &to->ptMaxPosition );
39 CONV_POINT32TO16( &from->ptMinTrackSize, &to->ptMinTrackSize );
40 CONV_POINT32TO16( &from->ptMaxTrackSize, &to->ptMaxTrackSize );
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000041}
42
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000043void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16 *from, MINMAXINFO32 *to )
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000044{
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000045 CONV_POINT16TO32( &from->ptReserved, &to->ptReserved );
46 CONV_POINT16TO32( &from->ptMaxSize, &to->ptMaxSize );
47 CONV_POINT16TO32( &from->ptMaxPosition, &to->ptMaxPosition );
48 CONV_POINT16TO32( &from->ptMinTrackSize, &to->ptMinTrackSize );
49 CONV_POINT16TO32( &from->ptMaxTrackSize, &to->ptMaxTrackSize );
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000050}
51
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000052void STRUCT32_WINDOWPOS32to16( const WINDOWPOS32* from, WINDOWPOS16* to )
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000053{
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000054 to->hwnd = (HWND16)from->hwnd;
55 to->hwndInsertAfter = (HWND16)from->hwndInsertAfter;
56 to->x = (INT16)from->x;
57 to->y = (INT16)from->y;
58 to->cx = (INT16)from->cx;
59 to->cy = (INT16)from->cy;
60 to->flags = (UINT16)from->flags;
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000061}
62
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000063void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16* from, WINDOWPOS32* to )
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000064{
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000065 to->hwnd = (HWND32)from->hwnd;
66 to->hwndInsertAfter = (HWND32)from->hwndInsertAfter;
67 to->x = (INT32)from->x;
68 to->y = (INT32)from->y;
69 to->cx = (INT32)from->cx;
70 to->cy = (INT32)from->cy;
71 to->flags = (UINT32)from->flags;
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000072}
73
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000074void STRUCT32_NCCALCSIZE32to16Flat( const NCCALCSIZE_PARAMS32* from,
75 NCCALCSIZE_PARAMS16* to, int validRects )
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000076{
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000077 CONV_RECT32TO16( &from->rgrc[0], &to->rgrc[0] );
78 if (validRects)
79 {
80 CONV_RECT32TO16( &from->rgrc[1], &to->rgrc[1] );
81 CONV_RECT32TO16( &from->rgrc[2], &to->rgrc[2] );
82 }
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000083}
84
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000085void STRUCT32_NCCALCSIZE16to32Flat( const NCCALCSIZE_PARAMS16* from,
86 NCCALCSIZE_PARAMS32* to, int validRects )
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000087{
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000088 CONV_RECT16TO32( &from->rgrc[0], &to->rgrc[0] );
89 if (validRects)
90 {
91 CONV_RECT32TO16( &from->rgrc[1], &to->rgrc[1] );
92 CONV_RECT32TO16( &from->rgrc[2], &to->rgrc[2] );
93 }
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000094}
95
96/* The strings are not copied */
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000097void STRUCT32_CREATESTRUCT32Ato16( const CREATESTRUCT32A* from,
98 CREATESTRUCT16* to )
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +000099{
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000100 to->lpCreateParams = from->lpCreateParams;
101 to->hInstance = (HINSTANCE16)from->hInstance;
102 to->hMenu = (HMENU16)from->hMenu;
103 to->hwndParent = (HWND16)from->hwndParent;
104 to->cy = (INT16)from->cy;
105 to->cx = (INT16)from->cx;
106 to->y = (INT16)from->y;
107 to->x = (INT16)from->x;
108 to->style = from->style;
109 to->dwExStyle = from->dwExStyle;
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +0000110}
111
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000112void STRUCT32_CREATESTRUCT16to32A( const CREATESTRUCT16* from,
113 CREATESTRUCT32A *to )
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +0000114{
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000115 to->lpCreateParams = from->lpCreateParams;
116 to->hInstance = (HINSTANCE32)from->hInstance;
117 to->hMenu = (HMENU32)from->hMenu;
118 to->hwndParent = (HWND32)from->hwndParent;
119 to->cy = (INT32)from->cy;
120 to->cx = (INT32)from->cx;
121 to->y = (INT32)from->y;
122 to->x = (INT32)from->x;
123 to->style = from->style;
124 to->dwExStyle = from->dwExStyle;
Alexandre Julliardd2e1c1a1996-03-09 16:12:43 +0000125}
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000126
127/* The strings are not copied */
128void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCT32A* from,
129 MDICREATESTRUCT16* to )
130{
131 to->hOwner = (HINSTANCE16)from->hOwner;
132 to->x = (INT16)from->x;
133 to->y = (INT16)from->y;
134 to->cx = (INT16)from->cx;
135 to->cy = (INT16)from->cy;
136 to->style = from->style;
137 to->lParam = from->lParam;
138}
139
140void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16* from,
141 MDICREATESTRUCT32A *to )
142{
143 to->hOwner = (HINSTANCE32)from->hOwner;
144 to->x = (INT32)from->x;
145 to->y = (INT32)from->y;
146 to->cx = (INT32)from->cx;
147 to->cy = (INT32)from->cy;
148 to->style = from->style;
149 to->lParam = from->lParam;
150}
151