mf/samplegrabber: Handle paused state.
[wine.git] / tools / wrc / wrctypes.h
blob375455ea97395caeed60e06ffd951d7e3ef95dca
1 /*
2 * General type definitions
4 * Copyright 1998 Bertho A. Stultiens (BS)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WRC_WRCTYPES_H
22 #define __WRC_WRCTYPES_H
24 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winnls.h"
29 #ifndef VS_FFI_SIGNATURE
30 #include "winver.h"
31 #endif
33 /* Memory/load flags */
34 #define WRC_MO_MOVEABLE 0x0010
35 #define WRC_MO_PURE 0x0020
36 #define WRC_MO_PRELOAD 0x0040
37 #define WRC_MO_DISCARDABLE 0x1000
39 /* Resource type IDs */
40 #define WRC_RT_CURSOR (1)
41 #define WRC_RT_BITMAP (2)
42 #define WRC_RT_ICON (3)
43 #define WRC_RT_MENU (4)
44 #define WRC_RT_DIALOG (5)
45 #define WRC_RT_STRING (6)
46 #define WRC_RT_FONTDIR (7)
47 #define WRC_RT_FONT (8)
48 #define WRC_RT_ACCELERATOR (9)
49 #define WRC_RT_RCDATA (10)
50 #define WRC_RT_MESSAGETABLE (11)
51 #define WRC_RT_GROUP_CURSOR (12)
52 #define WRC_RT_GROUP_ICON (14)
53 #define WRC_RT_VERSION (16)
54 #define WRC_RT_DLGINCLUDE (17)
55 #define WRC_RT_PLUGPLAY (19)
56 #define WRC_RT_VXD (20)
57 #define WRC_RT_ANICURSOR (21)
58 #define WRC_RT_ANIICON (22)
59 #define WRC_RT_HTML (23)
60 #define WRC_RT_DLGINIT (240)
61 #define WRC_RT_TOOLBAR (241)
63 /* Default class type IDs */
64 #define CT_BUTTON 0x80
65 #define CT_EDIT 0x81
66 #define CT_STATIC 0x82
67 #define CT_LISTBOX 0x83
68 #define CT_SCROLLBAR 0x84
69 #define CT_COMBOBOX 0x85
71 /* Byteordering defines */
72 #define WRC_BO_NATIVE 0x00
73 #define WRC_BO_LITTLE 0x01
74 #define WRC_BO_BIG 0x02
76 #define WRC_LOBYTE(w) ((WORD)(w) & 0xff)
77 #define WRC_HIBYTE(w) (((WORD)(w) >> 8) & 0xff)
78 #define WRC_LOWORD(d) ((DWORD)(d) & 0xffff)
79 #define WRC_HIWORD(d) (((DWORD)(d) >> 16) & 0xffff)
80 #define BYTESWAP_WORD(w) ((WORD)(((WORD)WRC_LOBYTE(w) << 8) + (WORD)WRC_HIBYTE(w)))
81 #define BYTESWAP_DWORD(d) ((DWORD)(((DWORD)BYTESWAP_WORD(WRC_LOWORD(d)) << 16) + ((DWORD)BYTESWAP_WORD(WRC_HIWORD(d)))))
83 typedef struct
85 const char *file;
86 int line;
87 int col;
88 } location_t;
90 /* Binary resource structure */
91 #define RES_BLOCKSIZE 512
93 typedef struct res {
94 unsigned int allocsize; /* Allocated datablock size */
95 unsigned int size; /* Actual size of data */
96 unsigned int dataidx; /* Tag behind the resource-header */
97 unsigned char *data;
98 } res_t;
100 /* Resource strings are slightly more complex because they include '\0' */
101 enum str_e {str_char, str_unicode};
103 typedef struct string {
104 int size;
105 enum str_e type;
106 union {
107 char *cstr;
108 WCHAR *wstr;
109 } str;
110 location_t loc;
111 } string_t;
113 /* Resources are identified either by name or by number */
114 enum name_e {name_str, name_ord};
116 typedef struct name_id {
117 union {
118 string_t *s_name;
119 int i_name;
120 } name;
121 enum name_e type;
122 } name_id_t;
124 /* Language definitions */
125 typedef struct language {
126 int id;
127 int sub;
128 } language_t;
130 typedef DWORD characts_t;
131 typedef DWORD version_t;
133 typedef struct lvc {
134 language_t *language;
135 version_t *version;
136 characts_t *characts;
137 } lvc_t;
139 typedef struct font_id {
140 string_t *name;
141 int size;
142 int weight;
143 int italic;
144 } font_id_t;
146 /* control styles */
147 typedef struct style {
148 DWORD or_mask;
149 DWORD and_mask;
150 } style_t;
152 /* resource types */
153 /* These are in the same order (and ordinal) as the RT_xxx
154 * defines. This is _required_.
155 * I rolled my own numbers for the win32 extension that are
156 * documented, but generate either old RT_xxx numbers, or
157 * don't have an ordinal associated (user type).
158 * I don't know any specs for those noted such, for that matter,
159 * I don't even know whether they can be generated other than by
160 * using a user-type resource.
162 enum res_e {
163 res_0 = 0,
164 res_cur,
165 res_bmp,
166 res_ico,
167 res_men,
168 res_dlg,
169 res_stt,
170 res_fntdir,
171 res_fnt,
172 res_acc,
173 res_rdt,
174 res_msg,
175 res_curg,
176 res_13, /* Hm, wonder why it's not used... */
177 res_icog,
178 res_15,
179 res_ver,
180 res_dlginc, /* Not implemented, no layout available */
181 res_18,
182 res_pnp, /* Not implemented, no layout available */
183 res_vxd, /* Not implemented, no layout available */
184 res_anicur,
185 res_aniico,
186 res_html, /* Not implemented, no layout available */
188 res_dlginit = WRC_RT_DLGINIT, /* 240 */
189 res_toolbar = WRC_RT_TOOLBAR, /* 241 */
191 res_usr = 256 + 6
194 /* Raw bytes in a row... */
195 typedef struct raw_data {
196 unsigned int size;
197 char *data;
198 lvc_t lvc; /* Localized data */
199 } raw_data_t;
201 /* Dialog structures */
202 typedef struct control {
203 struct control *next; /* List of controls */
204 struct control *prev;
205 name_id_t *ctlclass; /* ControlClass */
206 name_id_t *title; /* Title of control */
207 int id;
208 int x; /* Position */
209 int y;
210 int width; /* Size */
211 int height;
212 style_t *style; /* Style */
213 style_t *exstyle;
214 DWORD helpid; /* EX: */
215 int gotstyle; /* Used to determine whether the default */
216 int gotexstyle; /* styles must be set */
217 int gothelpid;
218 raw_data_t *extra; /* EX: number of extra bytes in resource */
219 } control_t;
221 typedef struct dialog {
222 DWORD memopt;
223 int x; /* Position */
224 int y;
225 int width; /* Size */
226 int height;
227 style_t *style; /* Style */
228 style_t *exstyle;
229 DWORD helpid; /* EX: */
230 int gotstyle; /* Used to determine whether the default */
231 int gotexstyle; /* styles must be set */
232 int gothelpid;
233 int is_ex;
234 name_id_t *menu;
235 name_id_t *dlgclass;
236 string_t *title;
237 font_id_t *font;
238 lvc_t lvc;
239 control_t *controls;
240 } dialog_t;
242 /* Menu structures */
243 typedef struct menu_item {
244 struct menu_item *next;
245 struct menu_item *prev;
246 struct menu_item *popup;
247 int id;
248 DWORD type;
249 DWORD state;
250 int helpid;
251 string_t *name;
252 int gotid;
253 int gottype;
254 int gotstate;
255 int gothelpid;
256 } menu_item_t;
258 typedef struct menu {
259 DWORD memopt;
260 lvc_t lvc;
261 int is_ex;
262 menu_item_t *items;
263 } menu_t;
265 typedef struct itemex_opt
267 int id;
268 DWORD type;
269 DWORD state;
270 int helpid;
271 int gotid;
272 int gottype;
273 int gotstate;
274 int gothelpid;
275 } itemex_opt_t;
278 * Font resources
280 typedef struct font {
281 DWORD memopt;
282 raw_data_t *data;
283 } font_t;
285 typedef struct fontdir {
286 DWORD memopt;
287 raw_data_t *data;
288 } fontdir_t;
291 * Icon resources
293 typedef struct icon_header {
294 WORD reserved; /* Don't know, should be 0 I guess */
295 WORD type; /* Always 1 for icons */
296 WORD count; /* Number of packed icons in resource */
297 } icon_header_t;
299 typedef struct icon_dir_entry {
300 BYTE width; /* From the SDK doc. */
301 BYTE height;
302 BYTE nclr;
303 BYTE reserved;
304 WORD planes;
305 WORD bits;
306 DWORD ressize;
307 DWORD offset;
308 } icon_dir_entry_t;
310 typedef struct icon {
311 struct icon *next;
312 struct icon *prev;
313 lvc_t lvc;
314 int id; /* Unique icon id within resource file */
315 int width; /* Field from the IconDirEntry */
316 int height;
317 int nclr;
318 int planes;
319 int bits;
320 raw_data_t *data;
321 } icon_t;
323 typedef struct icon_group {
324 DWORD memopt;
325 lvc_t lvc;
326 icon_t *iconlist;
327 int nicon;
328 } icon_group_t;
331 * Cursor resources
333 typedef struct cursor_header {
334 WORD reserved; /* Don't know, should be 0 I guess */
335 WORD type; /* Always 2 for cursors */
336 WORD count; /* Number of packed cursors in resource */
337 } cursor_header_t;
339 typedef struct cursor_dir_entry {
340 BYTE width; /* From the SDK doc. */
341 BYTE height;
342 BYTE nclr;
343 BYTE reserved;
344 WORD xhot;
345 WORD yhot;
346 DWORD ressize;
347 DWORD offset;
348 } cursor_dir_entry_t;
350 typedef struct cursor {
351 struct cursor *next;
352 struct cursor *prev;
353 lvc_t lvc;
354 int id; /* Unique icon id within resource file */
355 int width; /* Field from the CursorDirEntry */
356 int height;
357 int nclr;
358 int planes;
359 int bits;
360 int xhot;
361 int yhot;
362 raw_data_t *data;
363 } cursor_t;
365 typedef struct cursor_group {
366 DWORD memopt;
367 lvc_t lvc;
368 cursor_t *cursorlist;
369 int ncursor;
370 } cursor_group_t;
373 * Animated cursors and icons
375 typedef struct aniheader {
376 DWORD structsize; /* Header size (36 bytes) */
377 DWORD frames; /* Number of unique icons in this cursor */
378 DWORD steps; /* Number of blits before the animation cycles */
379 DWORD cx; /* reserved, must be 0? */
380 DWORD cy; /* reserved, must be 0? */
381 DWORD bitcount; /* reserved, must be 0? */
382 DWORD planes; /* reserved, must be 0? */
383 DWORD rate; /* Default rate (1/60th of a second) if "rate" not present */
384 DWORD flags; /* Animation flag (1==AF_ICON, although both icons and cursors set this) */
385 } aniheader_t;
387 typedef struct riff_tag {
388 BYTE tag[4];
389 DWORD size;
390 } riff_tag_t;
392 typedef struct ani_curico {
393 DWORD memopt;
394 raw_data_t *data;
395 } ani_curico_t;
397 typedef struct ani_any {
398 enum res_e type;
399 union {
400 ani_curico_t *ani;
401 cursor_group_t *curg;
402 icon_group_t *icog;
403 } u;
404 } ani_any_t;
407 * Bitmaps
409 typedef struct bitmap {
410 DWORD memopt;
411 raw_data_t *data;
412 } bitmap_t;
414 typedef struct html {
415 DWORD memopt;
416 raw_data_t *data;
417 } html_t;
419 typedef struct rcdata {
420 DWORD memopt;
421 raw_data_t *data;
422 } rcdata_t;
424 typedef struct {
425 DWORD memopt;
426 name_id_t *type;
427 raw_data_t *data;
428 } user_t;
431 * Messagetables
433 typedef struct msgtab_block {
434 DWORD idlo; /* Lowest id in the set */
435 DWORD idhi; /* Highest is in the set */
436 DWORD offset; /* Offset from resource start to first entry */
437 } msgtab_block_t;
439 typedef struct msgtab_entry {
440 WORD length; /* Length of the data in bytes */
441 WORD flags; /* 0 for char, 1 for WCHAR */
442 /* {char}|{WCHAR} data[...]; */
443 } msgtab_entry_t;
445 typedef struct messagetable {
446 DWORD memopt;
447 raw_data_t *data;
448 } messagetable_t;
450 /* StringTable structures */
451 typedef struct stt_entry {
452 string_t *str;
453 int id;
454 DWORD memopt;
455 characts_t *characts;
456 version_t *version;
457 } stt_entry_t;
459 typedef struct stringtable {
460 struct stringtable *next;
461 struct stringtable *prev;
462 DWORD memopt;
463 lvc_t lvc;
464 int idbase;
465 int nentries;
466 stt_entry_t *entries;
467 } stringtable_t;
469 /* VersionInfo structures */
470 enum ver_val_e {val_str, val_words, val_block};
472 struct ver_block; /* Forward ref */
474 typedef struct ver_words {
475 WORD *words;
476 int nwords;
477 } ver_words_t;
479 typedef struct ver_value {
480 struct ver_value *next;
481 struct ver_value *prev;
482 string_t *key;
483 union {
484 string_t *str;
485 ver_words_t *words;
486 struct ver_block *block;
487 } value;
488 enum ver_val_e type;
489 } ver_value_t;
491 typedef struct ver_block {
492 struct ver_block *next;
493 struct ver_block *prev;
494 string_t *name;
495 ver_value_t *values;
496 } ver_block_t;
498 typedef struct versioninfo {
499 int filever_maj1;
500 int filever_maj2;
501 int filever_min1;
502 int filever_min2;
503 int prodver_maj1;
504 int prodver_maj2;
505 int prodver_min1;
506 int prodver_min2;
507 int fileos;
508 int fileflags;
509 int fileflagsmask;
510 int filetype;
511 int filesubtype;
512 struct {
513 unsigned fv:1;
514 unsigned pv:1;
515 unsigned fo:1;
516 unsigned ff:1;
517 unsigned ffm:1;
518 unsigned ft:1;
519 unsigned fst:1;
520 } gotit;
521 ver_block_t *blocks;
522 lvc_t lvc;
523 DWORD memopt;
524 } versioninfo_t;
526 /* Accelerator structures */
527 #define WRC_AF_VIRTKEY 0x0001
528 #define WRC_AF_NOINVERT 0x0002
529 #define WRC_AF_SHIFT 0x0004
530 #define WRC_AF_CONTROL 0x0008
531 #define WRC_AF_ALT 0x0010
532 #define WRC_AF_ASCII 0x4000
534 typedef struct event {
535 struct event *next;
536 struct event *prev;
537 string_t *str;
538 int flags;
539 int key;
540 int id;
541 } event_t;
543 typedef struct accelerator {
544 DWORD memopt;
545 lvc_t lvc;
546 event_t *events;
547 } accelerator_t;
549 /* Toolbar structures */
550 typedef struct toolbar_item {
551 struct toolbar_item *next;
552 struct toolbar_item *prev;
553 int id;
554 } toolbar_item_t;
556 typedef struct toolbar {
557 DWORD memopt;
558 lvc_t lvc;
559 int button_width;
560 int button_height;
561 int nitems;
562 toolbar_item_t *items;
563 } toolbar_t;
565 typedef struct dlginit {
566 DWORD memopt;
567 raw_data_t *data;
568 } dlginit_t;
571 /* A top-level resource node */
572 typedef struct resource {
573 struct resource *next;
574 struct resource *prev;
575 enum res_e type;
576 name_id_t *name; /* resource's name */
577 language_t *lan; /* Only used as a sorting key and c-name creation*/
578 union {
579 accelerator_t *acc;
580 ani_curico_t *ani;
581 bitmap_t *bmp;
582 cursor_t *cur;
583 cursor_group_t *curg;
584 dialog_t *dlg;
585 dlginit_t *dlgi;
586 font_t *fnt;
587 fontdir_t *fnd;
588 icon_t *ico;
589 icon_group_t *icog;
590 menu_t *men;
591 messagetable_t *msg;
592 html_t *html;
593 rcdata_t *rdt;
594 stringtable_t *stt;
595 toolbar_t *tbt;
596 user_t *usr;
597 versioninfo_t *ver;
598 void *overlay; /* To catch all types at once... */
599 } res;
600 res_t *binres; /* To binary converted resource */
601 char *c_name; /* BaseName in output */
602 DWORD memopt;
603 } resource_t;
605 /* Resource count */
606 typedef struct res32_count {
607 int count;
608 resource_t **rsc;
609 } res32_count_t;
611 typedef struct res_count {
612 name_id_t type;
613 int count; /* win16 mode */
614 resource_t **rscarray;
615 int count32;
616 res32_count_t *rsc32array; /* win32 mode */
617 int n_id_entries;
618 int n_name_entries;
619 } res_count_t;
621 typedef struct style_pair {
622 style_t *style;
623 style_t *exstyle;
624 } style_pair_t;
626 #endif