Wolfgang Thallergcc16 merge934c3885 months agoHistory
1097 lines · 26.3 KB · C
RawDownload
/* windint.h -- internal header file for windres program.   Copyright (C) 1997-2026 Free Software Foundation, Inc.   Written by Kai Tietz, Onevision.    This file is part of GNU Binutils.    This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 3 of the License, or   (at your option) any later version.    This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.    You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA   02110-1301, USA.  */ #include "winduni.h" #ifndef WINDINT_H#define WINDINT_H /* Use bfd_size_type to ensure a sufficient number of bits.  */#ifndef DEFINED_RC_UINT_TYPE#define DEFINED_RC_UINT_TYPEtypedef bfd_size_type rc_uint_type;#endif /* Resource directory structure.  */ typedef struct res_hdr{  rc_uint_type data_size;  rc_uint_type header_size;} res_hdr; struct __attribute__ ((__packed__)) bin_res_hdr{  bfd_byte data_size[4];  bfd_byte header_size[4];};#define BIN_RES_HDR_SIZE 8 struct __attribute__ ((__packed__)) bin_res_id{  bfd_byte sig[2]; /* Has to be 0xffff for unnamed ids.  */  bfd_byte id[2];};#define BIN_RES_ID  4 /* This structure is used when converting resource information to   binary.  */ typedef struct bindata{  /* Next data.  */  struct bindata *next;  /* Length of data.  */  rc_uint_type length;  /* Data.  */  bfd_byte *data;} bindata; /* This structure is used when converting resource information to   coff.  */typedef struct coff_res_data{  /* Next data.  */  struct coff_res_data *next;  /* Length of data.  */  rc_uint_type length;  /* Data.  */  const struct rc_res_resource *res;} coff_res_data; /* We represent resources internally as a tree, similar to the tree   used in the .rsrc section of a COFF file.  The root is a   rc_res_directory structure.  */ typedef struct rc_res_directory{  /* Resource flags.  According to the MS docs, this is currently     always zero.  */  rc_uint_type characteristics;  /* Time/date stamp.  */  rc_uint_type time;  /* Major version number.  */  rc_uint_type major;  /* Minor version number.  */  rc_uint_type minor;  /* Directory entries.  */  struct rc_res_entry *entries;} rc_res_directory; /* A resource ID is stored in a rc_res_id structure.  */ typedef struct rc_res_id{  /* Non-zero if this entry has a name rather than an ID.  */  rc_uint_type named : 1;  union  {    /* If the named field is non-zero, this is the name.  */    struct    {      /* Length of the name.  */      rc_uint_type length;      /* Pointer to the name, which is a Unicode string.  */      unichar *name;    } n;    /* If the named field is zero, this is the ID.  */    rc_uint_type id;  } u;} rc_res_id; /* Each entry in the tree is a rc_res_entry structure.  We mix   directories and resources because in a COFF file all entries in a   directory are sorted together, whether the entries are   subdirectories or resources.  */ typedef struct rc_res_entry{  /* Next entry.  */  struct rc_res_entry *next;  /* Resource ID.  */  rc_res_id id;  /* Non-zero if this entry is a subdirectory rather than a leaf.  */  rc_uint_type subdir : 1;  union  {    /* If the subdir field is non-zero, this is a pointer to the       subdirectory.  */    rc_res_directory *dir;    /* If the subdir field is zero, this is a pointer to the resource       data.  */    struct rc_res_resource *res;  } u;} rc_res_entry; /* Types of resources.  */ enum rc_res_type{  RES_TYPE_UNINITIALIZED,  RES_TYPE_ACCELERATOR,  RES_TYPE_BITMAP,  RES_TYPE_CURSOR,  RES_TYPE_GROUP_CURSOR,  RES_TYPE_DIALOG,  RES_TYPE_FONT,  RES_TYPE_FONTDIR,  RES_TYPE_ICON,  RES_TYPE_GROUP_ICON,  RES_TYPE_MENU,  RES_TYPE_MESSAGETABLE,  RES_TYPE_RCDATA,  RES_TYPE_STRINGTABLE,  RES_TYPE_USERDATA,  RES_TYPE_VERSIONINFO,  RES_TYPE_DLGINCLUDE,  RES_TYPE_PLUGPLAY,  RES_TYPE_VXD,  RES_TYPE_ANICURSOR,  RES_TYPE_ANIICON,  RES_TYPE_DLGINIT,  RES_TYPE_TOOLBAR}; /* A res file and a COFF file store information differently.  The   res_info structures holds data which in a res file is stored with   each resource, but in a COFF file is stored elsewhere.  */ typedef struct rc_res_res_info{  /* Language.  In a COFF file, the third level of the directory is     keyed by the language, so the language of a resource is defined     by its location in the resource tree.  */  rc_uint_type language;  /* Characteristics of the resource.  Entirely user defined.  In a     COFF file, the rc_res_directory structure has a characteristics     field, but I don't know if it's related to the one in the res     file.  */  rc_uint_type characteristics;  /* Version of the resource.  Entirely user defined.  In a COFF file,     the rc_res_directory structure has a characteristics field, but I     don't know if it's related to the one in the res file.  */  rc_uint_type version;  /* Memory flags.  This is a combination of the MEMFLAG values     defined below.  Most of these values are historical, and are not     meaningful for win32.  I don't think there is any way to store     this information in a COFF file.  */  rc_uint_type memflags;} rc_res_res_info; /* Binary layout of rc_res_info.  */ struct __attribute__ ((__packed__)) bin_res_info{  bfd_byte version[4];  bfd_byte memflags[2];  bfd_byte language[2];  bfd_byte version2[4];  bfd_byte characteristics[4];};#define BIN_RES_INFO_SIZE 16 /* Each resource in a COFF file has some information which can does   not appear in a res file.  */ typedef struct rc_res_coff_info{  /* The code page used for the data.  I don't really know what this     should be.  It has something todo with ASCII to Unicode encoding.  */  rc_uint_type codepage;  /* A resource entry in a COFF file has a reserved field, which we     record here when reading a COFF file.  When writing a COFF file,     we set this field to zero.  */  rc_uint_type reserved;} rc_res_coff_info; /* Resource data is stored in a rc_res_resource structure.  */ typedef struct rc_res_resource{  /* The type of resource.  */  enum rc_res_type type;  /* The data for the resource.  */  union  {    struct    {      rc_uint_type length;      const bfd_byte *data;    } data;    struct rc_accelerator *acc;    struct rc_cursor *cursor;    struct rc_group_cursor *group_cursor;    struct rc_dialog *dialog;    struct rc_fontdir *fontdir;    struct rc_group_icon *group_icon;    struct rc_menu *menu;    struct rc_rcdata_item *rcdata;    struct rc_stringtable *stringtable;    struct rc_rcdata_item *userdata;    struct rc_versioninfo *versioninfo;    struct rc_toolbar *toolbar;  } u;  /* Information from a res file.  */  struct rc_res_res_info res_info;  /* Information from a COFF file.  */  rc_res_coff_info coff_info;} rc_res_resource; #define SUBLANG_SHIFT 10 /* Memory flags in the memflags field of a rc_res_resource.  */ #define MEMFLAG_MOVEABLE	0x10#define MEMFLAG_PURE		0x20#define MEMFLAG_PRELOAD		0x40#define MEMFLAG_DISCARDABLE	0x1000 /* Standard resource type codes.  These are used in the ID field of a   rc_res_entry structure.  */ #define RT_CURSOR		 1#define RT_BITMAP		 2#define RT_ICON			 3#define RT_MENU			 4#define RT_DIALOG		 5#define RT_STRING		 6#define RT_FONTDIR		 7#define RT_FONT			 8#define RT_ACCELERATOR		 9#define RT_RCDATA		10#define RT_MESSAGETABLE		11#define RT_GROUP_CURSOR		12#define RT_GROUP_ICON		14#define RT_VERSION		16#define RT_DLGINCLUDE		17#define RT_PLUGPLAY		19#define RT_VXD			20#define RT_ANICURSOR		21#define RT_ANIICON		22#define RT_HTML			23#define RT_MANIFEST		24#define RT_DLGINIT		240#define RT_TOOLBAR		241 /* An accelerator resource is a linked list of these structures.  */ typedef struct rc_accelerator{  /* Next accelerator.  */  struct rc_accelerator *next;  /* Flags.  A combination of the ACC values defined below.  */  rc_uint_type flags;  /* Key value.  */  rc_uint_type key;  /* Resource ID.  */  rc_uint_type id;} rc_accelerator; struct __attribute__ ((__packed__)) bin_accelerator{  bfd_byte flags[2];  bfd_byte key[2];  bfd_byte id[2];  bfd_byte pad[2];};#define BIN_ACCELERATOR_SIZE  8 /* Accelerator flags in the flags field of a rc_accelerator.   These are the same values that appear in a res file.  I hope.  */ #define ACC_VIRTKEY	0x01#define ACC_NOINVERT	0x02#define ACC_SHIFT	0x04#define ACC_CONTROL	0x08#define ACC_ALT		0x10#define ACC_LAST	0x80 /* A cursor resource.  */ typedef struct rc_cursor{  /* X coordinate of hotspot.  */  bfd_signed_vma xhotspot;  /* Y coordinate of hotspot.  */  bfd_signed_vma yhotspot;  /* Length of bitmap data.  */  rc_uint_type length;  /* Data.  */  const bfd_byte *data;} rc_cursor; struct __attribute__ ((__packed__)) bin_cursor{  bfd_byte xhotspot[2];  bfd_byte yhotspot[2];};#define BIN_CURSOR_SIZE 4 /* A group_cursor resource is a list of rc_i_group_cursor structures.  */ typedef struct rc_group_cursor{  /* Next cursor in group.  */  struct rc_group_cursor *next;  /* Width.  */  rc_uint_type width;  /* Height.  */  rc_uint_type height;  /* Planes.  */  rc_uint_type planes;  /* Bits per pixel.  */  rc_uint_type bits;  /* Number of bytes in cursor resource.  */  rc_uint_type bytes;  /* Index of cursor resource.  */  rc_uint_type index;} rc_group_cursor; struct __attribute__ ((__packed__)) bin_group_cursor_item{  bfd_byte width[2];  bfd_byte height[2];  bfd_byte planes[2];  bfd_byte bits[2];  bfd_byte bytes[4];  bfd_byte index[2];};#define BIN_GROUP_CURSOR_ITEM_SIZE 14 struct __attribute__ ((__packed__)) bin_group_cursor{  bfd_byte sig1[2];  bfd_byte sig2[2];  bfd_byte nitems[2];  /* struct bin_group_cursor_item item[nitems]; */};#define BIN_GROUP_CURSOR_SIZE 6 /* A dialog resource.  */ typedef struct rc_dialog{  /* Basic window style.  */  unsigned int style;  /* Extended window style.  */  rc_uint_type exstyle;  /* X coordinate.  */  rc_uint_type x;  /* Y coordinate.  */  rc_uint_type y;  /* Width.  */  rc_uint_type width;  /* Height.  */  rc_uint_type height;  /* Menu name.  */  rc_res_id menu;  /* Class name.  */  rc_res_id class;  /* Caption.  */  unichar *caption;  /* Font point size.  */  rc_uint_type pointsize;  /* Font name.  */  unichar *font;  /* Extended information for a dialogex.  */  struct rc_dialog_ex *ex;  /* Controls.  */  struct rc_dialog_control *controls;} rc_dialog; struct __attribute__ ((__packed__)) bin_dialog{  bfd_byte style[4];  bfd_byte exstyle[4];  bfd_byte off[2];  bfd_byte x[2];  bfd_byte y[2];  bfd_byte width[2];  bfd_byte height[2];};#define BIN_DIALOG_SIZE 18 /* An extended dialog has additional information.  */ typedef struct rc_dialog_ex{  /* Help ID.  */  rc_uint_type help;  /* Font weight.  */  rc_uint_type weight;  /* Whether the font is italic.  */  bfd_byte italic;  /* Character set.  */  bfd_byte charset;} rc_dialog_ex; struct __attribute__ ((__packed__)) bin_dialogex{  bfd_byte sig1[2];  bfd_byte sig2[2];  bfd_byte help[4];  bfd_byte exstyle[4];  bfd_byte style[4];  bfd_byte off[2];  bfd_byte x[2];  bfd_byte y[2];  bfd_byte width[2];  bfd_byte height[2];};#define BIN_DIALOGEX_SIZE 26 struct __attribute__ ((__packed__)) bin_dialogfont{  bfd_byte pointsize[2];};#define BIN_DIALOGFONT_SIZE 2 struct __attribute__ ((__packed__)) bin_dialogexfont{  bfd_byte pointsize[2];  bfd_byte weight[2];  bfd_byte italic[1];  bfd_byte charset[1];};#define BIN_DIALOGEXFONT_SIZE 6 /* Window style flags, from the winsup Defines.h header file.  These   can appear in the style field of a rc_dialog or a rc_dialog_control.  */ #define CW_USEDEFAULT	0x80000000#define WS_BORDER	0x800000L#define WS_CAPTION	0xc00000L#define WS_CHILD	0x40000000L#define WS_CHILDWINDOW	0x40000000L#define WS_CLIPCHILDREN	0x2000000L#define WS_CLIPSIBLINGS	0x4000000L#define WS_DISABLED	0x8000000L#define WS_DLGFRAME	0x400000L#define WS_GROUP	0x20000L#define WS_HSCROLL	0x100000L#define WS_ICONIC	0x20000000L#define WS_MAXIMIZE	0x1000000L#define WS_MAXIMIZEBOX	0x10000L#define WS_MINIMIZE	0x20000000L#define WS_MINIMIZEBOX	0x20000L#define WS_OVERLAPPED	0L#define WS_OVERLAPPEDWINDOW	0xcf0000L#define WS_POPUP	0x80000000L#define WS_POPUPWINDOW	0x80880000L#define WS_SIZEBOX	0x40000L#define WS_SYSMENU	0x80000L

Lines 1–500 of 1097.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t