Place "Common Files" under "Program Files" instead of root directory.
[wine] / windows / struct32.c
1 /*
2  * Win32 structure conversion functions
3  *
4  * Copyright 1996 Martin von Loewis
5  *
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.
10  *
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.
15  *
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "struct32.h"
22 #include "win.h"
23 #include "winerror.h"
24
25 void STRUCT32_MSG16to32(const MSG16 *msg16,MSG *msg32)
26 {
27         msg32->hwnd = WIN_Handle32(msg16->hwnd);
28         msg32->message=msg16->message;
29         msg32->wParam=msg16->wParam;
30         msg32->lParam=msg16->lParam;
31         msg32->time=msg16->time;
32         msg32->pt.x=msg16->pt.x;
33         msg32->pt.y=msg16->pt.y;
34 }
35
36 void STRUCT32_MSG32to16(const MSG *msg32,MSG16 *msg16)
37 {
38         msg16->hwnd = WIN_Handle16(msg32->hwnd);
39         msg16->message=msg32->message;
40         msg16->wParam=msg32->wParam;
41         msg16->lParam=msg32->lParam;
42         msg16->time=msg32->time;
43         msg16->pt.x=msg32->pt.x;
44         msg16->pt.y=msg32->pt.y;
45 }
46
47 void STRUCT32_MINMAXINFO32to16( const MINMAXINFO *from, MINMAXINFO16 *to )
48 {
49     CONV_POINT32TO16( &from->ptReserved,     &to->ptReserved );
50     CONV_POINT32TO16( &from->ptMaxSize,      &to->ptMaxSize );
51     CONV_POINT32TO16( &from->ptMaxPosition,  &to->ptMaxPosition );
52     CONV_POINT32TO16( &from->ptMinTrackSize, &to->ptMinTrackSize );
53     CONV_POINT32TO16( &from->ptMaxTrackSize, &to->ptMaxTrackSize );
54 }
55
56 void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16 *from, MINMAXINFO *to )
57 {
58     CONV_POINT16TO32( &from->ptReserved,     &to->ptReserved );
59     CONV_POINT16TO32( &from->ptMaxSize,      &to->ptMaxSize );
60     CONV_POINT16TO32( &from->ptMaxPosition,  &to->ptMaxPosition );
61     CONV_POINT16TO32( &from->ptMinTrackSize, &to->ptMinTrackSize );
62     CONV_POINT16TO32( &from->ptMaxTrackSize, &to->ptMaxTrackSize );
63 }
64
65 void STRUCT32_WINDOWPOS32to16( const WINDOWPOS* from, WINDOWPOS16* to )
66 {
67     to->hwnd            = WIN_Handle16(from->hwnd);
68     to->hwndInsertAfter = WIN_Handle16(from->hwndInsertAfter);
69     to->x               = from->x;
70     to->y               = from->y;
71     to->cx              = from->cx;
72     to->cy              = from->cy;
73     to->flags           = from->flags;
74 }
75
76 void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16* from, WINDOWPOS* to )
77 {
78     to->hwnd            = WIN_Handle32(from->hwnd);
79     to->hwndInsertAfter = (from->hwndInsertAfter == (HWND16)-1) ?
80                            HWND_TOPMOST : WIN_Handle32(from->hwndInsertAfter);
81     to->x               = from->x;
82     to->y               = from->y;
83     to->cx              = from->cx;
84     to->cy              = from->cy;
85     to->flags           = from->flags;
86 }
87
88 /* The strings are not copied */
89 void STRUCT32_CREATESTRUCT32Ato16( const CREATESTRUCTA* from,
90                                    CREATESTRUCT16* to )
91 {
92     to->lpCreateParams = from->lpCreateParams;
93     to->hInstance      = (HINSTANCE16)from->hInstance;
94     to->hMenu          = (HMENU16)from->hMenu;
95     to->hwndParent     = WIN_Handle16(from->hwndParent);
96     to->cy             = from->cy;
97     to->cx             = from->cx;
98     to->y              = from->y;
99     to->x              = from->x;
100     to->style          = from->style;
101     to->dwExStyle      = from->dwExStyle;
102 }
103
104 void STRUCT32_CREATESTRUCT16to32A( const CREATESTRUCT16* from,
105                                    CREATESTRUCTA *to )
106 {
107     to->lpCreateParams = from->lpCreateParams;
108     to->hInstance      = (HINSTANCE)from->hInstance;
109     to->hMenu          = (HMENU)from->hMenu;
110     to->hwndParent     = WIN_Handle32(from->hwndParent);
111     to->cy             = from->cy;
112     to->cx             = from->cx;
113     to->y              = from->y;
114     to->x              = from->x;
115     to->style          = from->style;
116     to->dwExStyle      = from->dwExStyle;
117 }
118
119 /* The strings are not copied */
120 void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCTA* from,
121                                       MDICREATESTRUCT16* to )
122 {
123     to->hOwner = (HINSTANCE16)from->hOwner;
124     to->x      = from->x;
125     to->y      = from->y;
126     to->cx     = from->cx;
127     to->cy     = from->cy;
128     to->style  = from->style;
129     to->lParam = from->lParam;
130 }
131
132 void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16* from,
133                                       MDICREATESTRUCTA *to )
134 {
135     to->hOwner = (HINSTANCE)from->hOwner;
136     to->x      = from->x;
137     to->y      = from->y;
138     to->cx     = from->cx;
139     to->cy     = from->cy;
140     to->style  = from->style;
141     to->lParam = from->lParam;
142 }
143