Add include for LoadLibrary.
[wine.git] / tools / wrc / wrctypes.h
blob1cdd964175e17a7cf4d650f85fe308b413ae2db7
1 /*
2 * General type definitions
4 * Copyright 1998 Bertho A. Stultiens (BS)
6 */
8 #ifndef __WRC_WRCTYPES_H
9 #define __WRC_WRCTYPES_H
11 #include "windef.h"
13 #ifndef MAKELANGID
14 #include "winnls.h"
15 #endif
17 #ifndef VS_FFI_SIGNATURE
18 #include "winver.h"
19 #endif
21 /* Memory/load flags */
22 #define WRC_MO_MOVEABLE 0x0010
23 #define WRC_MO_PURE 0x0020
24 #define WRC_MO_PRELOAD 0x0040
25 #define WRC_MO_DISCARDABLE 0x1000
27 /* Resource type IDs */
28 #define WRC_RT_CURSOR (1)
29 #define WRC_RT_BITMAP (2)
30 #define WRC_RT_ICON (3)
31 #define WRC_RT_MENU (4)
32 #define WRC_RT_DIALOG (5)
33 #define WRC_RT_STRING (6)
34 #define WRC_RT_FONTDIR (7)
35 #define WRC_RT_FONT (8)
36 #define WRC_RT_ACCELERATOR (9)
37 #define WRC_RT_RCDATA (10)
38 #define WRC_RT_MESSAGETABLE (11)
39 #define WRC_RT_GROUP_CURSOR (12)
40 #define WRC_RT_GROUP_ICON (14)
41 #define WRC_RT_VERSION (16)
42 #define WRC_RT_DLGINCLUDE (17)
43 #define WRC_RT_PLUGPLAY (19)
44 #define WRC_RT_VXD (20)
45 #define WRC_RT_ANICURSOR (21)
46 #define WRC_RT_ANIICON (22)
47 #define WRC_RT_HTML (23)
48 #define WRC_RT_DLGINIT (240)
49 #define WRC_RT_TOOLBAR (241)
51 /* Default class type IDs */
52 #define CT_BUTTON 0x80
53 #define CT_EDIT 0x81
54 #define CT_STATIC 0x82
55 #define CT_LISTBOX 0x83
56 #define CT_SCROLLBAR 0x84
57 #define CT_COMBOBOX 0x85
59 /* Byteordering defines */
60 #define WRC_BO_NATIVE 0x00
61 #define WRC_BO_LITTLE 0x01
62 #define WRC_BO_BIG 0x02
64 #define WRC_LOBYTE(w) ((WORD)(w) & 0xff)
65 #define WRC_HIBYTE(w) (((WORD)(w) >> 8) & 0xff)
66 #define WRC_LOWORD(d) ((DWORD)(d) & 0xffff)
67 #define WRC_HIWORD(d) (((DWORD)(d) >> 16) & 0xffff)
68 #define BYTESWAP_WORD(w) ((WORD)(((WORD)WRC_LOBYTE(w) << 8) + (WORD)WRC_HIBYTE(w)))
69 #define BYTESWAP_DWORD(d) ((DWORD)(((DWORD)BYTESWAP_WORD(WRC_LOWORD(d)) << 16) + ((DWORD)BYTESWAP_WORD(WRC_HIWORD(d)))))
71 /* Binary resource structure */
72 #define RES_BLOCKSIZE 512
74 typedef struct res {
75 int allocsize; /* Allocated datablock size */
76 int size; /* Actual size of data */
77 int dataidx; /* Tag behind the resource-header */
78 char *data;
79 } res_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 short *wstr;
90 } str;
91 } string_t;
93 /* Resources are identified either by name or by number */
94 enum name_e {name_str, name_ord};
96 typedef struct name_id {
97 union {
98 string_t *s_name;
99 int i_name;
100 } name;
101 enum name_e type;
102 } name_id_t;
104 /* Language definitions */
105 typedef struct language {
106 int id;
107 int sub;
108 } language_t;
110 typedef DWORD characts_t;
111 typedef DWORD version_t;
113 typedef struct lvc {
114 language_t *language;
115 version_t *version;
116 characts_t *characts;
117 } lvc_t;
119 typedef struct font_id {
120 string_t *name;
121 int size;
122 int weight;
123 int italic;
124 } font_id_t;
126 /* control styles */
127 typedef struct style {
128 DWORD or_mask;
129 DWORD and_mask;
130 } style_t;
132 /* resource types */
133 /* These are in the same order (and ordinal) as the RT_xxx
134 * defines. This is _required_.
135 * I rolled my own numbers for the win32 extension that are
136 * documented, but generate either old RT_xxx numbers, or
137 * don't have an ordinal associated (user type).
138 * I don't know any specs for those noted such, for that matter,
139 * I don't even know whether they can be generated other than by
140 * using a user-type resource.
142 enum res_e {
143 res_0 = 0,
144 res_cur,
145 res_bmp,
146 res_ico,
147 res_men,
148 res_dlg,
149 res_stt,
150 res_fntdir,
151 res_fnt,
152 res_acc,
153 res_rdt,
154 res_msg,
155 res_curg,
156 res_13, /* Hm, wonder why its not used... */
157 res_icog,
158 res_15,
159 res_ver,
160 res_dlginc, /* Not implemented, no layout available */
161 res_18,
162 res_pnp, /* Not implemented, no layout available */
163 res_vxd, /* Not implemented, no layout available */
164 res_anicur,
165 res_aniico,
166 res_html, /* Not implemented, no layout available */
168 res_dlginit = WRC_RT_DLGINIT, /* 240 */
169 res_toolbar = WRC_RT_TOOLBAR, /* 241 */
171 res_menex = 256 + 4,
172 res_dlgex,
173 res_usr
176 /* Raw bytes in a row... */
177 typedef struct raw_data {
178 int size;
179 char *data;
180 lvc_t lvc; /* Localized data */
181 } raw_data_t;
183 /* Dialog structures */
184 typedef struct control {
185 struct control *next; /* List of controls */
186 struct control *prev;
187 name_id_t *ctlclass; /* ControlClass */
188 name_id_t *title; /* Title of control */
189 int id;
190 int x; /* Position */
191 int y;
192 int width; /* Size */
193 int height;
194 style_t *style; /* Style */
195 style_t *exstyle;
196 DWORD helpid; /* EX: */
197 int gotstyle; /* Used to determine whether the default */
198 int gotexstyle; /* styles must be set */
199 int gothelpid;
200 raw_data_t *extra; /* EX: number of extra bytes in resource */
201 } control_t;
203 typedef struct dialog {
204 DWORD memopt;
205 int x; /* Position */
206 int y;
207 int width; /* Size */
208 int height;
209 style_t *style; /* Style */
210 style_t *exstyle;
211 int gotstyle; /* Used to determine whether the default */
212 int gotexstyle; /* styles must be set */
213 name_id_t *menu;
214 name_id_t *dlgclass;
215 string_t *title;
216 font_id_t *font;
217 lvc_t lvc;
218 control_t *controls;
219 } dialog_t;
221 /* DialogEx structures */
222 typedef struct dialogex {
223 DWORD memopt;
224 int x; /* Position */
225 int y;
226 int width; /* Size */
227 int height;
228 style_t *style; /* Style */
229 style_t *exstyle;
230 DWORD helpid; /* EX: */
231 int gotstyle; /* Used to determine whether the default */
232 int gotexstyle; /* styles must be set */
233 int gothelpid;
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 } dialogex_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 state;
249 string_t *name;
250 } menu_item_t;
252 typedef struct menu {
253 DWORD memopt;
254 lvc_t lvc;
255 menu_item_t *items;
256 } menu_t;
258 /* MenuEx structures */
259 typedef struct menuex_item {
260 struct menuex_item *next;
261 struct menuex_item *prev;
262 struct menuex_item *popup;
263 int id;
264 DWORD type;
265 DWORD state;
266 int helpid;
267 string_t *name;
268 int gotid;
269 int gottype;
270 int gotstate;
271 int gothelpid;
272 } menuex_item_t;
274 typedef struct menuex {
275 DWORD memopt;
276 lvc_t lvc;
277 menuex_item_t *items;
278 } menuex_t;
280 typedef struct itemex_opt
282 int id;
283 DWORD type;
284 DWORD state;
285 int helpid;
286 int gotid;
287 int gottype;
288 int gotstate;
289 int gothelpid;
290 } itemex_opt_t;
293 * Font resources
295 typedef struct font {
296 DWORD memopt;
297 raw_data_t *data;
298 } font_t;
300 typedef struct fontdir {
301 DWORD memopt;
302 raw_data_t *data;
303 } fontdir_t;
306 * Icon resources
308 typedef struct icon_header {
309 WORD reserved; /* Don't know, should be 0 I guess */
310 WORD type; /* Always 1 for icons */
311 WORD count; /* Number of packed icons in resource */
312 } icon_header_t;
314 typedef struct icon_dir_entry {
315 BYTE width; /* From the SDK doc. */
316 BYTE height;
317 BYTE nclr;
318 BYTE reserved;
319 WORD planes;
320 WORD bits;
321 DWORD ressize;
322 DWORD offset;
323 } icon_dir_entry_t;
325 typedef struct icon {
326 struct icon *next;
327 struct icon *prev;
328 lvc_t lvc;
329 int id; /* Unique icon id within resource file */
330 int width; /* Field from the IconDirEntry */
331 int height;
332 int nclr;
333 int planes;
334 int bits;
335 raw_data_t *data;
336 } icon_t;
338 typedef struct icon_group {
339 DWORD memopt;
340 lvc_t lvc;
341 icon_t *iconlist;
342 int nicon;
343 } icon_group_t;
346 * Cursor resources
348 typedef struct cursor_header {
349 WORD reserved; /* Don't know, should be 0 I guess */
350 WORD type; /* Always 2 for cursors */
351 WORD count; /* Number of packed cursors in resource */
352 } cursor_header_t;
354 typedef struct cursor_dir_entry {
355 BYTE width; /* From the SDK doc. */
356 BYTE height;
357 BYTE nclr;
358 BYTE reserved;
359 WORD xhot;
360 WORD yhot;
361 DWORD ressize;
362 DWORD offset;
363 } cursor_dir_entry_t;
365 typedef struct cursor {
366 struct cursor *next;
367 struct cursor *prev;
368 lvc_t lvc;
369 int id; /* Unique icon id within resource file */
370 int width; /* Field from the CursorDirEntry */
371 int height;
372 int nclr;
373 int planes;
374 int bits;
375 int xhot;
376 int yhot;
377 raw_data_t *data;
378 } cursor_t;
380 typedef struct cursor_group {
381 DWORD memopt;
382 lvc_t lvc;
383 cursor_t *cursorlist;
384 int ncursor;
385 } cursor_group_t;
388 * Animated cursors and icons
390 typedef struct aniheader {
391 DWORD structsize; /* Header size (36 bytes) */
392 DWORD frames; /* Number of unique icons in this cursor */
393 DWORD steps; /* Number of blits before the animation cycles */
394 DWORD cx; /* reserved, must be 0? */
395 DWORD cy; /* reserved, must be 0? */
396 DWORD bitcount; /* reserved, must be 0? */
397 DWORD planes; /* reserved, must be 0? */
398 DWORD rate; /* Default rate (1/60th of a second) if "rate" not present */
399 DWORD flags; /* Animation flag (1==AF_ICON, although both icons and cursors set this) */
400 } aniheader_t;
402 typedef struct riff_tag {
403 BYTE tag[4];
404 DWORD size;
405 } riff_tag_t;
407 typedef struct ani_curico {
408 DWORD memopt;
409 raw_data_t *data;
410 } ani_curico_t;
412 typedef struct ani_any {
413 enum res_e type;
414 union {
415 ani_curico_t *ani;
416 cursor_group_t *curg;
417 icon_group_t *icog;
418 } u;
419 } ani_any_t;
422 * Bitmaps
424 typedef struct bitmap {
425 DWORD memopt;
426 raw_data_t *data;
427 } bitmap_t;
429 typedef struct rcdata {
430 DWORD memopt;
431 raw_data_t *data;
432 } rcdata_t;
434 typedef struct user {
435 DWORD memopt;
436 name_id_t *type;
437 raw_data_t *data;
438 } user_t;
440 typedef struct messagetable {
441 raw_data_t *data;
442 } messagetable_t;
444 /* StringTable structures */
445 typedef struct stt_entry {
446 string_t *str;
447 int id;
448 DWORD memopt;
449 characts_t *characts;
450 version_t *version;
451 } stt_entry_t;
453 typedef struct stringtable {
454 struct stringtable *next;
455 struct stringtable *prev;
456 DWORD memopt;
457 lvc_t lvc;
458 int idbase;
459 int nentries;
460 stt_entry_t *entries;
461 } stringtable_t;
463 /* VersionInfo structures */
464 enum ver_val_e {val_str, val_words, val_block};
466 struct ver_block; /* Forward ref */
468 typedef struct ver_words {
469 WORD *words;
470 int nwords;
471 } ver_words_t;
473 typedef struct ver_value {
474 struct ver_value *next;
475 struct ver_value *prev;
476 string_t *key;
477 union {
478 string_t *str;
479 ver_words_t *words;
480 struct ver_block *block;
481 } value;
482 enum ver_val_e type;
483 } ver_value_t;
485 typedef struct ver_block {
486 struct ver_block *next;
487 struct ver_block *prev;
488 string_t *name;
489 ver_value_t *values;
490 } ver_block_t;
492 typedef struct versioninfo {
493 int filever_maj1;
494 int filever_maj2;
495 int filever_min1;
496 int filever_min2;
497 int prodver_maj1;
498 int prodver_maj2;
499 int prodver_min1;
500 int prodver_min2;
501 int fileos;
502 int fileflags;
503 int fileflagsmask;
504 int filetype;
505 int filesubtype;
506 struct {
507 int fv:1;
508 int pv:1;
509 int fo:1;
510 int ff:1;
511 int ffm:1;
512 int ft:1;
513 int fst:1;
514 } gotit;
515 ver_block_t *blocks;
516 lvc_t lvc;
517 DWORD memopt;
518 } versioninfo_t;
520 /* Accelerator structures */
521 #define WRC_AF_VIRTKEY 0x0001
522 #define WRC_AF_NOINVERT 0x0002
523 #define WRC_AF_SHIFT 0x0004
524 #define WRC_AF_CONTROL 0x0008
525 #define WRC_AF_ALT 0x0010
526 #define WRC_AF_ASCII 0x4000
528 typedef struct event {
529 struct event *next;
530 struct event *prev;
531 int flags;
532 int key;
533 int id;
534 } event_t;
536 typedef struct accelerator {
537 DWORD memopt;
538 lvc_t lvc;
539 event_t *events;
540 } accelerator_t;
542 /* Toolbar structures */
543 typedef struct toolbar_item {
544 struct toolbar_item *next;
545 struct toolbar_item *prev;
546 int id;
547 } toolbar_item_t;
549 typedef struct toolbar {
550 DWORD memopt;
551 lvc_t lvc;
552 int button_width;
553 int button_height;
554 int nitems;
555 toolbar_item_t *items;
556 } toolbar_t;
558 typedef struct dlginit {
559 DWORD memopt;
560 raw_data_t *data;
561 } dlginit_t;
564 /* A top-level resource node */
565 typedef struct resource {
566 struct resource *next;
567 struct resource *prev;
568 enum res_e type;
569 name_id_t *name; /* resource's name */
570 language_t *lan; /* Only used as a sorting key and c-name creation*/
571 union {
572 accelerator_t *acc;
573 ani_curico_t *ani;
574 bitmap_t *bmp;
575 cursor_t *cur;
576 cursor_group_t *curg;
577 dialog_t *dlg;
578 dialogex_t *dlgex;
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 menuex_t *menex;
586 messagetable_t *msg;
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