1214571Sdim/* windint.h -- internal header file for windres program.
2214571Sdim   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007
3214571Sdim   Free Software Foundation, Inc.
4214571Sdim   Written by Kai Tietz, Onevision.
5214571Sdim
6214571Sdim   This file is part of GNU Binutils.
7214571Sdim
8214571Sdim   This program is free software; you can redistribute it and/or modify
9214571Sdim   it under the terms of the GNU General Public License as published by
10214571Sdim   the Free Software Foundation; either version 2 of the License, or
11214571Sdim   (at your option) any later version.
12214571Sdim
13214571Sdim   This program is distributed in the hope that it will be useful,
14214571Sdim   but WITHOUT ANY WARRANTY; without even the implied warranty of
15214571Sdim   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16214571Sdim   GNU General Public License for more details.
17214571Sdim
18214571Sdim   You should have received a copy of the GNU General Public License
19214571Sdim   along with this program; if not, write to the Free Software
20214571Sdim   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21214571Sdim   02110-1301, USA.  */
22214571Sdim
23214571Sdim#include "winduni.h"
24214571Sdim
25214571Sdim#ifndef WINDINT_H
26214571Sdim#define WINDINT_H
27214571Sdim
28214571Sdim/* Use bfd_size_type to ensure a sufficient number of bits.  */
29214571Sdim#ifndef DEFINED_RC_UINT_TYPE
30214571Sdim#define DEFINED_RC_UINT_TYPE
31214571Sdimtypedef bfd_size_type rc_uint_type;
32214571Sdim#endif
33214571Sdim
34214571Sdim/* Resource directory structure.  */
35214571Sdim
36214571Sdimtypedef struct res_hdr
37214571Sdim{
38214571Sdim  rc_uint_type data_size;
39214571Sdim  rc_uint_type header_size;
40214571Sdim} res_hdr;
41214571Sdim
42214571Sdimstruct __attribute__ ((__packed__)) bin_res_hdr
43214571Sdim{
44214571Sdim  bfd_byte data_size[4];
45214571Sdim  bfd_byte header_size[4];
46214571Sdim};
47214571Sdim#define BIN_RES_HDR_SIZE 8
48214571Sdim
49214571Sdimstruct __attribute__ ((__packed__)) bin_res_id
50214571Sdim{
51214571Sdim  bfd_byte sig[2]; /* Has to be 0xffff for unnamed ids.  */
52214571Sdim  bfd_byte id[2];
53214571Sdim};
54214571Sdim#define BIN_RES_ID  4
55214571Sdim
56214571Sdim/* This structure is used when converting resource information to
57214571Sdim   binary.  */
58214571Sdim
59214571Sdimtypedef struct bindata
60214571Sdim{
61214571Sdim  /* Next data.  */
62214571Sdim  struct bindata *next;
63214571Sdim  /* Length of data.  */
64214571Sdim  rc_uint_type length;
65214571Sdim  /* Data.  */
66214571Sdim  bfd_byte *data;
67214571Sdim} bindata;
68214571Sdim
69214571Sdim/* This structure is used when converting resource information to
70214571Sdim   coff.  */
71214571Sdimtypedef struct coff_res_data
72214571Sdim{
73214571Sdim  /* Next data.  */
74214571Sdim  struct coff_res_data *next;
75214571Sdim  /* Length of data.  */
76214571Sdim  rc_uint_type length;
77214571Sdim  /* Data.  */
78214571Sdim  const struct rc_res_resource *res;
79214571Sdim} coff_res_data;
80214571Sdim
81214571Sdim/* We represent resources internally as a tree, similar to the tree
82214571Sdim   used in the .rsrc section of a COFF file.  The root is a
83214571Sdim   rc_res_directory structure.  */
84214571Sdim
85214571Sdimtypedef struct rc_res_directory
86214571Sdim{
87214571Sdim  /* Resource flags.  According to the MS docs, this is currently
88214571Sdim     always zero.  */
89214571Sdim  rc_uint_type characteristics;
90214571Sdim  /* Time/date stamp.  */
91214571Sdim  rc_uint_type time;
92214571Sdim  /* Major version number.  */
93214571Sdim  rc_uint_type major;
94214571Sdim  /* Minor version number.  */
95214571Sdim  rc_uint_type minor;
96214571Sdim  /* Directory entries.  */
97214571Sdim  struct rc_res_entry *entries;
98214571Sdim} rc_res_directory;
99214571Sdim
100214571Sdim/* A resource ID is stored in a rc_res_id structure.  */
101214571Sdim
102214571Sdimtypedef struct rc_res_id
103214571Sdim{
104214571Sdim  /* Non-zero if this entry has a name rather than an ID.  */
105214571Sdim  rc_uint_type named : 1;
106214571Sdim  union
107214571Sdim  {
108214571Sdim    /* If the named field is non-zero, this is the name.  */
109214571Sdim    struct
110214571Sdim    {
111214571Sdim      /* Length of the name.  */
112214571Sdim      rc_uint_type length;
113214571Sdim      /* Pointer to the name, which is a Unicode string.  */
114214571Sdim      unichar *name;
115214571Sdim    } n;
116214571Sdim    /* If the named field is zero, this is the ID.  */
117214571Sdim    rc_uint_type id;
118214571Sdim  } u;
119214571Sdim} rc_res_id;
120214571Sdim
121214571Sdim/* Each entry in the tree is a rc_res_entry structure.  We mix
122214571Sdim   directories and resources because in a COFF file all entries in a
123214571Sdim   directory are sorted together, whether the entries are
124214571Sdim   subdirectories or resources.  */
125214571Sdim
126214571Sdimtypedef struct rc_res_entry
127214571Sdim{
128214571Sdim  /* Next entry.  */
129214571Sdim  struct rc_res_entry *next;
130214571Sdim  /* Resource ID.  */
131214571Sdim  rc_res_id id;
132214571Sdim  /* Non-zero if this entry is a subdirectory rather than a leaf.  */
133214571Sdim  rc_uint_type subdir : 1;
134214571Sdim  union
135214571Sdim  {
136214571Sdim    /* If the subdir field is non-zero, this is a pointer to the
137214571Sdim       subdirectory.  */
138214571Sdim    rc_res_directory *dir;
139214571Sdim    /* If the subdir field is zero, this is a pointer to the resource
140214571Sdim       data.  */
141214571Sdim    struct rc_res_resource *res;
142214571Sdim  } u;
143214571Sdim} rc_res_entry;
144214571Sdim
145214571Sdim/* Types of resources.  */
146214571Sdim
147214571Sdimenum rc_res_type
148214571Sdim{
149214571Sdim  RES_TYPE_UNINITIALIZED,
150214571Sdim  RES_TYPE_ACCELERATOR,
151214571Sdim  RES_TYPE_BITMAP,
152214571Sdim  RES_TYPE_CURSOR,
153214571Sdim  RES_TYPE_GROUP_CURSOR,
154214571Sdim  RES_TYPE_DIALOG,
155214571Sdim  RES_TYPE_FONT,
156214571Sdim  RES_TYPE_FONTDIR,
157214571Sdim  RES_TYPE_ICON,
158214571Sdim  RES_TYPE_GROUP_ICON,
159214571Sdim  RES_TYPE_MENU,
160214571Sdim  RES_TYPE_MESSAGETABLE,
161214571Sdim  RES_TYPE_RCDATA,
162214571Sdim  RES_TYPE_STRINGTABLE,
163214571Sdim  RES_TYPE_USERDATA,
164214571Sdim  RES_TYPE_VERSIONINFO,
165214571Sdim  RES_TYPE_DLGINCLUDE,
166214571Sdim  RES_TYPE_PLUGPLAY,
167214571Sdim  RES_TYPE_VXD,
168214571Sdim  RES_TYPE_ANICURSOR,
169214571Sdim  RES_TYPE_ANIICON,
170214571Sdim  RES_TYPE_DLGINIT,
171214571Sdim  RES_TYPE_TOOLBAR
172214571Sdim};
173214571Sdim
174214571Sdim/* A res file and a COFF file store information differently.  The
175214571Sdim   res_info structures holds data which in a res file is stored with
176214571Sdim   each resource, but in a COFF file is stored elsewhere.  */
177214571Sdim
178214571Sdimtypedef struct rc_res_res_info
179214571Sdim{
180214571Sdim  /* Language.  In a COFF file, the third level of the directory is
181214571Sdim     keyed by the language, so the language of a resource is defined
182214571Sdim     by its location in the resource tree.  */
183214571Sdim  rc_uint_type language;
184214571Sdim  /* Characteristics of the resource.  Entirely user defined.  In a
185214571Sdim     COFF file, the rc_res_directory structure has a characteristics
186214571Sdim     field, but I don't know if it's related to the one in the res
187214571Sdim     file.  */
188214571Sdim  rc_uint_type characteristics;
189214571Sdim  /* Version of the resource.  Entirely user defined.  In a COFF file,
190214571Sdim     the rc_res_directory structure has a characteristics field, but I
191214571Sdim     don't know if it's related to the one in the res file.  */
192214571Sdim  rc_uint_type version;
193214571Sdim  /* Memory flags.  This is a combination of the MEMFLAG values
194214571Sdim     defined below.  Most of these values are historical, and are not
195214571Sdim     meaningful for win32.  I don't think there is any way to store
196214571Sdim     this information in a COFF file.  */
197214571Sdim  rc_uint_type memflags;
198214571Sdim} rc_res_res_info;
199214571Sdim
200214571Sdim/* Binary layout of rc_res_info.  */
201214571Sdim
202214571Sdimstruct __attribute__ ((__packed__)) bin_res_info
203214571Sdim{
204214571Sdim  bfd_byte version[4];
205214571Sdim  bfd_byte memflags[2];
206214571Sdim  bfd_byte language[2];
207214571Sdim  bfd_byte version2[4];
208214571Sdim  bfd_byte characteristics[4];
209214571Sdim};
210214571Sdim#define BIN_RES_INFO_SIZE 16
211214571Sdim
212214571Sdim/* Each resource in a COFF file has some information which can does
213214571Sdim   not appear in a res file.  */
214214571Sdim
215214571Sdimtypedef struct rc_res_coff_info
216214571Sdim{
217214571Sdim  /* The code page used for the data.  I don't really know what this
218214571Sdim     should be.  It has something todo with ASCII to Unicode encoding.  */
219214571Sdim  rc_uint_type codepage;
220214571Sdim  /* A resource entry in a COFF file has a reserved field, which we
221214571Sdim     record here when reading a COFF file.  When writing a COFF file,
222214571Sdim     we set this field to zero.  */
223214571Sdim  rc_uint_type reserved;
224214571Sdim} rc_res_coff_info;
225214571Sdim
226214571Sdim/* Resource data is stored in a rc_res_resource structure.  */
227214571Sdim
228214571Sdimtypedef struct rc_res_resource
229214571Sdim{
230214571Sdim  /* The type of resource.  */
231214571Sdim  enum rc_res_type type;
232214571Sdim  /* The data for the resource.  */
233214571Sdim  union
234214571Sdim  {
235214571Sdim    struct
236214571Sdim    {
237214571Sdim      rc_uint_type length;
238214571Sdim      const bfd_byte *data;
239214571Sdim    } data;
240214571Sdim    struct rc_accelerator *acc;
241214571Sdim    struct rc_cursor *cursor;
242214571Sdim    struct rc_group_cursor *group_cursor;
243214571Sdim    struct rc_dialog *dialog;
244214571Sdim    struct rc_fontdir *fontdir;
245214571Sdim    struct rc_group_icon *group_icon;
246214571Sdim    struct rc_menu *menu;
247214571Sdim    struct rc_rcdata_item *rcdata;
248214571Sdim    struct rc_stringtable *stringtable;
249214571Sdim    struct rc_rcdata_item *userdata;
250214571Sdim    struct rc_versioninfo *versioninfo;
251214571Sdim    struct rc_toolbar *toolbar;
252214571Sdim  } u;
253214571Sdim  /* Information from a res file.  */
254214571Sdim  struct rc_res_res_info res_info;
255214571Sdim  /* Information from a COFF file.  */
256214571Sdim  rc_res_coff_info coff_info;
257214571Sdim} rc_res_resource;
258214571Sdim
259214571Sdim#define SUBLANG_SHIFT 10
260214571Sdim
261214571Sdim/* Memory flags in the memflags field of a rc_res_resource.  */
262214571Sdim
263214571Sdim#define MEMFLAG_MOVEABLE	0x10
264214571Sdim#define MEMFLAG_PURE		0x20
265214571Sdim#define MEMFLAG_PRELOAD		0x40
266214571Sdim#define MEMFLAG_DISCARDABLE	0x1000
267214571Sdim
268214571Sdim/* Standard resource type codes.  These are used in the ID field of a
269214571Sdim   rc_res_entry structure.  */
270214571Sdim
271214571Sdim#define RT_CURSOR		 1
272214571Sdim#define RT_BITMAP		 2
273214571Sdim#define RT_ICON			 3
274214571Sdim#define RT_MENU			 4
275214571Sdim#define RT_DIALOG		 5
276214571Sdim#define RT_STRING		 6
277214571Sdim#define RT_FONTDIR		 7
278214571Sdim#define RT_FONT			 8
279214571Sdim#define RT_ACCELERATOR		 9
280214571Sdim#define RT_RCDATA		10
281214571Sdim#define RT_MESSAGETABLE		11
282214571Sdim#define RT_GROUP_CURSOR		12
283214571Sdim#define RT_GROUP_ICON		14
284214571Sdim#define RT_VERSION		16
285214571Sdim#define RT_DLGINCLUDE		17
286214571Sdim#define RT_PLUGPLAY		19
287214571Sdim#define RT_VXD			20
288214571Sdim#define RT_ANICURSOR		21
289214571Sdim#define RT_ANIICON		22
290214571Sdim#define RT_HTML			23
291214571Sdim#define RT_MANIFEST		24
292214571Sdim#define RT_DLGINIT		240
293214571Sdim#define RT_TOOLBAR		241
294214571Sdim
295214571Sdim/* An accelerator resource is a linked list of these structures.  */
296214571Sdim
297214571Sdimtypedef struct rc_accelerator
298214571Sdim{
299214571Sdim  /* Next accelerator.  */
300214571Sdim  struct rc_accelerator *next;
301214571Sdim  /* Flags.  A combination of the ACC values defined below.  */
302214571Sdim  rc_uint_type flags;
303214571Sdim  /* Key value.  */
304214571Sdim  rc_uint_type key;
305214571Sdim  /* Resource ID.  */
306214571Sdim  rc_uint_type id;
307214571Sdim} rc_accelerator;
308214571Sdim
309214571Sdimstruct __attribute__ ((__packed__)) bin_accelerator
310214571Sdim{
311214571Sdim  bfd_byte flags[2];
312214571Sdim  bfd_byte key[2];
313214571Sdim  bfd_byte id[2];
314214571Sdim  bfd_byte pad[2];
315214571Sdim};
316214571Sdim#define BIN_ACCELERATOR_SIZE  8
317214571Sdim
318214571Sdim/* Accelerator flags in the flags field of a rc_accelerator.
319214571Sdim   These are the same values that appear in a res file.  I hope.  */
320214571Sdim
321214571Sdim#define ACC_VIRTKEY	0x01
322214571Sdim#define ACC_NOINVERT	0x02
323214571Sdim#define ACC_SHIFT	0x04
324214571Sdim#define ACC_CONTROL	0x08
325214571Sdim#define ACC_ALT		0x10
326214571Sdim#define ACC_LAST	0x80
327214571Sdim
328214571Sdim/* A cursor resource.  */
329214571Sdim
330214571Sdimtypedef struct rc_cursor
331214571Sdim{
332214571Sdim  /* X coordinate of hotspot.  */
333214571Sdim  bfd_signed_vma xhotspot;
334214571Sdim  /* Y coordinate of hotspot.  */
335214571Sdim  bfd_signed_vma yhotspot;
336214571Sdim  /* Length of bitmap data.  */
337214571Sdim  rc_uint_type length;
338214571Sdim  /* Data.  */
339214571Sdim  const bfd_byte *data;
340214571Sdim} rc_cursor;
341214571Sdim
342214571Sdimstruct __attribute__ ((__packed__)) bin_cursor
343214571Sdim{
344214571Sdim  bfd_byte xhotspot[2];
345214571Sdim  bfd_byte yhotspot[2];
346214571Sdim};
347214571Sdim#define BIN_CURSOR_SIZE 4
348214571Sdim
349214571Sdim/* A group_cursor resource is a list of rc_i_group_cursor structures.  */
350214571Sdim
351214571Sdimtypedef struct rc_group_cursor
352214571Sdim{
353214571Sdim  /* Next cursor in group.  */
354214571Sdim  struct rc_group_cursor *next;
355214571Sdim  /* Width.  */
356214571Sdim  rc_uint_type width;
357214571Sdim  /* Height.  */
358214571Sdim  rc_uint_type height;
359214571Sdim  /* Planes.  */
360214571Sdim  rc_uint_type planes;
361214571Sdim  /* Bits per pixel.  */
362214571Sdim  rc_uint_type bits;
363214571Sdim  /* Number of bytes in cursor resource.  */
364214571Sdim  rc_uint_type bytes;
365214571Sdim  /* Index of cursor resource.  */
366214571Sdim  rc_uint_type index;
367214571Sdim} rc_group_cursor;
368214571Sdim
369214571Sdimstruct __attribute__ ((__packed__)) bin_group_cursor_item
370214571Sdim{
371214571Sdim  bfd_byte width[2];
372214571Sdim  bfd_byte height[2];
373214571Sdim  bfd_byte planes[2];
374214571Sdim  bfd_byte bits[2];
375214571Sdim  bfd_byte bytes[4];
376214571Sdim  bfd_byte index[2];
377214571Sdim};
378214571Sdim#define BIN_GROUP_CURSOR_ITEM_SIZE 14
379214571Sdim
380214571Sdimstruct __attribute__ ((__packed__)) bin_group_cursor
381214571Sdim{
382214571Sdim  bfd_byte sig1[2];
383214571Sdim  bfd_byte sig2[2];
384214571Sdim  bfd_byte nitems[2];
385214571Sdim  /* struct bin_group_cursor_item item[nitems]; */
386214571Sdim};
387214571Sdim#define BIN_GROUP_CURSOR_SIZE 6
388214571Sdim
389214571Sdim/* A dialog resource.  */
390214571Sdim
391214571Sdimtypedef struct rc_dialog
392214571Sdim{
393214571Sdim  /* Basic window style.  */
394214571Sdim  unsigned int style;
395214571Sdim  /* Extended window style.  */
396214571Sdim  rc_uint_type exstyle;
397214571Sdim  /* X coordinate.  */
398214571Sdim  rc_uint_type x;
399214571Sdim  /* Y coordinate.  */
400214571Sdim  rc_uint_type y;
401214571Sdim  /* Width.  */
402214571Sdim  rc_uint_type width;
403214571Sdim  /* Height.  */
404214571Sdim  rc_uint_type height;
405214571Sdim  /* Menu name.  */
406214571Sdim  rc_res_id menu;
407214571Sdim  /* Class name.  */
408214571Sdim  rc_res_id class;
409214571Sdim  /* Caption.  */
410214571Sdim  unichar *caption;
411214571Sdim  /* Font point size.  */
412214571Sdim  rc_uint_type pointsize;
413214571Sdim  /* Font name.  */
414214571Sdim  unichar *font;
415214571Sdim  /* Extended information for a dialogex.  */
416214571Sdim  struct rc_dialog_ex *ex;
417214571Sdim  /* Controls.  */
418214571Sdim  struct rc_dialog_control *controls;
419214571Sdim} rc_dialog;
420214571Sdim
421214571Sdimstruct __attribute__ ((__packed__)) bin_dialog
422214571Sdim{
423214571Sdim  bfd_byte style[4];
424214571Sdim  bfd_byte exstyle[4];
425214571Sdim  bfd_byte off[2];
426214571Sdim  bfd_byte x[2];
427214571Sdim  bfd_byte y[2];
428214571Sdim  bfd_byte width[2];
429214571Sdim  bfd_byte height[2];
430214571Sdim};
431214571Sdim#define BIN_DIALOG_SIZE 18
432214571Sdim
433214571Sdim/* An extended dialog has additional information.  */
434214571Sdim
435214571Sdimtypedef struct rc_dialog_ex
436214571Sdim{
437214571Sdim  /* Help ID.  */
438214571Sdim  rc_uint_type help;
439214571Sdim  /* Font weight.  */
440214571Sdim  rc_uint_type weight;
441214571Sdim  /* Whether the font is italic.  */
442214571Sdim  bfd_byte italic;
443214571Sdim  /* Character set.  */
444214571Sdim  bfd_byte charset;
445214571Sdim} rc_dialog_ex;
446214571Sdim
447214571Sdimstruct __attribute__ ((__packed__)) bin_dialogex
448214571Sdim{
449214571Sdim  bfd_byte sig1[2];
450214571Sdim  bfd_byte sig2[2];
451214571Sdim  bfd_byte help[4];
452214571Sdim  bfd_byte exstyle[4];
453214571Sdim  bfd_byte style[4];
454214571Sdim  bfd_byte off[2];
455214571Sdim  bfd_byte x[2];
456214571Sdim  bfd_byte y[2];
457214571Sdim  bfd_byte width[2];
458214571Sdim  bfd_byte height[2];
459214571Sdim};
460214571Sdim#define BIN_DIALOGEX_SIZE 26
461214571Sdim
462214571Sdimstruct __attribute__ ((__packed__)) bin_dialogfont
463214571Sdim{
464214571Sdim  bfd_byte pointsize[2];
465214571Sdim};
466214571Sdim#define BIN_DIALOGFONT_SIZE 2
467214571Sdim
468214571Sdimstruct __attribute__ ((__packed__)) bin_dialogexfont
469214571Sdim{
470214571Sdim  bfd_byte pointsize[2];
471214571Sdim  bfd_byte weight[2];
472214571Sdim  bfd_byte italic[1];
473214571Sdim  bfd_byte charset[1];
474214571Sdim};
475214571Sdim#define BIN_DIALOGEXFONT_SIZE 6
476214571Sdim
477214571Sdim/* Window style flags, from the winsup Defines.h header file.  These
478214571Sdim   can appear in the style field of a rc_dialog or a rc_dialog_control.  */
479214571Sdim
480214571Sdim#define CW_USEDEFAULT	0x80000000
481214571Sdim#define WS_BORDER	0x800000L
482214571Sdim#define WS_CAPTION	0xc00000L
483214571Sdim#define WS_CHILD	0x40000000L
484214571Sdim#define WS_CHILDWINDOW	0x40000000L
485214571Sdim#define WS_CLIPCHILDREN	0x2000000L
486214571Sdim#define WS_CLIPSIBLINGS	0x4000000L
487214571Sdim#define WS_DISABLED	0x8000000L
488214571Sdim#define WS_DLGFRAME	0x400000L
489214571Sdim#define WS_GROUP	0x20000L
490214571Sdim#define WS_HSCROLL	0x100000L
491214571Sdim#define WS_ICONIC	0x20000000L
492214571Sdim#define WS_MAXIMIZE	0x1000000L
493214571Sdim#define WS_MAXIMIZEBOX	0x10000L
494214571Sdim#define WS_MINIMIZE	0x20000000L
495214571Sdim#define WS_MINIMIZEBOX	0x20000L
496214571Sdim#define WS_OVERLAPPED	0L
497214571Sdim#define WS_OVERLAPPEDWINDOW	0xcf0000L
498214571Sdim#define WS_POPUP	0x80000000L
499214571Sdim#define WS_POPUPWINDOW	0x80880000L
500214571Sdim#define WS_SIZEBOX	0x40000L
501214571Sdim#define WS_SYSMENU	0x80000L
502214571Sdim#define WS_TABSTOP	0x10000L
503214571Sdim#define WS_THICKFRAME	0x40000L
504214571Sdim#define WS_TILED	0L
505214571Sdim#define WS_TILEDWINDOW	0xcf0000L
506214571Sdim#define WS_VISIBLE	0x10000000L
507214571Sdim#define WS_VSCROLL	0x200000L
508214571Sdim#define MDIS_ALLCHILDSTYLES	0x1
509214571Sdim#define BS_3STATE	0x5L
510214571Sdim#define BS_AUTO3STATE	0x6L
511214571Sdim#define BS_AUTOCHECKBOX	0x3L
512214571Sdim#define BS_AUTORADIOBUTTON	0x9L
513214571Sdim#define BS_BITMAP	0x80L
514214571Sdim#define BS_BOTTOM	0x800L
515214571Sdim#define BS_CENTER	0x300L
516214571Sdim#define BS_CHECKBOX	0x2L
517214571Sdim#define BS_DEFPUSHBUTTON	0x1L
518214571Sdim#define BS_GROUPBOX	0x7L
519214571Sdim#define BS_ICON		0x40L
520214571Sdim#define BS_LEFT		0x100L
521214571Sdim#define BS_LEFTTEXT	0x20L
522214571Sdim#define BS_MULTILINE	0x2000L
523214571Sdim#define BS_NOTIFY	0x4000L
524214571Sdim#define BS_OWNERDRAW	0xbL
525214571Sdim#define BS_PUSHBOX	0xcL		/* FIXME!  What should this be?  */
526214571Sdim#define BS_PUSHBUTTON	0L
527214571Sdim#define BS_PUSHLIKE	0x1000L
528214571Sdim#define BS_RADIOBUTTON	0x4L
529214571Sdim#define BS_RIGHT	0x200L
530214571Sdim#define BS_RIGHTBUTTON	0x20L
531214571Sdim#define BS_TEXT		0L
532214571Sdim#define BS_TOP		0x400L
533214571Sdim#define BS_USERBUTTON	0x8L
534214571Sdim#define BS_VCENTER	0xc00L
535214571Sdim#define CBS_AUTOHSCROLL	0x40L
536214571Sdim#define CBS_DISABLENOSCROLL	0x800L
537214571Sdim#define CBS_DROPDOWN	0x2L
538214571Sdim#define CBS_DROPDOWNLIST	0x3L
539214571Sdim#define CBS_HASSTRINGS	0x200L
540214571Sdim#define CBS_LOWERCASE	0x4000L
541214571Sdim#define CBS_NOINTEGRALHEIGHT	0x400L
542214571Sdim#define CBS_OEMCONVERT	0x80L
543214571Sdim#define CBS_OWNERDRAWFIXED	0x10L
544214571Sdim#define CBS_OWNERDRAWVARIABLE	0x20L
545214571Sdim#define CBS_SIMPLE	0x1L
546214571Sdim#define CBS_SORT	0x100L
547214571Sdim#define CBS_UPPERCASE	0x2000L
548214571Sdim#define ES_AUTOHSCROLL	0x80L
549214571Sdim#define ES_AUTOVSCROLL	0x40L
550214571Sdim#define ES_CENTER	0x1L
551214571Sdim#define ES_LEFT		0L
552214571Sdim#define ES_LOWERCASE	0x10L
553214571Sdim#define ES_MULTILINE	0x4L
554214571Sdim#define ES_NOHIDESEL	0x100L
555214571Sdim#define ES_NUMBER	0x2000L
556214571Sdim#define ES_OEMCONVERT	0x400L
557214571Sdim#define ES_PASSWORD	0x20L
558214571Sdim#define ES_READONLY	0x800L
559214571Sdim#define ES_RIGHT	0x2L
560214571Sdim#define ES_UPPERCASE	0x8L
561214571Sdim#define ES_WANTRETURN	0x1000L
562214571Sdim#define LBS_DISABLENOSCROLL	0x1000L
563214571Sdim#define LBS_EXTENDEDSEL	0x800L
564214571Sdim#define LBS_HASSTRINGS	0x40L
565214571Sdim#define LBS_MULTICOLUMN	0x200L
566214571Sdim#define LBS_MULTIPLESEL	0x8L
567214571Sdim#define LBS_NODATA	0x2000L
568214571Sdim#define LBS_NOINTEGRALHEIGHT	0x100L
569214571Sdim#define LBS_NOREDRAW	0x4L
570214571Sdim#define LBS_NOSEL	0x4000L
571214571Sdim#define LBS_NOTIFY	0x1L
572214571Sdim#define LBS_OWNERDRAWFIXED	0x10L
573214571Sdim#define LBS_OWNERDRAWVARIABLE	0x20L
574214571Sdim#define LBS_SORT	0x2L
575214571Sdim#define LBS_STANDARD	0xa00003L
576214571Sdim#define LBS_USETABSTOPS	0x80L
577214571Sdim#define LBS_WANTKEYBOARDINPUT	0x400L
578214571Sdim#define SBS_BOTTOMALIGN	0x4L
579214571Sdim#define SBS_HORZ	0L
580214571Sdim#define SBS_LEFTALIGN	0x2L
581214571Sdim#define SBS_RIGHTALIGN	0x4L
582214571Sdim#define SBS_SIZEBOX	0x8L
583214571Sdim#define SBS_SIZEBOXBOTTOMRIGHTALIGN	0x4L
584214571Sdim#define SBS_SIZEBOXTOPLEFTALIGN	0x2L
585214571Sdim#define SBS_SIZEGRIP	0x10L
586214571Sdim#define SBS_TOPALIGN	0x2L
587214571Sdim#define SBS_VERT	0x1L
588214571Sdim#define SS_BITMAP	0xeL
589214571Sdim#define SS_BLACKFRAME	0x7L
590214571Sdim#define SS_BLACKRECT	0x4L
591214571Sdim#define SS_CENTER	0x1L
592214571Sdim#define SS_CENTERIMAGE	0x200L
593214571Sdim#define SS_ENHMETAFILE	0xfL
594214571Sdim#define SS_ETCHEDFRAME	0x12L
595214571Sdim#define SS_ETCHEDHORZ	0x10L
596214571Sdim#define SS_ETCHEDVERT	0x11L
597214571Sdim#define SS_GRAYFRAME	0x8L
598214571Sdim#define SS_GRAYRECT	0x5L
599214571Sdim#define SS_ICON		0x3L
600214571Sdim#define SS_LEFT		0L
601214571Sdim#define SS_LEFTNOWORDWRAP	0xcL
602214571Sdim#define SS_NOPREFIX	0x80L
603214571Sdim#define SS_NOTIFY	0x100L
604214571Sdim#define SS_OWNERDRAW	0xdL
605214571Sdim#define SS_REALSIZEIMAGE	0x800L
606214571Sdim#define SS_RIGHT	0x2L
607214571Sdim#define SS_RIGHTJUST	0x400L
608214571Sdim#define SS_SIMPLE	0xbL
609214571Sdim#define SS_SUNKEN	0x1000L
610214571Sdim#define SS_USERITEM     0xaL
611214571Sdim#define SS_WHITEFRAME	0x9L
612214571Sdim#define SS_WHITERECT	0x6L
613214571Sdim#define DS_3DLOOK	0x4L
614214571Sdim#define DS_ABSALIGN	0x1L
615214571Sdim#define DS_CENTER	0x800L
616214571Sdim#define DS_CENTERMOUSE	0x1000L
617214571Sdim#define DS_CONTEXTHELP	0x2000L
618214571Sdim#define DS_CONTROL	0x400L
619214571Sdim#define DS_FIXEDSYS	0x8L
620214571Sdim#define DS_LOCALEDIT	0x20L
621214571Sdim#define DS_MODALFRAME	0x80L
622214571Sdim#define DS_NOFAILCREATE	0x10L
623214571Sdim#define DS_NOIDLEMSG	0x100L
624214571Sdim#define DS_SETFONT	0x40L
625214571Sdim#define DS_SETFOREGROUND	0x200L
626214571Sdim#define DS_SYSMODAL	0x2L
627214571Sdim
628214571Sdim/* A dialog control.  */
629214571Sdim
630214571Sdimtypedef struct rc_dialog_control
631214571Sdim{
632214571Sdim  /* Next control.  */
633214571Sdim  struct rc_dialog_control *next;
634214571Sdim  /* ID.  */
635214571Sdim  rc_uint_type id;
636214571Sdim  /* Style.  */
637214571Sdim  rc_uint_type style;
638214571Sdim  /* Extended style.  */
639214571Sdim  rc_uint_type exstyle;
640214571Sdim  /* X coordinate.  */
641214571Sdim  rc_uint_type x;
642214571Sdim  /* Y coordinate.  */
643214571Sdim  rc_uint_type y;
644214571Sdim  /* Width.  */
645214571Sdim  rc_uint_type width;
646214571Sdim  /* Height.  */
647214571Sdim  rc_uint_type height;
648214571Sdim  /* Class name.  */
649214571Sdim  rc_res_id class;
650214571Sdim  /* Associated text.  */
651214571Sdim  rc_res_id text;
652214571Sdim  /* Extra data for the window procedure.  */
653214571Sdim  struct rc_rcdata_item *data;
654214571Sdim  /* Help ID.  Only used in an extended dialog.  */
655214571Sdim  rc_uint_type help;
656214571Sdim} rc_dialog_control;
657214571Sdim
658214571Sdimstruct __attribute__ ((__packed__)) bin_dialog_control
659214571Sdim{
660214571Sdim  bfd_byte style[4];
661214571Sdim  bfd_byte exstyle[4];
662214571Sdim  bfd_byte x[2];
663214571Sdim  bfd_byte y[2];
664214571Sdim  bfd_byte width[2];
665214571Sdim  bfd_byte height[2];
666214571Sdim  bfd_byte id[2];
667214571Sdim};
668214571Sdim#define BIN_DIALOG_CONTROL_SIZE 18
669214571Sdim
670214571Sdimstruct __attribute__ ((__packed__)) bin_dialogex_control
671214571Sdim{
672214571Sdim  bfd_byte help[4];
673214571Sdim  bfd_byte exstyle[4];
674214571Sdim  bfd_byte style[4];
675214571Sdim  bfd_byte x[2];
676214571Sdim  bfd_byte y[2];
677214571Sdim  bfd_byte width[2];
678214571Sdim  bfd_byte height[2];
679214571Sdim  bfd_byte id[4];
680214571Sdim};
681214571Sdim#define BIN_DIALOGEX_CONTROL_SIZE 24
682214571Sdim
683214571Sdim/* Control classes.  These can be used as the ID field in a rc_dialog_control.  */
684214571Sdim
685214571Sdim#define CTL_BUTTON	0x80
686214571Sdim#define CTL_EDIT	0x81
687214571Sdim#define CTL_STATIC	0x82
688214571Sdim#define CTL_LISTBOX	0x83
689214571Sdim#define CTL_SCROLLBAR	0x84
690214571Sdim#define CTL_COMBOBOX	0x85
691214571Sdim
692214571Sdim/* A fontdir resource is a list of rc_fontdir.  */
693214571Sdim
694214571Sdimtypedef struct rc_fontdir
695214571Sdim{
696214571Sdim  struct rc_fontdir *next;
697214571Sdim  /* Index of font entry.  */
698214571Sdim  rc_uint_type index;
699214571Sdim  /* Length of font information.  */
700214571Sdim  rc_uint_type length;
701214571Sdim  /* Font information.  */
702214571Sdim  const bfd_byte *data;
703214571Sdim} rc_fontdir;
704214571Sdim
705214571Sdimstruct __attribute__ ((__packed__)) bin_fontdir_item
706214571Sdim{
707214571Sdim  bfd_byte index[2];
708214571Sdim  bfd_byte header[54];
709214571Sdim  bfd_byte device_name[1];
710214571Sdim  /* bfd_byte face_name[]; */
711214571Sdim};
712214571Sdim
713214571Sdim/* A group_icon resource is a list of rc_group_icon.  */
714214571Sdim
715214571Sdimtypedef struct rc_group_icon
716214571Sdim{
717214571Sdim  /* Next icon in group.  */
718214571Sdim  struct rc_group_icon *next;
719214571Sdim  /* Width.  */
720214571Sdim  bfd_byte width;
721214571Sdim  /* Height.  */
722214571Sdim  bfd_byte height;
723214571Sdim  /* Color count.  */
724214571Sdim  bfd_byte colors;
725214571Sdim  /* Planes.  */
726214571Sdim  rc_uint_type planes;
727214571Sdim  /* Bits per pixel.  */
728214571Sdim  rc_uint_type bits;
729214571Sdim  /* Number of bytes in cursor resource.  */
730214571Sdim  rc_uint_type bytes;
731214571Sdim  /* Index of cursor resource.  */
732214571Sdim  rc_uint_type index;
733214571Sdim} rc_group_icon;
734214571Sdim
735214571Sdimstruct __attribute__ ((__packed__)) bin_group_icon
736214571Sdim{
737214571Sdim  bfd_byte sig1[2];
738214571Sdim  bfd_byte sig2[2];
739214571Sdim  bfd_byte count[2];
740214571Sdim};
741214571Sdim#define BIN_GROUP_ICON_SIZE 6
742214571Sdim
743214571Sdimstruct __attribute__ ((__packed__)) bin_group_icon_item
744214571Sdim{
745214571Sdim  bfd_byte width[1];
746214571Sdim  bfd_byte height[1];
747214571Sdim  bfd_byte colors[1];
748214571Sdim  bfd_byte pad[1];
749214571Sdim  bfd_byte planes[2];
750214571Sdim  bfd_byte bits[2];
751214571Sdim  bfd_byte bytes[4];
752214571Sdim  bfd_byte index[2];
753214571Sdim};
754214571Sdim#define BIN_GROUP_ICON_ITEM_SIZE 14
755214571Sdim
756214571Sdim/* A menu resource.  */
757214571Sdim
758214571Sdimtypedef struct rc_menu
759214571Sdim{
760214571Sdim  /* List of menuitems.  */
761214571Sdim  struct rc_menuitem *items;
762214571Sdim  /* Help ID.  I don't think there is any way to set this in an rc
763214571Sdim     file, but it can appear in the binary format.  */
764214571Sdim  rc_uint_type help;
765214571Sdim} rc_menu;
766214571Sdim
767214571Sdimstruct __attribute__ ((__packed__)) bin_menu
768214571Sdim{
769214571Sdim  bfd_byte sig1[2];
770214571Sdim  bfd_byte sig2[2];
771214571Sdim};
772214571Sdim#define BIN_MENU_SIZE 4
773214571Sdim
774214571Sdimstruct __attribute__ ((__packed__)) bin_menuex
775214571Sdim{
776214571Sdim  bfd_byte sig1[2];
777214571Sdim  bfd_byte sig2[2];
778214571Sdim  bfd_byte help[4];
779214571Sdim};
780214571Sdim#define BIN_MENUEX_SIZE 8
781214571Sdim
782214571Sdim/* A menu resource is a list of rc_menuitem.  */
783214571Sdim
784214571Sdimtypedef struct rc_menuitem
785214571Sdim{
786214571Sdim  /* Next menu item.  */
787214571Sdim  struct rc_menuitem *next;
788214571Sdim  /* Type.  In a normal menu, rather than a menuex, this is the flags
789214571Sdim     field.  */
790214571Sdim  rc_uint_type type;
791214571Sdim  /* State.  This is only used in a menuex.  */
792214571Sdim  rc_uint_type state;
793214571Sdim  /* Id.  */
794214571Sdim  rc_uint_type id;
795214571Sdim  /* Unicode text.  */
796214571Sdim  unichar *text;
797214571Sdim  /* Popup menu items for a popup.  */
798214571Sdim  struct rc_menuitem *popup;
799214571Sdim  /* Help ID.  This is only used in a menuex.  */
800214571Sdim  rc_uint_type help;
801214571Sdim} rc_menuitem;
802214571Sdim
803214571Sdimstruct __attribute__ ((__packed__)) bin_menuitem
804214571Sdim{
805214571Sdim  bfd_byte flags[2];
806214571Sdim  bfd_byte id[2];
807214571Sdim};
808214571Sdim#define BIN_MENUITEM_SIZE  4
809214571Sdim#define BIN_MENUITEM_POPUP_SIZE  2
810214571Sdim
811214571Sdimstruct __attribute__ ((__packed__)) bin_menuitemex
812214571Sdim{
813214571Sdim  bfd_byte type[4];
814214571Sdim  bfd_byte state[4];
815214571Sdim  bfd_byte id[4];
816214571Sdim  bfd_byte flags[2];
817214571Sdim  /* unicode text */
818214571Sdim  /* if popup: align, bfd_byte help[4], align, bin_menuitemex[]; */
819214571Sdim};
820214571Sdim#define BIN_MENUITEMEX_SIZE 14
821214571Sdim
822214571Sdim/* Menu item flags.  These can appear in the flags field of a rc_menuitem.  */
823214571Sdim
824214571Sdim#define MENUITEM_GRAYED		0x001
825214571Sdim#define MENUITEM_INACTIVE	0x002
826214571Sdim#define MENUITEM_BITMAP		0x004
827214571Sdim#define MENUITEM_OWNERDRAW	0x100
828214571Sdim#define MENUITEM_CHECKED	0x008
829214571Sdim#define MENUITEM_POPUP		0x010
830214571Sdim#define MENUITEM_MENUBARBREAK	0x020
831214571Sdim#define MENUITEM_MENUBREAK	0x040
832214571Sdim#define MENUITEM_ENDMENU	0x080
833214571Sdim#define MENUITEM_HELP	       0x4000
834214571Sdim
835214571Sdim/* An rcdata resource is a pointer to a list of rc_rcdata_item.  */
836214571Sdim
837214571Sdimtypedef struct rc_rcdata_item
838214571Sdim{
839214571Sdim  /* Next data item.  */
840214571Sdim  struct rc_rcdata_item *next;
841214571Sdim  /* Type of data.  */
842214571Sdim  enum
843214571Sdim  {
844214571Sdim    RCDATA_WORD,
845214571Sdim    RCDATA_DWORD,
846214571Sdim    RCDATA_STRING,
847214571Sdim    RCDATA_WSTRING,
848214571Sdim    RCDATA_BUFFER
849214571Sdim  } type;
850214571Sdim  union
851214571Sdim  {
852214571Sdim    rc_uint_type word;
853214571Sdim    rc_uint_type dword;
854214571Sdim    struct
855214571Sdim    {
856214571Sdim      rc_uint_type length;
857214571Sdim      const char *s;
858214571Sdim    } string;
859214571Sdim    struct
860214571Sdim    {
861214571Sdim      rc_uint_type length;
862214571Sdim      const unichar *w;
863214571Sdim    } wstring;
864214571Sdim    struct
865214571Sdim    {
866214571Sdim      rc_uint_type length;
867214571Sdim      const bfd_byte *data;
868214571Sdim    } buffer;
869214571Sdim  } u;
870214571Sdim} rc_rcdata_item;
871214571Sdim
872214571Sdim/* A stringtable resource is a pointer to a rc_stringtable.  */
873214571Sdim
874214571Sdimtypedef struct rc_stringtable
875214571Sdim{
876214571Sdim  /* Each stringtable resource is a list of 16 unicode strings.  */
877214571Sdim  struct
878214571Sdim  {
879214571Sdim    /* Length of string.  */
880214571Sdim    rc_uint_type length;
881214571Sdim    /* String data if length > 0.  */
882214571Sdim    unichar *string;
883214571Sdim  } strings[16];
884214571Sdim} rc_stringtable;
885214571Sdim
886214571Sdim/* A versioninfo resource points to a rc_versioninfo.  */
887214571Sdim
888214571Sdimtypedef struct rc_versioninfo
889214571Sdim{
890214571Sdim  /* Fixed version information.  */
891214571Sdim  struct rc_fixed_versioninfo *fixed;
892214571Sdim  /* Variable version information.  */
893214571Sdim  struct rc_ver_info *var;
894214571Sdim} rc_versioninfo;
895214571Sdim
896214571Sdimstruct __attribute__ ((__packed__)) bin_versioninfo
897214571Sdim{
898214571Sdim  bfd_byte size[2];
899214571Sdim  bfd_byte fixed_size[2];
900214571Sdim  bfd_byte sig2[2];
901214571Sdim};
902214571Sdim#define BIN_VERSIONINFO_SIZE 6
903214571Sdim
904214571Sdim/* The fixed portion of a versioninfo resource.  */
905214571Sdim
906214571Sdimtypedef struct rc_fixed_versioninfo
907214571Sdim{
908214571Sdim  /* The file version, which is two 32 bit integers.  */
909214571Sdim  rc_uint_type file_version_ms;
910214571Sdim  rc_uint_type file_version_ls;
911214571Sdim  /* The product version, which is two 32 bit integers.  */
912214571Sdim  rc_uint_type product_version_ms;
913214571Sdim  rc_uint_type product_version_ls;
914214571Sdim  /* The file flags mask.  */
915214571Sdim  rc_uint_type file_flags_mask;
916214571Sdim  /* The file flags.  */
917214571Sdim  rc_uint_type file_flags;
918214571Sdim  /* The OS type.  */
919214571Sdim  rc_uint_type file_os;
920214571Sdim  /* The file type.  */
921214571Sdim  rc_uint_type file_type;
922214571Sdim  /* The file subtype.  */
923214571Sdim  rc_uint_type file_subtype;
924214571Sdim  /* The date, which in Windows is two 32 bit integers.  */
925214571Sdim  rc_uint_type file_date_ms;
926214571Sdim  rc_uint_type file_date_ls;
927214571Sdim} rc_fixed_versioninfo;
928214571Sdim
929214571Sdimstruct __attribute__ ((__packed__)) bin_fixed_versioninfo
930214571Sdim{
931214571Sdim  bfd_byte sig1[4];
932214571Sdim  bfd_byte sig2[4];
933214571Sdim  bfd_byte file_version[4];
934214571Sdim  bfd_byte file_version_ls[4];
935214571Sdim  bfd_byte product_version_ms[4];
936214571Sdim  bfd_byte product_version_ls[4];
937214571Sdim  bfd_byte file_flags_mask[4];
938214571Sdim  bfd_byte file_flags[4];
939214571Sdim  bfd_byte file_os[4];
940214571Sdim  bfd_byte file_type[4];
941214571Sdim  bfd_byte file_subtype[4];
942214571Sdim  bfd_byte file_date_ms[4];
943214571Sdim  bfd_byte file_date_ls[4];
944214571Sdim};
945214571Sdim#define BIN_FIXED_VERSIONINFO_SIZE 52
946214571Sdim
947214571Sdim/* A list of variable version information.  */
948214571Sdim
949214571Sdimtypedef struct rc_ver_info
950214571Sdim{
951214571Sdim  /* Next item.  */
952214571Sdim  struct rc_ver_info *next;
953214571Sdim  /* Type of data.  */
954214571Sdim  enum { VERINFO_STRING, VERINFO_VAR } type;
955214571Sdim  union
956214571Sdim  {
957214571Sdim    /* StringFileInfo data.  */
958214571Sdim    struct
959214571Sdim    {
960214571Sdim      /* Language.  */
961214571Sdim      unichar *language;
962214571Sdim      /* Strings.  */
963214571Sdim      struct rc_ver_stringinfo *strings;
964214571Sdim    } string;
965214571Sdim    /* VarFileInfo data.  */
966214571Sdim    struct
967214571Sdim    {
968214571Sdim      /* Key.  */
969214571Sdim      unichar *key;
970214571Sdim      /* Values.  */
971214571Sdim      struct rc_ver_varinfo *var;
972214571Sdim    } var;
973214571Sdim  } u;
974214571Sdim} rc_ver_info;
975214571Sdim
976214571Sdimstruct __attribute__ ((__packed__)) bin_ver_info
977214571Sdim{
978214571Sdim  bfd_byte size[2];
979214571Sdim  bfd_byte sig1[2];
980214571Sdim  bfd_byte sig2[2];
981214571Sdim};
982214571Sdim#define BIN_VER_INFO_SIZE 6
983214571Sdim
984214571Sdim/* A list of string version information.  */
985214571Sdim
986214571Sdimtypedef struct rc_ver_stringinfo
987214571Sdim{
988214571Sdim  /* Next string.  */
989214571Sdim  struct rc_ver_stringinfo *next;
990214571Sdim  /* Key.  */
991214571Sdim  unichar *key;
992214571Sdim  /* Value.  */
993214571Sdim  unichar *value;
994214571Sdim} rc_ver_stringinfo;
995214571Sdim
996214571Sdim/* A list of variable version information.  */
997214571Sdim
998214571Sdimtypedef struct rc_ver_varinfo
999214571Sdim{
1000214571Sdim  /* Next item.  */
1001214571Sdim  struct rc_ver_varinfo *next;
1002214571Sdim  /* Language ID.  */
1003214571Sdim  rc_uint_type language;
1004214571Sdim  /* Character set ID.  */
1005214571Sdim  rc_uint_type charset;
1006214571Sdim} rc_ver_varinfo;
1007214571Sdim
1008214571Sdimtypedef struct rc_toolbar_item
1009214571Sdim{
1010214571Sdim  struct rc_toolbar_item *next;
1011214571Sdim  struct rc_toolbar_item *prev;
1012214571Sdim  rc_res_id id;
1013214571Sdim} rc_toolbar_item;
1014214571Sdim
1015214571Sdimstruct __attribute__ ((__packed__)) bin_messagetable_item
1016214571Sdim{
1017214571Sdim  bfd_byte length[2];
1018214571Sdim  bfd_byte flags[2];
1019214571Sdim  bfd_byte data[1];
1020214571Sdim};
1021214571Sdim#define BIN_MESSAGETABLE_ITEM_SIZE  4
1022214571Sdim
1023214571Sdim#define MESSAGE_RESOURCE_UNICODE  0x0001
1024214571Sdim
1025214571Sdimstruct __attribute__ ((__packed__)) bin_messagetable_block
1026214571Sdim{
1027214571Sdim  bfd_byte lowid[4];
1028214571Sdim  bfd_byte highid[4];
1029214571Sdim  bfd_byte offset[4];
1030214571Sdim};
1031214571Sdim#define BIN_MESSAGETABLE_BLOCK_SIZE 12
1032214571Sdim
1033214571Sdimstruct __attribute__ ((__packed__)) bin_messagetable
1034214571Sdim{
1035214571Sdim  bfd_byte cblocks[4];
1036214571Sdim  struct bin_messagetable_block items[1];
1037214571Sdim};
1038214571Sdim#define BIN_MESSAGETABLE_SIZE 8
1039214571Sdim
1040214571Sdimtypedef struct rc_toolbar
1041214571Sdim{
1042214571Sdim  rc_uint_type button_width;
1043214571Sdim  rc_uint_type button_height;
1044214571Sdim  rc_uint_type nitems;
1045214571Sdim  rc_toolbar_item *items;
1046214571Sdim} rc_toolbar;
1047214571Sdim
1048214571Sdimstruct __attribute__ ((__packed__)) bin_toolbar
1049214571Sdim{
1050214571Sdim  bfd_byte button_width[4];
1051214571Sdim  bfd_byte button_height[4];
1052214571Sdim  bfd_byte nitems[4];
1053214571Sdim  /* { bfd_byte id[4]; } * nitems; */
1054214571Sdim};
1055214571Sdim#define BIN_TOOLBAR_SIZE 12
1056214571Sdim
1057214571Sdimextern int target_is_bigendian;
1058214571Sdim
1059214571Sdimtypedef struct windres_bfd
1060214571Sdim{
1061214571Sdim  bfd *abfd;
1062214571Sdim  asection *sec;
1063214571Sdim  rc_uint_type kind : 4;
1064214571Sdim} windres_bfd;
1065214571Sdim
1066214571Sdim#define WR_KIND_TARGET	  0
1067214571Sdim#define WR_KIND_BFD	  1
1068214571Sdim#define WR_KIND_BFD_BIN_L 2
1069214571Sdim#define WR_KIND_BFD_BIN_B 3
1070214571Sdim
1071214571Sdim#define WR_KIND(PTR)  (PTR)->kind
1072214571Sdim#define WR_SECTION(PTR)	(PTR)->sec
1073214571Sdim#define WR_BFD(PTR) (PTR)->abfd
1074214571Sdim
1075214571Sdimextern void set_windres_bfd_content (windres_bfd *, const void *, rc_uint_type, rc_uint_type);
1076214571Sdimextern void get_windres_bfd_content (windres_bfd *, void *, rc_uint_type, rc_uint_type);
1077214571Sdim
1078214571Sdimextern void windres_put_8 (windres_bfd *, void *, rc_uint_type);
1079214571Sdimextern void windres_put_16 (windres_bfd *, void *, rc_uint_type);
1080214571Sdimextern void windres_put_32 (windres_bfd *, void *, rc_uint_type);
1081214571Sdimextern rc_uint_type windres_get_8 (windres_bfd *, const void *, rc_uint_type);
1082214571Sdimextern rc_uint_type windres_get_16 (windres_bfd *, const void *, rc_uint_type);
1083214571Sdimextern rc_uint_type windres_get_32 (windres_bfd *, const void *, rc_uint_type);
1084214571Sdim
1085214571Sdimextern void set_windres_bfd (windres_bfd *, bfd *, asection *, rc_uint_type);
1086214571Sdimextern void set_windres_bfd_endianess (windres_bfd *, int);
1087214571Sdim
1088214571Sdim#endif
1089