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