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