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