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 |
| 5 | */ |
| 6 | |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 7 | #include "windows.h" |
| 8 | #include "winerror.h" |
| 9 | #include "struct32.h" |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 10 | #include "debug.h" |
| 11 | |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 12 | void STRUCT32_MSG16to32(const MSG16 *msg16,MSG32 *msg32) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 13 | { |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 14 | msg32->hwnd=(HWND32)msg16->hwnd; |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 15 | 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 Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 23 | void STRUCT32_MSG32to16(const MSG32 *msg32,MSG16 *msg16) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 24 | { |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 25 | msg16->hwnd=(HWND16)msg32->hwnd; |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 26 | 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 Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 34 | void STRUCT32_MINMAXINFO32to16( const MINMAXINFO32 *from, MINMAXINFO16 *to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 35 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 36 | 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 Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 41 | } |
| 42 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 43 | void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16 *from, MINMAXINFO32 *to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 44 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 45 | 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 Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 50 | } |
| 51 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 52 | void STRUCT32_WINDOWPOS32to16( const WINDOWPOS32* from, WINDOWPOS16* to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 53 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 54 | 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 Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 61 | } |
| 62 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 63 | void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16* from, WINDOWPOS32* to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 64 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 65 | 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 Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 72 | } |
| 73 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 74 | void STRUCT32_NCCALCSIZE32to16Flat( const NCCALCSIZE_PARAMS32* from, |
| 75 | NCCALCSIZE_PARAMS16* to, int validRects ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 76 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 77 | 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 Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 83 | } |
| 84 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 85 | void STRUCT32_NCCALCSIZE16to32Flat( const NCCALCSIZE_PARAMS16* from, |
| 86 | NCCALCSIZE_PARAMS32* to, int validRects ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 87 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 88 | 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 Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | /* The strings are not copied */ |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 97 | void STRUCT32_CREATESTRUCT32Ato16( const CREATESTRUCT32A* from, |
| 98 | CREATESTRUCT16* to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 99 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 100 | 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 Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 112 | void STRUCT32_CREATESTRUCT16to32A( const CREATESTRUCT16* from, |
| 113 | CREATESTRUCT32A *to ) |
Alexandre Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 114 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 115 | 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 Julliard | d2e1c1a | 1996-03-09 16:12:43 +0000 | [diff] [blame] | 125 | } |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 126 | |
| 127 | /* The strings are not copied */ |
| 128 | void 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 | |
| 140 | void 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 | |