Recovery of release 990110 after disk crash.
[wine.git] / tools / wrc / wrctypes.h
blob1d81d947e48113ce454099069a14e28e24bd955c
1 /*
2 * General type definitions
4 * Copyright 1998 Bertho A. Stultiens (BS)
6 */
8 #ifndef __WRC_WRCTYPES_H
9 #define __WRC_WRCTYPES_H
11 /* First is MS style, second wine style */
12 #if !defined(_INC_WINDOWS) && !defined(__WINE_WINDOWS_H)
13 #include "windows.h"
14 #endif
16 #ifndef MAKELANGID
17 #include "winnls.h"
18 #endif
20 #ifndef VS_FFI_SIGNATURE
21 #include "ver.h"
22 #endif
24 /* Memory/load flags */
25 #define WRC_MO_MOVEABLE 0x0010
26 #define WRC_MO_PURE 0x0020
27 #define WRC_MO_PRELOAD 0x0040
28 #define WRC_MO_DISCARDABLE 0x1000
30 /* Resource type IDs */
31 #define WRC_RT_CURSOR (1)
32 #define WRC_RT_BITMAP (2)
33 #define WRC_RT_ICON (3)
34 #define WRC_RT_MENU (4)
35 #define WRC_RT_DIALOG (5)
36 #define WRC_RT_STRING (6)
37 #define WRC_RT_FONTDIR (7)
38 #define WRC_RT_FONT (8)
39 #define WRC_RT_ACCELERATOR (9)
40 #define WRC_RT_RCDATA (10)
41 #define WRC_RT_MESSAGETABLE (11)
42 #define WRC_RT_GROUP_CURSOR (12)
43 #define WRC_RT_GROUP_ICON (14)
44 #define WRC_RT_VERSION (16)
45 #define WRC_RT_DLGINCLUDE (17)
46 #define WRC_RT_PLUGPLAY (19)
47 #define WRC_RT_VXD (20)
48 #define WRC_RT_ANICURSOR (21)
49 #define WRC_RT_ANIICON (22)
50 #define WRC_RT_TOOLBAR (241)
52 /* Default class type IDs */
53 #define CT_BUTTON 0x80
54 #define CT_EDIT 0x81
55 #define CT_STATIC 0x82
56 #define CT_LISTBOX 0x83
57 #define CT_SCROLLBAR 0x84
58 #define CT_COMBOBOX 0x85
61 /* Binary resource structure */
62 #define RES_BLOCKSIZE 512
64 typedef struct res {
65 int allocsize; /* Allocated datablock size */
66 int size; /* Actual size of data */
67 int dataidx; /* Tag behind the resource-header */
68 char *data;
69 } res_t;
71 /* Resource strings are slightly more complex because they include '\0' */
72 enum str_e {str_char, str_unicode};
74 typedef struct string {
75 int size;
76 enum str_e type;
77 union {
78 char *cstr;
79 short *wstr;
80 } str;
81 } string_t;
83 /* Resources are identified either by name or by number */
84 enum name_e {name_str, name_ord};
86 typedef struct name_id {
87 union {
88 string_t *s_name;
89 int i_name;
90 } name;
91 enum name_e type;
92 } name_id_t;
94 /* Language definitions */
95 typedef struct language {
96 int id;
97 int sub;
98 } language_t;
100 typedef DWORD characts_t;
101 typedef DWORD version_t;
103 typedef struct lvc {
104 language_t *language;
105 version_t *version;
106 characts_t *characts;
107 } lvc_t;
109 typedef struct font_id {
110 string_t *name;
111 int size;
112 int weight;
113 int italic;
114 } font_id_t;
116 /* resource types */
117 /* These are in the same order (and ordinal) as the RT_xxx
118 * defines. This is _required_.
119 * I rolled my own numbers for the win32 extension that are
120 * documented, but generate either old RT_xxx numbers, or
121 * don't have an ordinal associated (user type).
122 * I don't know any specs for those noted such, for that matter,
123 * I don't even know whether they can be generated other than by
124 * using a user-type resource.
126 enum res_e {
127 res_0 = 0,
128 res_cur,
129 res_ico,
130 res_bmp,
131 res_men,
132 res_dlg,
133 res_stt,
134 res_fntdir,
135 res_fnt,
136 res_acc,
137 res_rdt,
138 res_msg,
139 res_curg,
140 res_13, /* Hm, wonder why its not used... */
141 res_icog,
142 res_15,
143 res_ver,
144 res_dlginc, /* Not implemented, no layout available */
145 res_18,
146 res_pnp, /* Not implemented, no layout available */
147 res_vxd, /* Not implemented, no layout available */
148 res_anicur, /* Not implemented, no layout available */
149 res_aniico, /* Not implemented, no layout available */
151 res_toolbar = WRC_RT_TOOLBAR, /* 241 */
153 res_menex = 256 + 4,
154 res_dlgex,
155 res_usr,
158 /* Raw bytes in a row... */
159 typedef struct raw_data {
160 int size;
161 char *data;
162 } raw_data_t;
164 /* Dialog structures */
165 typedef struct control {
166 struct control *next; /* List of controls */
167 struct control *prev;
168 name_id_t *ctlclass; /* ControlClass */
169 string_t *title; /* Title of control */
170 int id;
171 int x; /* Position */
172 int y;
173 int width; /* Size */
174 int height;
175 DWORD style; /* Style */
176 DWORD exstyle;
177 DWORD helpid; /* EX: */
178 int gotstyle; /* Used to determine whether the default */
179 int gotexstyle; /* styles must be set */
180 int gothelpid;
181 raw_data_t *extra; /* EX: number of extra bytes in resource */
182 } control_t;
184 typedef struct dialog {
185 DWORD memopt;
186 int x; /* Position */
187 int y;
188 int width; /* Size */
189 int height;
190 DWORD style; /* Style */
191 DWORD exstyle;
192 int gotstyle; /* Used to determine whether the default */
193 int gotexstyle; /* styles must be set */
194 name_id_t *menu;
195 name_id_t *dlgclass;
196 string_t *title;
197 font_id_t *font;
198 lvc_t lvc;
199 control_t *controls;
200 } dialog_t;
202 /* DialogEx structures */
203 typedef struct dialogex {
204 DWORD memopt;
205 int x; /* Position */
206 int y;
207 int width; /* Size */
208 int height;
209 DWORD style; /* Style */
210 DWORD exstyle;
211 DWORD helpid; /* EX: */
212 int gotstyle; /* Used to determine whether the default */
213 int gotexstyle; /* styles must be set */
214 int gothelpid;
215 name_id_t *menu;
216 name_id_t *dlgclass;
217 string_t *title;
218 font_id_t *font;
219 lvc_t lvc;
220 control_t *controls;
221 } dialogex_t;
223 /* Menu structures */
224 typedef struct menu_item {
225 struct menu_item *next;
226 struct menu_item *prev;
227 struct menu_item *popup;
228 int id;
229 DWORD state;
230 string_t *name;
231 } menu_item_t;
233 typedef struct menu {
234 DWORD memopt;
235 lvc_t lvc;
236 menu_item_t *items;
237 } menu_t;
239 /* MenuEx structures */
240 typedef struct menuex_item {
241 struct menuex_item *next;
242 struct menuex_item *prev;
243 struct menuex_item *popup;
244 int id;
245 DWORD type;
246 DWORD state;
247 int helpid;
248 string_t *name;
249 int gotid;
250 int gottype;
251 int gotstate;
252 int gothelpid;
253 } menuex_item_t;
255 typedef struct menuex {
256 DWORD memopt;
257 lvc_t lvc;
258 menuex_item_t *items;
259 } menuex_t;
261 typedef struct itemex_opt
263 int id;
264 DWORD type;
265 DWORD state;
266 int helpid;
267 int gotid;
268 int gottype;
269 int gotstate;
270 int gothelpid;
271 } itemex_opt_t;
273 /* RC structures for types read from file or supplied binary */
274 typedef struct font {
275 DWORD memopt;
276 raw_data_t *data;
277 } font_t;
279 typedef struct icon_dir_entry {
280 BYTE width; /* From the SDK doc. */
281 BYTE height;
282 BYTE nclr;
283 BYTE reserved;
284 WORD planes;
285 WORD bits;
286 DWORD ressize;
287 DWORD offset;
288 } icon_dir_entry_t;
290 typedef struct icon {
291 struct icon *next;
292 struct icon *prev;
293 lvc_t lvc;
294 int id; /* Unique icon id within resource file */
295 int width; /* Field from the IconDirEntry */
296 int height;
297 int nclr;
298 int planes;
299 int bits;
300 raw_data_t *data;
301 } icon_t;
303 typedef struct icon_group {
304 DWORD memopt;
305 lvc_t lvc;
306 icon_t *iconlist;
307 int nicon;
308 } icon_group_t;
310 typedef struct cursor_dir_entry {
311 BYTE width; /* From the SDK doc. */
312 BYTE height;
313 BYTE nclr;
314 BYTE reserved;
315 WORD xhot;
316 WORD yhot;
317 DWORD ressize;
318 DWORD offset;
319 } cursor_dir_entry_t;
321 typedef struct cursor {
322 struct cursor *next;
323 struct cursor *prev;
324 lvc_t lvc;
325 int id; /* Unique icon id within resource file */
326 int width; /* Field from the CursorDirEntry */
327 int height;
328 int nclr;
329 int planes;
330 int bits;
331 int xhot;
332 int yhot;
333 raw_data_t *data;
334 } cursor_t;
336 typedef struct cursor_group {
337 DWORD memopt;
338 lvc_t lvc;
339 cursor_t *cursorlist;
340 int ncursor;
341 } cursor_group_t;
343 typedef struct bitmap {
344 DWORD memopt;
345 raw_data_t *data;
346 } bitmap_t;
348 typedef struct rcdata {
349 DWORD memopt;
350 lvc_t lvc;
351 raw_data_t *data;
352 } rcdata_t;
354 typedef struct user {
355 DWORD memopt;
356 name_id_t *type;
357 raw_data_t *data;
358 } user_t;
360 typedef struct messagetable {
361 raw_data_t *data;
362 } messagetable_t;
364 /* StringTable structures */
365 typedef struct stt_entry {
366 string_t *str;
367 int id;
368 DWORD memopt;
369 characts_t *characts;
370 version_t *version;
371 } stt_entry_t;
373 typedef struct stringtable {
374 struct stringtable *next;
375 struct stringtable *prev;
376 DWORD memopt;
377 lvc_t lvc;
378 int idbase;
379 int nentries;
380 stt_entry_t *entries;
381 } stringtable_t;
383 /* VersionInfo structures */
384 enum ver_val_e {val_str, val_words, val_block};
386 struct ver_block; /* Forward ref */
388 typedef struct ver_words {
389 WORD *words;
390 int nwords;
391 } ver_words_t;
393 typedef struct ver_value {
394 struct ver_value *next;
395 struct ver_value *prev;
396 string_t *key;
397 union {
398 string_t *str;
399 ver_words_t *words;
400 struct ver_block *block;
401 } value;
402 enum ver_val_e type;
403 } ver_value_t;
405 typedef struct ver_block {
406 struct ver_block *next;
407 struct ver_block *prev;
408 string_t *name;
409 ver_value_t *values;
410 } ver_block_t;
412 typedef struct versioninfo {
413 int filever_maj1;
414 int filever_maj2;
415 int filever_min1;
416 int filever_min2;
417 int prodver_maj1;
418 int prodver_maj2;
419 int prodver_min1;
420 int prodver_min2;
421 int fileos;
422 int fileflags;
423 int fileflagsmask;
424 int filetype;
425 int filesubtype;
426 struct {
427 int fv:1;
428 int pv:1;
429 int fo:1;
430 int ff:1;
431 int ffm:1;
432 int ft:1;
433 int fst:1;
434 } gotit;
435 ver_block_t *blocks;
436 } versioninfo_t;
438 /* Accelerator structures */
439 #define WRC_AF_VIRTKEY 0x0001
440 #define WRC_AF_NOINVERT 0x0002
441 #define WRC_AF_SHIFT 0x0004
442 #define WRC_AF_CONTROL 0x0008
443 #define WRC_AF_ALT 0x0010
444 #define WRC_AF_ASCII 0x4000
446 typedef struct event {
447 struct event *next;
448 struct event *prev;
449 int flags;
450 int key;
451 int id;
452 } event_t;
454 typedef struct accelerator {
455 DWORD memopt;
456 lvc_t lvc;
457 event_t *events;
458 } accelerator_t;
460 /* Toolbar structures */
461 typedef struct toolbar_item {
462 struct toolbar_item *next;
463 struct toolbar_item *prev;
464 int id;
465 } toolbar_item_t;
467 typedef struct toolbar {
468 DWORD memopt;
469 lvc_t lvc;
470 int button_width;
471 int button_height;
472 int nitems;
473 toolbar_item_t *items;
474 } toolbar_t;
476 /* A top-level resource node */
477 typedef struct resource {
478 struct resource *next;
479 struct resource *prev;
480 enum res_e type;
481 name_id_t *name; /* resource's name */
482 language_t *lan; /* Only used as a sorting key and c-name creation*/
483 union {
484 accelerator_t *acc;
485 bitmap_t *bmp;
486 cursor_t *cur;
487 cursor_group_t *curg;
488 dialog_t *dlg;
489 dialogex_t *dlgex;
490 font_t *fnt;
491 icon_t *ico;
492 icon_group_t *icog;
493 menu_t *men;
494 menuex_t *menex;
495 messagetable_t *msg;
496 rcdata_t *rdt;
497 stringtable_t *stt;
498 toolbar_t *tbt;
499 user_t *usr;
500 versioninfo_t *ver;
501 void *overlay; /* To catch all types at once... */
502 } res;
503 res_t *binres; /* To binary converted resource */
504 char *c_name; /* BaseName in output */
505 DWORD memopt;
506 } resource_t;
508 /* Resource count */
509 typedef struct res32_count {
510 int count;
511 resource_t **rsc;
512 } res32_count_t;
514 typedef struct res_count {
515 name_id_t type;
516 int count; /* win16 mode */
517 resource_t **rscarray;
518 int count32;
519 res32_count_t *rsc32array; /* win32 mode */
520 int n_id_entries;
521 int n_name_entries;
522 } res_count_t;
524 #endif