1 | /*
|
---|
2 | * Copyrignt 1998 Bertho A. Stultiens (BS)
|
---|
3 | *
|
---|
4 | * 16-Apr-1998 BS - Yeah, dump it to stdout.
|
---|
5 | *
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "config.h"
|
---|
9 |
|
---|
10 | #include <stdio.h>
|
---|
11 | #include <ctype.h>
|
---|
12 |
|
---|
13 | #include "wrc.h"
|
---|
14 | #include "dumpres.h"
|
---|
15 |
|
---|
16 | /*
|
---|
17 | *****************************************************************************
|
---|
18 | * Function : get_typename
|
---|
19 | * Syntax : char *get_typename(resource_t* r)
|
---|
20 | * Input :
|
---|
21 | * r - Resource description
|
---|
22 | * Output : A pointer to a string representing the resource type
|
---|
23 | * Description :
|
---|
24 | * Remarks :
|
---|
25 | *****************************************************************************
|
---|
26 | */
|
---|
27 | char *get_typename(resource_t* r)
|
---|
28 | {
|
---|
29 | switch(r->type){
|
---|
30 | case res_acc: return "ACCELERATOR";
|
---|
31 | case res_bmp: return "BITMAP";
|
---|
32 | case res_cur: return "CURSOR";
|
---|
33 | case res_curg: return "GROUP_CURSOR";
|
---|
34 | case res_dlg: return "DIALOG";
|
---|
35 | case res_dlgex: return "DIALOGEX";
|
---|
36 | case res_fnt: return "FONT";
|
---|
37 | case res_ico: return "ICON";
|
---|
38 | case res_icog: return "GROUP_ICON";
|
---|
39 | case res_men: return "MENU";
|
---|
40 | case res_menex: return "MENUEX";
|
---|
41 | case res_rdt: return "RCDATA";
|
---|
42 | case res_stt: return "STRINGTABLE";
|
---|
43 | case res_usr: return "UserResource";
|
---|
44 | case res_msg: return "MESSAGETABLE";
|
---|
45 | case res_ver: return "VERSIONINFO";
|
---|
46 | case res_dlginit: return "DLGINIT";
|
---|
47 | case res_toolbar: return "TOOLBAR";
|
---|
48 | default: return "Unknown";
|
---|
49 | }
|
---|
50 | }
|
---|
51 |
|
---|
52 | /*
|
---|
53 | *****************************************************************************
|
---|
54 | * Function : strncpyWtoA
|
---|
55 | * Syntax : char *strncpyWtoA(char *cs, short *ws, int maxlen)
|
---|
56 | * Input :
|
---|
57 | * cs - Pointer to buffer to receive result
|
---|
58 | * ws - Source wide-string
|
---|
59 | * maxlen - Max chars to copy
|
---|
60 | * Output : 'cs'
|
---|
61 | * Description : Copy a unicode string to ascii. Copying stops after the
|
---|
62 | * first occuring '\0' or when maxlen-1 chars are copied. The
|
---|
63 | * String is always nul terminated.
|
---|
64 | * Remarks : No codepage translation is done.
|
---|
65 | *****************************************************************************
|
---|
66 | */
|
---|
67 | char *strncpyWtoA(char *cs, short *ws, int maxlen)
|
---|
68 | {
|
---|
69 | char *cptr = cs;
|
---|
70 | short *wsMax = ws + maxlen;
|
---|
71 | while(ws < wsMax)
|
---|
72 | {
|
---|
73 | if(*ws < -128 || *ws > 127)
|
---|
74 | printf("***Warning: Unicode string contains non-printable chars***");
|
---|
75 | *cptr++ = (char)*ws++;
|
---|
76 | maxlen--;
|
---|
77 | }
|
---|
78 | *cptr = '\0';
|
---|
79 | return cs;
|
---|
80 | }
|
---|
81 |
|
---|
82 | /*
|
---|
83 | *****************************************************************************
|
---|
84 | * Function : print_string
|
---|
85 | * Syntax : void print_string(string_t *str)
|
---|
86 | * Input :
|
---|
87 | * Output :
|
---|
88 | * Description :
|
---|
89 | * Remarks :
|
---|
90 | *****************************************************************************
|
---|
91 | */
|
---|
92 | void print_string(string_t *str)
|
---|
93 | {
|
---|
94 | char buffer[512];
|
---|
95 | if(!str)
|
---|
96 | printf("<none>");
|
---|
97 | else if(str->type == str_char)
|
---|
98 | printf("\"%s\"", str->str.cstr);
|
---|
99 | else
|
---|
100 | {
|
---|
101 | strncpyWtoA(buffer, str->str.wstr, sizeof(buffer));
|
---|
102 | printf("L\"%s\"", buffer);
|
---|
103 | }
|
---|
104 | }
|
---|
105 |
|
---|
106 | /*
|
---|
107 | *****************************************************************************
|
---|
108 | * Function : get_nameid_str
|
---|
109 | * Syntax : char *get_nameid_str(name_id_t *n)
|
---|
110 | * Input :
|
---|
111 | * n - nameid to convert to text
|
---|
112 | * Output : A pointer to the name.
|
---|
113 | * Description :
|
---|
114 | * Remarks : Not reentrant because of static buffer
|
---|
115 | *****************************************************************************
|
---|
116 | */
|
---|
117 | char *get_nameid_str(name_id_t *n)
|
---|
118 | {
|
---|
119 | static char buffer[256];
|
---|
120 |
|
---|
121 | if(!n)
|
---|
122 | return "<none>";
|
---|
123 |
|
---|
124 | if(n->type == name_ord)
|
---|
125 | {
|
---|
126 | sprintf(buffer, "%d", n->name.i_name);
|
---|
127 | return buffer;
|
---|
128 | }
|
---|
129 | else if(n->type == name_str)
|
---|
130 | {
|
---|
131 | if(n->name.s_name->type == str_char)
|
---|
132 | return n->name.s_name->str.cstr;
|
---|
133 | else
|
---|
134 | {
|
---|
135 | strncpyWtoA(buffer, n->name.s_name->str.wstr, sizeof(buffer));
|
---|
136 | return buffer;
|
---|
137 | }
|
---|
138 | }
|
---|
139 | else
|
---|
140 | return "Hoooo, report this: wrong type in nameid";
|
---|
141 | }
|
---|
142 |
|
---|
143 | /*
|
---|
144 | *****************************************************************************
|
---|
145 | * Function : dump_memopt
|
---|
146 | * Syntax : void dump_memopt(DWORD memopt)
|
---|
147 | * Input :
|
---|
148 | * memopt - flag bits of the options set
|
---|
149 | * Output :
|
---|
150 | * Description :
|
---|
151 | * Remarks :
|
---|
152 | *****************************************************************************
|
---|
153 | */
|
---|
154 | void dump_memopt(DWORD memopt)
|
---|
155 | {
|
---|
156 | printf("Memory/load options: ");
|
---|
157 | if(memopt & 0x0040)
|
---|
158 | printf("PRELOAD ");
|
---|
159 | else
|
---|
160 | printf("LOADONCALL ");
|
---|
161 | if(memopt & 0x0010)
|
---|
162 | printf("MOVEABLE ");
|
---|
163 | else
|
---|
164 | printf("FIXED ");
|
---|
165 | if(memopt & 0x0020)
|
---|
166 | printf("PURE ");
|
---|
167 | else
|
---|
168 | printf("IMPURE ");
|
---|
169 | if(memopt & 0x1000)
|
---|
170 | printf("DISCARDABLE");
|
---|
171 | printf("\n");
|
---|
172 | }
|
---|
173 |
|
---|
174 | /*
|
---|
175 | *****************************************************************************
|
---|
176 | * Function : dump_lvc
|
---|
177 | * Syntax : void dump_lvc(lvc_t *l)
|
---|
178 | * Input :
|
---|
179 | * l - pointer to lvc structure
|
---|
180 | * Output :
|
---|
181 | * Description : Dump language, version and characteristics
|
---|
182 | * Remarks :
|
---|
183 | *****************************************************************************
|
---|
184 | */
|
---|
185 | void dump_lvc(lvc_t *l)
|
---|
186 | {
|
---|
187 | if(l->language)
|
---|
188 | printf("LANGUAGE %04x, %04x\n", l->language->id, l->language->sub);
|
---|
189 | else
|
---|
190 | printf("LANGUAGE <not set>\n");
|
---|
191 |
|
---|
192 | if(l->version)
|
---|
193 | printf("VERSION %08lx\n", *(l->version));
|
---|
194 | else
|
---|
195 | printf("VERSION <not set>\n");
|
---|
196 |
|
---|
197 | if(l->characts)
|
---|
198 | printf("CHARACTERISTICS %08lx\n", *(l->characts));
|
---|
199 | else
|
---|
200 | printf("CHARACTERISTICS <not set>\n");
|
---|
201 | }
|
---|
202 |
|
---|
203 | /*
|
---|
204 | *****************************************************************************
|
---|
205 | * Function : dump_raw_data
|
---|
206 | * Syntax : void dump_raw_data(raw_data_t *d)
|
---|
207 | * Input :
|
---|
208 | * d - Raw data descriptor
|
---|
209 | * Output :
|
---|
210 | * Description :
|
---|
211 | * Remarks :
|
---|
212 | *****************************************************************************
|
---|
213 | */
|
---|
214 | void dump_raw_data(raw_data_t *d)
|
---|
215 | {
|
---|
216 | int n;
|
---|
217 | int i;
|
---|
218 | int j;
|
---|
219 |
|
---|
220 | if(!d)
|
---|
221 | {
|
---|
222 | printf("<none>");
|
---|
223 | return;
|
---|
224 | }
|
---|
225 | printf("Rawdata size: %d\n", d->size);
|
---|
226 | if(debuglevel < 2)
|
---|
227 | return;
|
---|
228 |
|
---|
229 | for(n = 0; n < d->size; n++)
|
---|
230 | {
|
---|
231 | if((n % 16) == 0)
|
---|
232 | {
|
---|
233 | if(n)
|
---|
234 | {
|
---|
235 | printf("- ");
|
---|
236 | for(i = 0; i < 16; i++)
|
---|
237 | printf("%c", isprint(d->data[n-16+i]) ? d->data[n-16+i] : '.');
|
---|
238 | printf("\n%08x: ", n);
|
---|
239 | }
|
---|
240 | else
|
---|
241 | printf("%08x: ", n);
|
---|
242 | }
|
---|
243 | printf("%02x ", d->data[n] & 0xff);
|
---|
244 | }
|
---|
245 | printf("- ");
|
---|
246 | j = d->size % 16;
|
---|
247 | if(!j)
|
---|
248 | j = 16;
|
---|
249 | for(i = 0; i < j; i++)
|
---|
250 | printf("%c", isprint(d->data[n-j+i]) ? d->data[n-j+i] : '.');
|
---|
251 | printf("\n");
|
---|
252 | }
|
---|
253 |
|
---|
254 | /*
|
---|
255 | *****************************************************************************
|
---|
256 | * Function : dump_accelerator
|
---|
257 | * Syntax : void dump_accelerator(resource_t *acc)
|
---|
258 | * Input :
|
---|
259 | * acc - Accelerator resource descriptor
|
---|
260 | * Output : nop
|
---|
261 | * Description :
|
---|
262 | * Remarks :
|
---|
263 | *****************************************************************************
|
---|
264 | */
|
---|
265 | void dump_accelerator(accelerator_t *acc)
|
---|
266 | {
|
---|
267 | event_t *ev = acc->events;
|
---|
268 |
|
---|
269 | dump_memopt(acc->memopt);
|
---|
270 | dump_lvc(&(acc->lvc));
|
---|
271 |
|
---|
272 | printf("Events: %s\n", ev ? "" : "<none>");
|
---|
273 | while(ev)
|
---|
274 | {
|
---|
275 | printf("Key=");
|
---|
276 | if(isprint(ev->key))
|
---|
277 | printf("\"%c\"", ev->key);
|
---|
278 | else if(iscntrl(ev->key))
|
---|
279 | printf("\"^%c\"", ev->key +'@');
|
---|
280 | else
|
---|
281 | printf("\\x%02x", ev->key & 0xff);
|
---|
282 |
|
---|
283 | printf(" Id=%d flags=%04x\n", ev->id, ev->flags);
|
---|
284 | ev = ev->next;
|
---|
285 | }
|
---|
286 | }
|
---|
287 |
|
---|
288 | /*
|
---|
289 | *****************************************************************************
|
---|
290 | * Function : dump_cursor
|
---|
291 | * Syntax : void dump_cursor(cursor_t *cur)
|
---|
292 | * Input :
|
---|
293 | * cur - Cursor resource descriptor
|
---|
294 | * Output : nop
|
---|
295 | * Description :
|
---|
296 | * Remarks :
|
---|
297 | *****************************************************************************
|
---|
298 | */
|
---|
299 | void dump_cursor(cursor_t *cur)
|
---|
300 | {
|
---|
301 | printf("Id: %d\n", cur->id);
|
---|
302 | printf("Width: %d\n", cur->width);
|
---|
303 | printf("Height: %d\n", cur->height);
|
---|
304 | printf("X Hotspot: %d\n", cur->xhot);
|
---|
305 | printf("Y Hotspot: %d\n", cur->yhot);
|
---|
306 | dump_raw_data(cur->data);
|
---|
307 | }
|
---|
308 |
|
---|
309 | /*
|
---|
310 | *****************************************************************************
|
---|
311 | * Function : dump_cursor_group
|
---|
312 | * Syntax : void dump_cursor_group(cursor_group_t *cur)
|
---|
313 | * Input :
|
---|
314 | * cur - Cursor group resource descriptor
|
---|
315 | * Output : nop
|
---|
316 | * Description :
|
---|
317 | * Remarks :
|
---|
318 | *****************************************************************************
|
---|
319 | */
|
---|
320 | void dump_cursor_group(cursor_group_t *curg)
|
---|
321 | {
|
---|
322 | dump_memopt(curg->memopt);
|
---|
323 | printf("There are %d cursors in this group\n", curg->ncursor);
|
---|
324 | }
|
---|
325 |
|
---|
326 | /*
|
---|
327 | *****************************************************************************
|
---|
328 | * Function : dump_icon
|
---|
329 | * Syntax : void dump_icon(icon_t *ico)
|
---|
330 | * Input :
|
---|
331 | * ico - Icon resource descriptor
|
---|
332 | * Output : nop
|
---|
333 | * Description :
|
---|
334 | * Remarks :
|
---|
335 | *****************************************************************************
|
---|
336 | */
|
---|
337 | void dump_icon(icon_t *ico)
|
---|
338 | {
|
---|
339 | printf("Id: %d\n", ico->id);
|
---|
340 | printf("Width: %d\n", ico->width);
|
---|
341 | printf("Height: %d\n", ico->height);
|
---|
342 | printf("NColor: %d\n", ico->nclr);
|
---|
343 | printf("NPlanes: %d\n", ico->planes);
|
---|
344 | printf("NBits: %d\n", ico->bits);
|
---|
345 | dump_raw_data(ico->data);
|
---|
346 | }
|
---|
347 |
|
---|
348 | /*
|
---|
349 | *****************************************************************************
|
---|
350 | * Function : dump_icon_group
|
---|
351 | * Syntax : void dump_icon_group(icon_group_t *ico)
|
---|
352 | * Input :
|
---|
353 | * ico - Icon group resource descriptor
|
---|
354 | * Output : nop
|
---|
355 | * Description :
|
---|
356 | * Remarks :
|
---|
357 | *****************************************************************************
|
---|
358 | */
|
---|
359 | void dump_icon_group(icon_group_t *icog)
|
---|
360 | {
|
---|
361 | dump_memopt(icog->memopt);
|
---|
362 | printf("There are %d icons in this group\n", icog->nicon);
|
---|
363 | }
|
---|
364 |
|
---|
365 | /*
|
---|
366 | *****************************************************************************
|
---|
367 | * Function : dump_font
|
---|
368 | * Syntax : void dump_font(font_t *fnt)
|
---|
369 | * Input :
|
---|
370 | * fnt - Font resource descriptor
|
---|
371 | * Output : nop
|
---|
372 | * Description :
|
---|
373 | * Remarks :
|
---|
374 | *****************************************************************************
|
---|
375 | */
|
---|
376 | void dump_font(font_t *fnt)
|
---|
377 | {
|
---|
378 | dump_memopt(fnt->memopt);
|
---|
379 | dump_raw_data(fnt->data);
|
---|
380 | }
|
---|
381 |
|
---|
382 | /*
|
---|
383 | *****************************************************************************
|
---|
384 | * Function : dump_bitmap
|
---|
385 | * Syntax : void dump_bitmap(bitmap_t *bmp)
|
---|
386 | * Input :
|
---|
387 | * bmp - Bitmap resource descriptor
|
---|
388 | * Output : nop
|
---|
389 | * Description :
|
---|
390 | * Remarks :
|
---|
391 | *****************************************************************************
|
---|
392 | */
|
---|
393 | void dump_bitmap(bitmap_t *bmp)
|
---|
394 | {
|
---|
395 | dump_memopt(bmp->memopt);
|
---|
396 | dump_raw_data(bmp->data);
|
---|
397 | }
|
---|
398 |
|
---|
399 | /*
|
---|
400 | *****************************************************************************
|
---|
401 | * Function : dump_rcdata
|
---|
402 | * Syntax : void dump_rcdata(rcdata_t *rdt)
|
---|
403 | * Input :
|
---|
404 | * rdt - RCData resource descriptor
|
---|
405 | * Output : nop
|
---|
406 | * Description :
|
---|
407 | * Remarks :
|
---|
408 | *****************************************************************************
|
---|
409 | */
|
---|
410 | void dump_rcdata(rcdata_t *rdt)
|
---|
411 | {
|
---|
412 | dump_memopt(rdt->memopt);
|
---|
413 | dump_raw_data(rdt->data);
|
---|
414 | }
|
---|
415 |
|
---|
416 | /*
|
---|
417 | *****************************************************************************
|
---|
418 | * Function : dump_user
|
---|
419 | * Syntax : void dump_user(user_t *usr)
|
---|
420 | * Input :
|
---|
421 | * usr - User resource descriptor
|
---|
422 | * Output : nop
|
---|
423 | * Description :
|
---|
424 | * Remarks :
|
---|
425 | *****************************************************************************
|
---|
426 | */
|
---|
427 | void dump_user(user_t *usr)
|
---|
428 | {
|
---|
429 | dump_memopt(usr->memopt);
|
---|
430 | printf("Class %s\n", get_nameid_str(usr->type));
|
---|
431 | dump_raw_data(usr->data);
|
---|
432 | }
|
---|
433 |
|
---|
434 | /*
|
---|
435 | *****************************************************************************
|
---|
436 | * Function : dump_messagetable
|
---|
437 | * Syntax : void dump_messagetable(messagetable_t *msg)
|
---|
438 | * Input :
|
---|
439 | * msg - Messagetable resource descriptor
|
---|
440 | * Output : nop
|
---|
441 | * Description :
|
---|
442 | * Remarks :
|
---|
443 | *****************************************************************************
|
---|
444 | */
|
---|
445 | void dump_messagetable(messagetable_t *msg)
|
---|
446 | {
|
---|
447 | dump_raw_data(msg->data);
|
---|
448 | }
|
---|
449 |
|
---|
450 | /*
|
---|
451 | *****************************************************************************
|
---|
452 | * Function : dump_stringtable
|
---|
453 | * Syntax : void dump_stringtable(stringtable_t *stt)
|
---|
454 | * Input :
|
---|
455 | * stt - Stringtable resource descriptor
|
---|
456 | * Output : nop
|
---|
457 | * Description :
|
---|
458 | * Remarks :
|
---|
459 | *****************************************************************************
|
---|
460 | */
|
---|
461 | void dump_stringtable(stringtable_t *stt)
|
---|
462 | {
|
---|
463 | int i;
|
---|
464 | for(; stt; stt = stt->next)
|
---|
465 | {
|
---|
466 | printf("{\n");
|
---|
467 | dump_memopt(stt->memopt);
|
---|
468 | dump_lvc(&(stt->lvc));
|
---|
469 | for(i = 0; i < stt->nentries; i++)
|
---|
470 | {
|
---|
471 | printf("Id=%-5d (%d) ", stt->idbase+i, stt->entries[i].id);
|
---|
472 | if(stt->entries[i].str)
|
---|
473 | print_string(stt->entries[i].str);
|
---|
474 | else
|
---|
475 | printf("<none>");
|
---|
476 | printf("\n");
|
---|
477 | }
|
---|
478 | printf("}\n");
|
---|
479 | }
|
---|
480 | }
|
---|
481 |
|
---|
482 | /*
|
---|
483 | *****************************************************************************
|
---|
484 | * Function : dump_control
|
---|
485 | * Syntax : void dump_control(control_t *ctrl)
|
---|
486 | * Input :
|
---|
487 | * ctrl - Control resource descriptor
|
---|
488 | * Output :
|
---|
489 | * Description :
|
---|
490 | * Remarks :
|
---|
491 | *****************************************************************************
|
---|
492 | */
|
---|
493 | void dump_control(control_t *ctrl)
|
---|
494 | {
|
---|
495 | printf("Control {\n\tClass: %s\n", get_nameid_str(ctrl->ctlclass));
|
---|
496 | printf("\tText: "); get_nameid_str(ctrl->title); printf("\n");
|
---|
497 | printf("\tId: %d\n", ctrl->id);
|
---|
498 | printf("\tx, y, w, h: %d, %d, %d, %d\n", ctrl->x, ctrl->y, ctrl->width, ctrl->height);
|
---|
499 | if(ctrl->gotstyle)
|
---|
500 | printf("\tStyle: %08lx\n", ctrl->style);
|
---|
501 | if(ctrl->gotexstyle)
|
---|
502 | printf("\tExStyle: %08lx\n", ctrl->exstyle);
|
---|
503 | if(ctrl->gothelpid)
|
---|
504 | printf("\tHelpid: %ld\n", ctrl->helpid);
|
---|
505 | if(ctrl->extra)
|
---|
506 | {
|
---|
507 | printf("\t");
|
---|
508 | dump_raw_data(ctrl->extra);
|
---|
509 | }
|
---|
510 | printf("}\n");
|
---|
511 | }
|
---|
512 |
|
---|
513 | /*
|
---|
514 | *****************************************************************************
|
---|
515 | * Function : dump_dialog
|
---|
516 | * Syntax : void dump_dialog(dialog_t *dlg)
|
---|
517 | * Input :
|
---|
518 | * dlg - Dialog resource descriptor
|
---|
519 | * Output :
|
---|
520 | * Description :
|
---|
521 | * Remarks :
|
---|
522 | *****************************************************************************
|
---|
523 | */
|
---|
524 | void dump_dialog(dialog_t *dlg)
|
---|
525 | {
|
---|
526 | control_t *c = dlg->controls;
|
---|
527 |
|
---|
528 | dump_memopt(dlg->memopt);
|
---|
529 | dump_lvc(&(dlg->lvc));
|
---|
530 | printf("x, y, w, h: %d, %d, %d, %d\n", dlg->x, dlg->y, dlg->width, dlg->height);
|
---|
531 | if(dlg->gotstyle)
|
---|
532 | printf("Style: %08lx\n", dlg->style);
|
---|
533 | if(dlg->gotexstyle)
|
---|
534 | printf("ExStyle: %08lx\n", dlg->exstyle);
|
---|
535 | printf("Menu: %s\n", get_nameid_str(dlg->menu));
|
---|
536 | printf("Class: %s\n", get_nameid_str(dlg->dlgclass));
|
---|
537 | printf("Title: "); print_string(dlg->title); printf("\n");
|
---|
538 | printf("Font: ");
|
---|
539 | if(!dlg->font)
|
---|
540 | printf("<none>\n");
|
---|
541 | else
|
---|
542 | {
|
---|
543 | printf("%d, ", dlg->font->size);
|
---|
544 | print_string(dlg->font->name);
|
---|
545 | printf("\n");
|
---|
546 | }
|
---|
547 | while(c)
|
---|
548 | {
|
---|
549 | dump_control(c);
|
---|
550 | c = c->next;
|
---|
551 | }
|
---|
552 | }
|
---|
553 |
|
---|
554 | /*
|
---|
555 | *****************************************************************************
|
---|
556 | * Function : dump_dialogex
|
---|
557 | * Syntax : void dump_dialogex(dialogex_t *dlgex)
|
---|
558 | * Input :
|
---|
559 | * dlgex - DialogEx resource descriptor
|
---|
560 | * Output :
|
---|
561 | * Description :
|
---|
562 | * Remarks :
|
---|
563 | *****************************************************************************
|
---|
564 | */
|
---|
565 | void dump_dialogex(dialogex_t *dlgex)
|
---|
566 | {
|
---|
567 | control_t *c = dlgex->controls;
|
---|
568 |
|
---|
569 | dump_memopt(dlgex->memopt);
|
---|
570 | dump_lvc(&(dlgex->lvc));
|
---|
571 | printf("x, y, w, h: %d, %d, %d, %d\n", dlgex->x, dlgex->y, dlgex->width, dlgex->height);
|
---|
572 | if(dlgex->gotstyle)
|
---|
573 | printf("Style: %08lx\n", dlgex->style);
|
---|
574 | if(dlgex->gotexstyle)
|
---|
575 | printf("ExStyle: %08lx\n", dlgex->exstyle);
|
---|
576 | if(dlgex->gothelpid)
|
---|
577 | printf("Helpid: %ld\n", dlgex->helpid);
|
---|
578 | printf("Menu: %s\n", get_nameid_str(dlgex->menu));
|
---|
579 | printf("Class: %s\n", get_nameid_str(dlgex->dlgclass));
|
---|
580 | printf("Title: "); print_string(dlgex->title); printf("\n");
|
---|
581 | printf("Font: ");
|
---|
582 | if(!dlgex->font)
|
---|
583 | printf("<none>\n");
|
---|
584 | else
|
---|
585 | {
|
---|
586 | printf("%d, ", dlgex->font->size);
|
---|
587 | print_string(dlgex->font->name);
|
---|
588 | printf(", %d, %d\n", dlgex->font->weight, dlgex->font->italic);
|
---|
589 | }
|
---|
590 | while(c)
|
---|
591 | {
|
---|
592 | dump_control(c);
|
---|
593 | c = c->next;
|
---|
594 | }
|
---|
595 | }
|
---|
596 |
|
---|
597 | /*
|
---|
598 | *****************************************************************************
|
---|
599 | * Function : dump_menu_item
|
---|
600 | * Syntax : void dump_menu_item(menu_item_t *item)
|
---|
601 | * Input :
|
---|
602 | * Output :
|
---|
603 | * Description :
|
---|
604 | * Remarks :
|
---|
605 | *****************************************************************************
|
---|
606 | */
|
---|
607 | void dump_menu_item(menu_item_t *item)
|
---|
608 | {
|
---|
609 | while(item)
|
---|
610 | {
|
---|
611 | if(item->popup)
|
---|
612 | {
|
---|
613 | printf("POPUP ");
|
---|
614 | print_string(item->name);
|
---|
615 | printf("\n");
|
---|
616 | dump_menu_item(item->popup);
|
---|
617 | }
|
---|
618 | else
|
---|
619 | {
|
---|
620 | printf("MENUITEM ");
|
---|
621 | if(item->name)
|
---|
622 | {
|
---|
623 | print_string(item->name);
|
---|
624 | printf(", %d, %08lx", item->id, item->state);
|
---|
625 | }
|
---|
626 | else
|
---|
627 | printf("SEPARATOR");
|
---|
628 | printf("\n");
|
---|
629 | }
|
---|
630 | item = item->next;
|
---|
631 | }
|
---|
632 | }
|
---|
633 |
|
---|
634 | /*
|
---|
635 | *****************************************************************************
|
---|
636 | * Function : dump_menu
|
---|
637 | * Syntax : void dump_menu(menu_t *men)
|
---|
638 | * Input :
|
---|
639 | * men - Menu resource descriptor
|
---|
640 | * Output :
|
---|
641 | * Description :
|
---|
642 | * Remarks :
|
---|
643 | *****************************************************************************
|
---|
644 | */
|
---|
645 | void dump_menu(menu_t *men)
|
---|
646 | {
|
---|
647 | dump_memopt(men->memopt);
|
---|
648 | dump_lvc(&(men->lvc));
|
---|
649 | dump_menu_item(men->items);
|
---|
650 | }
|
---|
651 |
|
---|
652 | /*
|
---|
653 | *****************************************************************************
|
---|
654 | * Function : dump_menuex_item
|
---|
655 | * Syntax : void dump_menuex_item(menuex_item_t *item)
|
---|
656 | * Input :
|
---|
657 | * Output :
|
---|
658 | * Description :
|
---|
659 | * Remarks :
|
---|
660 | *****************************************************************************
|
---|
661 | */
|
---|
662 | void dump_menuex_item(menuex_item_t *item)
|
---|
663 | {
|
---|
664 | while(item)
|
---|
665 | {
|
---|
666 | if(item->popup)
|
---|
667 | {
|
---|
668 | printf("POPUP ");
|
---|
669 | print_string(item->name);
|
---|
670 | if(item->gotid)
|
---|
671 | printf(", Id=%d", item->id);
|
---|
672 | if(item->gottype)
|
---|
673 | printf(", Type=%ld", item->type);
|
---|
674 | if(item->gotstate)
|
---|
675 | printf(", State=%08lx", item->state);
|
---|
676 | if(item->gothelpid)
|
---|
677 | printf(", HelpId=%d", item->helpid);
|
---|
678 | printf("\n");
|
---|
679 | dump_menuex_item(item->popup);
|
---|
680 | }
|
---|
681 | else
|
---|
682 | {
|
---|
683 | printf("MENUITEM ");
|
---|
684 | if(item->name)
|
---|
685 | {
|
---|
686 | print_string(item->name);
|
---|
687 | if(item->gotid)
|
---|
688 | printf(", Id=%d", item->id);
|
---|
689 | if(item->gottype)
|
---|
690 | printf(", Type=%ld", item->type);
|
---|
691 | if(item->gotstate)
|
---|
692 | printf(", State=%08lx", item->state);
|
---|
693 | if(item->gothelpid)
|
---|
694 | printf(", HelpId=%d", item->helpid);
|
---|
695 | }
|
---|
696 | else
|
---|
697 | printf("SEPARATOR");
|
---|
698 | printf("\n");
|
---|
699 | }
|
---|
700 | item = item->next;
|
---|
701 | }
|
---|
702 | }
|
---|
703 |
|
---|
704 | /*
|
---|
705 | *****************************************************************************
|
---|
706 | * Function : dump_menuex
|
---|
707 | * Syntax : void dump_menuex(dialogex_t *menex)
|
---|
708 | * Input :
|
---|
709 | * menex - MenuEx resource descriptor
|
---|
710 | * Output :
|
---|
711 | * Description :
|
---|
712 | * Remarks :
|
---|
713 | *****************************************************************************
|
---|
714 | */
|
---|
715 | void dump_menuex(menuex_t *menex)
|
---|
716 | {
|
---|
717 | dump_memopt(menex->memopt);
|
---|
718 | dump_lvc(&(menex->lvc));
|
---|
719 | dump_menuex_item(menex->items);
|
---|
720 | }
|
---|
721 |
|
---|
722 | /*
|
---|
723 | *****************************************************************************
|
---|
724 | * Function : dump_ver_value
|
---|
725 | * Syntax : void dump_ver_value(ver_value_t *val)
|
---|
726 | * Input :
|
---|
727 | * Output :
|
---|
728 | * Description :
|
---|
729 | * Remarks :
|
---|
730 | *****************************************************************************
|
---|
731 | */
|
---|
732 | void dump_ver_value(ver_value_t *val)
|
---|
733 | {
|
---|
734 | extern void dump_ver_block(ver_block_t *);
|
---|
735 | if(val->type == val_str)
|
---|
736 | {
|
---|
737 | printf("VALUE ");
|
---|
738 | print_string(val->key);
|
---|
739 | printf(" ");
|
---|
740 | print_string(val->value.str);
|
---|
741 | printf("\n");
|
---|
742 | }
|
---|
743 | else if(val->type == val_words)
|
---|
744 | {
|
---|
745 | int i;
|
---|
746 | printf("VALUE");
|
---|
747 | print_string(val->key);
|
---|
748 | for(i = 0; i < val->value.words->nwords; i++)
|
---|
749 | printf(" %04x", val->value.words->words[i]);
|
---|
750 | printf("\n");
|
---|
751 | }
|
---|
752 | else if(val->type == val_block)
|
---|
753 | {
|
---|
754 | dump_ver_block(val->value.block);
|
---|
755 | }
|
---|
756 | }
|
---|
757 |
|
---|
758 | /*
|
---|
759 | *****************************************************************************
|
---|
760 | * Function : dump_ver_block
|
---|
761 | * Syntax : void dump_ver_block(ver_block_t *blk)
|
---|
762 | * Input :
|
---|
763 | * Output :
|
---|
764 | * Description :
|
---|
765 | * Remarks :
|
---|
766 | *****************************************************************************
|
---|
767 | */
|
---|
768 | void dump_ver_block(ver_block_t *blk)
|
---|
769 | {
|
---|
770 | ver_value_t *val = blk->values;
|
---|
771 | printf("BLOCK ");
|
---|
772 | print_string(blk->name);
|
---|
773 | printf("\n{\n");
|
---|
774 | while(val)
|
---|
775 | {
|
---|
776 | dump_ver_value(val);
|
---|
777 | val = val->next;
|
---|
778 | }
|
---|
779 | printf("}\n");
|
---|
780 | }
|
---|
781 |
|
---|
782 | /*
|
---|
783 | *****************************************************************************
|
---|
784 | * Function : dump_versioninfo
|
---|
785 | * Syntax : void dump_versioninfo(versioninfo_t *ver)
|
---|
786 | * Input :
|
---|
787 | * ver - Versioninfo resource descriptor
|
---|
788 | * Output :
|
---|
789 | * Description :
|
---|
790 | * Remarks :
|
---|
791 | *****************************************************************************
|
---|
792 | */
|
---|
793 | void dump_versioninfo(versioninfo_t *ver)
|
---|
794 | {
|
---|
795 | ver_block_t *blk = ver->blocks;
|
---|
796 |
|
---|
797 | if(ver->gotit.fv)
|
---|
798 | printf("FILEVERSION %04x, %04x, %04x, %04x\n",
|
---|
799 | ver->filever_maj1,
|
---|
800 | ver->filever_maj2,
|
---|
801 | ver->filever_min1,
|
---|
802 | ver->filever_min2);
|
---|
803 | if(ver->gotit.pv)
|
---|
804 | printf("PRODUCTVERSION %04x, %04x, %04x, %04x\n",
|
---|
805 | ver->prodver_maj1,
|
---|
806 | ver->prodver_maj2,
|
---|
807 | ver->prodver_min1,
|
---|
808 | ver->prodver_min2);
|
---|
809 | if(ver->gotit.fo)
|
---|
810 | printf("FILEOS %08x\n", ver->fileos);
|
---|
811 | if(ver->gotit.ff)
|
---|
812 | printf("FILEFLAGS %08x\n", ver->fileflags);
|
---|
813 | if(ver->gotit.ffm)
|
---|
814 | printf("FILEFLAGSMASK %08x\n", ver->fileflagsmask);
|
---|
815 | if(ver->gotit.ft)
|
---|
816 | printf("FILETYPE %08x\n", ver->filetype);
|
---|
817 | if(ver->gotit.fst)
|
---|
818 | printf("FILESUBTYPE %08x\n", ver->filesubtype);
|
---|
819 | while(blk)
|
---|
820 | {
|
---|
821 | dump_ver_block(blk);
|
---|
822 | blk = blk->next;
|
---|
823 | }
|
---|
824 | }
|
---|
825 |
|
---|
826 | /*
|
---|
827 | *****************************************************************************
|
---|
828 | * Function : dump_toolbar_item
|
---|
829 | * Syntax : void dump_toolbar_item(toolbar_item_t *item)
|
---|
830 | * Input :
|
---|
831 | * Output :
|
---|
832 | * Description :
|
---|
833 | * Remarks :
|
---|
834 | *****************************************************************************
|
---|
835 | */
|
---|
836 | void dump_toolbar_items(toolbar_item_t *items)
|
---|
837 | {
|
---|
838 | while(items)
|
---|
839 | {
|
---|
840 | if(items->id)
|
---|
841 | printf(" BUTTON %d", items->id );
|
---|
842 | else
|
---|
843 | printf(" SEPARATOR");
|
---|
844 |
|
---|
845 | printf("\n");
|
---|
846 |
|
---|
847 | items = items->next;
|
---|
848 | }
|
---|
849 | }
|
---|
850 |
|
---|
851 | /*
|
---|
852 | *****************************************************************************
|
---|
853 | * Function : dump_toolbar
|
---|
854 | * Syntax : void dump_toolbar(toolbar_t *toolbar)
|
---|
855 | * Input :
|
---|
856 | * toolbar - Toolbar resource descriptor
|
---|
857 | * Output :
|
---|
858 | * Description :
|
---|
859 | * Remarks :
|
---|
860 | *****************************************************************************
|
---|
861 | */
|
---|
862 | void dump_toolbar(toolbar_t *toolbar)
|
---|
863 | {
|
---|
864 | dump_memopt(toolbar->memopt);
|
---|
865 | dump_lvc(&(toolbar->lvc));
|
---|
866 | dump_toolbar_items(toolbar->items);
|
---|
867 | }
|
---|
868 |
|
---|
869 | /*
|
---|
870 | *****************************************************************************
|
---|
871 | * Function : dump_dlginit
|
---|
872 | * Syntax : void dump_dlginit(dlginit_t *dit)
|
---|
873 | * Input :
|
---|
874 | * dit - DlgInit resource descriptor
|
---|
875 | * Output :
|
---|
876 | * Description :
|
---|
877 | * Remarks :
|
---|
878 | *****************************************************************************
|
---|
879 | */
|
---|
880 | void dump_dlginit(dlginit_t *dit)
|
---|
881 | {
|
---|
882 | dump_memopt(dit->memopt);
|
---|
883 | dump_lvc(&(dit->lvc));
|
---|
884 | dump_raw_data(dit->data);
|
---|
885 | }
|
---|
886 |
|
---|
887 | /*
|
---|
888 | *****************************************************************************
|
---|
889 | * Function :
|
---|
890 | * Syntax :
|
---|
891 | * Input :
|
---|
892 | * Output :
|
---|
893 | * Description :
|
---|
894 | * Remarks :
|
---|
895 | *****************************************************************************
|
---|
896 | */
|
---|
897 | /*
|
---|
898 | *****************************************************************************
|
---|
899 | * Function : dump_resources
|
---|
900 | * Syntax : void dump_resources(resource_t *top)
|
---|
901 | * Input :
|
---|
902 | * top - Top of the resource tree
|
---|
903 | * Output :
|
---|
904 | * nop
|
---|
905 | * Description : Dump the parsed resource-tree to stdout
|
---|
906 | * Remarks :
|
---|
907 | *****************************************************************************
|
---|
908 | */
|
---|
909 | void dump_resources(resource_t *top)
|
---|
910 | {
|
---|
911 | printf("Internal resource-tree dump:\n");
|
---|
912 | while(top)
|
---|
913 | {
|
---|
914 | printf("Resource: %s\nId: %s\n",
|
---|
915 | get_typename(top),
|
---|
916 | get_nameid_str(top->name));
|
---|
917 | switch(top->type)
|
---|
918 | {
|
---|
919 | case res_acc:
|
---|
920 | dump_accelerator(top->res.acc);
|
---|
921 | break;
|
---|
922 | case res_bmp:
|
---|
923 | dump_bitmap(top->res.bmp);
|
---|
924 | break;
|
---|
925 | case res_cur:
|
---|
926 | dump_cursor(top->res.cur);
|
---|
927 | break;
|
---|
928 | case res_curg:
|
---|
929 | dump_cursor_group(top->res.curg);
|
---|
930 | break;
|
---|
931 | case res_dlg:
|
---|
932 | dump_dialog(top->res.dlg);
|
---|
933 | break;
|
---|
934 | case res_dlgex:
|
---|
935 | dump_dialogex(top->res.dlgex);
|
---|
936 | break;
|
---|
937 | case res_fnt:
|
---|
938 | dump_font(top->res.fnt);
|
---|
939 | break;
|
---|
940 | case res_icog:
|
---|
941 | dump_icon_group(top->res.icog);
|
---|
942 | break;
|
---|
943 | case res_ico:
|
---|
944 | dump_icon(top->res.ico);
|
---|
945 | break;
|
---|
946 | case res_men:
|
---|
947 | dump_menu(top->res.men);
|
---|
948 | break;
|
---|
949 | case res_menex:
|
---|
950 | dump_menuex(top->res.menex);
|
---|
951 | break;
|
---|
952 | case res_rdt:
|
---|
953 | dump_rcdata(top->res.rdt);
|
---|
954 | break;
|
---|
955 | case res_stt:
|
---|
956 | dump_stringtable(top->res.stt);
|
---|
957 | break;
|
---|
958 | case res_usr:
|
---|
959 | dump_user(top->res.usr);
|
---|
960 | break;
|
---|
961 | case res_msg:
|
---|
962 | dump_messagetable(top->res.msg);
|
---|
963 | break;
|
---|
964 | case res_ver:
|
---|
965 | dump_versioninfo(top->res.ver);
|
---|
966 | break;
|
---|
967 | case res_dlginit:
|
---|
968 | dump_dlginit(top->res.dlgi);
|
---|
969 | break;
|
---|
970 | case res_toolbar:
|
---|
971 | dump_toolbar(top->res.tbt);
|
---|
972 | break;
|
---|
973 | default:
|
---|
974 | printf("Report this: Unknown resource type parsed %08x\n", top->type);
|
---|
975 | }
|
---|
976 | printf("\n");
|
---|
977 | top = top->next;
|
---|
978 | }
|
---|
979 | }
|
---|
980 |
|
---|