Commit | Line | Data |
---|---|---|
1d371d35 ILT |
1 | /* windres.h -- header file for windres program. |
2 | Copyright 1997 Free Software Foundation, Inc. | |
3 | Written by Ian Lance Taylor, Cygnus Support. | |
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 2 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., 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
21 | ||
22 | #include <ansidecl.h> | |
23 | ||
24 | /* This is the header file for the windres program. It defines | |
25 | structures and declares functions used within the program. */ | |
26 | ||
27 | /* We represent resources internally as a tree, similar to the tree | |
28 | used in the .rsrc section of a COFF file. The root is a | |
29 | res_directory structure. */ | |
30 | ||
31 | struct res_directory | |
32 | { | |
33 | /* Resource flags. According to the MS docs, this is currently | |
34 | always zero. */ | |
35 | unsigned long characteristics; | |
36 | /* Time/date stamp. */ | |
37 | unsigned long time; | |
38 | /* Major version number. */ | |
39 | unsigned short major; | |
40 | /* Minor version number. */ | |
41 | unsigned short minor; | |
42 | /* Directory entries. */ | |
43 | struct res_entry *entries; | |
44 | }; | |
45 | ||
46 | /* A resource ID is stored in a res_id structure. */ | |
47 | ||
48 | struct res_id | |
49 | { | |
50 | /* Non-zero if this entry has a name rather than an ID. */ | |
51 | unsigned int named : 1; | |
52 | union | |
53 | { | |
54 | /* If the named field is non-zero, this is the name. */ | |
55 | struct | |
56 | { | |
57 | /* Length of the name. */ | |
58 | unsigned short length; | |
59 | /* Pointer to the name, which is a Unicode string. */ | |
60 | unsigned short *name; | |
61 | } n; | |
62 | /* If the named field is zero, this is the ID. */ | |
63 | unsigned long id; | |
64 | } u; | |
65 | }; | |
66 | ||
67 | /* Each entry in the tree is a res_entry structure. We mix | |
68 | directories and resources because in a COFF file all entries in a | |
69 | directory are sorted together, whether the entries are | |
70 | subdirectories or resources. */ | |
71 | ||
72 | struct res_entry | |
73 | { | |
74 | /* Next entry. */ | |
75 | struct res_entry *next; | |
76 | /* Resource ID. */ | |
77 | struct res_id id; | |
78 | /* Non-zero if this entry is a subdirectory rather than a leaf. */ | |
79 | unsigned int subdir : 1; | |
80 | union | |
81 | { | |
82 | /* If the subdir field is non-zero, this is a pointer to the | |
83 | subdirectory. */ | |
84 | struct res_directory *dir; | |
85 | /* If the subdir field is zero, this is a pointer to the resource | |
86 | data. */ | |
87 | struct res_resource *res; | |
88 | } u; | |
89 | }; | |
90 | ||
91 | /* Types of resources. */ | |
92 | ||
93 | enum res_type | |
94 | { | |
95 | RES_TYPE_UNINITIALIZED, | |
96 | RES_TYPE_ACCELERATOR, | |
97 | RES_TYPE_BITMAP, | |
98 | RES_TYPE_CURSOR, | |
99 | RES_TYPE_GROUP_CURSOR, | |
100 | RES_TYPE_DIALOG, | |
101 | RES_TYPE_FONT, | |
102 | RES_TYPE_FONTDIR, | |
103 | RES_TYPE_ICON, | |
104 | RES_TYPE_GROUP_ICON, | |
105 | RES_TYPE_MENU, | |
106 | RES_TYPE_MESSAGETABLE, | |
107 | RES_TYPE_RCDATA, | |
108 | RES_TYPE_STRINGTABLE, | |
109 | RES_TYPE_USERDATA, | |
110 | RES_TYPE_VERSIONINFO | |
111 | }; | |
112 | ||
113 | /* A res file and a COFF file store information differently. The | |
114 | res_info structures holds data which in a res file is stored with | |
115 | each resource, but in a COFF file is stored elsewhere. */ | |
116 | ||
117 | struct res_res_info | |
118 | { | |
119 | /* Language. In a COFF file, the third level of the directory is | |
120 | keyed by the language, so the language of a resource is defined | |
121 | by its location in the resource tree. */ | |
122 | unsigned short language; | |
123 | /* Characteristics of the resource. Entirely user defined. In a | |
124 | COFF file, the res_directory structure has a characteristics | |
125 | field, but I don't know if it's related to the one in the res | |
126 | file. */ | |
127 | unsigned long characteristics; | |
128 | /* Version of the resource. Entirely user defined. In a COFF file, | |
129 | the res_directory structure has a characteristics field, but I | |
130 | don't know if it's related to the one in the res file. */ | |
131 | unsigned long version; | |
132 | /* Memory flags. This is a combination of the MEMFLAG values | |
133 | defined below. Most of these values are historical, and are not | |
134 | meaningful for win32. I don't think there is any way to store | |
135 | this information in a COFF file. */ | |
136 | unsigned short memflags; | |
137 | }; | |
138 | ||
139 | /* Each resource in a COFF file has some information which can does | |
140 | not appear in a res file. */ | |
141 | ||
142 | struct res_coff_info | |
143 | { | |
144 | /* The code page used for the data. I don't really know what this | |
145 | should be. */ | |
146 | unsigned long codepage; | |
147 | /* A resource entry in a COFF file has a reserved field, which we | |
148 | record here when reading a COFF file. When writing a COFF file, | |
149 | we set this field to zero. */ | |
150 | unsigned long reserved; | |
151 | }; | |
152 | ||
153 | /* Resource data is stored in a res_resource structure. */ | |
154 | ||
155 | struct res_resource | |
156 | { | |
157 | /* The type of resource. */ | |
158 | enum res_type type; | |
159 | /* The data for the resource. */ | |
160 | union | |
161 | { | |
162 | struct | |
163 | { | |
164 | unsigned long length; | |
165 | unsigned char *data; | |
166 | } data; | |
167 | struct accelerator *acc; | |
168 | struct cursor *cursor; | |
169 | struct group_cursor *group_cursor; | |
170 | struct dialog *dialog; | |
171 | struct fontdir *fontdir; | |
172 | struct group_icon *group_icon; | |
173 | struct menuitem *menu; | |
174 | struct rcdata_data *rcdata; | |
175 | struct stringtable *stringtable; | |
176 | struct rcdata_data *userdata; | |
177 | struct versioninfo *versioninfo; | |
178 | } u; | |
179 | /* Information from a res file. */ | |
180 | struct res_res_info res_info; | |
181 | /* Information from a COFF file. */ | |
182 | struct res_coff_info coff_info; | |
183 | }; | |
184 | ||
185 | /* Memory flags in the memflags field of a struct res_resource. */ | |
186 | ||
187 | #define MEMFLAG_MOVEABLE 0x10 | |
188 | #define MEMFLAG_PURE 0x20 | |
189 | #define MEMFLAG_PRELOAD 0x40 | |
190 | #define MEMFLAG_DISCARDABLE 0x1000 | |
191 | ||
192 | /* Standard resource type codes. These are used in the ID field of a | |
193 | res_entry structure. */ | |
194 | ||
195 | #define RT_CURSOR 1 | |
196 | #define RT_BITMAP 2 | |
197 | #define RT_ICON 3 | |
198 | #define RT_MENU 4 | |
199 | #define RT_DIALOG 5 | |
200 | #define RT_STRING 6 | |
201 | #define RT_FONTDIR 7 | |
202 | #define RT_FONT 8 | |
203 | #define RT_ACCELERATORS 9 | |
204 | #define RT_RCDATA 10 | |
205 | #define RT_MESSAGETABLE 11 | |
206 | #define RT_GROUP_CURSOR 12 | |
207 | #define RT_GROUP_ICON 14 | |
208 | #define RT_VERSION 16 | |
209 | #define RT_DLGINCLUDE 17 | |
210 | #define RT_PLUGPLAY 18 | |
211 | #define RT_VXD 19 | |
212 | #define RT_ANICURSOR 21 | |
213 | #define RT_ANIICON 22 | |
214 | ||
215 | /* An accelerator resource is a linked list of these structures. */ | |
216 | ||
217 | struct accelerator | |
218 | { | |
219 | /* Next accelerator. */ | |
220 | struct accelerator *next; | |
221 | /* Flags. A combination of the ACC values defined below. */ | |
222 | unsigned short flags; | |
223 | /* Key value. */ | |
224 | unsigned short key; | |
225 | /* Resource ID. */ | |
226 | unsigned short id; | |
227 | }; | |
228 | ||
229 | /* Accelerator flags in the flags field of a struct accelerator. | |
230 | These are the same values that appear in a res file. I hope. */ | |
231 | ||
232 | #define ACC_VIRTKEY 0x01 | |
233 | #define ACC_NOINVERT 0x02 | |
234 | #define ACC_SHIFT 0x04 | |
235 | #define ACC_CONTROL 0x08 | |
236 | #define ACC_ALT 0x10 | |
237 | #define ACC_LAST 0x80 | |
238 | ||
239 | /* A cursor resource. */ | |
240 | ||
241 | struct cursor | |
242 | { | |
243 | /* X coordinate of hotspot. */ | |
244 | short xhotspot; | |
245 | /* Y coordinate of hotspot. */ | |
246 | short yhotspot; | |
247 | /* Length of bitmap data. */ | |
248 | unsigned long length; | |
249 | /* Data. */ | |
250 | unsigned char *data; | |
251 | }; | |
252 | ||
253 | /* A group_cursor resource is a list of group_cursor structures. */ | |
254 | ||
255 | struct group_cursor | |
256 | { | |
257 | /* Next cursor in group. */ | |
258 | struct group_cursor *next; | |
259 | /* Width. */ | |
260 | unsigned short width; | |
261 | /* Height. */ | |
262 | unsigned short height; | |
263 | /* Planes. */ | |
264 | unsigned short planes; | |
265 | /* Bits per pixel. */ | |
266 | unsigned short bits; | |
267 | /* Number of bytes in cursor resource. */ | |
268 | unsigned long bytes; | |
269 | /* Index of cursor resource. */ | |
270 | unsigned short index; | |
271 | }; | |
272 | ||
273 | /* A dialog resource. */ | |
274 | ||
275 | struct dialog | |
276 | { | |
277 | /* Basic window style. */ | |
278 | unsigned long style; | |
279 | /* Extended window style. */ | |
280 | unsigned long exstyle; | |
281 | /* X coordinate. */ | |
282 | unsigned short x; | |
283 | /* Y coordinate. */ | |
284 | unsigned short y; | |
285 | /* Width. */ | |
286 | unsigned short width; | |
287 | /* Height. */ | |
288 | unsigned short height; | |
289 | /* Menu name. */ | |
290 | struct res_id menu; | |
291 | /* Class name. */ | |
292 | struct res_id class; | |
293 | /* Caption. */ | |
294 | char *caption; | |
295 | /* Font point size. */ | |
296 | unsigned short pointsize; | |
297 | /* Font name. */ | |
298 | char *font; | |
299 | /* Extended information for a dialogex. */ | |
300 | struct dialog_ex *ex; | |
301 | /* Controls. */ | |
302 | struct dialog_control *controls; | |
303 | }; | |
304 | ||
305 | /* An extended dialog has additional information. */ | |
306 | ||
307 | struct dialog_ex | |
308 | { | |
309 | /* Help ID. */ | |
310 | unsigned long help; | |
311 | /* Font weight. */ | |
312 | unsigned short weight; | |
313 | /* Whether the font is italic. */ | |
314 | unsigned short italic; | |
315 | }; | |
316 | ||
317 | /* Window style flags, from the winsup Defines.h header file. These | |
318 | can appear in the style field of a struct dialog or a struct | |
319 | dialog_control. */ | |
320 | ||
321 | #define CW_USEDEFAULT (0x80000000) | |
322 | #define WS_BORDER (0x800000L) | |
323 | #define WS_CAPTION (0xc00000L) | |
324 | #define WS_CHILD (0x40000000L) | |
325 | #define WS_CHILDWINDOW (0x40000000L) | |
326 | #define WS_CLIPCHILDREN (0x2000000L) | |
327 | #define WS_CLIPSIBLINGS (0x4000000L) | |
328 | #define WS_DISABLED (0x8000000L) | |
329 | #define WS_DLGFRAME (0x400000L) | |
330 | #define WS_GROUP (0x20000L) | |
331 | #define WS_HSCROLL (0x100000L) | |
332 | #define WS_ICONIC (0x20000000L) | |
333 | #define WS_MAXIMIZE (0x1000000L) | |
334 | #define WS_MAXIMIZEBOX (0x10000L) | |
335 | #define WS_MINIMIZE (0x20000000L) | |
336 | #define WS_MINIMIZEBOX (0x20000L) | |
337 | #define WS_OVERLAPPED (0L) | |
338 | #define WS_OVERLAPPEDWINDOW (0xcf0000L) | |
339 | #define WS_POPUP (0x80000000L) | |
340 | #define WS_POPUPWINDOW (0x80880000L) | |
341 | #define WS_SIZEBOX (0x40000L) | |
342 | #define WS_SYSMENU (0x80000L) | |
343 | #define WS_TABSTOP (0x10000L) | |
344 | #define WS_THICKFRAME (0x40000L) | |
345 | #define WS_TILED (0L) | |
346 | #define WS_TILEDWINDOW (0xcf0000L) | |
347 | #define WS_VISIBLE (0x10000000L) | |
348 | #define WS_VSCROLL (0x200000L) | |
349 | #define MDIS_ALLCHILDSTYLES (0x1) | |
350 | #define BS_3STATE (0x5L) | |
351 | #define BS_AUTO3STATE (0x6L) | |
352 | #define BS_AUTOCHECKBOX (0x3L) | |
353 | #define BS_AUTORADIOBUTTON (0x9L) | |
354 | #define BS_BITMAP (0x80L) | |
355 | #define BS_BOTTOM (0x800L) | |
356 | #define BS_CENTER (0x300L) | |
357 | #define BS_CHECKBOX (0x2L) | |
358 | #define BS_DEFPUSHBUTTON (0x1L) | |
359 | #define BS_GROUPBOX (0x7L) | |
360 | #define BS_ICON (0x40L) | |
361 | #define BS_LEFT (0x100L) | |
362 | #define BS_LEFTTEXT (0x20L) | |
363 | #define BS_MULTILINE (0x2000L) | |
364 | #define BS_NOTIFY (0x4000L) | |
365 | #define BS_OWNERDRAW (0xbL) | |
366 | #define BS_PUSHBOX (0xcL) /* FIXME! What should this be? */ | |
367 | #define BS_PUSHBUTTON (0L) | |
368 | #define BS_PUSHLIKE (0x1000L) | |
369 | #define BS_RADIOBUTTON (0x4L) | |
370 | #define BS_RIGHT (0x200L) | |
371 | #define BS_RIGHTBUTTON (0x20L) | |
372 | #define BS_TEXT (0L) | |
373 | #define BS_TOP (0x400L) | |
374 | #define BS_USERBUTTON (0x8L) | |
375 | #define BS_VCENTER (0xc00L) | |
376 | #define CBS_AUTOHSCROLL (0x40L) | |
377 | #define CBS_DISABLENOSCROLL (0x800L) | |
378 | #define CBS_DROPDOWN (0x2L) | |
379 | #define CBS_DROPDOWNLIST (0x3L) | |
380 | #define CBS_HASSTRINGS (0x200L) | |
381 | #define CBS_LOWERCASE (0x4000L) | |
382 | #define CBS_NOINTEGRALHEIGHT (0x400L) | |
383 | #define CBS_OEMCONVERT (0x80L) | |
384 | #define CBS_OWNERDRAWFIXED (0x10L) | |
385 | #define CBS_OWNERDRAWVARIABLE (0x20L) | |
386 | #define CBS_SIMPLE (0x1L) | |
387 | #define CBS_SORT (0x100L) | |
388 | #define CBS_UPPERCASE (0x2000L) | |
389 | #define ES_AUTOHSCROLL (0x80L) | |
390 | #define ES_AUTOVSCROLL (0x40L) | |
391 | #define ES_CENTER (0x1L) | |
392 | #define ES_LEFT (0L) | |
393 | #define ES_LOWERCASE (0x10L) | |
394 | #define ES_MULTILINE (0x4L) | |
395 | #define ES_NOHIDESEL (0x100L) | |
396 | #define ES_NUMBER (0x2000L) | |
397 | #define ES_OEMCONVERT (0x400L) | |
398 | #define ES_PASSWORD (0x20L) | |
399 | #define ES_READONLY (0x800L) | |
400 | #define ES_RIGHT (0x2L) | |
401 | #define ES_UPPERCASE (0x8L) | |
402 | #define ES_WANTRETURN (0x1000L) | |
403 | #define LBS_DISABLENOSCROLL (0x1000L) | |
404 | #define LBS_EXTENDEDSEL (0x800L) | |
405 | #define LBS_HASSTRINGS (0x40L) | |
406 | #define LBS_MULTICOLUMN (0x200L) | |
407 | #define LBS_MULTIPLESEL (0x8L) | |
408 | #define LBS_NODATA (0x2000L) | |
409 | #define LBS_NOINTEGRALHEIGHT (0x100L) | |
410 | #define LBS_NOREDRAW (0x4L) | |
411 | #define LBS_NOSEL (0x4000L) | |
412 | #define LBS_NOTIFY (0x1L) | |
413 | #define LBS_OWNERDRAWFIXED (0x10L) | |
414 | #define LBS_OWNERDRAWVARIABLE (0x20L) | |
415 | #define LBS_SORT (0x2L) | |
416 | #define LBS_STANDARD (0xa00003L) | |
417 | #define LBS_USETABSTOPS (0x80L) | |
418 | #define LBS_WANTKEYBOARDINPUT (0x400L) | |
419 | #define SBS_BOTTOMALIGN (0x4L) | |
420 | #define SBS_HORZ (0L) | |
421 | #define SBS_LEFTALIGN (0x2L) | |
422 | #define SBS_RIGHTALIGN (0x4L) | |
423 | #define SBS_SIZEBOX (0x8L) | |
424 | #define SBS_SIZEBOXBOTTOMRIGHTALIGN (0x4L) | |
425 | #define SBS_SIZEBOXTOPLEFTALIGN (0x2L) | |
426 | #define SBS_SIZEGRIP (0x10L) | |
427 | #define SBS_TOPALIGN (0x2L) | |
428 | #define SBS_VERT (0x1L) | |
429 | #define SS_BITMAP (0xeL) | |
430 | #define SS_BLACKFRAME (0x7L) | |
431 | #define SS_BLACKRECT (0x4L) | |
432 | #define SS_CENTER (0x1L) | |
433 | #define SS_CENTERIMAGE (0x200L) | |
434 | #define SS_ENHMETAFILE (0xfL) | |
435 | #define SS_ETCHEDFRAME (0x12L) | |
436 | #define SS_ETCHEDHORZ (0x10L) | |
437 | #define SS_ETCHEDVERT (0x11L) | |
438 | #define SS_GRAYFRAME (0x8L) | |
439 | #define SS_GRAYRECT (0x5L) | |
440 | #define SS_ICON (0x3L) | |
441 | #define SS_LEFT (0L) | |
442 | #define SS_LEFTNOWORDWRAP (0xcL) | |
443 | #define SS_NOPREFIX (0x80L) | |
444 | #define SS_NOTIFY (0x100L) | |
445 | #define SS_OWNERDRAW (0xdL) | |
446 | #define SS_REALSIZEIMAGE (0x800L) | |
447 | #define SS_RIGHT (0x2L) | |
448 | #define SS_RIGHTJUST (0x400L) | |
449 | #define SS_SIMPLE (0xbL) | |
450 | #define SS_SUNKEN (0x1000L) | |
451 | #define SS_USERITEM (0xaL) | |
452 | #define SS_WHITEFRAME (0x9L) | |
453 | #define SS_WHITERECT (0x6L) | |
454 | #define DS_3DLOOK (0x4L) | |
455 | #define DS_ABSALIGN (0x1L) | |
456 | #define DS_CENTER (0x800L) | |
457 | #define DS_CENTERMOUSE (0x1000L) | |
458 | #define DS_CONTEXTHELP (0x2000L) | |
459 | #define DS_CONTROL (0x400L) | |
460 | #define DS_FIXEDSYS (0x8L) | |
461 | #define DS_LOCALEDIT (0x20L) | |
462 | #define DS_MODALFRAME (0x80L) | |
463 | #define DS_NOFAILCREATE (0x10L) | |
464 | #define DS_NOIDLEMSG (0x100L) | |
465 | #define DS_SETFONT (0x40L) | |
466 | #define DS_SETFOREGROUND (0x200L) | |
467 | #define DS_SYSMODAL (0x2L) | |
468 | ||
469 | /* A dialog control. */ | |
470 | ||
471 | struct dialog_control | |
472 | { | |
473 | /* Next control. */ | |
474 | struct dialog_control *next; | |
475 | /* ID. */ | |
476 | unsigned short id; | |
477 | /* Style. */ | |
478 | unsigned long style; | |
479 | /* Extended style. */ | |
480 | unsigned long exstyle; | |
481 | /* X coordinate. */ | |
482 | unsigned short x; | |
483 | /* Y coordinate. */ | |
484 | unsigned short y; | |
485 | /* Width. */ | |
486 | unsigned short width; | |
487 | /* Height. */ | |
488 | unsigned short height; | |
489 | /* Class name. */ | |
490 | struct res_id class; | |
491 | /* Associated text. */ | |
492 | struct res_id text; | |
493 | /* Extra data for the window procedure. */ | |
494 | struct rcdata_data *data; | |
495 | /* Help ID. Only used in an extended dialog. */ | |
496 | unsigned long help; | |
497 | }; | |
498 | ||
499 | /* Control classes. These can be used as the ID field in a struct | |
500 | dialog_control. */ | |
501 | ||
502 | #define CTL_BUTTON 0x80 | |
503 | #define CTL_EDIT 0x81 | |
504 | #define CTL_STATIC 0x82 | |
505 | #define CTL_LISTBOX 0x83 | |
506 | #define CTL_SCROLLBAR 0x84 | |
507 | #define CTL_COMBOBOX 0x85 | |
508 | ||
509 | /* A fontdir resource is a list of fontdir structures. */ | |
510 | ||
511 | struct fontdir | |
512 | { | |
513 | struct fontdir *next; | |
514 | /* Index of font entry. */ | |
515 | short index; | |
516 | /* Length of font information. */ | |
517 | unsigned long length; | |
518 | /* Font information. */ | |
519 | unsigned char *data; | |
520 | }; | |
521 | ||
522 | /* A group_icon resource is a list of group_icon structures. */ | |
523 | ||
524 | struct group_icon | |
525 | { | |
526 | /* Next icon in group. */ | |
527 | struct group_icon *next; | |
528 | /* Width. */ | |
529 | unsigned char width; | |
530 | /* Height. */ | |
531 | unsigned char height; | |
532 | /* Color count. */ | |
533 | unsigned char colors; | |
534 | /* Planes. */ | |
535 | unsigned short planes; | |
536 | /* Bits per pixel. */ | |
537 | unsigned short bits; | |
538 | /* Number of bytes in cursor resource. */ | |
539 | unsigned long bytes; | |
540 | /* Index of cursor resource. */ | |
541 | unsigned short index; | |
542 | }; | |
543 | ||
544 | /* A menu resource is a list of menuitem structures. */ | |
545 | ||
546 | struct menuitem | |
547 | { | |
548 | /* Next menuitem. */ | |
549 | struct menuitem *next; | |
550 | /* Type. In a normal menu, rather than a menuex, this is the flags | |
551 | field. */ | |
552 | unsigned long type; | |
553 | /* State. This is only used in a menuex. */ | |
554 | unsigned long state; | |
555 | /* Id. */ | |
556 | unsigned short id; | |
557 | /* Text. */ | |
558 | char *text; | |
559 | /* Popup menu items for a popup. */ | |
560 | struct menuitem *popup; | |
561 | /* Help ID. This is only used in a menuex. */ | |
562 | unsigned long help; | |
563 | }; | |
564 | ||
565 | /* Menu item flags. These can appear in the flags field of a struct | |
566 | menuitem. */ | |
567 | ||
568 | #define MENUITEM_GRAYED 0x001 | |
569 | #define MENUITEM_INACTIVE 0x002 | |
570 | #define MENUITEM_BITMAP 0x004 | |
571 | #define MENUITEM_OWNERDRAW 0x100 | |
572 | #define MENUITEM_CHECKED 0x008 | |
573 | #define MENUITEM_POPUP 0x010 | |
574 | #define MENUITEM_MENUBARBREAK 0x020 | |
575 | #define MENUITEM_MENUBREAK 0x040 | |
576 | #define MENUITEM_HELP 0x4000 | |
577 | ||
578 | /* An rcdata resource is a pointer to an rcdata_data structure. */ | |
579 | ||
580 | struct rcdata_data | |
581 | { | |
582 | /* First data item. */ | |
583 | struct rcdata_item *first; | |
584 | /* Last data item. */ | |
585 | struct rcdata_item *last; | |
586 | }; | |
587 | ||
588 | /* For an rcdata resource we keep a list of rcdata_item structures. */ | |
589 | ||
590 | struct rcdata_item | |
591 | { | |
592 | /* Next data item. */ | |
593 | struct rcdata_item *next; | |
594 | /* Type of data. */ | |
595 | enum | |
596 | { | |
597 | RCDATA_WORD, | |
598 | RCDATA_DWORD, | |
599 | RCDATA_STRING, | |
600 | RCDATA_WSTRING, | |
601 | RCDATA_BUFFER | |
602 | } type; | |
603 | union | |
604 | { | |
605 | unsigned int word; | |
606 | unsigned long dword; | |
607 | char *string; | |
608 | unsigned short *wstring; | |
609 | struct | |
610 | { | |
611 | unsigned long length; | |
612 | unsigned char *data; | |
613 | } buffer; | |
614 | } u; | |
615 | }; | |
616 | ||
617 | /* A stringtable resource is a pointer to a stringtable structure. */ | |
618 | ||
619 | struct stringtable | |
620 | { | |
621 | /* Each stringtable resource is a list of 16 unicode strings. */ | |
622 | struct | |
623 | { | |
624 | /* Length of string. */ | |
625 | unsigned short length; | |
626 | /* String data if length > 0. */ | |
627 | unsigned short *string; | |
628 | } strings[16]; | |
629 | }; | |
630 | ||
631 | /* A versioninfo resource points to a versioninfo structure. */ | |
632 | ||
633 | struct versioninfo | |
634 | { | |
635 | /* Fixed version information. */ | |
636 | struct fixed_versioninfo *fixed; | |
637 | /* Variable version information. */ | |
638 | struct ver_info *var; | |
639 | }; | |
640 | ||
641 | /* The fixed portion of a versioninfo resource. */ | |
642 | ||
643 | struct fixed_versioninfo | |
644 | { | |
645 | /* The file version, which is two 32 bit integers. */ | |
646 | unsigned long file_version_ms; | |
647 | unsigned long file_version_ls; | |
648 | /* The product version, which is two 32 bit integers. */ | |
649 | unsigned long product_version_ms; | |
650 | unsigned long product_version_ls; | |
651 | /* The file flags mask. */ | |
652 | unsigned long file_flags_mask; | |
653 | /* The file flags. */ | |
654 | unsigned long file_flags; | |
655 | /* The OS type. */ | |
656 | unsigned long file_os; | |
657 | /* The file type. */ | |
658 | unsigned long file_type; | |
659 | /* The file subtype. */ | |
660 | unsigned long file_subtype; | |
661 | /* The date, which in Windows is two 32 bit integers. */ | |
662 | unsigned long file_date_ms; | |
663 | unsigned long file_date_ls; | |
664 | }; | |
665 | ||
666 | /* A list of variable version information. */ | |
667 | ||
668 | struct ver_info | |
669 | { | |
670 | /* Next item. */ | |
671 | struct ver_info *next; | |
672 | /* Type of data. */ | |
673 | enum { VERINFO_STRING, VERINFO_VAR } type; | |
674 | union | |
675 | { | |
676 | /* StringFileInfo data. */ | |
677 | struct | |
678 | { | |
679 | /* Language. */ | |
680 | unsigned short *language; | |
681 | /* Strings. */ | |
682 | struct ver_stringinfo *strings; | |
683 | } string; | |
684 | /* VarFileInfo data. */ | |
685 | struct | |
686 | { | |
687 | /* Key. */ | |
688 | unsigned short *key; | |
689 | /* Values. */ | |
690 | struct ver_varinfo *var; | |
691 | } var; | |
692 | } u; | |
693 | }; | |
694 | ||
695 | /* A list of string version information. */ | |
696 | ||
697 | struct ver_stringinfo | |
698 | { | |
699 | /* Next string. */ | |
700 | struct ver_stringinfo *next; | |
701 | /* Key. */ | |
702 | unsigned short *key; | |
703 | /* Value. */ | |
704 | unsigned short *value; | |
705 | }; | |
706 | ||
707 | /* A list of variable version information. */ | |
708 | ||
709 | struct ver_varinfo | |
710 | { | |
711 | /* Next item. */ | |
712 | struct ver_varinfo *next; | |
713 | /* Language ID. */ | |
714 | unsigned short language; | |
715 | /* Character set ID. */ | |
716 | unsigned short charset; | |
717 | }; | |
718 | ||
719 | /* Function declarations. */ | |
720 | ||
721 | extern struct res_directory *read_rc_file | |
722 | PARAMS ((const char *, const char *, const char *, int)); | |
723 | extern struct res_directory *read_res_file PARAMS ((const char *)); | |
724 | extern struct res_directory *read_coff_rsrc | |
725 | PARAMS ((const char *, const char *)); | |
726 | extern void write_rc_file | |
727 | PARAMS ((const char *, const struct res_directory *)); | |
728 | extern void write_res_file | |
729 | PARAMS ((const char *, const struct res_directory *)); | |
730 | extern void write_coff_file | |
731 | PARAMS ((const char *, const char *, const struct res_directory *)); | |
732 | ||
733 | extern FILE *open_file_search | |
734 | PARAMS ((const char *, const char *, const char *, char **)); | |
735 | ||
736 | /* Resource ID handling. */ | |
737 | ||
738 | extern int res_id_cmp PARAMS ((struct res_id, struct res_id)); | |
739 | extern void res_id_print PARAMS ((FILE *, struct res_id, int)); | |
740 | extern void res_ids_print PARAMS ((FILE *, int, const struct res_id *)); | |
741 | extern void res_string_to_id PARAMS ((struct res_id *, const char *)); | |
742 | ||
743 | /* Unicode support. */ | |
744 | ||
745 | extern void unicode_from_ascii | |
746 | PARAMS ((unsigned short *, unsigned short **, const char *)); | |
747 | extern void unicode_print PARAMS ((FILE *, const unsigned short *, int)); | |
748 | ||
749 | /* Manipulation of the resource tree. */ | |
750 | ||
751 | extern struct res_resource *define_resource | |
752 | PARAMS ((struct res_directory **, int, const struct res_id *, int)); | |
753 | extern struct res_resource *define_standard_resource | |
754 | PARAMS ((struct res_directory **, int, struct res_id, int, int)); | |
755 | ||
756 | extern int extended_dialog PARAMS ((const struct dialog *)); | |
757 | extern int extended_menu PARAMS ((const struct menuitem *)); | |
758 | ||
759 | /* Communication between the rc file support and the parser and lexer. */ | |
760 | ||
761 | extern int yydebug; | |
762 | extern FILE *yyin; | |
763 | extern char *rc_filename; | |
764 | extern int rc_lineno; | |
765 | extern int yyparse PARAMS ((void)); | |
766 | extern int yylex PARAMS ((void)); | |
767 | extern void yyerror PARAMS ((const char *)); | |
768 | extern void rcparse_warning PARAMS ((const char *)); | |
769 | extern void rcparse_set_language PARAMS ((int)); | |
770 | ||
771 | extern void define_accelerator | |
772 | PARAMS ((struct res_id, const struct res_res_info *, struct accelerator *)); | |
773 | extern void define_bitmap | |
774 | PARAMS ((struct res_id, const struct res_res_info *, const char *)); | |
775 | extern void define_cursor | |
776 | PARAMS ((struct res_id, const struct res_res_info *, const char *)); | |
777 | extern void define_dialog | |
778 | PARAMS ((struct res_id, const struct res_res_info *, const struct dialog *)); | |
779 | extern struct dialog_control *define_control | |
780 | PARAMS ((char *, unsigned long, unsigned long, unsigned long, | |
781 | unsigned long, unsigned long, unsigned long, unsigned long, | |
782 | unsigned long)); | |
783 | extern void define_font | |
784 | PARAMS ((struct res_id, const struct res_res_info *, const char *)); | |
785 | extern void define_icon | |
786 | PARAMS ((struct res_id, const struct res_res_info *, const char *)); | |
787 | extern void define_menu | |
788 | PARAMS ((struct res_id, const struct res_res_info *, struct menuitem *)); | |
789 | extern struct menuitem *define_menuitem | |
790 | PARAMS ((char *, int, unsigned long, unsigned long, unsigned long, | |
791 | struct menuitem *)); | |
792 | extern void define_messagetable | |
793 | PARAMS ((struct res_id, const struct res_res_info *, const char *)); | |
794 | extern void define_rcdata | |
795 | PARAMS ((struct res_id, const struct res_res_info *, struct rcdata_data *)); | |
796 | extern struct rcdata_data *append_rcdata_item | |
797 | PARAMS ((struct rcdata_data *, struct rcdata_item *)); | |
798 | extern struct rcdata_data *append_rcdata_string | |
799 | PARAMS ((struct rcdata_data *, char *)); | |
800 | extern struct rcdata_data *append_rcdata_number | |
801 | PARAMS ((struct rcdata_data *, unsigned long, int)); | |
802 | extern void define_stringtable | |
803 | PARAMS ((const struct res_res_info *, unsigned long, char *)); | |
804 | extern void define_user_data | |
805 | PARAMS ((struct res_id, struct res_id, const struct res_res_info *, | |
806 | struct rcdata_data *)); | |
807 | extern void define_user_file | |
808 | PARAMS ((struct res_id, struct res_id, const struct res_res_info *, | |
809 | const char *)); | |
810 | extern void define_versioninfo | |
811 | PARAMS ((struct res_id, int, struct fixed_versioninfo *, | |
812 | struct ver_info *)); | |
813 | extern struct ver_info *append_ver_stringfileinfo | |
814 | PARAMS ((struct ver_info *, char *, struct ver_stringinfo *)); | |
815 | extern struct ver_info *append_ver_varfileinfo | |
816 | PARAMS ((struct ver_info *, char *, struct ver_varinfo *)); | |
817 | extern struct ver_stringinfo *append_verval | |
818 | PARAMS ((struct ver_stringinfo *, char *, char *)); | |
819 | extern struct ver_varinfo *append_vertrans | |
820 | PARAMS ((struct ver_varinfo *, unsigned long, unsigned long)); |