Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Win32 structure conversion functions |
| 3 | * |
| 4 | * Copyright 1996 Martin von Loewis |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 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 |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 21 | #include "struct32.h" |
Alexandre Julliard | 0ca051e | 2002-10-17 16:43:42 +0000 | [diff] [blame] | 22 | #include "wownt32.h" |
Alexandre Julliard | d23a82b | 2001-09-19 20:37:04 +0000 | [diff] [blame] | 23 | #include "win.h" |
Marcus Meissner | 317af32 | 1999-02-17 13:51:06 +0000 | [diff] [blame] | 24 | #include "winerror.h" |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 25 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 26 | void STRUCT32_MSG16to32(const MSG16 *msg16,MSG *msg32) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 27 | { |
Alexandre Julliard | d23a82b | 2001-09-19 20:37:04 +0000 | [diff] [blame] | 28 | msg32->hwnd = WIN_Handle32(msg16->hwnd); |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 29 | msg32->message=msg16->message; |
| 30 | msg32->wParam=msg16->wParam; |
| 31 | msg32->lParam=msg16->lParam; |
| 32 | msg32->time=msg16->time; |
| 33 | msg32->pt.x=msg16->pt.x; |
| 34 | msg32->pt.y=msg16->pt.y; |
| 35 | } |
| 36 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 37 | void STRUCT32_MSG32to16(const MSG *msg32,MSG16 *msg16) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 38 | { |
Michael Stefaniuc | 2247af3 | 2002-09-04 19:37:01 +0000 | [diff] [blame] | 39 | msg16->hwnd = HWND_16(msg32->hwnd); |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 40 | msg16->message=msg32->message; |
| 41 | msg16->wParam=msg32->wParam; |
| 42 | msg16->lParam=msg32->lParam; |
| 43 | msg16->time=msg32->time; |
| 44 | msg16->pt.x=msg32->pt.x; |
| 45 | msg16->pt.y=msg32->pt.y; |
| 46 | } |
| 47 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 48 | void STRUCT32_MINMAXINFO32to16( const MINMAXINFO *from, MINMAXINFO16 *to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 49 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 50 | CONV_POINT32TO16( &from->ptReserved, &to->ptReserved ); |
| 51 | CONV_POINT32TO16( &from->ptMaxSize, &to->ptMaxSize ); |
| 52 | CONV_POINT32TO16( &from->ptMaxPosition, &to->ptMaxPosition ); |
| 53 | CONV_POINT32TO16( &from->ptMinTrackSize, &to->ptMinTrackSize ); |
| 54 | CONV_POINT32TO16( &from->ptMaxTrackSize, &to->ptMaxTrackSize ); |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 55 | } |
| 56 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 57 | void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16 *from, MINMAXINFO *to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 58 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 59 | CONV_POINT16TO32( &from->ptReserved, &to->ptReserved ); |
| 60 | CONV_POINT16TO32( &from->ptMaxSize, &to->ptMaxSize ); |
| 61 | CONV_POINT16TO32( &from->ptMaxPosition, &to->ptMaxPosition ); |
| 62 | CONV_POINT16TO32( &from->ptMinTrackSize, &to->ptMinTrackSize ); |
| 63 | CONV_POINT16TO32( &from->ptMaxTrackSize, &to->ptMaxTrackSize ); |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 64 | } |
| 65 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 66 | void STRUCT32_WINDOWPOS32to16( const WINDOWPOS* from, WINDOWPOS16* to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 67 | { |
Michael Stefaniuc | 2247af3 | 2002-09-04 19:37:01 +0000 | [diff] [blame] | 68 | to->hwnd = HWND_16(from->hwnd); |
| 69 | to->hwndInsertAfter = HWND_16(from->hwndInsertAfter); |
Alexandre Julliard | d23a82b | 2001-09-19 20:37:04 +0000 | [diff] [blame] | 70 | to->x = from->x; |
| 71 | to->y = from->y; |
| 72 | to->cx = from->cx; |
| 73 | to->cy = from->cy; |
| 74 | to->flags = from->flags; |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 75 | } |
| 76 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 77 | void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16* from, WINDOWPOS* to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 78 | { |
Alexandre Julliard | d23a82b | 2001-09-19 20:37:04 +0000 | [diff] [blame] | 79 | to->hwnd = WIN_Handle32(from->hwnd); |
| 80 | to->hwndInsertAfter = (from->hwndInsertAfter == (HWND16)-1) ? |
| 81 | HWND_TOPMOST : WIN_Handle32(from->hwndInsertAfter); |
| 82 | to->x = from->x; |
| 83 | to->y = from->y; |
| 84 | to->cx = from->cx; |
| 85 | to->cy = from->cy; |
| 86 | to->flags = from->flags; |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 87 | } |
| 88 | |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 89 | /* The strings are not copied */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 90 | void STRUCT32_CREATESTRUCT32Ato16( const CREATESTRUCTA* from, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 91 | CREATESTRUCT16* to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 92 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 93 | to->lpCreateParams = from->lpCreateParams; |
Alexandre Julliard | a8a422f | 2002-11-22 20:43:01 +0000 | [diff] [blame] | 94 | to->hInstance = HINSTANCE_16(from->hInstance); |
| 95 | to->hMenu = HMENU_16(from->hMenu); |
Michael Stefaniuc | 2247af3 | 2002-09-04 19:37:01 +0000 | [diff] [blame] | 96 | to->hwndParent = HWND_16(from->hwndParent); |
Alexandre Julliard | d23a82b | 2001-09-19 20:37:04 +0000 | [diff] [blame] | 97 | to->cy = from->cy; |
| 98 | to->cx = from->cx; |
| 99 | to->y = from->y; |
| 100 | to->x = from->x; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 101 | to->style = from->style; |
| 102 | to->dwExStyle = from->dwExStyle; |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 103 | } |
| 104 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 105 | void STRUCT32_CREATESTRUCT16to32A( const CREATESTRUCT16* from, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 106 | CREATESTRUCTA *to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 107 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 108 | to->lpCreateParams = from->lpCreateParams; |
Alexandre Julliard | a8a422f | 2002-11-22 20:43:01 +0000 | [diff] [blame] | 109 | to->hInstance = HINSTANCE_32(from->hInstance); |
| 110 | to->hMenu = HMENU_32(from->hMenu); |
Alexandre Julliard | d23a82b | 2001-09-19 20:37:04 +0000 | [diff] [blame] | 111 | to->hwndParent = WIN_Handle32(from->hwndParent); |
| 112 | to->cy = from->cy; |
| 113 | to->cx = from->cx; |
| 114 | to->y = from->y; |
| 115 | to->x = from->x; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 116 | to->style = from->style; |
| 117 | to->dwExStyle = from->dwExStyle; |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 118 | } |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 119 | |
| 120 | /* The strings are not copied */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 121 | void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCTA* from, |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 122 | MDICREATESTRUCT16* to ) |
| 123 | { |
Alexandre Julliard | a8a422f | 2002-11-22 20:43:01 +0000 | [diff] [blame] | 124 | to->hOwner = HINSTANCE_16(from->hOwner); |
Alexandre Julliard | d23a82b | 2001-09-19 20:37:04 +0000 | [diff] [blame] | 125 | to->x = from->x; |
| 126 | to->y = from->y; |
| 127 | to->cx = from->cx; |
| 128 | to->cy = from->cy; |
| 129 | to->style = from->style; |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 130 | to->lParam = from->lParam; |
| 131 | } |
| 132 | |
| 133 | void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16* from, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 134 | MDICREATESTRUCTA *to ) |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 135 | { |
Alexandre Julliard | a8a422f | 2002-11-22 20:43:01 +0000 | [diff] [blame] | 136 | to->hOwner = HINSTANCE_32(from->hOwner); |
Alexandre Julliard | d23a82b | 2001-09-19 20:37:04 +0000 | [diff] [blame] | 137 | to->x = from->x; |
| 138 | to->y = from->y; |
| 139 | to->cx = from->cx; |
| 140 | to->cy = from->cy; |
| 141 | to->style = from->style; |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 142 | to->lParam = from->lParam; |
| 143 | } |
| 144 | |