Initialize the output buffer parameters to 0 in RegQueryValue*
[wine.git] / tools / wrc / wrctypes.h
blob139b5e16143d7d8c49806cb7812455ab0317b1a9
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 "ver.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_TOOLBAR (241)
49 /* Default class type IDs */
50 #define CT_BUTTON 0x80
51 #define CT_EDIT 0x81
52 #define CT_STATIC 0x82
53 #define CT_LISTBOX 0x83
54 #define CT_SCROLLBAR 0x84
55 #define CT_COMBOBOX 0x85
58 /* Binary resource structure */
59 #define RES_BLOCKSIZE 512
61 typedef struct res {
62 int allocsize; /* Allocated datablock size */
63 int size; /* Actual size of data */
64 int dataidx; /* Tag behind the resource-header */
65 char *data;
66 } res_t;
68 /* Resource strings are slightly more complex because they include '\0' */
69 enum str_e {str_char, str_unicode};
71 typedef struct string {
72 int size;
73 enum str_e type;
74 union {
75 char *cstr;
76 short *wstr;
77 } str;
78 } string_t;
80 /* Resources are identified either by name or by number */
81 enum name_e {name_str, name_ord};
83 typedef struct name_id {
84 union {
85 string_t *s_name;
86 int i_name;
87 } name;
88 enum name_e type;
89 } name_id_t;
91 /* Language definitions */
92 typedef struct language {
93 int id;
94 int sub;
95 } language_t;
97 typedef DWORD characts_t;
98 typedef DWORD version_t;
100 typedef struct lvc {
101 language_t *language;
102 version_t *version;
103 characts_t *characts;
104 } lvc_t;
106 typedef struct font_id {
107 string_t *name;
108 int size;
109 int weight;
110 int italic;
111 } font_id_t;
113 /* resource types */
114 /* These are in the same order (and ordinal) as the RT_xxx
115 * defines. This is _required_.
116 * I rolled my own numbers for the win32 extension that are
117 * documented, but generate either old RT_xxx numbers, or
118 * don't have an ordinal associated (user type).
119 * I don't know any specs for those noted such, for that matter,
120 * I don't even know whether they can be generated other than by
121 * using a user-type resource.
123 enum res_e {
124 res_0 = 0,
125 res_cur,
126 res_bmp,
127 res_ico,
128 res_men,
129 res_dlg,
130 res_stt,
131 res_fntdir,
132 res_fnt,
133 res_acc,
134 res_rdt,
135 res_msg,
136 res_curg,
137 res_13, /* Hm, wonder why its not used... */
138 res_icog,
139 res_15,
140 res_ver,
141 res_dlginc, /* Not implemented, no layout available */
142 res_18,
143 res_pnp, /* Not implemented, no layout available */
144 res_vxd, /* Not implemented, no layout available */
145 res_anicur, /* Not implemented, no layout available */
146 res_aniico, /* Not implemented, no layout available */
148 res_toolbar = WRC_RT_TOOLBAR, /* 241 */
150 res_menex = 256 + 4,
151 res_dlgex,
152 res_usr
155 /* Raw bytes in a row... */
156 typedef struct raw_data {
157 int size;
158 char *data;
159 } raw_data_t;
161 /* Dialog structures */
162 typedef struct control {
163 struct control *next; /* List of controls */
164 struct control *prev;
165 name_id_t *ctlclass; /* ControlClass */
166 string_t *title; /* Title of control */
167 int id;
168 int x; /* Position */
169 int y;
170 int width; /* Size */
171 int height;
172 DWORD style; /* Style */
173 DWORD exstyle;
174 DWORD helpid; /* EX: */
175 int gotstyle; /* Used to determine whether the default */
176 int gotexstyle; /* styles must be set */
177 int gothelpid;
178 raw_data_t *extra; /* EX: number of extra bytes in resource */
179 } control_t;
181 typedef struct dialog {
182 DWORD memopt;
183 int x; /* Position */
184 int y;
185 int width; /* Size */
186 int height;
187 DWORD style; /* Style */
188 DWORD exstyle;
189 int gotstyle; /* Used to determine whether the default */
190 int gotexstyle; /* styles must be set */
191 name_id_t *menu;
192 name_id_t *dlgclass;
193 string_t *title;
194 font_id_t *font;
195 lvc_t lvc;
196 control_t *controls;
197 } dialog_t;
199 /* DialogEx structures */
200 typedef struct dialogex {
201 DWORD memopt;
202 int x; /* Position */
203 int y;
204 int width; /* Size */
205 int height;
206 DWORD style; /* Style */
207 DWORD exstyle;
208 DWORD helpid; /* EX: */
209 int gotstyle; /* Used to determine whether the default */
210 int gotexstyle; /* styles must be set */
211 int gothelpid;
212 name_id_t *menu;
213 name_id_t *dlgclass;
214 string_t *title;
215 font_id_t *font;
216 lvc_t lvc;
217 control_t *controls;
218 } dialogex_t;
220 /* Menu structures */
221 typedef struct menu_item {
222 struct menu_item *next;
223 struct menu_item *prev;
224 struct menu_item *popup;
225 int id;
226 DWORD state;
227 string_t *name;
228 } menu_item_t;
230 typedef struct menu {
231 DWORD memopt;
232 lvc_t lvc;
233 menu_item_t *items;
234 } menu_t;
236 /* MenuEx structures */
237 typedef struct menuex_item {
238 struct menuex_item *next;
239 struct menuex_item *prev;
240 struct menuex_item *popup;
241 int id;
242 DWORD type;
243 DWORD state;
244 int helpid;
245 string_t *name;
246 int gotid;
247 int gottype;
248 int gotstate;
249 int gothelpid;
250 } menuex_item_t;
252 typedef struct menuex {
253 DWORD memopt;
254 lvc_t lvc;
255 menuex_item_t *items;
256 } menuex_t;
258 typedef struct itemex_opt
260 int id;
261 DWORD type;
262 DWORD state;
263 int helpid;
264 int gotid;
265 int gottype;
266 int gotstate;
267 int gothelpid;
268 } itemex_opt_t;
270 /* RC structures for types read from file or supplied binary */
271 typedef struct font {
272 DWORD memopt;
273 raw_data_t *data;
274 } font_t;
276 typedef struct icon_dir_entry {
277 BYTE width; /* From the SDK doc. */
278 BYTE height;
279 BYTE nclr;
280 BYTE reserved;
281 WORD planes;
282 WORD bits;
283 DWORD ressize;
284 DWORD offset;
285 } icon_dir_entry_t;
287 typedef struct icon {
288 struct icon *next;
289 struct icon *prev;
290 lvc_t lvc;
291 int id; /* Unique icon id within resource file */
292 int width; /* Field from the IconDirEntry */
293 int height;
294 int nclr;
295 int planes;
296 int bits;
297 raw_data_t *data;
298 } icon_t;
300 typedef struct icon_group {
301 DWORD memopt;
302 lvc_t lvc;
303 icon_t *iconlist;
304 int nicon;
305 } icon_group_t;
307 typedef struct cursor_dir_entry {
308 BYTE width; /* From the SDK doc. */
309 BYTE height;
310 BYTE nclr;
311 BYTE reserved;
312 WORD xhot;
313 WORD yhot;
314 DWORD ressize;
315 DWORD offset;
316 } cursor_dir_entry_t;
318 typedef struct cursor {
319 struct cursor *next;
320 struct cursor *prev;
321 lvc_t lvc;
322 int id; /* Unique icon id within resource file */
323 int width; /* Field from the CursorDirEntry */
324 int height;
325 int nclr;
326 int planes;
327 int bits;
328 int xhot;
329 int yhot;
330 raw_data_t *data;
331 } cursor_t;
333 typedef struct cursor_group {
334 DWORD memopt;
335 lvc_t lvc;
336 cursor_t *cursorlist;
337 int ncursor;
338 } cursor_group_t;
340 typedef struct bitmap {
341 DWORD memopt;
342 raw_data_t *data;
343 } bitmap_t;
345 typedef struct rcdata {
346 DWORD memopt;
347 lvc_t lvc;
348 raw_data_t *data;
349 } rcdata_t;
351 typedef struct user {
352 DWORD memopt;
353 name_id_t *type;
354 raw_data_t *data;
355 } user_t;
357 typedef struct messagetable {
358 raw_data_t *data;
359 } messagetable_t;
361 /* StringTable structures */
362 typedef struct stt_entry {
363 string_t *str;
364 int id;
365 DWORD memopt;
366 characts_t *characts;
367 version_t *version;
368 } stt_entry_t;
370 typedef struct stringtable {
371 struct stringtable *next;
372 struct stringtable *prev;
373 DWORD memopt;
374 lvc_t lvc;
375 int idbase;
376 int nentries;
377 stt_entry_t *entries;
378 } stringtable_t;
380 /* VersionInfo structures */
381 enum ver_val_e {val_str, val_words, val_block};
383 struct ver_block; /* Forward ref */
385 typedef struct ver_words {
386 WORD *words;
387 int nwords;
388 } ver_words_t;
390 typedef struct ver_value {
391 struct ver_value *next;
392 struct ver_value *prev;
393 string_t *key;
394 union {
395 string_t *str;
396 ver_words_t *words;
397 struct ver_block *block;
398 } value;
399 enum ver_val_e type;
400 } ver_value_t;
402 typedef struct ver_block {
403 struct ver_block *next;
404 struct ver_block *prev;
405 string_t *name;
406 ver_value_t *values;
407 } ver_block_t;
409 typedef struct versioninfo {
410 int filever_maj1;
411 int filever_maj2;
412 int filever_min1;
413 int filever_min2;
414 int prodver_maj1;
415 int prodver_maj2;
416 int prodver_min1;
417 int prodver_min2;
418 int fileos;
419 int fileflags;
420 int fileflagsmask;
421 int filetype;
422 int filesubtype;
423 struct {
424 int fv:1;
425 int pv:1;
426 int fo:1;
427 int ff:1;
428 int ffm:1;
429 int ft:1;
430 int fst:1;
431 } gotit;
432 ver_block_t *blocks;
433 } versioninfo_t;
435 /* Accelerator structures */
436 #define WRC_AF_VIRTKEY 0x0001
437 #define WRC_AF_NOINVERT 0x0002
438 #define WRC_AF_SHIFT 0x0004
439 #define WRC_AF_CONTROL 0x0008
440 #define WRC_AF_ALT 0x0010
441 #define WRC_AF_ASCII 0x4000
443 typedef struct event {
444 struct event *next;
445 struct event *prev;
446 int flags;
447 int key;
448 int id;
449 } event_t;
451 typedef struct accelerator {
452 DWORD memopt;
453 lvc_t lvc;
454 event_t *events;
455 } accelerator_t;
457 /* Toolbar structures */
458 typedef struct toolbar_item {
459 struct toolbar_item *next;
460 struct toolbar_item *prev;
461 int id;
462 } toolbar_item_t;
464 typedef struct toolbar {
465 DWORD memopt;
466 lvc_t lvc;
467 int button_width;
468 int button_height;
469 int nitems;
470 toolbar_item_t *items;
471 } toolbar_t;
473 /* A top-level resource node */
474 typedef struct resource {
475 struct resource *next;
476 struct resource *prev;
477 enum res_e type;
478 name_id_t *name; /* resource's name */
479 language_t *lan; /* Only used as a sorting key and c-name creation*/
480 union {
481 accelerator_t *acc;
482 bitmap_t *bmp;
483 cursor_t *cur;
484 cursor_group_t *curg;
485 dialog_t *dlg;
486 dialogex_t *dlgex;
487 font_t *fnt;
488 icon_t *ico;
489 icon_group_t *icog;
490 menu_t *men;
491 menuex_t *menex;
492 messagetable_t *msg;
493 rcdata_t *rdt;
494 stringtable_t *stt;
495 toolbar_t *tbt;
496 user_t *usr;
497 versioninfo_t *ver;
498 void *overlay; /* To catch all types at once... */
499 } res;
500 res_t *binres; /* To binary converted resource */
501 char *c_name; /* BaseName in output */
502 DWORD memopt;
503 } resource_t;
505 /* Resource count */
506 typedef struct res32_count {
507 int count;
508 resource_t **rsc;
509 } res32_count_t;
511 typedef struct res_count {
512 name_id_t type;
513 int count; /* win16 mode */
514 resource_t **rscarray;
515 int count32;
516 res32_count_t *rsc32array; /* win32 mode */
517 int n_id_entries;
518 int n_name_entries;
519 } res_count_t;
521 #endif