Bump version for general release.
[binutils.git] / binutils / windint.h
blob7093fd1fde856ddce286ab35612e30cc85b8b6a2
1 /* windint.h -- internal header file for windres program.
2 Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007
3 Free Software Foundation, Inc.
4 Written by Kai Tietz, Onevision.
6 This file is part of GNU Binutils.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21 02110-1301, USA. */
23 #include "winduni.h"
25 #ifndef WINDINT_H
26 #define WINDINT_H
28 /* Use bfd_size_type to ensure a sufficient number of bits. */
29 #ifndef DEFINED_RC_UINT_TYPE
30 #define DEFINED_RC_UINT_TYPE
31 typedef bfd_size_type rc_uint_type;
32 #endif
34 /* Resource directory structure. */
36 typedef struct res_hdr
38 rc_uint_type data_size;
39 rc_uint_type header_size;
40 } res_hdr;
42 struct __attribute__ ((__packed__)) bin_res_hdr
44 bfd_byte data_size[4];
45 bfd_byte header_size[4];
47 #define BIN_RES_HDR_SIZE 8
49 struct __attribute__ ((__packed__)) bin_res_id
51 bfd_byte sig[2]; /* Has to be 0xffff for unnamed ids. */
52 bfd_byte id[2];
54 #define BIN_RES_ID 4
56 /* This structure is used when converting resource information to
57 binary. */
59 typedef struct bindata
61 /* Next data. */
62 struct bindata *next;
63 /* Length of data. */
64 rc_uint_type length;
65 /* Data. */
66 bfd_byte *data;
67 } bindata;
69 /* This structure is used when converting resource information to
70 coff. */
71 typedef struct coff_res_data
73 /* Next data. */
74 struct coff_res_data *next;
75 /* Length of data. */
76 rc_uint_type length;
77 /* Data. */
78 const struct rc_res_resource *res;
79 } coff_res_data;
81 /* We represent resources internally as a tree, similar to the tree
82 used in the .rsrc section of a COFF file. The root is a
83 rc_res_directory structure. */
85 typedef struct rc_res_directory
87 /* Resource flags. According to the MS docs, this is currently
88 always zero. */
89 rc_uint_type characteristics;
90 /* Time/date stamp. */
91 rc_uint_type time;
92 /* Major version number. */
93 rc_uint_type major;
94 /* Minor version number. */
95 rc_uint_type minor;
96 /* Directory entries. */
97 struct rc_res_entry *entries;
98 } rc_res_directory;
100 /* A resource ID is stored in a rc_res_id structure. */
102 typedef struct rc_res_id
104 /* Non-zero if this entry has a name rather than an ID. */
105 rc_uint_type named : 1;
106 union
108 /* If the named field is non-zero, this is the name. */
109 struct
111 /* Length of the name. */
112 rc_uint_type length;
113 /* Pointer to the name, which is a Unicode string. */
114 unichar *name;
115 } n;
116 /* If the named field is zero, this is the ID. */
117 rc_uint_type id;
118 } u;
119 } rc_res_id;
121 /* Each entry in the tree is a rc_res_entry structure. We mix
122 directories and resources because in a COFF file all entries in a
123 directory are sorted together, whether the entries are
124 subdirectories or resources. */
126 typedef struct rc_res_entry
128 /* Next entry. */
129 struct rc_res_entry *next;
130 /* Resource ID. */
131 rc_res_id id;
132 /* Non-zero if this entry is a subdirectory rather than a leaf. */
133 rc_uint_type subdir : 1;
134 union
136 /* If the subdir field is non-zero, this is a pointer to the
137 subdirectory. */
138 rc_res_directory *dir;
139 /* If the subdir field is zero, this is a pointer to the resource
140 data. */
141 struct rc_res_resource *res;
142 } u;
143 } rc_res_entry;
145 /* Types of resources. */
147 enum rc_res_type
149 RES_TYPE_UNINITIALIZED,
150 RES_TYPE_ACCELERATOR,
151 RES_TYPE_BITMAP,
152 RES_TYPE_CURSOR,
153 RES_TYPE_GROUP_CURSOR,
154 RES_TYPE_DIALOG,
155 RES_TYPE_FONT,
156 RES_TYPE_FONTDIR,
157 RES_TYPE_ICON,
158 RES_TYPE_GROUP_ICON,
159 RES_TYPE_MENU,
160 RES_TYPE_MESSAGETABLE,
161 RES_TYPE_RCDATA,
162 RES_TYPE_STRINGTABLE,
163 RES_TYPE_USERDATA,
164 RES_TYPE_VERSIONINFO,
165 RES_TYPE_DLGINCLUDE,
166 RES_TYPE_PLUGPLAY,
167 RES_TYPE_VXD,
168 RES_TYPE_ANICURSOR,
169 RES_TYPE_ANIICON,
170 RES_TYPE_DLGINIT,
171 RES_TYPE_TOOLBAR
174 /* A res file and a COFF file store information differently. The
175 res_info structures holds data which in a res file is stored with
176 each resource, but in a COFF file is stored elsewhere. */
178 typedef struct rc_res_res_info
180 /* Language. In a COFF file, the third level of the directory is
181 keyed by the language, so the language of a resource is defined
182 by its location in the resource tree. */
183 rc_uint_type language;
184 /* Characteristics of the resource. Entirely user defined. In a
185 COFF file, the rc_res_directory structure has a characteristics
186 field, but I don't know if it's related to the one in the res
187 file. */
188 rc_uint_type characteristics;
189 /* Version of the resource. Entirely user defined. In a COFF file,
190 the rc_res_directory structure has a characteristics field, but I
191 don't know if it's related to the one in the res file. */
192 rc_uint_type version;
193 /* Memory flags. This is a combination of the MEMFLAG values
194 defined below. Most of these values are historical, and are not
195 meaningful for win32. I don't think there is any way to store
196 this information in a COFF file. */
197 rc_uint_type memflags;
198 } rc_res_res_info;
200 /* Binary layout of rc_res_info. */
202 struct __attribute__ ((__packed__)) bin_res_info
204 bfd_byte version[4];
205 bfd_byte memflags[2];
206 bfd_byte language[2];
207 bfd_byte version2[4];
208 bfd_byte characteristics[4];
210 #define BIN_RES_INFO_SIZE 16
212 /* Each resource in a COFF file has some information which can does
213 not appear in a res file. */
215 typedef struct rc_res_coff_info
217 /* The code page used for the data. I don't really know what this
218 should be. It has something todo with ASCII to Unicode encoding. */
219 rc_uint_type codepage;
220 /* A resource entry in a COFF file has a reserved field, which we
221 record here when reading a COFF file. When writing a COFF file,
222 we set this field to zero. */
223 rc_uint_type reserved;
224 } rc_res_coff_info;
226 /* Resource data is stored in a rc_res_resource structure. */
228 typedef struct rc_res_resource
230 /* The type of resource. */
231 enum rc_res_type type;
232 /* The data for the resource. */
233 union
235 struct
237 rc_uint_type length;
238 const bfd_byte *data;
239 } data;
240 struct rc_accelerator *acc;
241 struct rc_cursor *cursor;
242 struct rc_group_cursor *group_cursor;
243 struct rc_dialog *dialog;
244 struct rc_fontdir *fontdir;
245 struct rc_group_icon *group_icon;
246 struct rc_menu *menu;
247 struct rc_rcdata_item *rcdata;
248 struct rc_stringtable *stringtable;
249 struct rc_rcdata_item *userdata;
250 struct rc_versioninfo *versioninfo;
251 struct rc_toolbar *toolbar;
252 } u;
253 /* Information from a res file. */
254 struct rc_res_res_info res_info;
255 /* Information from a COFF file. */
256 rc_res_coff_info coff_info;
257 } rc_res_resource;
259 #define SUBLANG_SHIFT 10
261 /* Memory flags in the memflags field of a rc_res_resource. */
263 #define MEMFLAG_MOVEABLE 0x10
264 #define MEMFLAG_PURE 0x20
265 #define MEMFLAG_PRELOAD 0x40
266 #define MEMFLAG_DISCARDABLE 0x1000
268 /* Standard resource type codes. These are used in the ID field of a
269 rc_res_entry structure. */
271 #define RT_CURSOR 1
272 #define RT_BITMAP 2
273 #define RT_ICON 3
274 #define RT_MENU 4
275 #define RT_DIALOG 5
276 #define RT_STRING 6
277 #define RT_FONTDIR 7
278 #define RT_FONT 8
279 #define RT_ACCELERATOR 9
280 #define RT_RCDATA 10
281 #define RT_MESSAGETABLE 11
282 #define RT_GROUP_CURSOR 12
283 #define RT_GROUP_ICON 14
284 #define RT_VERSION 16
285 #define RT_DLGINCLUDE 17
286 #define RT_PLUGPLAY 19
287 #define RT_VXD 20
288 #define RT_ANICURSOR 21
289 #define RT_ANIICON 22
290 #define RT_HTML 23
291 #define RT_MANIFEST 24
292 #define RT_DLGINIT 240
293 #define RT_TOOLBAR 241
295 /* An accelerator resource is a linked list of these structures. */
297 typedef struct rc_accelerator
299 /* Next accelerator. */
300 struct rc_accelerator *next;
301 /* Flags. A combination of the ACC values defined below. */
302 rc_uint_type flags;
303 /* Key value. */
304 rc_uint_type key;
305 /* Resource ID. */
306 rc_uint_type id;
307 } rc_accelerator;
309 struct __attribute__ ((__packed__)) bin_accelerator
311 bfd_byte flags[2];
312 bfd_byte key[2];
313 bfd_byte id[2];
314 bfd_byte pad[2];
316 #define BIN_ACCELERATOR_SIZE 8
318 /* Accelerator flags in the flags field of a rc_accelerator.
319 These are the same values that appear in a res file. I hope. */
321 #define ACC_VIRTKEY 0x01
322 #define ACC_NOINVERT 0x02
323 #define ACC_SHIFT 0x04
324 #define ACC_CONTROL 0x08
325 #define ACC_ALT 0x10
326 #define ACC_LAST 0x80
328 /* A cursor resource. */
330 typedef struct rc_cursor
332 /* X coordinate of hotspot. */
333 bfd_signed_vma xhotspot;
334 /* Y coordinate of hotspot. */
335 bfd_signed_vma yhotspot;
336 /* Length of bitmap data. */
337 rc_uint_type length;
338 /* Data. */
339 const bfd_byte *data;
340 } rc_cursor;
342 struct __attribute__ ((__packed__)) bin_cursor
344 bfd_byte xhotspot[2];
345 bfd_byte yhotspot[2];
347 #define BIN_CURSOR_SIZE 4
349 /* A group_cursor resource is a list of rc_i_group_cursor structures. */
351 typedef struct rc_group_cursor
353 /* Next cursor in group. */
354 struct rc_group_cursor *next;
355 /* Width. */
356 rc_uint_type width;
357 /* Height. */
358 rc_uint_type height;
359 /* Planes. */
360 rc_uint_type planes;
361 /* Bits per pixel. */
362 rc_uint_type bits;
363 /* Number of bytes in cursor resource. */
364 rc_uint_type bytes;
365 /* Index of cursor resource. */
366 rc_uint_type index;
367 } rc_group_cursor;
369 struct __attribute__ ((__packed__)) bin_group_cursor_item
371 bfd_byte width[2];
372 bfd_byte height[2];
373 bfd_byte planes[2];
374 bfd_byte bits[2];
375 bfd_byte bytes[4];
376 bfd_byte index[2];
378 #define BIN_GROUP_CURSOR_ITEM_SIZE 14
380 struct __attribute__ ((__packed__)) bin_group_cursor
382 bfd_byte sig1[2];
383 bfd_byte sig2[2];
384 bfd_byte nitems[2];
385 /* struct bin_group_cursor_item item[nitems]; */
387 #define BIN_GROUP_CURSOR_SIZE 6
389 /* A dialog resource. */
391 typedef struct rc_dialog
393 /* Basic window style. */
394 unsigned int style;
395 /* Extended window style. */
396 rc_uint_type exstyle;
397 /* X coordinate. */
398 rc_uint_type x;
399 /* Y coordinate. */
400 rc_uint_type y;
401 /* Width. */
402 rc_uint_type width;
403 /* Height. */
404 rc_uint_type height;
405 /* Menu name. */
406 rc_res_id menu;
407 /* Class name. */
408 rc_res_id class;
409 /* Caption. */
410 unichar *caption;
411 /* Font point size. */
412 rc_uint_type pointsize;
413 /* Font name. */
414 unichar *font;
415 /* Extended information for a dialogex. */
416 struct rc_dialog_ex *ex;
417 /* Controls. */
418 struct rc_dialog_control *controls;
419 } rc_dialog;
421 struct __attribute__ ((__packed__)) bin_dialog
423 bfd_byte style[4];
424 bfd_byte exstyle[4];
425 bfd_byte off[2];
426 bfd_byte x[2];
427 bfd_byte y[2];
428 bfd_byte width[2];
429 bfd_byte height[2];
431 #define BIN_DIALOG_SIZE 18
433 /* An extended dialog has additional information. */
435 typedef struct rc_dialog_ex
437 /* Help ID. */
438 rc_uint_type help;
439 /* Font weight. */
440 rc_uint_type weight;
441 /* Whether the font is italic. */
442 bfd_byte italic;
443 /* Character set. */
444 bfd_byte charset;
445 } rc_dialog_ex;
447 struct __attribute__ ((__packed__)) bin_dialogex
449 bfd_byte sig1[2];
450 bfd_byte sig2[2];
451 bfd_byte help[4];
452 bfd_byte exstyle[4];
453 bfd_byte style[4];
454 bfd_byte off[2];
455 bfd_byte x[2];
456 bfd_byte y[2];
457 bfd_byte width[2];
458 bfd_byte height[2];
460 #define BIN_DIALOGEX_SIZE 26
462 struct __attribute__ ((__packed__)) bin_dialogfont
464 bfd_byte pointsize[2];
466 #define BIN_DIALOGFONT_SIZE 2
468 struct __attribute__ ((__packed__)) bin_dialogexfont
470 bfd_byte pointsize[2];
471 bfd_byte weight[2];
472 bfd_byte italic[1];
473 bfd_byte charset[1];
475 #define BIN_DIALOGEXFONT_SIZE 6
477 /* Window style flags, from the winsup Defines.h header file. These
478 can appear in the style field of a rc_dialog or a rc_dialog_control. */
480 #define CW_USEDEFAULT 0x80000000
481 #define WS_BORDER 0x800000L
482 #define WS_CAPTION 0xc00000L
483 #define WS_CHILD 0x40000000L
484 #define WS_CHILDWINDOW 0x40000000L
485 #define WS_CLIPCHILDREN 0x2000000L
486 #define WS_CLIPSIBLINGS 0x4000000L
487 #define WS_DISABLED 0x8000000L
488 #define WS_DLGFRAME 0x400000L
489 #define WS_GROUP 0x20000L
490 #define WS_HSCROLL 0x100000L
491 #define WS_ICONIC 0x20000000L
492 #define WS_MAXIMIZE 0x1000000L
493 #define WS_MAXIMIZEBOX 0x10000L
494 #define WS_MINIMIZE 0x20000000L
495 #define WS_MINIMIZEBOX 0x20000L
496 #define WS_OVERLAPPED 0L
497 #define WS_OVERLAPPEDWINDOW 0xcf0000L
498 #define WS_POPUP 0x80000000L
499 #define WS_POPUPWINDOW 0x80880000L
500 #define WS_SIZEBOX 0x40000L
501 #define WS_SYSMENU 0x80000L
502 #define WS_TABSTOP 0x10000L
503 #define WS_THICKFRAME 0x40000L
504 #define WS_TILED 0L
505 #define WS_TILEDWINDOW 0xcf0000L
506 #define WS_VISIBLE 0x10000000L
507 #define WS_VSCROLL 0x200000L
508 #define MDIS_ALLCHILDSTYLES 0x1
509 #define BS_3STATE 0x5L
510 #define BS_AUTO3STATE 0x6L
511 #define BS_AUTOCHECKBOX 0x3L
512 #define BS_AUTORADIOBUTTON 0x9L
513 #define BS_BITMAP 0x80L
514 #define BS_BOTTOM 0x800L
515 #define BS_CENTER 0x300L
516 #define BS_CHECKBOX 0x2L
517 #define BS_DEFPUSHBUTTON 0x1L
518 #define BS_GROUPBOX 0x7L
519 #define BS_ICON 0x40L
520 #define BS_LEFT 0x100L
521 #define BS_LEFTTEXT 0x20L
522 #define BS_MULTILINE 0x2000L
523 #define BS_NOTIFY 0x4000L
524 #define BS_OWNERDRAW 0xbL
525 #define BS_PUSHBOX 0xcL /* FIXME! What should this be? */
526 #define BS_PUSHBUTTON 0L
527 #define BS_PUSHLIKE 0x1000L
528 #define BS_RADIOBUTTON 0x4L
529 #define BS_RIGHT 0x200L
530 #define BS_RIGHTBUTTON 0x20L
531 #define BS_TEXT 0L
532 #define BS_TOP 0x400L
533 #define BS_USERBUTTON 0x8L
534 #define BS_VCENTER 0xc00L
535 #define CBS_AUTOHSCROLL 0x40L
536 #define CBS_DISABLENOSCROLL 0x800L
537 #define CBS_DROPDOWN 0x2L
538 #define CBS_DROPDOWNLIST 0x3L
539 #define CBS_HASSTRINGS 0x200L
540 #define CBS_LOWERCASE 0x4000L
541 #define CBS_NOINTEGRALHEIGHT 0x400L
542 #define CBS_OEMCONVERT 0x80L
543 #define CBS_OWNERDRAWFIXED 0x10L
544 #define CBS_OWNERDRAWVARIABLE 0x20L
545 #define CBS_SIMPLE 0x1L
546 #define CBS_SORT 0x100L
547 #define CBS_UPPERCASE 0x2000L
548 #define ES_AUTOHSCROLL 0x80L
549 #define ES_AUTOVSCROLL 0x40L
550 #define ES_CENTER 0x1L
551 #define ES_LEFT 0L
552 #define ES_LOWERCASE 0x10L
553 #define ES_MULTILINE 0x4L
554 #define ES_NOHIDESEL 0x100L
555 #define ES_NUMBER 0x2000L
556 #define ES_OEMCONVERT 0x400L
557 #define ES_PASSWORD 0x20L
558 #define ES_READONLY 0x800L
559 #define ES_RIGHT 0x2L
560 #define ES_UPPERCASE 0x8L
561 #define ES_WANTRETURN 0x1000L
562 #define LBS_DISABLENOSCROLL 0x1000L
563 #define LBS_EXTENDEDSEL 0x800L
564 #define LBS_HASSTRINGS 0x40L
565 #define LBS_MULTICOLUMN 0x200L
566 #define LBS_MULTIPLESEL 0x8L
567 #define LBS_NODATA 0x2000L
568 #define LBS_NOINTEGRALHEIGHT 0x100L
569 #define LBS_NOREDRAW 0x4L
570 #define LBS_NOSEL 0x4000L
571 #define LBS_NOTIFY 0x1L
572 #define LBS_OWNERDRAWFIXED 0x10L
573 #define LBS_OWNERDRAWVARIABLE 0x20L
574 #define LBS_SORT 0x2L
575 #define LBS_STANDARD 0xa00003L
576 #define LBS_USETABSTOPS 0x80L
577 #define LBS_WANTKEYBOARDINPUT 0x400L
578 #define SBS_BOTTOMALIGN 0x4L
579 #define SBS_HORZ 0L
580 #define SBS_LEFTALIGN 0x2L
581 #define SBS_RIGHTALIGN 0x4L
582 #define SBS_SIZEBOX 0x8L
583 #define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x4L
584 #define SBS_SIZEBOXTOPLEFTALIGN 0x2L
585 #define SBS_SIZEGRIP 0x10L
586 #define SBS_TOPALIGN 0x2L
587 #define SBS_VERT 0x1L
588 #define SS_BITMAP 0xeL
589 #define SS_BLACKFRAME 0x7L
590 #define SS_BLACKRECT 0x4L
591 #define SS_CENTER 0x1L
592 #define SS_CENTERIMAGE 0x200L
593 #define SS_ENHMETAFILE 0xfL
594 #define SS_ETCHEDFRAME 0x12L
595 #define SS_ETCHEDHORZ 0x10L
596 #define SS_ETCHEDVERT 0x11L
597 #define SS_GRAYFRAME 0x8L
598 #define SS_GRAYRECT 0x5L
599 #define SS_ICON 0x3L
600 #define SS_LEFT 0L
601 #define SS_LEFTNOWORDWRAP 0xcL
602 #define SS_NOPREFIX 0x80L
603 #define SS_NOTIFY 0x100L
604 #define SS_OWNERDRAW 0xdL
605 #define SS_REALSIZEIMAGE 0x800L
606 #define SS_RIGHT 0x2L
607 #define SS_RIGHTJUST 0x400L
608 #define SS_SIMPLE 0xbL
609 #define SS_SUNKEN 0x1000L
610 #define SS_USERITEM 0xaL
611 #define SS_WHITEFRAME 0x9L
612 #define SS_WHITERECT 0x6L
613 #define DS_3DLOOK 0x4L
614 #define DS_ABSALIGN 0x1L
615 #define DS_CENTER 0x800L
616 #define DS_CENTERMOUSE 0x1000L
617 #define DS_CONTEXTHELP 0x2000L
618 #define DS_CONTROL 0x400L
619 #define DS_FIXEDSYS 0x8L
620 #define DS_LOCALEDIT 0x20L
621 #define DS_MODALFRAME 0x80L
622 #define DS_NOFAILCREATE 0x10L
623 #define DS_NOIDLEMSG 0x100L
624 #define DS_SETFONT 0x40L
625 #define DS_SETFOREGROUND 0x200L
626 #define DS_SYSMODAL 0x2L
628 /* A dialog control. */
630 typedef struct rc_dialog_control
632 /* Next control. */
633 struct rc_dialog_control *next;
634 /* ID. */
635 rc_uint_type id;
636 /* Style. */
637 rc_uint_type style;
638 /* Extended style. */
639 rc_uint_type exstyle;
640 /* X coordinate. */
641 rc_uint_type x;
642 /* Y coordinate. */
643 rc_uint_type y;
644 /* Width. */
645 rc_uint_type width;
646 /* Height. */
647 rc_uint_type height;
648 /* Class name. */
649 rc_res_id class;
650 /* Associated text. */
651 rc_res_id text;
652 /* Extra data for the window procedure. */
653 struct rc_rcdata_item *data;
654 /* Help ID. Only used in an extended dialog. */
655 rc_uint_type help;
656 } rc_dialog_control;
658 struct __attribute__ ((__packed__)) bin_dialog_control
660 bfd_byte style[4];
661 bfd_byte exstyle[4];
662 bfd_byte x[2];
663 bfd_byte y[2];
664 bfd_byte width[2];
665 bfd_byte height[2];
666 bfd_byte id[2];
668 #define BIN_DIALOG_CONTROL_SIZE 18
670 struct __attribute__ ((__packed__)) bin_dialogex_control
672 bfd_byte help[4];
673 bfd_byte exstyle[4];
674 bfd_byte style[4];
675 bfd_byte x[2];
676 bfd_byte y[2];
677 bfd_byte width[2];
678 bfd_byte height[2];
679 bfd_byte id[4];
681 #define BIN_DIALOGEX_CONTROL_SIZE 24
683 /* Control classes. These can be used as the ID field in a rc_dialog_control. */
685 #define CTL_BUTTON 0x80
686 #define CTL_EDIT 0x81
687 #define CTL_STATIC 0x82
688 #define CTL_LISTBOX 0x83
689 #define CTL_SCROLLBAR 0x84
690 #define CTL_COMBOBOX 0x85
692 /* A fontdir resource is a list of rc_fontdir. */
694 typedef struct rc_fontdir
696 struct rc_fontdir *next;
697 /* Index of font entry. */
698 rc_uint_type index;
699 /* Length of font information. */
700 rc_uint_type length;
701 /* Font information. */
702 const bfd_byte *data;
703 } rc_fontdir;
705 struct __attribute__ ((__packed__)) bin_fontdir_item
707 bfd_byte index[2];
708 bfd_byte header[54];
709 bfd_byte device_name[1];
710 /* bfd_byte face_name[]; */
713 /* A group_icon resource is a list of rc_group_icon. */
715 typedef struct rc_group_icon
717 /* Next icon in group. */
718 struct rc_group_icon *next;
719 /* Width. */
720 bfd_byte width;
721 /* Height. */
722 bfd_byte height;
723 /* Color count. */
724 bfd_byte colors;
725 /* Planes. */
726 rc_uint_type planes;
727 /* Bits per pixel. */
728 rc_uint_type bits;
729 /* Number of bytes in cursor resource. */
730 rc_uint_type bytes;
731 /* Index of cursor resource. */
732 rc_uint_type index;
733 } rc_group_icon;
735 struct __attribute__ ((__packed__)) bin_group_icon
737 bfd_byte sig1[2];
738 bfd_byte sig2[2];
739 bfd_byte count[2];
741 #define BIN_GROUP_ICON_SIZE 6
743 struct __attribute__ ((__packed__)) bin_group_icon_item
745 bfd_byte width[1];
746 bfd_byte height[1];
747 bfd_byte colors[1];
748 bfd_byte pad[1];
749 bfd_byte planes[2];
750 bfd_byte bits[2];
751 bfd_byte bytes[4];
752 bfd_byte index[2];
754 #define BIN_GROUP_ICON_ITEM_SIZE 14
756 /* A menu resource. */
758 typedef struct rc_menu
760 /* List of menuitems. */
761 struct rc_menuitem *items;
762 /* Help ID. I don't think there is any way to set this in an rc
763 file, but it can appear in the binary format. */
764 rc_uint_type help;
765 } rc_menu;
767 struct __attribute__ ((__packed__)) bin_menu
769 bfd_byte sig1[2];
770 bfd_byte sig2[2];
772 #define BIN_MENU_SIZE 4
774 struct __attribute__ ((__packed__)) bin_menuex
776 bfd_byte sig1[2];
777 bfd_byte sig2[2];
778 bfd_byte help[4];
780 #define BIN_MENUEX_SIZE 8
782 /* A menu resource is a list of rc_menuitem. */
784 typedef struct rc_menuitem
786 /* Next menu item. */
787 struct rc_menuitem *next;
788 /* Type. In a normal menu, rather than a menuex, this is the flags
789 field. */
790 rc_uint_type type;
791 /* State. This is only used in a menuex. */
792 rc_uint_type state;
793 /* Id. */
794 rc_uint_type id;
795 /* Unicode text. */
796 unichar *text;
797 /* Popup menu items for a popup. */
798 struct rc_menuitem *popup;
799 /* Help ID. This is only used in a menuex. */
800 rc_uint_type help;
801 } rc_menuitem;
803 struct __attribute__ ((__packed__)) bin_menuitem
805 bfd_byte flags[2];
806 bfd_byte id[2];
808 #define BIN_MENUITEM_SIZE 4
809 #define BIN_MENUITEM_POPUP_SIZE 2
811 struct __attribute__ ((__packed__)) bin_menuitemex
813 bfd_byte type[4];
814 bfd_byte state[4];
815 bfd_byte id[4];
816 bfd_byte flags[2];
817 /* unicode text */
818 /* if popup: align, bfd_byte help[4], align, bin_menuitemex[]; */
820 #define BIN_MENUITEMEX_SIZE 14
822 /* Menu item flags. These can appear in the flags field of a rc_menuitem. */
824 #define MENUITEM_GRAYED 0x001
825 #define MENUITEM_INACTIVE 0x002
826 #define MENUITEM_BITMAP 0x004
827 #define MENUITEM_OWNERDRAW 0x100
828 #define MENUITEM_CHECKED 0x008
829 #define MENUITEM_POPUP 0x010
830 #define MENUITEM_MENUBARBREAK 0x020
831 #define MENUITEM_MENUBREAK 0x040
832 #define MENUITEM_ENDMENU 0x080
833 #define MENUITEM_HELP 0x4000
835 /* An rcdata resource is a pointer to a list of rc_rcdata_item. */
837 typedef struct rc_rcdata_item
839 /* Next data item. */
840 struct rc_rcdata_item *next;
841 /* Type of data. */
842 enum
844 RCDATA_WORD,
845 RCDATA_DWORD,
846 RCDATA_STRING,
847 RCDATA_WSTRING,
848 RCDATA_BUFFER
849 } type;
850 union
852 rc_uint_type word;
853 rc_uint_type dword;
854 struct
856 rc_uint_type length;
857 const char *s;
858 } string;
859 struct
861 rc_uint_type length;
862 const unichar *w;
863 } wstring;
864 struct
866 rc_uint_type length;
867 const bfd_byte *data;
868 } buffer;
869 } u;
870 } rc_rcdata_item;
872 /* A stringtable resource is a pointer to a rc_stringtable. */
874 typedef struct rc_stringtable
876 /* Each stringtable resource is a list of 16 unicode strings. */
877 struct
879 /* Length of string. */
880 rc_uint_type length;
881 /* String data if length > 0. */
882 unichar *string;
883 } strings[16];
884 } rc_stringtable;
886 /* A versioninfo resource points to a rc_versioninfo. */
888 typedef struct rc_versioninfo
890 /* Fixed version information. */
891 struct rc_fixed_versioninfo *fixed;
892 /* Variable version information. */
893 struct rc_ver_info *var;
894 } rc_versioninfo;
896 struct __attribute__ ((__packed__)) bin_versioninfo
898 bfd_byte size[2];
899 bfd_byte fixed_size[2];
900 bfd_byte sig2[2];
902 #define BIN_VERSIONINFO_SIZE 6
904 /* The fixed portion of a versioninfo resource. */
906 typedef struct rc_fixed_versioninfo
908 /* The file version, which is two 32 bit integers. */
909 rc_uint_type file_version_ms;
910 rc_uint_type file_version_ls;
911 /* The product version, which is two 32 bit integers. */
912 rc_uint_type product_version_ms;
913 rc_uint_type product_version_ls;
914 /* The file flags mask. */
915 rc_uint_type file_flags_mask;
916 /* The file flags. */
917 rc_uint_type file_flags;
918 /* The OS type. */
919 rc_uint_type file_os;
920 /* The file type. */
921 rc_uint_type file_type;
922 /* The file subtype. */
923 rc_uint_type file_subtype;
924 /* The date, which in Windows is two 32 bit integers. */
925 rc_uint_type file_date_ms;
926 rc_uint_type file_date_ls;
927 } rc_fixed_versioninfo;
929 struct __attribute__ ((__packed__)) bin_fixed_versioninfo
931 bfd_byte sig1[4];
932 bfd_byte sig2[4];
933 bfd_byte file_version[4];
934 bfd_byte file_version_ls[4];
935 bfd_byte product_version_ms[4];
936 bfd_byte product_version_ls[4];
937 bfd_byte file_flags_mask[4];
938 bfd_byte file_flags[4];
939 bfd_byte file_os[4];
940 bfd_byte file_type[4];
941 bfd_byte file_subtype[4];
942 bfd_byte file_date_ms[4];
943 bfd_byte file_date_ls[4];
945 #define BIN_FIXED_VERSIONINFO_SIZE 52
947 /* A list of variable version information. */
949 typedef struct rc_ver_info
951 /* Next item. */
952 struct rc_ver_info *next;
953 /* Type of data. */
954 enum { VERINFO_STRING, VERINFO_VAR } type;
955 union
957 /* StringFileInfo data. */
958 struct
960 /* Language. */
961 unichar *language;
962 /* Strings. */
963 struct rc_ver_stringinfo *strings;
964 } string;
965 /* VarFileInfo data. */
966 struct
968 /* Key. */
969 unichar *key;
970 /* Values. */
971 struct rc_ver_varinfo *var;
972 } var;
973 } u;
974 } rc_ver_info;
976 struct __attribute__ ((__packed__)) bin_ver_info
978 bfd_byte size[2];
979 bfd_byte sig1[2];
980 bfd_byte sig2[2];
982 #define BIN_VER_INFO_SIZE 6
984 /* A list of string version information. */
986 typedef struct rc_ver_stringinfo
988 /* Next string. */
989 struct rc_ver_stringinfo *next;
990 /* Key. */
991 unichar *key;
992 /* Value. */
993 unichar *value;
994 } rc_ver_stringinfo;
996 /* A list of variable version information. */
998 typedef struct rc_ver_varinfo
1000 /* Next item. */
1001 struct rc_ver_varinfo *next;
1002 /* Language ID. */
1003 rc_uint_type language;
1004 /* Character set ID. */
1005 rc_uint_type charset;
1006 } rc_ver_varinfo;
1008 typedef struct rc_toolbar_item
1010 struct rc_toolbar_item *next;
1011 struct rc_toolbar_item *prev;
1012 rc_res_id id;
1013 } rc_toolbar_item;
1015 struct __attribute__ ((__packed__)) bin_messagetable_item
1017 bfd_byte length[2];
1018 bfd_byte flags[2];
1019 bfd_byte data[1];
1021 #define BIN_MESSAGETABLE_ITEM_SIZE 4
1023 #define MESSAGE_RESOURCE_UNICODE 0x0001
1025 struct __attribute__ ((__packed__)) bin_messagetable_block
1027 bfd_byte lowid[4];
1028 bfd_byte highid[4];
1029 bfd_byte offset[4];
1031 #define BIN_MESSAGETABLE_BLOCK_SIZE 12
1033 struct __attribute__ ((__packed__)) bin_messagetable
1035 bfd_byte cblocks[4];
1036 struct bin_messagetable_block items[1];
1038 #define BIN_MESSAGETABLE_SIZE 8
1040 typedef struct rc_toolbar
1042 rc_uint_type button_width;
1043 rc_uint_type button_height;
1044 rc_uint_type nitems;
1045 rc_toolbar_item *items;
1046 } rc_toolbar;
1048 struct __attribute__ ((__packed__)) bin_toolbar
1050 bfd_byte button_width[4];
1051 bfd_byte button_height[4];
1052 bfd_byte nitems[4];
1053 /* { bfd_byte id[4]; } * nitems; */
1055 #define BIN_TOOLBAR_SIZE 12
1057 extern int target_is_bigendian;
1059 typedef struct windres_bfd
1061 bfd *abfd;
1062 asection *sec;
1063 rc_uint_type kind : 4;
1064 } windres_bfd;
1066 #define WR_KIND_TARGET 0
1067 #define WR_KIND_BFD 1
1068 #define WR_KIND_BFD_BIN_L 2
1069 #define WR_KIND_BFD_BIN_B 3
1071 #define WR_KIND(PTR) (PTR)->kind
1072 #define WR_SECTION(PTR) (PTR)->sec
1073 #define WR_BFD(PTR) (PTR)->abfd
1075 extern void set_windres_bfd_content (windres_bfd *, const void *, rc_uint_type, rc_uint_type);
1076 extern void get_windres_bfd_content (windres_bfd *, void *, rc_uint_type, rc_uint_type);
1078 extern void windres_put_8 (windres_bfd *, void *, rc_uint_type);
1079 extern void windres_put_16 (windres_bfd *, void *, rc_uint_type);
1080 extern void windres_put_32 (windres_bfd *, void *, rc_uint_type);
1081 extern rc_uint_type windres_get_8 (windres_bfd *, const void *, rc_uint_type);
1082 extern rc_uint_type windres_get_16 (windres_bfd *, const void *, rc_uint_type);
1083 extern rc_uint_type windres_get_32 (windres_bfd *, const void *, rc_uint_type);
1085 extern void set_windres_bfd (windres_bfd *, bfd *, asection *, rc_uint_type);
1086 extern void set_windres_bfd_endianess (windres_bfd *, int);
1088 #endif