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