winegstreamer: Synchronize concurrent access to the media source.
[wine.git] / tools / wrc / wrctypes.h
blobb453e2fdb08b4b5a68b81972c026dc5fbd054126
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 #define GET_WORD(ptr) (((unsigned char *)(ptr))[0] | (((unsigned char *)(ptr))[1] << 8))
72 #define GET_DWORD(ptr) (((unsigned char *)(ptr))[0] | (((unsigned char *)(ptr))[1] << 8) | (((unsigned char *)(ptr))[2] << 16) | (((unsigned char *)(ptr))[3] << 24))
74 typedef struct
76 const char *file;
77 int line;
78 int col;
79 } location_t;
81 /* Resource strings are slightly more complex because they include '\0' */
82 enum str_e {str_char, str_unicode};
84 typedef struct string {
85 int size;
86 enum str_e type;
87 union {
88 char *cstr;
89 WCHAR *wstr;
90 } str;
91 location_t loc;
92 } string_t;
94 /* Resources are identified either by name or by number */
95 enum name_e {name_str, name_ord};
97 typedef struct name_id {
98 union {
99 string_t *s_name;
100 int i_name;
101 } name;
102 enum name_e type;
103 } name_id_t;
105 typedef unsigned int language_t;
106 typedef unsigned int characts_t;
107 typedef unsigned int version_t;
109 typedef struct lvc {
110 language_t language;
111 version_t version;
112 characts_t characts;
113 } lvc_t;
115 typedef struct font_id {
116 string_t *name;
117 int size;
118 int weight;
119 int italic;
120 } font_id_t;
122 /* control styles */
123 typedef struct style {
124 unsigned int or_mask;
125 unsigned int and_mask;
126 } style_t;
128 /* resource types */
129 /* These are in the same order (and ordinal) as the RT_xxx
130 * defines. This is _required_.
131 * I rolled my own numbers for the win32 extension that are
132 * documented, but generate either old RT_xxx numbers, or
133 * don't have an ordinal associated (user type).
134 * I don't know any specs for those noted such, for that matter,
135 * I don't even know whether they can be generated other than by
136 * using a user-type resource.
138 enum res_e {
139 res_0 = 0,
140 res_cur,
141 res_bmp,
142 res_ico,
143 res_men,
144 res_dlg,
145 res_stt,
146 res_fntdir,
147 res_fnt,
148 res_acc,
149 res_rdt,
150 res_msg,
151 res_curg,
152 res_13, /* Hm, wonder why it's not used... */
153 res_icog,
154 res_15,
155 res_ver,
156 res_dlginc, /* Not implemented, no layout available */
157 res_18,
158 res_pnp, /* Not implemented, no layout available */
159 res_vxd, /* Not implemented, no layout available */
160 res_anicur,
161 res_aniico,
162 res_html, /* Not implemented, no layout available */
164 res_dlginit = WRC_RT_DLGINIT, /* 240 */
165 res_toolbar = WRC_RT_TOOLBAR, /* 241 */
167 res_usr = 256 + 6
170 /* Raw bytes in a row... */
171 typedef struct raw_data {
172 unsigned int size;
173 char *data;
174 lvc_t lvc; /* Localized data */
175 } raw_data_t;
177 /* Dialog structures */
178 typedef struct control {
179 struct control *next; /* List of controls */
180 struct control *prev;
181 name_id_t *ctlclass; /* ControlClass */
182 name_id_t *title; /* Title of control */
183 int id;
184 int x; /* Position */
185 int y;
186 int width; /* Size */
187 int height;
188 style_t *style; /* Style */
189 style_t *exstyle;
190 unsigned int helpid; /* EX: */
191 int gotstyle; /* Used to determine whether the default */
192 int gotexstyle; /* styles must be set */
193 int gothelpid;
194 raw_data_t *extra; /* EX: number of extra bytes in resource */
195 } control_t;
197 typedef struct dialog {
198 unsigned int memopt;
199 int x; /* Position */
200 int y;
201 int width; /* Size */
202 int height;
203 style_t *style; /* Style */
204 style_t *exstyle;
205 unsigned int helpid; /* EX: */
206 int gotstyle; /* Used to determine whether the default */
207 int gotexstyle; /* styles must be set */
208 int gothelpid;
209 int is_ex;
210 name_id_t *menu;
211 name_id_t *dlgclass;
212 string_t *title;
213 font_id_t *font;
214 lvc_t lvc;
215 control_t *controls;
216 } dialog_t;
218 /* Menu structures */
219 typedef struct menu_item {
220 struct menu_item *next;
221 struct menu_item *prev;
222 struct menu_item *popup;
223 int id;
224 unsigned int type;
225 unsigned int state;
226 int helpid;
227 string_t *name;
228 int gotid;
229 int gottype;
230 int gotstate;
231 int gothelpid;
232 } menu_item_t;
234 typedef struct menu {
235 unsigned int memopt;
236 lvc_t lvc;
237 int is_ex;
238 menu_item_t *items;
239 } menu_t;
241 typedef struct itemex_opt
243 int id;
244 unsigned int type;
245 unsigned int state;
246 int helpid;
247 int gotid;
248 int gottype;
249 int gotstate;
250 int gothelpid;
251 } itemex_opt_t;
254 * Font resources
256 typedef struct font {
257 unsigned int memopt;
258 raw_data_t *data;
259 } font_t;
261 typedef struct fontdir {
262 unsigned int memopt;
263 raw_data_t *data;
264 } fontdir_t;
267 * Icon resources
269 typedef struct icon_header {
270 unsigned short reserved; /* Don't know, should be 0 I guess */
271 unsigned short type; /* Always 1 for icons */
272 unsigned short count; /* Number of packed icons in resource */
273 } icon_header_t;
275 typedef struct icon_dir_entry {
276 unsigned char width; /* From the SDK doc. */
277 unsigned char height;
278 unsigned char nclr;
279 unsigned char reserved;
280 unsigned short planes;
281 unsigned short bits;
282 unsigned int ressize;
283 unsigned int offset;
284 } icon_dir_entry_t;
286 typedef struct icon {
287 struct icon *next;
288 struct icon *prev;
289 lvc_t lvc;
290 int id; /* Unique icon id within resource file */
291 int width; /* Field from the IconDirEntry */
292 int height;
293 int nclr;
294 int planes;
295 int bits;
296 raw_data_t *data;
297 } icon_t;
299 typedef struct icon_group {
300 unsigned int memopt;
301 lvc_t lvc;
302 icon_t *iconlist;
303 int nicon;
304 } icon_group_t;
307 * Cursor resources
309 typedef struct cursor_header {
310 unsigned short reserved; /* Don't know, should be 0 I guess */
311 unsigned short type; /* Always 2 for cursors */
312 unsigned short count; /* Number of packed cursors in resource */
313 } cursor_header_t;
315 typedef struct cursor_dir_entry {
316 unsigned char width; /* From the SDK doc. */
317 unsigned char height;
318 unsigned char nclr;
319 unsigned char reserved;
320 unsigned short xhot;
321 unsigned short yhot;
322 unsigned int ressize;
323 unsigned int offset;
324 } cursor_dir_entry_t;
326 typedef struct cursor {
327 struct cursor *next;
328 struct cursor *prev;
329 lvc_t lvc;
330 int id; /* Unique icon id within resource file */
331 int width; /* Field from the CursorDirEntry */
332 int height;
333 int nclr;
334 int planes;
335 int bits;
336 int xhot;
337 int yhot;
338 raw_data_t *data;
339 } cursor_t;
341 typedef struct cursor_group {
342 unsigned int memopt;
343 lvc_t lvc;
344 cursor_t *cursorlist;
345 int ncursor;
346 } cursor_group_t;
349 * Animated cursors and icons
351 typedef struct aniheader {
352 unsigned int structsize; /* Header size (36 bytes) */
353 unsigned int frames; /* Number of unique icons in this cursor */
354 unsigned int steps; /* Number of blits before the animation cycles */
355 unsigned int cx; /* reserved, must be 0? */
356 unsigned int cy; /* reserved, must be 0? */
357 unsigned int bitcount; /* reserved, must be 0? */
358 unsigned int planes; /* reserved, must be 0? */
359 unsigned int rate; /* Default rate (1/60th of a second) if "rate" not present */
360 unsigned int flags; /* Animation flag (1==AF_ICON, although both icons and cursors set this) */
361 } aniheader_t;
363 typedef struct riff_tag {
364 unsigned char tag[4];
365 unsigned int size;
366 } riff_tag_t;
368 typedef struct ani_curico {
369 unsigned int memopt;
370 raw_data_t *data;
371 } ani_curico_t;
373 typedef struct ani_any {
374 enum res_e type;
375 union {
376 ani_curico_t *ani;
377 cursor_group_t *curg;
378 icon_group_t *icog;
379 } u;
380 } ani_any_t;
383 * Bitmaps
385 typedef struct bitmap {
386 unsigned int memopt;
387 raw_data_t *data;
388 } bitmap_t;
390 typedef struct html {
391 unsigned int memopt;
392 raw_data_t *data;
393 } html_t;
395 typedef struct rcdata {
396 unsigned int memopt;
397 raw_data_t *data;
398 } rcdata_t;
400 typedef struct {
401 unsigned int memopt;
402 name_id_t *type;
403 raw_data_t *data;
404 } user_t;
407 * Messagetables
409 typedef struct msgtab_block {
410 unsigned int idlo; /* Lowest id in the set */
411 unsigned int idhi; /* Highest is in the set */
412 unsigned int offset; /* Offset from resource start to first entry */
413 } msgtab_block_t;
415 typedef struct msgtab_entry {
416 unsigned short length; /* Length of the data in bytes */
417 unsigned short flags; /* 0 for char, 1 for WCHAR */
418 /* {char}|{WCHAR} data[...]; */
419 } msgtab_entry_t;
421 typedef struct messagetable {
422 unsigned int memopt;
423 raw_data_t *data;
424 } messagetable_t;
426 /* StringTable structures */
427 typedef struct stt_entry {
428 string_t *str;
429 int id;
430 unsigned int memopt;
431 characts_t characts;
432 version_t version;
433 } stt_entry_t;
435 typedef struct stringtable {
436 struct stringtable *next;
437 struct stringtable *prev;
438 unsigned int memopt;
439 lvc_t lvc;
440 int idbase;
441 int nentries;
442 stt_entry_t *entries;
443 } stringtable_t;
445 /* VersionInfo structures */
446 enum ver_val_e {val_str, val_words, val_block};
448 struct ver_block; /* Forward ref */
450 typedef struct ver_words {
451 unsigned short *words;
452 int nwords;
453 } ver_words_t;
455 typedef struct ver_value {
456 struct ver_value *next;
457 struct ver_value *prev;
458 string_t *key;
459 union {
460 string_t *str;
461 ver_words_t *words;
462 struct ver_block *block;
463 } value;
464 enum ver_val_e type;
465 } ver_value_t;
467 typedef struct ver_block {
468 struct ver_block *next;
469 struct ver_block *prev;
470 string_t *name;
471 ver_value_t *values;
472 } ver_block_t;
474 typedef struct versioninfo {
475 int filever_maj1;
476 int filever_maj2;
477 int filever_min1;
478 int filever_min2;
479 int prodver_maj1;
480 int prodver_maj2;
481 int prodver_min1;
482 int prodver_min2;
483 int fileos;
484 int fileflags;
485 int fileflagsmask;
486 int filetype;
487 int filesubtype;
488 struct {
489 unsigned fv:1;
490 unsigned pv:1;
491 unsigned fo:1;
492 unsigned ff:1;
493 unsigned ffm:1;
494 unsigned ft:1;
495 unsigned fst:1;
496 } gotit;
497 ver_block_t *blocks;
498 lvc_t lvc;
499 unsigned int memopt;
500 } versioninfo_t;
502 /* Accelerator structures */
503 #define WRC_AF_VIRTKEY 0x0001
504 #define WRC_AF_NOINVERT 0x0002
505 #define WRC_AF_SHIFT 0x0004
506 #define WRC_AF_CONTROL 0x0008
507 #define WRC_AF_ALT 0x0010
508 #define WRC_AF_ASCII 0x4000
510 typedef struct event {
511 struct event *next;
512 struct event *prev;
513 string_t *str;
514 int flags;
515 int key;
516 int id;
517 } event_t;
519 typedef struct accelerator {
520 unsigned int memopt;
521 lvc_t lvc;
522 event_t *events;
523 } accelerator_t;
525 /* Toolbar structures */
526 typedef struct toolbar_item {
527 struct toolbar_item *next;
528 struct toolbar_item *prev;
529 int id;
530 } toolbar_item_t;
532 typedef struct toolbar {
533 unsigned int memopt;
534 lvc_t lvc;
535 int button_width;
536 int button_height;
537 int nitems;
538 toolbar_item_t *items;
539 } toolbar_t;
541 typedef struct dlginit {
542 unsigned int memopt;
543 raw_data_t *data;
544 } dlginit_t;
547 /* A top-level resource node */
548 typedef struct resource {
549 struct resource *next;
550 struct resource *prev;
551 enum res_e type;
552 name_id_t *name; /* resource's name */
553 language_t lan; /* Only used as a sorting key and c-name creation*/
554 union {
555 accelerator_t *acc;
556 ani_curico_t *ani;
557 bitmap_t *bmp;
558 cursor_t *cur;
559 cursor_group_t *curg;
560 dialog_t *dlg;
561 dlginit_t *dlgi;
562 font_t *fnt;
563 fontdir_t *fnd;
564 icon_t *ico;
565 icon_group_t *icog;
566 menu_t *men;
567 messagetable_t *msg;
568 html_t *html;
569 rcdata_t *rdt;
570 stringtable_t *stt;
571 toolbar_t *tbt;
572 user_t *usr;
573 versioninfo_t *ver;
574 void *overlay; /* To catch all types at once... */
575 } res;
576 unsigned int memopt;
577 } resource_t;
579 /* Resource count */
580 typedef struct res32_count {
581 int count;
582 resource_t **rsc;
583 } res32_count_t;
585 typedef struct res_count {
586 name_id_t type;
587 int count; /* win16 mode */
588 resource_t **rscarray;
589 int count32;
590 res32_count_t *rsc32array; /* win32 mode */
591 int n_id_entries;
592 int n_name_entries;
593 } res_count_t;
595 typedef struct style_pair {
596 style_t *style;
597 style_t *exstyle;
598 } style_pair_t;
600 #endif