Back to index

cell-binutils  2.17cvs20070401
windres.h
Go to the documentation of this file.
00001 /* windres.h -- header file for windres program.
00002    Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
00003    Free Software Foundation, Inc.
00004    Written by Ian Lance Taylor, Cygnus Support.
00005 
00006    This file is part of GNU Binutils.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2 of the License, or
00011    (at your option) any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
00021    02110-1301, USA.  */
00022 
00023 #include "ansidecl.h"
00024 
00025 /* This is the header file for the windres program.  It defines
00026    structures and declares functions used within the program.  */
00027 
00028 #include "winduni.h"
00029 
00030 /* We represent resources internally as a tree, similar to the tree
00031    used in the .rsrc section of a COFF file.  The root is a
00032    res_directory structure.  */
00033 
00034 struct res_directory
00035 {
00036   /* Resource flags.  According to the MS docs, this is currently
00037      always zero.  */
00038   unsigned long characteristics;
00039   /* Time/date stamp.  */
00040   unsigned long time;
00041   /* Major version number.  */
00042   unsigned short major;
00043   /* Minor version number.  */
00044   unsigned short minor;
00045   /* Directory entries.  */
00046   struct res_entry *entries;
00047 };
00048 
00049 /* A resource ID is stored in a res_id structure.  */
00050 
00051 struct res_id
00052 {
00053   /* Non-zero if this entry has a name rather than an ID.  */
00054   unsigned int named : 1;
00055   union
00056   {
00057     /* If the named field is non-zero, this is the name.  */
00058     struct
00059     {
00060       /* Length of the name.  */
00061       int length;
00062       /* Pointer to the name, which is a Unicode string.  */
00063       unichar *name;
00064     } n;
00065     /* If the named field is zero, this is the ID.  */
00066     unsigned long id;
00067   } u;
00068 };
00069 
00070 /* Each entry in the tree is a res_entry structure.  We mix
00071    directories and resources because in a COFF file all entries in a
00072    directory are sorted together, whether the entries are
00073    subdirectories or resources.  */
00074 
00075 struct res_entry
00076 {
00077   /* Next entry.  */
00078   struct res_entry *next;
00079   /* Resource ID.  */
00080   struct res_id id;
00081   /* Non-zero if this entry is a subdirectory rather than a leaf.  */
00082   unsigned int subdir : 1;
00083   union
00084   {
00085     /* If the subdir field is non-zero, this is a pointer to the
00086        subdirectory.  */
00087     struct res_directory *dir;
00088     /* If the subdir field is zero, this is a pointer to the resource
00089        data.  */
00090     struct res_resource *res;
00091   } u;
00092 };
00093 
00094 /* Types of resources.  */
00095 
00096 enum res_type
00097 {
00098   RES_TYPE_UNINITIALIZED,
00099   RES_TYPE_ACCELERATOR,
00100   RES_TYPE_BITMAP,
00101   RES_TYPE_CURSOR,
00102   RES_TYPE_GROUP_CURSOR,
00103   RES_TYPE_DIALOG,
00104   RES_TYPE_FONT,
00105   RES_TYPE_FONTDIR,
00106   RES_TYPE_ICON,
00107   RES_TYPE_GROUP_ICON,
00108   RES_TYPE_MENU,
00109   RES_TYPE_MESSAGETABLE,
00110   RES_TYPE_RCDATA,
00111   RES_TYPE_STRINGTABLE,
00112   RES_TYPE_USERDATA,
00113   RES_TYPE_VERSIONINFO
00114 };
00115 
00116 /* A res file and a COFF file store information differently.  The
00117    res_info structures holds data which in a res file is stored with
00118    each resource, but in a COFF file is stored elsewhere.  */
00119 
00120 struct res_res_info
00121 {
00122   /* Language.  In a COFF file, the third level of the directory is
00123      keyed by the language, so the language of a resource is defined
00124      by its location in the resource tree.  */
00125   unsigned short language;
00126   /* Characteristics of the resource.  Entirely user defined.  In a
00127      COFF file, the res_directory structure has a characteristics
00128      field, but I don't know if it's related to the one in the res
00129      file.  */
00130   unsigned long characteristics;
00131   /* Version of the resource.  Entirely user defined.  In a COFF file,
00132      the res_directory structure has a characteristics field, but I
00133      don't know if it's related to the one in the res file.  */
00134   unsigned long version;
00135   /* Memory flags.  This is a combination of the MEMFLAG values
00136      defined below.  Most of these values are historical, and are not
00137      meaningful for win32.  I don't think there is any way to store
00138      this information in a COFF file.  */
00139   unsigned short memflags;
00140 };
00141 
00142 /* Each resource in a COFF file has some information which can does
00143    not appear in a res file.  */
00144 
00145 struct res_coff_info
00146 {
00147   /* The code page used for the data.  I don't really know what this
00148      should be.  */
00149   unsigned long codepage;
00150   /* A resource entry in a COFF file has a reserved field, which we
00151      record here when reading a COFF file.  When writing a COFF file,
00152      we set this field to zero.  */
00153   unsigned long reserved;
00154 };
00155 
00156 /* Resource data is stored in a res_resource structure.  */
00157 
00158 struct res_resource
00159 {
00160   /* The type of resource.  */
00161   enum res_type type;
00162   /* The data for the resource.  */
00163   union
00164   {
00165     struct
00166     {
00167       unsigned long length;
00168       const unsigned char *data;
00169     } data;
00170     struct accelerator *acc;
00171     struct cursor *cursor;
00172     struct group_cursor *group_cursor;
00173     struct dialog *dialog;
00174     struct fontdir *fontdir;
00175     struct group_icon *group_icon;
00176     struct menu *menu;
00177     struct rcdata_item *rcdata;
00178     struct stringtable *stringtable;
00179     struct rcdata_item *userdata;
00180     struct versioninfo *versioninfo;
00181   } u;
00182   /* Information from a res file.  */
00183   struct res_res_info res_info;
00184   /* Information from a COFF file.  */
00185   struct res_coff_info coff_info;
00186 };
00187 
00188 #define SUBLANG_SHIFT 10
00189 
00190 /* Memory flags in the memflags field of a struct res_resource.  */
00191 
00192 #define MEMFLAG_MOVEABLE    0x10
00193 #define MEMFLAG_PURE        0x20
00194 #define MEMFLAG_PRELOAD            0x40
00195 #define MEMFLAG_DISCARDABLE 0x1000
00196 
00197 /* Standard resource type codes.  These are used in the ID field of a
00198    res_entry structure.  */
00199 
00200 #define RT_CURSOR            1
00201 #define RT_BITMAP            2
00202 #define RT_ICON                     3
00203 #define RT_MENU                     4
00204 #define RT_DIALOG            5
00205 #define RT_STRING            6
00206 #define RT_FONTDIR           7
00207 #define RT_FONT                     8
00208 #define RT_ACCELERATOR              9
00209 #define RT_RCDATA           10
00210 #define RT_MESSAGETABLE            11
00211 #define RT_GROUP_CURSOR            12
00212 #define RT_GROUP_ICON              14
00213 #define RT_VERSION          16
00214 #define RT_DLGINCLUDE              17
00215 #define RT_PLUGPLAY         19
00216 #define RT_VXD                     20
00217 #define RT_ANICURSOR        21
00218 #define RT_ANIICON          22
00219 
00220 /* An accelerator resource is a linked list of these structures.  */
00221 
00222 struct accelerator
00223 {
00224   /* Next accelerator.  */
00225   struct accelerator *next;
00226   /* Flags.  A combination of the ACC values defined below.  */
00227   unsigned short flags;
00228   /* Key value.  */
00229   unsigned short key;
00230   /* Resource ID.  */
00231   unsigned short id;
00232 };
00233 
00234 /* Accelerator flags in the flags field of a struct accelerator.
00235    These are the same values that appear in a res file.  I hope.  */
00236 
00237 #define ACC_VIRTKEY  0x01
00238 #define ACC_NOINVERT 0x02
00239 #define ACC_SHIFT    0x04
00240 #define ACC_CONTROL  0x08
00241 #define ACC_ALT             0x10
00242 #define ACC_LAST     0x80
00243 
00244 /* A cursor resource.  */
00245 
00246 struct cursor
00247 {
00248   /* X coordinate of hotspot.  */
00249   short xhotspot;
00250   /* Y coordinate of hotspot.  */
00251   short yhotspot;
00252   /* Length of bitmap data.  */
00253   unsigned long length;
00254   /* Data.  */
00255   const unsigned char *data;
00256 };
00257 
00258 /* A group_cursor resource is a list of group_cursor structures.  */
00259 
00260 struct group_cursor
00261 {
00262   /* Next cursor in group.  */
00263   struct group_cursor *next;
00264   /* Width.  */
00265   unsigned short width;
00266   /* Height.  */
00267   unsigned short height;
00268   /* Planes.  */
00269   unsigned short planes;
00270   /* Bits per pixel.  */
00271   unsigned short bits;
00272   /* Number of bytes in cursor resource.  */
00273   unsigned long bytes;
00274   /* Index of cursor resource.  */
00275   unsigned short index;
00276 };
00277 
00278 /* A dialog resource.  */
00279 
00280 struct dialog
00281 {
00282   /* Basic window style.  */
00283   unsigned long style;
00284   /* Extended window style.  */
00285   unsigned long exstyle;
00286   /* X coordinate.  */
00287   unsigned short x;
00288   /* Y coordinate.  */
00289   unsigned short y;
00290   /* Width.  */
00291   unsigned short width;
00292   /* Height.  */
00293   unsigned short height;
00294   /* Menu name.  */
00295   struct res_id menu;
00296   /* Class name.  */
00297   struct res_id class;
00298   /* Caption.  */
00299   unichar *caption;
00300   /* Font point size.  */
00301   unsigned short pointsize;
00302   /* Font name.  */
00303   unichar *font;
00304   /* Extended information for a dialogex.  */
00305   struct dialog_ex *ex;
00306   /* Controls.  */
00307   struct dialog_control *controls;
00308 };
00309 
00310 /* An extended dialog has additional information.  */
00311 
00312 struct dialog_ex
00313 {
00314   /* Help ID.  */
00315   unsigned long help;
00316   /* Font weight.  */
00317   unsigned short weight;
00318   /* Whether the font is italic.  */
00319   unsigned char italic;
00320   /* Character set.  */
00321   unsigned char charset;
00322 };
00323 
00324 /* Window style flags, from the winsup Defines.h header file.  These
00325    can appear in the style field of a struct dialog or a struct
00326    dialog_control.  */
00327 
00328 #define CW_USEDEFAULT       (0x80000000)
00329 #define WS_BORDER    (0x800000L)
00330 #define WS_CAPTION   (0xc00000L)
00331 #define WS_CHILD     (0x40000000L)
00332 #define WS_CHILDWINDOW      (0x40000000L)
00333 #define WS_CLIPCHILDREN     (0x2000000L)
00334 #define WS_CLIPSIBLINGS     (0x4000000L)
00335 #define WS_DISABLED  (0x8000000L)
00336 #define WS_DLGFRAME  (0x400000L)
00337 #define WS_GROUP     (0x20000L)
00338 #define WS_HSCROLL   (0x100000L)
00339 #define WS_ICONIC    (0x20000000L)
00340 #define WS_MAXIMIZE  (0x1000000L)
00341 #define WS_MAXIMIZEBOX      (0x10000L)
00342 #define WS_MINIMIZE  (0x20000000L)
00343 #define WS_MINIMIZEBOX      (0x20000L)
00344 #define WS_OVERLAPPED       (0L)
00345 #define WS_OVERLAPPEDWINDOW (0xcf0000L)
00346 #define WS_POPUP     (0x80000000L)
00347 #define WS_POPUPWINDOW      (0x80880000L)
00348 #define WS_SIZEBOX   (0x40000L)
00349 #define WS_SYSMENU   (0x80000L)
00350 #define WS_TABSTOP   (0x10000L)
00351 #define WS_THICKFRAME       (0x40000L)
00352 #define WS_TILED     (0L)
00353 #define WS_TILEDWINDOW      (0xcf0000L)
00354 #define WS_VISIBLE   (0x10000000L)
00355 #define WS_VSCROLL   (0x200000L)
00356 #define MDIS_ALLCHILDSTYLES (0x1)
00357 #define BS_3STATE    (0x5L)
00358 #define BS_AUTO3STATE       (0x6L)
00359 #define BS_AUTOCHECKBOX     (0x3L)
00360 #define BS_AUTORADIOBUTTON  (0x9L)
00361 #define BS_BITMAP    (0x80L)
00362 #define BS_BOTTOM    (0x800L)
00363 #define BS_CENTER    (0x300L)
00364 #define BS_CHECKBOX  (0x2L)
00365 #define BS_DEFPUSHBUTTON    (0x1L)
00366 #define BS_GROUPBOX  (0x7L)
00367 #define BS_ICON      (0x40L)
00368 #define BS_LEFT      (0x100L)
00369 #define BS_LEFTTEXT  (0x20L)
00370 #define BS_MULTILINE (0x2000L)
00371 #define BS_NOTIFY    (0x4000L)
00372 #define BS_OWNERDRAW (0xbL)
00373 #define BS_PUSHBOX   (0xcL)        /* FIXME!  What should this be?  */
00374 #define BS_PUSHBUTTON       (0L)
00375 #define BS_PUSHLIKE  (0x1000L)
00376 #define BS_RADIOBUTTON      (0x4L)
00377 #define BS_RIGHT     (0x200L)
00378 #define BS_RIGHTBUTTON      (0x20L)
00379 #define BS_TEXT      (0L)
00380 #define BS_TOP       (0x400L)
00381 #define BS_USERBUTTON       (0x8L)
00382 #define BS_VCENTER   (0xc00L)
00383 #define CBS_AUTOHSCROLL     (0x40L)
00384 #define CBS_DISABLENOSCROLL (0x800L)
00385 #define CBS_DROPDOWN (0x2L)
00386 #define CBS_DROPDOWNLIST    (0x3L)
00387 #define CBS_HASSTRINGS      (0x200L)
00388 #define CBS_LOWERCASE       (0x4000L)
00389 #define CBS_NOINTEGRALHEIGHT       (0x400L)
00390 #define CBS_OEMCONVERT      (0x80L)
00391 #define CBS_OWNERDRAWFIXED  (0x10L)
00392 #define CBS_OWNERDRAWVARIABLE      (0x20L)
00393 #define CBS_SIMPLE   (0x1L)
00394 #define CBS_SORT     (0x100L)
00395 #define CBS_UPPERCASE       (0x2000L)
00396 #define ES_AUTOHSCROLL      (0x80L)
00397 #define ES_AUTOVSCROLL      (0x40L)
00398 #define ES_CENTER    (0x1L)
00399 #define ES_LEFT      (0L)
00400 #define ES_LOWERCASE (0x10L)
00401 #define ES_MULTILINE (0x4L)
00402 #define ES_NOHIDESEL (0x100L)
00403 #define ES_NUMBER    (0x2000L)
00404 #define ES_OEMCONVERT       (0x400L)
00405 #define ES_PASSWORD  (0x20L)
00406 #define ES_READONLY  (0x800L)
00407 #define ES_RIGHT     (0x2L)
00408 #define ES_UPPERCASE (0x8L)
00409 #define ES_WANTRETURN       (0x1000L)
00410 #define LBS_DISABLENOSCROLL (0x1000L)
00411 #define LBS_EXTENDEDSEL     (0x800L)
00412 #define LBS_HASSTRINGS      (0x40L)
00413 #define LBS_MULTICOLUMN     (0x200L)
00414 #define LBS_MULTIPLESEL     (0x8L)
00415 #define LBS_NODATA   (0x2000L)
00416 #define LBS_NOINTEGRALHEIGHT       (0x100L)
00417 #define LBS_NOREDRAW (0x4L)
00418 #define LBS_NOSEL    (0x4000L)
00419 #define LBS_NOTIFY   (0x1L)
00420 #define LBS_OWNERDRAWFIXED  (0x10L)
00421 #define LBS_OWNERDRAWVARIABLE      (0x20L)
00422 #define LBS_SORT     (0x2L)
00423 #define LBS_STANDARD (0xa00003L)
00424 #define LBS_USETABSTOPS     (0x80L)
00425 #define LBS_WANTKEYBOARDINPUT      (0x400L)
00426 #define SBS_BOTTOMALIGN     (0x4L)
00427 #define SBS_HORZ     (0L)
00428 #define SBS_LEFTALIGN       (0x2L)
00429 #define SBS_RIGHTALIGN      (0x4L)
00430 #define SBS_SIZEBOX  (0x8L)
00431 #define SBS_SIZEBOXBOTTOMRIGHTALIGN       (0x4L)
00432 #define SBS_SIZEBOXTOPLEFTALIGN    (0x2L)
00433 #define SBS_SIZEGRIP (0x10L)
00434 #define SBS_TOPALIGN (0x2L)
00435 #define SBS_VERT     (0x1L)
00436 #define SS_BITMAP    (0xeL)
00437 #define SS_BLACKFRAME       (0x7L)
00438 #define SS_BLACKRECT (0x4L)
00439 #define SS_CENTER    (0x1L)
00440 #define SS_CENTERIMAGE      (0x200L)
00441 #define SS_ENHMETAFILE      (0xfL)
00442 #define SS_ETCHEDFRAME      (0x12L)
00443 #define SS_ETCHEDHORZ       (0x10L)
00444 #define SS_ETCHEDVERT       (0x11L)
00445 #define SS_GRAYFRAME (0x8L)
00446 #define SS_GRAYRECT  (0x5L)
00447 #define SS_ICON      (0x3L)
00448 #define SS_LEFT      (0L)
00449 #define SS_LEFTNOWORDWRAP   (0xcL)
00450 #define SS_NOPREFIX  (0x80L)
00451 #define SS_NOTIFY    (0x100L)
00452 #define SS_OWNERDRAW (0xdL)
00453 #define SS_REALSIZEIMAGE    (0x800L)
00454 #define SS_RIGHT     (0x2L)
00455 #define SS_RIGHTJUST (0x400L)
00456 #define SS_SIMPLE    (0xbL)
00457 #define SS_SUNKEN    (0x1000L)
00458 #define SS_USERITEM     (0xaL)
00459 #define SS_WHITEFRAME       (0x9L)
00460 #define SS_WHITERECT (0x6L)
00461 #define DS_3DLOOK    (0x4L)
00462 #define DS_ABSALIGN  (0x1L)
00463 #define DS_CENTER    (0x800L)
00464 #define DS_CENTERMOUSE      (0x1000L)
00465 #define DS_CONTEXTHELP      (0x2000L)
00466 #define DS_CONTROL   (0x400L)
00467 #define DS_FIXEDSYS  (0x8L)
00468 #define DS_LOCALEDIT (0x20L)
00469 #define DS_MODALFRAME       (0x80L)
00470 #define DS_NOFAILCREATE     (0x10L)
00471 #define DS_NOIDLEMSG (0x100L)
00472 #define DS_SETFONT   (0x40L)
00473 #define DS_SETFOREGROUND    (0x200L)
00474 #define DS_SYSMODAL  (0x2L)
00475 
00476 /* A dialog control.  */
00477 
00478 struct dialog_control
00479 {
00480   /* Next control.  */
00481   struct dialog_control *next;
00482   /* ID.  */
00483   unsigned short id;
00484   /* Style.  */
00485   unsigned long style;
00486   /* Extended style.  */
00487   unsigned long exstyle;
00488   /* X coordinate.  */
00489   unsigned short x;
00490   /* Y coordinate.  */
00491   unsigned short y;
00492   /* Width.  */
00493   unsigned short width;
00494   /* Height.  */
00495   unsigned short height;
00496   /* Class name.  */
00497   struct res_id class;
00498   /* Associated text.  */
00499   struct res_id text;
00500   /* Extra data for the window procedure.  */
00501   struct rcdata_item *data;
00502   /* Help ID.  Only used in an extended dialog.  */
00503   unsigned long help;
00504 };
00505 
00506 /* Control classes.  These can be used as the ID field in a struct
00507    dialog_control.  */
00508 
00509 #define CTL_BUTTON   0x80
00510 #define CTL_EDIT     0x81
00511 #define CTL_STATIC   0x82
00512 #define CTL_LISTBOX  0x83
00513 #define CTL_SCROLLBAR       0x84
00514 #define CTL_COMBOBOX 0x85
00515 
00516 /* A fontdir resource is a list of fontdir structures.  */
00517 
00518 struct fontdir
00519 {
00520   struct fontdir *next;
00521   /* Index of font entry.  */
00522   short index;
00523   /* Length of font information.  */
00524   unsigned long length;
00525   /* Font information.  */
00526   const unsigned char *data;
00527 };
00528 
00529 /* A group_icon resource is a list of group_icon structures.  */
00530 
00531 struct group_icon
00532 {
00533   /* Next icon in group.  */
00534   struct group_icon *next;
00535   /* Width.  */
00536   unsigned char width;
00537   /* Height.  */
00538   unsigned char height;
00539   /* Color count.  */
00540   unsigned char colors;
00541   /* Planes.  */
00542   unsigned short planes;
00543   /* Bits per pixel.  */
00544   unsigned short bits;
00545   /* Number of bytes in cursor resource.  */
00546   unsigned long bytes;
00547   /* Index of cursor resource.  */
00548   unsigned short index;
00549 };
00550 
00551 /* A menu resource.  */
00552 
00553 struct menu
00554 {
00555   /* List of menuitems.  */
00556   struct menuitem *items;
00557   /* Help ID.  I don't think there is any way to set this in an rc
00558      file, but it can appear in the binary format.  */
00559   unsigned long help;
00560 };
00561 
00562 /* A menu resource is a list of menuitem structures.  */
00563 
00564 struct menuitem
00565 {
00566   /* Next menuitem.  */
00567   struct menuitem *next;
00568   /* Type.  In a normal menu, rather than a menuex, this is the flags
00569      field.  */
00570   unsigned long type;
00571   /* State.  This is only used in a menuex.  */
00572   unsigned long state;
00573   /* Id.  */
00574   unsigned short id;
00575   /* Unicode text.  */
00576   unichar *text;
00577   /* Popup menu items for a popup.  */
00578   struct menuitem *popup;
00579   /* Help ID.  This is only used in a menuex.  */
00580   unsigned long help;
00581 };
00582 
00583 /* Menu item flags.  These can appear in the flags field of a struct
00584    menuitem.  */
00585 
00586 #define MENUITEM_GRAYED            0x001
00587 #define MENUITEM_INACTIVE   0x002
00588 #define MENUITEM_BITMAP            0x004
00589 #define MENUITEM_OWNERDRAW  0x100
00590 #define MENUITEM_CHECKED    0x008
00591 #define MENUITEM_POPUP             0x010
00592 #define MENUITEM_MENUBARBREAK      0x020
00593 #define MENUITEM_MENUBREAK  0x040
00594 #define MENUITEM_ENDMENU    0x080
00595 #define MENUITEM_HELP              0x4000
00596 
00597 /* An rcdata resource is a pointer to a list of rcdata_item
00598    structures.  */
00599 
00600 struct rcdata_item
00601 {
00602   /* Next data item.  */
00603   struct rcdata_item *next;
00604   /* Type of data.  */
00605   enum
00606   {
00607     RCDATA_WORD,
00608     RCDATA_DWORD,
00609     RCDATA_STRING,
00610     RCDATA_WSTRING,
00611     RCDATA_BUFFER
00612   } type;
00613   union
00614   {
00615     unsigned int word;
00616     unsigned long dword;
00617     struct
00618     {
00619       unsigned long length;
00620       const char *s;
00621     } string;
00622     struct
00623     {
00624       unsigned long length;
00625       const unichar *w;
00626     } wstring;
00627     struct
00628     {
00629       unsigned long length;
00630       const unsigned char *data;
00631     } buffer;
00632   } u;
00633 };
00634 
00635 /* A stringtable resource is a pointer to a stringtable structure.  */
00636 
00637 struct stringtable
00638 {
00639   /* Each stringtable resource is a list of 16 unicode strings.  */
00640   struct
00641   {
00642     /* Length of string.  */
00643     int length;
00644     /* String data if length > 0.  */
00645     unichar *string;
00646   } strings[16];
00647 };
00648 
00649 /* A versioninfo resource points to a versioninfo structure.  */
00650 
00651 struct versioninfo
00652 {
00653   /* Fixed version information.  */
00654   struct fixed_versioninfo *fixed;
00655   /* Variable version information.  */
00656   struct ver_info *var;
00657 };
00658 
00659 /* The fixed portion of a versioninfo resource.  */
00660 
00661 struct fixed_versioninfo
00662 {
00663   /* The file version, which is two 32 bit integers.  */
00664   unsigned long file_version_ms;
00665   unsigned long file_version_ls;
00666   /* The product version, which is two 32 bit integers.  */
00667   unsigned long product_version_ms;
00668   unsigned long product_version_ls;
00669   /* The file flags mask.  */
00670   unsigned long file_flags_mask;
00671   /* The file flags.  */
00672   unsigned long file_flags;
00673   /* The OS type.  */
00674   unsigned long file_os;
00675   /* The file type.  */
00676   unsigned long file_type;
00677   /* The file subtype.  */
00678   unsigned long file_subtype;
00679   /* The date, which in Windows is two 32 bit integers.  */
00680   unsigned long file_date_ms;
00681   unsigned long file_date_ls;
00682 };
00683 
00684 /* A list of variable version information.  */
00685 
00686 struct ver_info
00687 {
00688   /* Next item.  */
00689   struct ver_info *next;
00690   /* Type of data.  */
00691   enum { VERINFO_STRING, VERINFO_VAR } type;
00692   union
00693   {
00694     /* StringFileInfo data.  */
00695     struct
00696     {
00697       /* Language.  */
00698       unichar *language;
00699       /* Strings.  */
00700       struct ver_stringinfo *strings;
00701     } string;
00702     /* VarFileInfo data.  */
00703     struct
00704     {
00705       /* Key.  */
00706       unichar *key;
00707       /* Values.  */
00708       struct ver_varinfo *var;
00709     } var;
00710   } u;
00711 };
00712 
00713 /* A list of string version information.  */
00714 
00715 struct ver_stringinfo
00716 {
00717   /* Next string.  */
00718   struct ver_stringinfo *next;
00719   /* Key.  */
00720   unichar *key;
00721   /* Value.  */
00722   unichar *value;
00723 };
00724 
00725 /* A list of variable version information.  */
00726 
00727 struct ver_varinfo
00728 {
00729   /* Next item.  */
00730   struct ver_varinfo *next;
00731   /* Language ID.  */
00732   unsigned short language;
00733   /* Character set ID.  */
00734   unsigned short charset;
00735 };
00736 
00737 /* This structure is used when converting resource information to
00738    binary.  */
00739 
00740 struct bindata
00741 {
00742   /* Next data.  */
00743   struct bindata *next;
00744   /* Length of data.  */
00745   unsigned long length;
00746   /* Data.  */
00747   unsigned char *data;
00748 };
00749 
00750 extern int verbose;
00751 
00752 /* Function declarations.  */
00753 
00754 extern struct res_directory *read_rc_file
00755   (const char *, const char *, const char *, int, int);
00756 extern struct res_directory *read_res_file (const char *);
00757 extern struct res_directory *read_coff_rsrc (const char *, const char *);
00758 extern void write_rc_file (const char *, const struct res_directory *);
00759 extern void write_res_file (const char *, const struct res_directory *);
00760 extern void write_coff_file
00761   (const char *, const char *, const struct res_directory *);
00762 
00763 extern struct res_resource *bin_to_res
00764   (struct res_id, const unsigned char *, unsigned long, int);
00765 extern struct bindata *res_to_bin (const struct res_resource *, int);
00766 
00767 extern FILE *open_file_search
00768   (const char *, const char *, const char *, char **);
00769 
00770 extern void *res_alloc (size_t);
00771 extern void *reswr_alloc (size_t);
00772 
00773 /* Resource ID handling.  */
00774 
00775 extern int res_id_cmp (struct res_id, struct res_id);
00776 extern void res_id_print (FILE *, struct res_id, int);
00777 extern void res_ids_print (FILE *, int, const struct res_id *);
00778 extern void res_string_to_id (struct res_id *, const char *);
00779 
00780 /* Manipulation of the resource tree.  */
00781 
00782 extern struct res_resource *define_resource
00783   (struct res_directory **, int, const struct res_id *, int);
00784 extern struct res_resource *define_standard_resource
00785   (struct res_directory **, int, struct res_id, int, int);
00786 
00787 extern int extended_dialog (const struct dialog *);
00788 extern int extended_menu (const struct menu *);
00789 
00790 /* Communication between the rc file support and the parser and lexer.  */
00791 
00792 extern int yydebug;
00793 extern FILE *yyin;
00794 extern char *rc_filename;
00795 extern int rc_lineno;
00796 
00797 extern int yyparse (void);
00798 extern int yylex (void);
00799 extern void yyerror (const char *);
00800 extern void rcparse_warning (const char *);
00801 extern void rcparse_set_language (int);
00802 extern void rcparse_discard_strings (void);
00803 extern void rcparse_rcdata (void);
00804 extern void rcparse_normal (void);
00805 
00806 extern void define_accelerator
00807   (struct res_id, const struct res_res_info *, struct accelerator *);
00808 extern void define_bitmap
00809   (struct res_id, const struct res_res_info *, const char *);
00810 extern void define_cursor
00811   (struct res_id, const struct res_res_info *, const char *);
00812 extern void define_dialog
00813   (struct res_id, const struct res_res_info *, const struct dialog *);
00814 extern struct dialog_control *define_control
00815   (const struct res_id, unsigned long, unsigned long, unsigned long,
00816    unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
00817 extern struct dialog_control *define_icon_control
00818   (struct res_id, unsigned long, unsigned long, unsigned long, unsigned long,
00819    unsigned long, unsigned long, struct rcdata_item *, struct dialog_ex *);
00820 extern void define_font
00821   (struct res_id, const struct res_res_info *, const char *);
00822 extern void define_icon
00823   (struct res_id, const struct res_res_info *, const char *);
00824 extern void define_menu
00825   (struct res_id, const struct res_res_info *, struct menuitem *);
00826 extern struct menuitem *define_menuitem
00827   (const char *, int, unsigned long, unsigned long, unsigned long,
00828    struct menuitem *);
00829 extern void define_messagetable
00830   (struct res_id, const struct res_res_info *, const char *);
00831 extern void define_rcdata
00832   (struct res_id, const struct res_res_info *, struct rcdata_item *);
00833 extern void define_rcdata_file 
00834   (struct res_id, const struct res_res_info *, const char *);
00835 extern struct rcdata_item *define_rcdata_string
00836   (const char *, unsigned long);
00837 extern struct rcdata_item *define_rcdata_number (unsigned long, int);
00838 extern void define_stringtable
00839   (const struct res_res_info *, unsigned long, const char *);
00840 extern void define_user_data
00841   (struct res_id, struct res_id, const struct res_res_info *,
00842    struct rcdata_item *);
00843 extern void define_user_file
00844   (struct res_id, struct res_id, const struct res_res_info *, const char *);
00845 extern void define_versioninfo
00846   (struct res_id, int, struct fixed_versioninfo *, struct ver_info *);
00847 extern struct ver_info *append_ver_stringfileinfo
00848   (struct ver_info *, const char *, struct ver_stringinfo *);
00849 extern struct ver_info *append_ver_varfileinfo
00850   (struct ver_info *, const char *, struct ver_varinfo *);
00851 extern struct ver_stringinfo *append_verval
00852   (struct ver_stringinfo *, const char *, const char *);
00853 extern struct ver_varinfo *append_vertrans
00854   (struct ver_varinfo *, unsigned long, unsigned long);