2 * Generate .res format from a resource-tree
4 * Copyright 1998 Bertho A. Stultiens
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 * 05-May-2000 BS - Added code to support endian conversions. The
22 * extra functions also aid unaligned access, but
23 * this is not yet implemented.
24 * 25-May-1998 BS - Added simple unicode -> char conversion for resource
25 * names in .s and .h files.
44 #include "wine/unicode.h"
46 #define SetResSize(res, tag) set_dword((res), (tag), (res)->size - get_dword((res), (tag)))
51 r
= xmalloc(sizeof(res_t
));
52 r
->allocsize
= RES_BLOCKSIZE
;
55 r
->data
= xmalloc(RES_BLOCKSIZE
);
59 res_t
*grow_res(res_t
*r
, unsigned int add
)
62 r
->data
= xrealloc(r
->data
, r
->allocsize
);
67 *****************************************************************************
71 * Syntax : void put_byte(res_t *res, unsigned c)
72 * void put_word(res_t *res, unsigned w)
73 * void put_dword(res_t *res, unsigned d)
75 * res - Binary resource to put the data in
76 * c, w, d - Data to put
78 * Description : Put primitives that put an item in the binary resource.
79 * The data array grows automatically.
81 *****************************************************************************
83 void put_byte(res_t
*res
, unsigned c
)
85 if(res
->allocsize
- res
->size
< sizeof(char))
86 grow_res(res
, RES_BLOCKSIZE
);
87 res
->data
[res
->size
] = (char)c
;
88 res
->size
+= sizeof(char);
91 void put_word(res_t
*res
, unsigned w
)
93 if(res
->allocsize
- res
->size
< sizeof(WORD
))
94 grow_res(res
, RES_BLOCKSIZE
);
97 #ifdef WORDS_BIGENDIAN
101 res
->data
[res
->size
+0] = HIBYTE(w
);
102 res
->data
[res
->size
+1] = LOBYTE(w
);
105 #ifndef WORDS_BIGENDIAN
109 res
->data
[res
->size
+1] = HIBYTE(w
);
110 res
->data
[res
->size
+0] = LOBYTE(w
);
113 res
->size
+= sizeof(WORD
);
116 void put_dword(res_t
*res
, unsigned d
)
118 if(res
->allocsize
- res
->size
< sizeof(DWORD
))
119 grow_res(res
, RES_BLOCKSIZE
);
122 #ifdef WORDS_BIGENDIAN
126 res
->data
[res
->size
+0] = HIBYTE(HIWORD(d
));
127 res
->data
[res
->size
+1] = LOBYTE(HIWORD(d
));
128 res
->data
[res
->size
+2] = HIBYTE(LOWORD(d
));
129 res
->data
[res
->size
+3] = LOBYTE(LOWORD(d
));
132 #ifndef WORDS_BIGENDIAN
136 res
->data
[res
->size
+3] = HIBYTE(HIWORD(d
));
137 res
->data
[res
->size
+2] = LOBYTE(HIWORD(d
));
138 res
->data
[res
->size
+1] = HIBYTE(LOWORD(d
));
139 res
->data
[res
->size
+0] = LOBYTE(LOWORD(d
));
142 res
->size
+= sizeof(DWORD
);
145 static void put_pad(res_t
*res
)
147 while(res
->size
& 0x3)
152 *****************************************************************************
153 * Function : set_word
155 * Syntax : void set_word(res_t *res, int ofs, unsigned w)
156 * void set_dword(res_t *res, int ofs, unsigned d)
158 * res - Binary resource to put the data in
159 * ofs - Byte offset in data-array
162 * Description : Set the value of a binary resource data array to a
165 *****************************************************************************
167 static void set_word(res_t
*res
, int ofs
, unsigned w
)
171 #ifdef WORDS_BIGENDIAN
175 res
->data
[ofs
+0] = HIBYTE(w
);
176 res
->data
[ofs
+1] = LOBYTE(w
);
179 #ifndef WORDS_BIGENDIAN
183 res
->data
[ofs
+1] = HIBYTE(w
);
184 res
->data
[ofs
+0] = LOBYTE(w
);
189 static void set_dword(res_t
*res
, int ofs
, unsigned d
)
193 #ifdef WORDS_BIGENDIAN
197 res
->data
[ofs
+0] = HIBYTE(HIWORD(d
));
198 res
->data
[ofs
+1] = LOBYTE(HIWORD(d
));
199 res
->data
[ofs
+2] = HIBYTE(LOWORD(d
));
200 res
->data
[ofs
+3] = LOBYTE(LOWORD(d
));
203 #ifndef WORDS_BIGENDIAN
207 res
->data
[ofs
+3] = HIBYTE(HIWORD(d
));
208 res
->data
[ofs
+2] = LOBYTE(HIWORD(d
));
209 res
->data
[ofs
+1] = HIBYTE(LOWORD(d
));
210 res
->data
[ofs
+0] = LOBYTE(LOWORD(d
));
216 *****************************************************************************
217 * Function : get_dword
219 * res - Binary resource to put the data in
220 * ofs - Byte offset in data-array
221 * Output : The data in native endian
222 * Description : Get the value of a binary resource data array in native
225 *****************************************************************************
227 static DWORD
get_dword(res_t
*res
, int ofs
)
231 #ifdef WORDS_BIGENDIAN
235 return (res
->data
[ofs
+0] << 24)
236 | (res
->data
[ofs
+1] << 16)
237 | (res
->data
[ofs
+2] << 8)
240 #ifndef WORDS_BIGENDIAN
244 return (res
->data
[ofs
+3] << 24)
245 | (res
->data
[ofs
+2] << 16)
246 | (res
->data
[ofs
+1] << 8)
252 *****************************************************************************
253 * Function : string_to_upper
254 * Syntax : void string_to_upper(string_t *str)
258 * Remarks : FIXME: codepages...
259 *****************************************************************************
261 static void string_to_upper(string_t
*str
)
265 if(str
->type
== str_char
)
267 for (i
= 0; i
< str
->size
; i
++) str
->str
.cstr
[i
] = toupper((unsigned char)str
->str
.cstr
[i
]);
269 else if(str
->type
== str_unicode
)
271 for (i
= 0; i
< str
->size
; i
++) str
->str
.wstr
[i
] = toupperW(str
->str
.wstr
[i
]);
275 internal_error(__FILE__
, __LINE__
, "Invalid string type %d\n", str
->type
);
280 *****************************************************************************
281 * Function : put_string
282 * Syntax : void put_string(res_t *res, string_t *str, enum str_e type,
283 * int isterm, const language_t *lang)
285 * res - Binary resource to put the data in
286 * str - String to put
287 * type - Data has to be written in either str_char or str_unicode
288 * isterm - The string is '\0' terminated (disregard the string's
293 *****************************************************************************
295 static void put_string(res_t
*res
, const string_t
*str
, enum str_e type
, int isterm
,
296 const language_t
*lang
)
304 if (lang
) codepage
= get_language_codepage( lang
->id
, lang
->sub
);
305 else codepage
= get_language_codepage( 0, 0 );
307 assert( codepage
!= -1 );
309 newstr
= convert_string(str
, type
, codepage
);
310 if (type
== str_unicode
)
312 if (str
->type
== str_char
)
314 if (!check_unicode_conversion( str
, newstr
, codepage
))
316 print_location( &str
->loc
);
317 error( "String %s does not convert identically to Unicode and back in codepage %d. "
318 "Try using a Unicode string instead\n", str
->str
.cstr
, codepage
);
320 if (check_valid_utf8( str
, codepage
))
322 print_location( &str
->loc
);
323 warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use.\n",
324 str
->str
.cstr
, codepage
);
327 if (!isterm
) put_word(res
, newstr
->size
);
328 for(cnt
= 0; cnt
< newstr
->size
; cnt
++)
330 WCHAR c
= newstr
->str
.wstr
[cnt
];
331 if (isterm
&& !c
) break;
334 if (isterm
) put_word(res
, 0);
338 if (!isterm
) put_byte(res
, newstr
->size
);
339 for(cnt
= 0; cnt
< newstr
->size
; cnt
++)
341 char c
= newstr
->str
.cstr
[cnt
];
342 if (isterm
&& !c
) break;
345 if (isterm
) put_byte(res
, 0);
351 *****************************************************************************
352 * Function : put_name_id
353 * Syntax : void put_name_id(res_t *res, name_id_t *nid, int upcase, const language_t *lang)
358 *****************************************************************************
360 static void put_name_id(res_t
*res
, name_id_t
*nid
, int upcase
, const language_t
*lang
)
362 if(nid
->type
== name_ord
)
365 put_word(res
, 0xffff);
368 put_word(res
, (WORD
)nid
->name
.i_name
);
370 else if(nid
->type
== name_str
)
373 string_to_upper(nid
->name
.s_name
);
374 put_string(res
, nid
->name
.s_name
, win32
? str_unicode
: str_char
, TRUE
, lang
);
378 internal_error(__FILE__
, __LINE__
, "Invalid name_id type %d\n", nid
->type
);
383 *****************************************************************************
385 * Syntax : void put_lvc(res_t *res, lvc_t *lvc)
390 *****************************************************************************
392 static void put_lvc(res_t
*res
, lvc_t
*lvc
)
394 if(lvc
&& lvc
->language
)
395 put_word(res
, MAKELANGID(lvc
->language
->id
, lvc
->language
->sub
));
397 put_word(res
, 0); /* Neutral */
398 if(lvc
&& lvc
->version
)
399 put_dword(res
, *(lvc
->version
));
402 if(lvc
&& lvc
->characts
)
403 put_dword(res
, *(lvc
->characts
));
409 *****************************************************************************
410 * Function : put_raw_data
411 * Syntax : void put_raw_data(res_t *res, raw_data_t *raw, int offset)
416 *****************************************************************************
418 static void put_raw_data(res_t
*res
, raw_data_t
*raw
, int offset
)
420 unsigned int wsize
= raw
->size
- offset
;
421 if(res
->allocsize
- res
->size
< wsize
)
422 grow_res(res
, wsize
);
423 memcpy(&(res
->data
[res
->size
]), raw
->data
+ offset
, wsize
);
428 *****************************************************************************
429 * Function : put_res_header
430 * Syntax : input_res_header(res_t *res, int type, name_id_t *ntype,
431 * name_id_t *name, DWORD memopt, lvc_t *lvc)
434 * res - Binary resource descriptor to write to
435 * type - Resource identifier (if ntype == NULL)
436 * ntype - Name id of type
437 * name - Resource's name
438 * memopt - Resource's memory options to write
439 * lvc - Language, version and characteristics (win32 only)
440 * Output : An index to the resource size field. The resource size field
441 * contains the header size upon exit.
444 *****************************************************************************
446 static int put_res_header(res_t
*res
, int type
, name_id_t
*ntype
, name_id_t
*name
,
447 DWORD memopt
, lvc_t
*lvc
)
451 put_dword(res
, 0); /* We will overwrite these later */
455 put_word(res
, 0xffff); /* ResType */
459 put_name_id(res
, ntype
, TRUE
, lvc
->language
);
460 put_name_id(res
, name
, TRUE
, lvc
->language
); /* ResName */
462 put_dword(res
, 0); /* DataVersion */
463 put_word(res
, memopt
); /* Memory options */
464 put_lvc(res
, lvc
); /* Language, version and characts */
465 set_dword(res
, 0*sizeof(DWORD
), res
->size
); /* Set preliminary resource */
466 set_dword(res
, 1*sizeof(DWORD
), res
->size
); /* Set HeaderSize */
467 res
->dataidx
= res
->size
;
475 put_byte(res
, 0xff); /* ResType */
479 put_name_id(res
, ntype
, TRUE
, NULL
);
480 put_name_id(res
, name
, TRUE
, NULL
); /* ResName */
481 put_word(res
, memopt
); /* Memory options */
483 put_dword(res
, 0); /* ResSize overwritten later*/
484 set_dword(res
, tag
, res
->size
);
485 res
->dataidx
= res
->size
;
491 *****************************************************************************
492 * Function : accelerator2res
493 * Syntax : res_t *accelerator2res(name_id_t *name, accelerator_t *acc)
495 * name - Name/ordinal of the resource
496 * acc - The accelerator descriptor
497 * Output : New .res format structure
500 *****************************************************************************
502 static res_t
*accelerator2res(name_id_t
*name
, accelerator_t
*acc
)
507 assert(name
!= NULL
);
514 restag
= put_res_header(res
, WRC_RT_ACCELERATOR
, NULL
, name
, acc
->memopt
, &(acc
->lvc
));
517 put_word(res
, ev
->flags
| (ev
->next
? 0 : 0x80));
518 put_word(res
, ev
->key
);
519 put_word(res
, ev
->id
);
520 put_word(res
, 0); /* Padding */
527 restag
= put_res_header(res
, WRC_RT_ACCELERATOR
, NULL
, name
, acc
->memopt
, NULL
);
530 put_byte(res
, ev
->flags
| (ev
->next
? 0 : 0x80));
531 put_word(res
, ev
->key
);
532 put_word(res
, ev
->id
);
536 /* Set ResourceSize */
537 SetResSize(res
, restag
);
542 *****************************************************************************
543 * Function : dialog2res
544 * Syntax : res_t *dialog2res(name_id_t *name, dialog_t *dlg)
546 * name - Name/ordinal of the resource
547 * dlg - The dialog descriptor
548 * Output : New .res format structure
551 *****************************************************************************
553 static res_t
*dialog2res(name_id_t
*name
, dialog_t
*dlg
)
560 assert(name
!= NULL
);
563 ctrl
= dlg
->controls
;
567 restag
= put_res_header(res
, WRC_RT_DIALOG
, NULL
, name
, dlg
->memopt
, &(dlg
->lvc
));
571 /* FIXME: MS doc says that the first word must contain 0xffff
572 * and the second 0x0001 to signal a DLGTEMPLATEEX. Borland's
573 * compiler reverses the two words.
574 * I don't know which one to choose, but I write it as Mr. B
577 put_word(res
, 1); /* Signature */
578 put_word(res
, 0xffff); /* DlgVer */
579 put_dword(res
, dlg
->gothelpid
? dlg
->helpid
: 0);
580 put_dword(res
, dlg
->gotexstyle
? dlg
->exstyle
->or_mask
: 0);
581 put_dword(res
, dlg
->gotstyle
? dlg
->style
->or_mask
: WS_POPUPWINDOW
);
585 put_dword(res
, dlg
->style
->or_mask
);
586 put_dword(res
, dlg
->gotexstyle
? dlg
->exstyle
->or_mask
: 0);
588 tag_nctrl
= res
->size
;
589 put_word(res
, 0); /* Number of controls */
590 put_word(res
, dlg
->x
);
591 put_word(res
, dlg
->y
);
592 put_word(res
, dlg
->width
);
593 put_word(res
, dlg
->height
);
595 put_name_id(res
, dlg
->menu
, TRUE
, dlg
->lvc
.language
);
599 put_name_id(res
, dlg
->dlgclass
, TRUE
, dlg
->lvc
.language
);
603 put_string(res
, dlg
->title
, str_unicode
, TRUE
, dlg
->lvc
.language
);
608 put_word(res
, dlg
->font
->size
);
611 put_word(res
, dlg
->font
->weight
);
612 /* FIXME: ? TRUE should be sufficient to say that it's
613 * italic, but Borland's compiler says it's 0x0101.
614 * I just copy it here, and hope for the best.
616 put_word(res
, dlg
->font
->italic
? 0x0101 : 0);
618 put_string(res
, dlg
->font
->name
, str_unicode
, TRUE
, dlg
->lvc
.language
);
626 put_dword(res
, ctrl
->gothelpid
? ctrl
->helpid
: 0);
627 put_dword(res
, ctrl
->gotexstyle
? ctrl
->exstyle
->or_mask
: 0);
628 /* FIXME: what is default control style? */
629 put_dword(res
, ctrl
->gotstyle
? ctrl
->style
->or_mask
: WS_CHILD
| WS_VISIBLE
);
633 /* FIXME: what is default control style? */
634 put_dword(res
, ctrl
->gotstyle
? ctrl
->style
->or_mask
: WS_CHILD
);
635 put_dword(res
, ctrl
->gotexstyle
? ctrl
->exstyle
->or_mask
: 0);
637 put_word(res
, ctrl
->x
);
638 put_word(res
, ctrl
->y
);
639 put_word(res
, ctrl
->width
);
640 put_word(res
, ctrl
->height
);
642 put_dword(res
, ctrl
->id
);
644 put_word(res
, ctrl
->id
);
646 put_name_id(res
, ctrl
->ctlclass
, TRUE
, dlg
->lvc
.language
);
648 internal_error(__FILE__
, __LINE__
, "Control has no control-class\n");
650 put_name_id(res
, ctrl
->title
, FALSE
, dlg
->lvc
.language
);
655 put_word(res
, ctrl
->extra
->size
+2);
657 put_raw_data(res
, ctrl
->extra
, 0);
667 /* Set number of controls */
668 set_word(res
, tag_nctrl
, (WORD
)nctrl
);
672 restag
= put_res_header(res
, WRC_RT_DIALOG
, NULL
, name
, dlg
->memopt
, NULL
);
674 put_dword(res
, dlg
->gotstyle
? dlg
->style
->or_mask
: WS_POPUPWINDOW
);
675 tag_nctrl
= res
->size
;
676 put_byte(res
, 0); /* Number of controls */
677 put_word(res
, dlg
->x
);
678 put_word(res
, dlg
->y
);
679 put_word(res
, dlg
->width
);
680 put_word(res
, dlg
->height
);
682 put_name_id(res
, dlg
->menu
, TRUE
, NULL
);
686 put_name_id(res
, dlg
->dlgclass
, TRUE
, NULL
);
690 put_string(res
, dlg
->title
, str_char
, TRUE
, NULL
);
695 put_word(res
, dlg
->font
->size
);
696 put_string(res
, dlg
->font
->name
, str_char
, TRUE
, NULL
);
701 put_word(res
, ctrl
->x
);
702 put_word(res
, ctrl
->y
);
703 put_word(res
, ctrl
->width
);
704 put_word(res
, ctrl
->height
);
705 put_word(res
, ctrl
->id
);
706 put_dword(res
, ctrl
->gotstyle
? ctrl
->style
->or_mask
: WS_CHILD
);
709 if(ctrl
->ctlclass
->type
== name_ord
710 && ctrl
->ctlclass
->name
.i_name
>= 0x80
711 && ctrl
->ctlclass
->name
.i_name
<= 0x85)
712 put_byte(res
, ctrl
->ctlclass
->name
.i_name
);
713 else if(ctrl
->ctlclass
->type
== name_str
)
714 put_name_id(res
, ctrl
->ctlclass
, FALSE
, NULL
);
716 error("Unknown control-class %04x\n", ctrl
->ctlclass
->name
.i_name
);
719 internal_error(__FILE__
, __LINE__
, "Control has no control-class\n");
721 put_name_id(res
, ctrl
->title
, FALSE
, NULL
);
725 /* FIXME: What is this extra byte doing here? */
731 /* Set number of controls */
732 ((char *)res
->data
)[tag_nctrl
] = (char)nctrl
;
734 /* Set ResourceSize */
735 SetResSize(res
, restag
);
740 *****************************************************************************
741 * Function : menuitem2res
742 * Syntax : void menuitem2res(res_t *res, menu_item_t *item)
746 * Remarks : Self recursive
747 *****************************************************************************
749 static void menuitem2res(res_t
*res
, menu_item_t
*menitem
, const language_t
*lang
)
751 menu_item_t
*itm
= menitem
;
756 put_word(res
, itm
->state
| (itm
->popup
? MF_POPUP
: 0) | (!itm
->next
? MF_END
: 0));
758 put_word(res
, itm
->id
);
760 put_string(res
, itm
->name
, str_unicode
, TRUE
, lang
);
764 menuitem2res(res
, itm
->popup
, lang
);
772 put_word(res
, itm
->state
| (itm
->popup
? MF_POPUP
: 0) | (!itm
->next
? MF_END
: 0));
774 put_word(res
, itm
->id
);
776 put_string(res
, itm
->name
, str_char
, TRUE
, lang
);
780 menuitem2res(res
, itm
->popup
, lang
);
788 *****************************************************************************
789 * Function : menuexitem2res
790 * Syntax : void menuexitem2res(res_t *res, menuex_item_t *item)
794 * Remarks : Self recursive
795 *****************************************************************************
797 static void menuexitem2res(res_t
*res
, menu_item_t
*menitem
, const language_t
*lang
)
799 menu_item_t
*itm
= menitem
;
803 put_dword(res
, itm
->gottype
? itm
->type
: 0);
804 put_dword(res
, itm
->gotstate
? itm
->state
: 0);
805 put_dword(res
, itm
->gotid
? itm
->id
: 0); /* FIXME: Docu. says word */
806 put_word(res
, (itm
->popup
? 0x01 : 0) | (!itm
->next
? MF_END
: 0));
808 put_string(res
, itm
->name
, str_unicode
, TRUE
, lang
);
814 put_dword(res
, itm
->gothelpid
? itm
->helpid
: 0);
815 menuexitem2res(res
, itm
->popup
, lang
);
823 *****************************************************************************
824 * Function : menu2res
825 * Syntax : res_t *menu2res(name_id_t *name, menu_t *men)
827 * name - Name/ordinal of the resource
828 * menex - The menuex descriptor
829 * Output : New .res format structure
832 *****************************************************************************
834 static res_t
*menu2res(name_id_t
*name
, menu_t
*men
)
838 assert(name
!= NULL
);
844 restag
= put_res_header(res
, WRC_RT_MENU
, NULL
, name
, men
->memopt
, &(men
->lvc
));
848 put_word(res
, 1); /* Menuheader: Version */
849 put_word(res
, 4); /* Offset */
850 put_dword(res
, 0); /* HelpId */
852 menuexitem2res(res
, men
->items
, men
->lvc
.language
);
856 put_dword(res
, 0); /* Menuheader: Version and HeaderSize */
857 menuitem2res(res
, men
->items
, men
->lvc
.language
);
859 /* Set ResourceSize */
860 SetResSize(res
, restag
);
865 restag
= put_res_header(res
, WRC_RT_MENU
, NULL
, name
, men
->memopt
, NULL
);
867 put_dword(res
, 0); /* Menuheader: Version and HeaderSize */
868 menuitem2res(res
, men
->items
, NULL
);
869 /* Set ResourceSize */
870 SetResSize(res
, restag
);
876 *****************************************************************************
877 * Function : cursorgroup2res
878 * Syntax : res_t *cursorgroup2res(name_id_t *name, cursor_group_t *curg)
880 * name - Name/ordinal of the resource
881 * curg - The cursor descriptor
882 * Output : New .res format structure
885 *****************************************************************************
887 static res_t
*cursorgroup2res(name_id_t
*name
, cursor_group_t
*curg
)
892 assert(name
!= NULL
);
893 assert(curg
!= NULL
);
896 restag
= put_res_header(res
, WRC_RT_GROUP_CURSOR
, NULL
, name
, curg
->memopt
, &(curg
->lvc
));
899 put_word(res
, 0); /* Reserved */
900 /* FIXME: The ResType in the NEWHEADER structure should
901 * contain 14 according to the MS win32 doc. This is
902 * not the case with the BRC compiler and I really doubt
903 * the latter. Putting one here is compliant to win16 spec,
904 * but who knows the true value?
906 put_word(res
, 2); /* ResType */
907 put_word(res
, curg
->ncursor
);
909 for(cur
= curg
->cursorlist
; cur
; cur
= cur
->next
)
911 cur
= curg
->cursorlist
;
914 for(; cur
; cur
= cur
->prev
)
917 put_word(res
, cur
->width
);
918 /* FIXME: The height of a cursor is half the size of
919 * the bitmap's height. BRC puts the height from the
920 * BITMAPINFOHEADER here instead of the cursorfile's
921 * height. MS doesn't seem to care...
923 put_word(res
, cur
->height
);
924 /* FIXME: The next two are reversed in BRC and I don't
925 * know why. Probably a bug. But, we can safely ignore
926 * it because win16 does not support color cursors.
927 * A warning should have been generated by the parser.
929 put_word(res
, cur
->planes
);
930 put_word(res
, cur
->bits
);
931 /* FIXME: The +4 is the hotspot in the cursor resource.
932 * However, I could not find this in the documentation.
933 * The hotspot bytes must either be included or MS
936 put_dword(res
, cur
->data
->size
+4);
937 put_word(res
, cur
->id
);
942 put_word(res
, 0); /* Reserved */
943 put_word(res
, 2); /* ResType */
944 put_word(res
, curg
->ncursor
);
946 for(cur
= curg
->cursorlist
; cur
; cur
= cur
->next
)
948 cur
= curg
->cursorlist
;
951 for(; cur
; cur
= cur
->prev
)
954 put_word(res
, cur
->width
);
955 /* FIXME: The height of a cursor is half the size of
956 * the bitmap's height. BRC puts the height from the
957 * BITMAPINFOHEADER here instead of the cursorfile's
958 * height. MS doesn't seem to care...
960 put_word(res
, cur
->height
);
961 /* FIXME: The next two are reversed in BRC and I don't
962 * know why. Probably a bug. But, we can safely ignore
963 * it because win16 does not support color cursors.
964 * A warning should have been generated by the parser.
966 put_word(res
, cur
->planes
);
967 put_word(res
, cur
->bits
);
968 /* FIXME: The +4 is the hotspot in the cursor resource.
969 * However, I could not find this in the documentation.
970 * The hotspot bytes must either be included or MS
973 put_dword(res
, cur
->data
->size
+4);
974 put_word(res
, cur
->id
);
977 SetResSize(res
, restag
); /* Set ResourceSize */
985 *****************************************************************************
986 * Function : cursor2res
987 * Syntax : res_t *cursor2res(cursor_t *cur)
989 * cur - The cursor descriptor
990 * Output : New .res format structure
993 *****************************************************************************
995 static res_t
*cursor2res(cursor_t
*cur
)
1001 assert(cur
!= NULL
);
1004 name
.type
= name_ord
;
1005 name
.name
.i_name
= cur
->id
;
1006 restag
= put_res_header(res
, WRC_RT_CURSOR
, NULL
, &name
, WRC_MO_MOVEABLE
| WRC_MO_DISCARDABLE
, &(cur
->lvc
));
1007 put_word(res
, cur
->xhot
);
1008 put_word(res
, cur
->yhot
);
1009 put_raw_data(res
, cur
->data
, 0);
1011 SetResSize(res
, restag
); /* Set ResourceSize */
1019 *****************************************************************************
1020 * Function : icongroup2res
1021 * Syntax : res_t *icongroup2res(name_id_t *name, icon_group_t *icog)
1023 * name - Name/ordinal of the resource
1024 * icog - The icon group descriptor
1025 * Output : New .res format structure
1028 *****************************************************************************
1030 static res_t
*icongroup2res(name_id_t
*name
, icon_group_t
*icog
)
1035 assert(name
!= NULL
);
1036 assert(icog
!= NULL
);
1039 restag
= put_res_header(res
, WRC_RT_GROUP_ICON
, NULL
, name
, icog
->memopt
, &(icog
->lvc
));
1042 put_word(res
, 0); /* Reserved */
1043 /* FIXME: The ResType in the NEWHEADER structure should
1044 * contain 14 according to the MS win32 doc. This is
1045 * not the case with the BRC compiler and I really doubt
1046 * the latter. Putting one here is compliant to win16 spec,
1047 * but who knows the true value?
1049 put_word(res
, 1); /* ResType */
1050 put_word(res
, icog
->nicon
);
1051 for(ico
= icog
->iconlist
; ico
; ico
= ico
->next
)
1053 put_byte(res
, ico
->width
);
1054 put_byte(res
, ico
->height
);
1055 put_byte(res
, ico
->nclr
);
1056 put_byte(res
, 0); /* Reserved */
1057 put_word(res
, ico
->planes
);
1058 put_word(res
, ico
->bits
);
1059 put_dword(res
, ico
->data
->size
);
1060 put_word(res
, ico
->id
);
1065 put_word(res
, 0); /* Reserved */
1066 put_word(res
, 1); /* ResType */
1067 put_word(res
, icog
->nicon
);
1068 for(ico
= icog
->iconlist
; ico
; ico
= ico
->next
)
1070 put_byte(res
, ico
->width
);
1071 put_byte(res
, ico
->height
);
1072 put_byte(res
, ico
->nclr
);
1073 put_byte(res
, 0); /* Reserved */
1074 put_word(res
, ico
->planes
);
1075 put_word(res
, ico
->bits
);
1076 put_dword(res
, ico
->data
->size
);
1077 put_word(res
, ico
->id
);
1080 SetResSize(res
, restag
); /* Set ResourceSize */
1088 *****************************************************************************
1089 * Function : icon2res
1090 * Syntax : res_t *icon2res(icon_t *ico)
1092 * ico - The icon descriptor
1093 * Output : New .res format structure
1096 *****************************************************************************
1098 static res_t
*icon2res(icon_t
*ico
)
1104 assert(ico
!= NULL
);
1107 name
.type
= name_ord
;
1108 name
.name
.i_name
= ico
->id
;
1109 restag
= put_res_header(res
, WRC_RT_ICON
, NULL
, &name
, WRC_MO_MOVEABLE
| WRC_MO_DISCARDABLE
, &(ico
->lvc
));
1110 put_raw_data(res
, ico
->data
, 0);
1112 SetResSize(res
, restag
); /* Set ResourceSize */
1120 *****************************************************************************
1121 * Function : anicurico2res
1122 * Syntax : res_t *anicurico2res(name_id_t *name, ani_curico_t *ani)
1124 * name - Name/ordinal of the resource
1125 * ani - The animated object descriptor
1126 * Output : New .res format structure
1128 * Remarks : The endian of the object's structures have been converted
1130 * There are rumors that win311 could handle animated stuff.
1131 * That is why they are generated for both win16 and win32
1133 *****************************************************************************
1135 static res_t
*anicurico2res(name_id_t
*name
, ani_curico_t
*ani
, enum res_e type
)
1139 assert(name
!= NULL
);
1140 assert(ani
!= NULL
);
1143 restag
= put_res_header(res
, type
== res_anicur
? WRC_RT_ANICURSOR
: WRC_RT_ANIICON
,
1144 NULL
, name
, ani
->memopt
, NULL
);
1145 put_raw_data(res
, ani
->data
, 0);
1146 /* Set ResourceSize */
1147 SetResSize(res
, restag
);
1154 *****************************************************************************
1155 * Function : bitmap2res
1156 * Syntax : res_t *bitmap2res(name_id_t *name, bitmap_t *bmp)
1158 * name - Name/ordinal of the resource
1159 * bmp - The bitmap descriptor
1160 * Output : New .res format structure
1162 * Remarks : The endian of the bitmap structures have been converted
1164 *****************************************************************************
1166 static res_t
*bitmap2res(name_id_t
*name
, bitmap_t
*bmp
)
1170 assert(name
!= NULL
);
1171 assert(bmp
!= NULL
);
1174 restag
= put_res_header(res
, WRC_RT_BITMAP
, NULL
, name
, bmp
->memopt
, &(bmp
->data
->lvc
));
1175 if(bmp
->data
->data
[0] == 'B'
1176 && bmp
->data
->data
[1] == 'M'
1177 && ((BITMAPFILEHEADER
*)bmp
->data
->data
)->bfSize
== bmp
->data
->size
1178 && bmp
->data
->size
>= sizeof(BITMAPFILEHEADER
))
1180 /* The File header is still attached, don't write it */
1181 put_raw_data(res
, bmp
->data
, sizeof(BITMAPFILEHEADER
));
1185 put_raw_data(res
, bmp
->data
, 0);
1187 /* Set ResourceSize */
1188 SetResSize(res
, restag
);
1195 *****************************************************************************
1196 * Function : font2res
1197 * Syntax : res_t *font2res(name_id_t *name, font_t *fnt)
1199 * name - Name/ordinal of the resource
1200 * fnt - The font descriptor
1201 * Output : New .res format structure
1203 * Remarks : The data has been prepared just after parsing.
1204 *****************************************************************************
1206 static res_t
*font2res(name_id_t
*name
, font_t
*fnt
)
1210 assert(name
!= NULL
);
1211 assert(fnt
!= NULL
);
1214 restag
= put_res_header(res
, WRC_RT_FONT
, NULL
, name
, fnt
->memopt
, &(fnt
->data
->lvc
));
1215 put_raw_data(res
, fnt
->data
, 0);
1216 /* Set ResourceSize */
1217 SetResSize(res
, restag
);
1224 *****************************************************************************
1225 * Function : fontdir2res
1226 * Syntax : res_t *fontdir2res(name_id_t *name, fontdir_t *fnd)
1228 * name - Name/ordinal of the resource
1229 * fntdir - The fontdir descriptor
1230 * Output : New .res format structure
1232 * Remarks : The data has been prepared just after parsing.
1233 *****************************************************************************
1235 static res_t
*fontdir2res(name_id_t
*name
, fontdir_t
*fnd
)
1239 assert(name
!= NULL
);
1240 assert(fnd
!= NULL
);
1243 restag
= put_res_header(res
, WRC_RT_FONTDIR
, NULL
, name
, fnd
->memopt
, &(fnd
->data
->lvc
));
1244 put_raw_data(res
, fnd
->data
, 0);
1245 /* Set ResourceSize */
1246 SetResSize(res
, restag
);
1253 *****************************************************************************
1254 * Function : html2res
1255 * Syntax : res_t *html2res(name_id_t *name, html_t *html)
1257 * name - Name/ordinal of the resource
1258 * rdt - The html descriptor
1259 * Output : New .res format structure
1262 *****************************************************************************
1264 static res_t
*html2res(name_id_t
*name
, html_t
*html
)
1268 assert(name
!= NULL
);
1269 assert(html
!= NULL
);
1272 restag
= put_res_header(res
, WRC_RT_HTML
, NULL
, name
, html
->memopt
, &(html
->data
->lvc
));
1273 put_raw_data(res
, html
->data
, 0);
1274 /* Set ResourceSize */
1275 SetResSize(res
, restag
);
1282 *****************************************************************************
1283 * Function : rcdata2res
1284 * Syntax : res_t *rcdata2res(name_id_t *name, rcdata_t *rdt)
1286 * name - Name/ordinal of the resource
1287 * rdt - The rcdata descriptor
1288 * Output : New .res format structure
1291 *****************************************************************************
1293 static res_t
*rcdata2res(name_id_t
*name
, rcdata_t
*rdt
)
1297 assert(name
!= NULL
);
1298 assert(rdt
!= NULL
);
1301 restag
= put_res_header(res
, WRC_RT_RCDATA
, NULL
, name
, rdt
->memopt
, &(rdt
->data
->lvc
));
1302 put_raw_data(res
, rdt
->data
, 0);
1303 /* Set ResourceSize */
1304 SetResSize(res
, restag
);
1311 *****************************************************************************
1312 * Function : messagetable2res
1313 * Syntax : res_t *messagetable2res(name_id_t *name, messagetable_t *msg)
1315 * name - Name/ordinal of the resource
1316 * msg - The messagetable descriptor
1317 * Output : New .res format structure
1319 * Remarks : The data has been converted to the appropriate endian
1320 * after it was parsed.
1321 *****************************************************************************
1323 static res_t
*messagetable2res(name_id_t
*name
, messagetable_t
*msg
)
1327 assert(name
!= NULL
);
1328 assert(msg
!= NULL
);
1331 restag
= put_res_header(res
, WRC_RT_MESSAGETABLE
, NULL
, name
, msg
->memopt
, &(msg
->data
->lvc
));
1332 put_raw_data(res
, msg
->data
, 0);
1333 /* Set ResourceSize */
1334 SetResSize(res
, restag
);
1341 *****************************************************************************
1342 * Function : stringtable2res
1343 * Syntax : res_t *stringtable2res(stringtable_t *stt)
1345 * stt - The stringtable descriptor
1346 * Output : New .res format structure
1349 *****************************************************************************
1351 static res_t
*stringtable2res(stringtable_t
*stt
)
1359 assert(stt
!= NULL
);
1362 for(; stt
; stt
= stt
->next
)
1366 warning("Empty internal stringtable\n");
1369 name
.type
= name_ord
;
1370 name
.name
.i_name
= (stt
->idbase
>> 4) + 1;
1371 restag
= put_res_header(res
, WRC_RT_STRING
, NULL
, &name
, stt
->memopt
, win32
? &(stt
->lvc
) : NULL
);
1372 for(i
= 0; i
< stt
->nentries
; i
++)
1374 if(stt
->entries
[i
].str
&& stt
->entries
[i
].str
->size
)
1376 put_string(res
, stt
->entries
[i
].str
, win32
? str_unicode
: str_char
,
1377 FALSE
, win32
? stt
->lvc
.language
: NULL
);
1387 /* Set ResourceSize */
1388 SetResSize(res
, restag
- lastsize
);
1391 lastsize
= res
->size
;
1397 *****************************************************************************
1398 * Function : user2res
1399 * Syntax : res_t *user2res(name_id_t *name, user_t *usr)
1401 * name - Name/ordinal of the resource
1402 * usr - The userresource descriptor
1403 * Output : New .res format structure
1406 *****************************************************************************
1408 static res_t
*user2res(name_id_t
*name
, user_t
*usr
)
1412 assert(name
!= NULL
);
1413 assert(usr
!= NULL
);
1416 restag
= put_res_header(res
, 0, usr
->type
, name
, usr
->memopt
, &(usr
->data
->lvc
));
1417 put_raw_data(res
, usr
->data
, 0);
1418 /* Set ResourceSize */
1419 SetResSize(res
, restag
);
1426 *****************************************************************************
1427 * Function : versionblock2res
1428 * Syntax : void versionblock2res(res_t *res, ver_block_t *blk)
1430 * res - Binary resource to write to
1431 * blk - The version block to be written
1434 * Remarks : Self recursive
1435 *****************************************************************************
1437 static void versionblock2res(res_t
*res
, ver_block_t
*blk
, int level
, const language_t
*lang
)
1446 blksizetag
= res
->size
;
1447 put_word(res
, 0); /* Will be overwritten later */
1450 put_word(res
, 0); /* level ? */
1451 put_string(res
, blk
->name
, win32
? str_unicode
: str_char
, TRUE
, lang
);
1453 for(val
= blk
->values
; val
; val
= val
->next
)
1455 if(val
->type
== val_str
)
1457 valblksizetag
= res
->size
;
1458 put_word(res
, 0); /* Will be overwritten later */
1459 valvalsizetag
= res
->size
;
1460 put_word(res
, 0); /* Will be overwritten later */
1463 put_word(res
, level
);
1465 put_string(res
, val
->key
, win32
? str_unicode
: str_char
, TRUE
, lang
);
1468 put_string(res
, val
->value
.str
, win32
? str_unicode
: str_char
, TRUE
, lang
);
1470 set_word(res
, valvalsizetag
, (WORD
)((res
->size
- tag
) >> 1));
1472 set_word(res
, valvalsizetag
, (WORD
)(res
->size
- tag
));
1473 set_word(res
, valblksizetag
, (WORD
)(res
->size
- valblksizetag
));
1476 else if(val
->type
== val_words
)
1478 valblksizetag
= res
->size
;
1479 put_word(res
, 0); /* Will be overwritten later */
1480 valvalsizetag
= res
->size
;
1481 put_word(res
, 0); /* Will be overwritten later */
1484 put_word(res
, level
);
1486 put_string(res
, val
->key
, win32
? str_unicode
: str_char
, TRUE
, lang
);
1489 for(i
= 0; i
< val
->value
.words
->nwords
; i
++)
1491 put_word(res
, val
->value
.words
->words
[i
]);
1493 set_word(res
, valvalsizetag
, (WORD
)(res
->size
- tag
));
1494 set_word(res
, valblksizetag
, (WORD
)(res
->size
- valblksizetag
));
1497 else if(val
->type
== val_block
)
1499 versionblock2res(res
, val
->value
.block
, level
+1, lang
);
1503 internal_error(__FILE__
, __LINE__
, "Invalid value indicator %d in VERSIONINFO\n", val
->type
);
1508 set_word(res
, blksizetag
, (WORD
)(res
->size
- blksizetag
));
1512 *****************************************************************************
1513 * Function : versioninfo2res
1514 * Syntax : res_t *versioninfo2res(name_id_t *name, versioninfo_t *ver)
1516 * name - Name/ordinal of the resource
1517 * ver - The versioninfo descriptor
1518 * Output : New .res format structure
1521 *****************************************************************************
1523 static res_t
*versioninfo2res(name_id_t
*name
, versioninfo_t
*ver
)
1526 int rootblocksizetag
;
1533 assert(name
!= NULL
);
1534 assert(ver
!= NULL
);
1536 vsvi
.type
= str_char
;
1537 vsvi
.str
.cstr
= xstrdup("VS_VERSION_INFO");
1538 vsvi
.size
= 15; /* Excl. termination */
1541 restag
= put_res_header(res
, WRC_RT_VERSION
, NULL
, name
, ver
->memopt
, &(ver
->lvc
));
1542 rootblocksizetag
= res
->size
;
1543 put_word(res
, 0); /* BlockSize filled in later */
1544 valsizetag
= res
->size
;
1545 put_word(res
, 0); /* ValueSize filled in later*/
1547 put_word(res
, 0); /* Tree-level ? */
1548 put_string(res
, &vsvi
, win32
? str_unicode
: str_char
,
1549 TRUE
, win32
? ver
->lvc
.language
: NULL
);
1553 put_dword(res
, VS_FFI_SIGNATURE
);
1554 put_dword(res
, VS_FFI_STRUCVERSION
);
1555 put_dword(res
, (ver
->filever_maj1
<< 16) + (ver
->filever_maj2
& 0xffff));
1556 put_dword(res
, (ver
->filever_min1
<< 16) + (ver
->filever_min2
& 0xffff));
1557 put_dword(res
, (ver
->prodver_maj1
<< 16) + (ver
->prodver_maj2
& 0xffff));
1558 put_dword(res
, (ver
->prodver_min1
<< 16) + (ver
->prodver_min2
& 0xffff));
1559 put_dword(res
, ver
->fileflagsmask
);
1560 put_dword(res
, ver
->fileflags
);
1561 put_dword(res
, ver
->fileos
);
1562 put_dword(res
, ver
->filetype
);
1563 put_dword(res
, ver
->filesubtype
);
1564 put_dword(res
, 0); /* FileDateMS */
1565 put_dword(res
, 0); /* FileDateLS */
1567 set_word(res
, valsizetag
, (WORD
)(res
->size
- tag
));
1568 /* Descend into the blocks */
1569 for(blk
= ver
->blocks
; blk
; blk
= blk
->next
)
1570 versionblock2res(res
, blk
, 0, win32
? ver
->lvc
.language
: NULL
);
1571 /* Set root block's size */
1572 set_word(res
, rootblocksizetag
, (WORD
)(res
->size
- rootblocksizetag
));
1574 SetResSize(res
, restag
);
1578 free(vsvi
.str
.cstr
);
1583 *****************************************************************************
1584 * Function : toolbaritem2res
1585 * Syntax : void toolbaritem2res(res_t *res, toolbar_item_t *tbitem)
1589 * Remarks : Self recursive
1590 *****************************************************************************
1592 static void toolbaritem2res(res_t
*res
, toolbar_item_t
*tbitem
)
1594 toolbar_item_t
*itm
= tbitem
;
1598 put_word(res
, itm
->id
);
1605 *****************************************************************************
1606 * Function : toolbar2res
1607 * Syntax : res_t *toolbar2res(name_id_t *name, toolbar_t *toolbar)
1609 * name - Name/ordinal of the resource
1610 * toolbar - The toolbar descriptor
1611 * Output : New .res format structure
1614 *****************************************************************************
1616 static res_t
*toolbar2res(name_id_t
*name
, toolbar_t
*toolbar
)
1620 assert(name
!= NULL
);
1621 assert(toolbar
!= NULL
);
1626 restag
= put_res_header(res
, WRC_RT_TOOLBAR
, NULL
, name
, toolbar
->memopt
, &(toolbar
->lvc
));
1628 put_word(res
, 1); /* Menuheader: Version */
1629 put_word(res
, toolbar
->button_width
); /* (in pixels?) */
1630 put_word(res
, toolbar
->button_height
); /* (in pixels?) */
1631 put_word(res
, toolbar
->nitems
);
1633 toolbaritem2res(res
, toolbar
->items
);
1634 /* Set ResourceSize */
1635 SetResSize(res
, restag
);
1640 /* Do not generate anything in 16-bit mode */
1649 *****************************************************************************
1650 * Function : dlginit2res
1651 * Syntax : res_t *dlginit2res(name_id_t *name, dlginit_t *dit)
1653 * name - Name/ordinal of the resource
1654 * rdt - The dlginit descriptor
1655 * Output : New .res format structure
1658 *****************************************************************************
1660 static res_t
*dlginit2res(name_id_t
*name
, dlginit_t
*dit
)
1664 assert(name
!= NULL
);
1665 assert(dit
!= NULL
);
1668 restag
= put_res_header(res
, WRC_RT_DLGINIT
, NULL
, name
, dit
->memopt
, &(dit
->data
->lvc
));
1669 put_raw_data(res
, dit
->data
, 0);
1670 /* Set ResourceSize */
1671 SetResSize(res
, restag
);
1678 *****************************************************************************
1679 * Function : prep_nid_for_label
1680 * Syntax : char *prep_nid_for_label(const name_id_t *nid)
1683 * Description : Converts a resource name into the first 32 (or less)
1684 * characters of the name with conversions.
1686 *****************************************************************************
1688 #define MAXNAMELEN 32
1689 char *prep_nid_for_label(const name_id_t
*nid
)
1691 static char buf
[MAXNAMELEN
+1];
1693 assert(nid
!= NULL
);
1695 if(nid
->type
== name_str
&& nid
->name
.s_name
->type
== str_unicode
)
1699 sptr
= nid
->name
.s_name
->str
.wstr
;
1701 for(i
= 0; *sptr
&& i
< MAXNAMELEN
; i
++)
1703 if((unsigned)*sptr
< 0x80 && isprint(*sptr
& 0xff))
1706 warning("Resourcename (str_unicode) contain unprintable characters or invalid translation, ignored\n");
1710 else if(nid
->type
== name_str
&& nid
->name
.s_name
->type
== str_char
)
1714 cptr
= nid
->name
.s_name
->str
.cstr
;
1716 for(i
= 0; *cptr
&& i
< MAXNAMELEN
; i
++)
1718 if((unsigned)*cptr
< 0x80 && isprint(*cptr
& 0xff))
1721 warning("Resourcename (str_char) contain unprintable characters, ignored\n");
1725 else if(nid
->type
== name_ord
)
1727 sprintf(buf
, "%u", nid
->name
.i_name
);
1731 internal_error(__FILE__
, __LINE__
, "Resource name_id with invalid type %d\n", nid
->type
);
1738 *****************************************************************************
1739 * Function : make_c_name
1740 * Syntax : char *make_c_name(const char *base, const name_id_t *nid, const language_t *lan)
1743 * Description : Converts a resource name into a valid c-identifier in the
1746 *****************************************************************************
1748 char *make_c_name(const char *base
, const name_id_t
*nid
, const language_t
*lan
)
1750 char *buf
= prep_nid_for_label(nid
);
1751 return strmake( "_%s_%s_%d", base
, buf
, lan
? MAKELANGID(lan
->id
, lan
->sub
) : 0);
1755 *****************************************************************************
1756 * Function : get_c_typename
1757 * Syntax : const char *get_c_typename(enum res_e type)
1760 * Description : Convert resource enum to char string to be used in c-name
1763 *****************************************************************************
1765 const char *get_c_typename(enum res_e type
)
1769 case res_acc
: return "Acc";
1770 case res_anicur
:return "AniCur";
1771 case res_aniico
:return "AniIco";
1772 case res_bmp
: return "Bmp";
1773 case res_cur
: return "Cur";
1774 case res_curg
: return "CurGrp";
1775 case res_dlg
: return "Dlg";
1776 case res_fnt
: return "Fnt";
1777 case res_fntdir
:return "FntDir";
1778 case res_ico
: return "Ico";
1779 case res_icog
: return "IcoGrp";
1780 case res_men
: return "Men";
1781 case res_rdt
: return "RCDat";
1782 case res_stt
: return "StrTab";
1783 case res_usr
: return "Usr";
1784 case res_msg
: return "MsgTab";
1785 case res_ver
: return "VerInf";
1786 case res_toolbar
: return "TlBr";
1787 case res_dlginit
: return "DlgInit";
1788 default: return "Oops";
1793 *****************************************************************************
1794 * Function : resources2res
1795 * Syntax : void resources2res(resource_t *top)
1797 * top - The resource-tree to convert
1799 * Description : Convert logical resource descriptors into binary data
1801 *****************************************************************************
1803 void resources2res(resource_t
*top
)
1811 top
->binres
= accelerator2res(top
->name
, top
->res
.acc
);
1815 top
->binres
= bitmap2res(top
->name
, top
->res
.bmp
);
1819 top
->binres
= cursor2res(top
->res
.cur
);
1823 top
->binres
= cursorgroup2res(top
->name
, top
->res
.curg
);
1827 top
->binres
= dialog2res(top
->name
, top
->res
.dlg
);
1831 top
->binres
= font2res(top
->name
, top
->res
.fnt
);
1835 top
->binres
= fontdir2res(top
->name
, top
->res
.fnd
);
1839 top
->binres
= icon2res(top
->res
.ico
);
1843 top
->binres
= icongroup2res(top
->name
, top
->res
.icog
);
1847 top
->binres
= menu2res(top
->name
, top
->res
.men
);
1851 top
->binres
= html2res(top
->name
, top
->res
.html
);
1855 top
->binres
= rcdata2res(top
->name
, top
->res
.rdt
);
1859 top
->binres
= stringtable2res(top
->res
.stt
);
1863 top
->binres
= user2res(top
->name
, top
->res
.usr
);
1867 top
->binres
= messagetable2res(top
->name
, top
->res
.msg
);
1871 top
->binres
= versioninfo2res(top
->name
, top
->res
.ver
);
1875 top
->binres
= toolbar2res(top
->name
, top
->res
.tbt
);
1879 top
->binres
= dlginit2res(top
->name
, top
->res
.dlgi
);
1884 top
->binres
= anicurico2res(top
->name
, top
->res
.ani
, top
->type
);
1887 internal_error(__FILE__
, __LINE__
, "Unknown resource type encountered %d in binary res generation\n", top
->type
);
1889 top
->c_name
= make_c_name(get_c_typename(top
->type
), top
->name
, top
->lan
);