windint.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  1. /* windint.h -- internal header file for windres program.
  2. Copyright (C) 1997-2015 Free Software Foundation, Inc.
  3. Written by Kai Tietz, Onevision.
  4. This file is part of GNU Binutils.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program 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
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
  16. 02110-1301, USA. */
  17. #include "winduni.h"
  18. #ifndef WINDINT_H
  19. #define WINDINT_H
  20. /* Use bfd_size_type to ensure a sufficient number of bits. */
  21. #ifndef DEFINED_RC_UINT_TYPE
  22. #define DEFINED_RC_UINT_TYPE
  23. typedef bfd_size_type rc_uint_type;
  24. #endif
  25. /* Resource directory structure. */
  26. typedef struct res_hdr
  27. {
  28. rc_uint_type data_size;
  29. rc_uint_type header_size;
  30. } res_hdr;
  31. struct __attribute__ ((__packed__)) bin_res_hdr
  32. {
  33. bfd_byte data_size[4];
  34. bfd_byte header_size[4];
  35. };
  36. #define BIN_RES_HDR_SIZE 8
  37. struct __attribute__ ((__packed__)) bin_res_id
  38. {
  39. bfd_byte sig[2]; /* Has to be 0xffff for unnamed ids. */
  40. bfd_byte id[2];
  41. };
  42. #define BIN_RES_ID 4
  43. /* This structure is used when converting resource information to
  44. binary. */
  45. typedef struct bindata
  46. {
  47. /* Next data. */
  48. struct bindata *next;
  49. /* Length of data. */
  50. rc_uint_type length;
  51. /* Data. */
  52. bfd_byte *data;
  53. } bindata;
  54. /* This structure is used when converting resource information to
  55. coff. */
  56. typedef struct coff_res_data
  57. {
  58. /* Next data. */
  59. struct coff_res_data *next;
  60. /* Length of data. */
  61. rc_uint_type length;
  62. /* Data. */
  63. const struct rc_res_resource *res;
  64. } coff_res_data;
  65. /* We represent resources internally as a tree, similar to the tree
  66. used in the .rsrc section of a COFF file. The root is a
  67. rc_res_directory structure. */
  68. typedef struct rc_res_directory
  69. {
  70. /* Resource flags. According to the MS docs, this is currently
  71. always zero. */
  72. rc_uint_type characteristics;
  73. /* Time/date stamp. */
  74. rc_uint_type time;
  75. /* Major version number. */
  76. rc_uint_type major;
  77. /* Minor version number. */
  78. rc_uint_type minor;
  79. /* Directory entries. */
  80. struct rc_res_entry *entries;
  81. } rc_res_directory;
  82. /* A resource ID is stored in a rc_res_id structure. */
  83. typedef struct rc_res_id
  84. {
  85. /* Non-zero if this entry has a name rather than an ID. */
  86. rc_uint_type named : 1;
  87. union
  88. {
  89. /* If the named field is non-zero, this is the name. */
  90. struct
  91. {
  92. /* Length of the name. */
  93. rc_uint_type length;
  94. /* Pointer to the name, which is a Unicode string. */
  95. unichar *name;
  96. } n;
  97. /* If the named field is zero, this is the ID. */
  98. rc_uint_type id;
  99. } u;
  100. } rc_res_id;
  101. /* Each entry in the tree is a rc_res_entry structure. We mix
  102. directories and resources because in a COFF file all entries in a
  103. directory are sorted together, whether the entries are
  104. subdirectories or resources. */
  105. typedef struct rc_res_entry
  106. {
  107. /* Next entry. */
  108. struct rc_res_entry *next;
  109. /* Resource ID. */
  110. rc_res_id id;
  111. /* Non-zero if this entry is a subdirectory rather than a leaf. */
  112. rc_uint_type subdir : 1;
  113. union
  114. {
  115. /* If the subdir field is non-zero, this is a pointer to the
  116. subdirectory. */
  117. rc_res_directory *dir;
  118. /* If the subdir field is zero, this is a pointer to the resource
  119. data. */
  120. struct rc_res_resource *res;
  121. } u;
  122. } rc_res_entry;
  123. /* Types of resources. */
  124. enum rc_res_type
  125. {
  126. RES_TYPE_UNINITIALIZED,
  127. RES_TYPE_ACCELERATOR,
  128. RES_TYPE_BITMAP,
  129. RES_TYPE_CURSOR,
  130. RES_TYPE_GROUP_CURSOR,
  131. RES_TYPE_DIALOG,
  132. RES_TYPE_FONT,
  133. RES_TYPE_FONTDIR,
  134. RES_TYPE_ICON,
  135. RES_TYPE_GROUP_ICON,
  136. RES_TYPE_MENU,
  137. RES_TYPE_MESSAGETABLE,
  138. RES_TYPE_RCDATA,
  139. RES_TYPE_STRINGTABLE,
  140. RES_TYPE_USERDATA,
  141. RES_TYPE_VERSIONINFO,
  142. RES_TYPE_DLGINCLUDE,
  143. RES_TYPE_PLUGPLAY,
  144. RES_TYPE_VXD,
  145. RES_TYPE_ANICURSOR,
  146. RES_TYPE_ANIICON,
  147. RES_TYPE_DLGINIT,
  148. RES_TYPE_TOOLBAR
  149. };
  150. /* A res file and a COFF file store information differently. The
  151. res_info structures holds data which in a res file is stored with
  152. each resource, but in a COFF file is stored elsewhere. */
  153. typedef struct rc_res_res_info
  154. {
  155. /* Language. In a COFF file, the third level of the directory is
  156. keyed by the language, so the language of a resource is defined
  157. by its location in the resource tree. */
  158. rc_uint_type language;
  159. /* Characteristics of the resource. Entirely user defined. In a
  160. COFF file, the rc_res_directory structure has a characteristics
  161. field, but I don't know if it's related to the one in the res
  162. file. */
  163. rc_uint_type characteristics;
  164. /* Version of the resource. Entirely user defined. In a COFF file,
  165. the rc_res_directory structure has a characteristics field, but I
  166. don't know if it's related to the one in the res file. */
  167. rc_uint_type version;
  168. /* Memory flags. This is a combination of the MEMFLAG values
  169. defined below. Most of these values are historical, and are not
  170. meaningful for win32. I don't think there is any way to store
  171. this information in a COFF file. */
  172. rc_uint_type memflags;
  173. } rc_res_res_info;
  174. /* Binary layout of rc_res_info. */
  175. struct __attribute__ ((__packed__)) bin_res_info
  176. {
  177. bfd_byte version[4];
  178. bfd_byte memflags[2];
  179. bfd_byte language[2];
  180. bfd_byte version2[4];
  181. bfd_byte characteristics[4];
  182. };
  183. #define BIN_RES_INFO_SIZE 16
  184. /* Each resource in a COFF file has some information which can does
  185. not appear in a res file. */
  186. typedef struct rc_res_coff_info
  187. {
  188. /* The code page used for the data. I don't really know what this
  189. should be. It has something todo with ASCII to Unicode encoding. */
  190. rc_uint_type codepage;
  191. /* A resource entry in a COFF file has a reserved field, which we
  192. record here when reading a COFF file. When writing a COFF file,
  193. we set this field to zero. */
  194. rc_uint_type reserved;
  195. } rc_res_coff_info;
  196. /* Resource data is stored in a rc_res_resource structure. */
  197. typedef struct rc_res_resource
  198. {
  199. /* The type of resource. */
  200. enum rc_res_type type;
  201. /* The data for the resource. */
  202. union
  203. {
  204. struct
  205. {
  206. rc_uint_type length;
  207. const bfd_byte *data;
  208. } data;
  209. struct rc_accelerator *acc;
  210. struct rc_cursor *cursor;
  211. struct rc_group_cursor *group_cursor;
  212. struct rc_dialog *dialog;
  213. struct rc_fontdir *fontdir;
  214. struct rc_group_icon *group_icon;
  215. struct rc_menu *menu;
  216. struct rc_rcdata_item *rcdata;
  217. struct rc_stringtable *stringtable;
  218. struct rc_rcdata_item *userdata;
  219. struct rc_versioninfo *versioninfo;
  220. struct rc_toolbar *toolbar;
  221. } u;
  222. /* Information from a res file. */
  223. struct rc_res_res_info res_info;
  224. /* Information from a COFF file. */
  225. rc_res_coff_info coff_info;
  226. } rc_res_resource;
  227. #define SUBLANG_SHIFT 10
  228. /* Memory flags in the memflags field of a rc_res_resource. */
  229. #define MEMFLAG_MOVEABLE 0x10
  230. #define MEMFLAG_PURE 0x20
  231. #define MEMFLAG_PRELOAD 0x40
  232. #define MEMFLAG_DISCARDABLE 0x1000
  233. /* Standard resource type codes. These are used in the ID field of a
  234. rc_res_entry structure. */
  235. #define RT_CURSOR 1
  236. #define RT_BITMAP 2
  237. #define RT_ICON 3
  238. #define RT_MENU 4
  239. #define RT_DIALOG 5
  240. #define RT_STRING 6
  241. #define RT_FONTDIR 7
  242. #define RT_FONT 8
  243. #define RT_ACCELERATOR 9
  244. #define RT_RCDATA 10
  245. #define RT_MESSAGETABLE 11
  246. #define RT_GROUP_CURSOR 12
  247. #define RT_GROUP_ICON 14
  248. #define RT_VERSION 16
  249. #define RT_DLGINCLUDE 17
  250. #define RT_PLUGPLAY 19
  251. #define RT_VXD 20
  252. #define RT_ANICURSOR 21
  253. #define RT_ANIICON 22
  254. #define RT_HTML 23
  255. #define RT_MANIFEST 24
  256. #define RT_DLGINIT 240
  257. #define RT_TOOLBAR 241
  258. /* An accelerator resource is a linked list of these structures. */
  259. typedef struct rc_accelerator
  260. {
  261. /* Next accelerator. */
  262. struct rc_accelerator *next;
  263. /* Flags. A combination of the ACC values defined below. */
  264. rc_uint_type flags;
  265. /* Key value. */
  266. rc_uint_type key;
  267. /* Resource ID. */
  268. rc_uint_type id;
  269. } rc_accelerator;
  270. struct __attribute__ ((__packed__)) bin_accelerator
  271. {
  272. bfd_byte flags[2];
  273. bfd_byte key[2];
  274. bfd_byte id[2];
  275. bfd_byte pad[2];
  276. };
  277. #define BIN_ACCELERATOR_SIZE 8
  278. /* Accelerator flags in the flags field of a rc_accelerator.
  279. These are the same values that appear in a res file. I hope. */
  280. #define ACC_VIRTKEY 0x01
  281. #define ACC_NOINVERT 0x02
  282. #define ACC_SHIFT 0x04
  283. #define ACC_CONTROL 0x08
  284. #define ACC_ALT 0x10
  285. #define ACC_LAST 0x80
  286. /* A cursor resource. */
  287. typedef struct rc_cursor
  288. {
  289. /* X coordinate of hotspot. */
  290. bfd_signed_vma xhotspot;
  291. /* Y coordinate of hotspot. */
  292. bfd_signed_vma yhotspot;
  293. /* Length of bitmap data. */
  294. rc_uint_type length;
  295. /* Data. */
  296. const bfd_byte *data;
  297. } rc_cursor;
  298. struct __attribute__ ((__packed__)) bin_cursor
  299. {
  300. bfd_byte xhotspot[2];
  301. bfd_byte yhotspot[2];
  302. };
  303. #define BIN_CURSOR_SIZE 4
  304. /* A group_cursor resource is a list of rc_i_group_cursor structures. */
  305. typedef struct rc_group_cursor
  306. {
  307. /* Next cursor in group. */
  308. struct rc_group_cursor *next;
  309. /* Width. */
  310. rc_uint_type width;
  311. /* Height. */
  312. rc_uint_type height;
  313. /* Planes. */
  314. rc_uint_type planes;
  315. /* Bits per pixel. */
  316. rc_uint_type bits;
  317. /* Number of bytes in cursor resource. */
  318. rc_uint_type bytes;
  319. /* Index of cursor resource. */
  320. rc_uint_type index;
  321. } rc_group_cursor;
  322. struct __attribute__ ((__packed__)) bin_group_cursor_item
  323. {
  324. bfd_byte width[2];
  325. bfd_byte height[2];
  326. bfd_byte planes[2];
  327. bfd_byte bits[2];
  328. bfd_byte bytes[4];
  329. bfd_byte index[2];
  330. };
  331. #define BIN_GROUP_CURSOR_ITEM_SIZE 14
  332. struct __attribute__ ((__packed__)) bin_group_cursor
  333. {
  334. bfd_byte sig1[2];
  335. bfd_byte sig2[2];
  336. bfd_byte nitems[2];
  337. /* struct bin_group_cursor_item item[nitems]; */
  338. };
  339. #define BIN_GROUP_CURSOR_SIZE 6
  340. /* A dialog resource. */
  341. typedef struct rc_dialog
  342. {
  343. /* Basic window style. */
  344. unsigned int style;
  345. /* Extended window style. */
  346. rc_uint_type exstyle;
  347. /* X coordinate. */
  348. rc_uint_type x;
  349. /* Y coordinate. */
  350. rc_uint_type y;
  351. /* Width. */
  352. rc_uint_type width;
  353. /* Height. */
  354. rc_uint_type height;
  355. /* Menu name. */
  356. rc_res_id menu;
  357. /* Class name. */
  358. rc_res_id class;
  359. /* Caption. */
  360. unichar *caption;
  361. /* Font point size. */
  362. rc_uint_type pointsize;
  363. /* Font name. */
  364. unichar *font;
  365. /* Extended information for a dialogex. */
  366. struct rc_dialog_ex *ex;
  367. /* Controls. */
  368. struct rc_dialog_control *controls;
  369. } rc_dialog;
  370. struct __attribute__ ((__packed__)) bin_dialog
  371. {
  372. bfd_byte style[4];
  373. bfd_byte exstyle[4];
  374. bfd_byte off[2];
  375. bfd_byte x[2];
  376. bfd_byte y[2];
  377. bfd_byte width[2];
  378. bfd_byte height[2];
  379. };
  380. #define BIN_DIALOG_SIZE 18
  381. /* An extended dialog has additional information. */
  382. typedef struct rc_dialog_ex
  383. {
  384. /* Help ID. */
  385. rc_uint_type help;
  386. /* Font weight. */
  387. rc_uint_type weight;
  388. /* Whether the font is italic. */
  389. bfd_byte italic;
  390. /* Character set. */
  391. bfd_byte charset;
  392. } rc_dialog_ex;
  393. struct __attribute__ ((__packed__)) bin_dialogex
  394. {
  395. bfd_byte sig1[2];
  396. bfd_byte sig2[2];
  397. bfd_byte help[4];
  398. bfd_byte exstyle[4];
  399. bfd_byte style[4];
  400. bfd_byte off[2];
  401. bfd_byte x[2];
  402. bfd_byte y[2];
  403. bfd_byte width[2];
  404. bfd_byte height[2];
  405. };
  406. #define BIN_DIALOGEX_SIZE 26
  407. struct __attribute__ ((__packed__)) bin_dialogfont
  408. {
  409. bfd_byte pointsize[2];
  410. };
  411. #define BIN_DIALOGFONT_SIZE 2
  412. struct __attribute__ ((__packed__)) bin_dialogexfont
  413. {
  414. bfd_byte pointsize[2];
  415. bfd_byte weight[2];
  416. bfd_byte italic[1];
  417. bfd_byte charset[1];
  418. };
  419. #define BIN_DIALOGEXFONT_SIZE 6
  420. /* Window style flags, from the winsup Defines.h header file. These
  421. can appear in the style field of a rc_dialog or a rc_dialog_control. */
  422. #define CW_USEDEFAULT 0x80000000
  423. #define WS_BORDER 0x800000L
  424. #define WS_CAPTION 0xc00000L
  425. #define WS_CHILD 0x40000000L
  426. #define WS_CHILDWINDOW 0x40000000L
  427. #define WS_CLIPCHILDREN 0x2000000L
  428. #define WS_CLIPSIBLINGS 0x4000000L
  429. #define WS_DISABLED 0x8000000L
  430. #define WS_DLGFRAME 0x400000L
  431. #define WS_GROUP 0x20000L
  432. #define WS_HSCROLL 0x100000L
  433. #define WS_ICONIC 0x20000000L
  434. #define WS_MAXIMIZE 0x1000000L
  435. #define WS_MAXIMIZEBOX 0x10000L
  436. #define WS_MINIMIZE 0x20000000L
  437. #define WS_MINIMIZEBOX 0x20000L
  438. #define WS_OVERLAPPED 0L
  439. #define WS_OVERLAPPEDWINDOW 0xcf0000L
  440. #define WS_POPUP 0x80000000L
  441. #define WS_POPUPWINDOW 0x80880000L
  442. #define WS_SIZEBOX 0x40000L
  443. #define WS_SYSMENU 0x80000L
  444. #define WS_TABSTOP 0x10000L
  445. #define WS_THICKFRAME 0x40000L
  446. #define WS_TILED 0L
  447. #define WS_TILEDWINDOW 0xcf0000L
  448. #define WS_VISIBLE 0x10000000L
  449. #define WS_VSCROLL 0x200000L
  450. #define MDIS_ALLCHILDSTYLES 0x1
  451. #define BS_3STATE 0x5L
  452. #define BS_AUTO3STATE 0x6L
  453. #define BS_AUTOCHECKBOX 0x3L
  454. #define BS_AUTORADIOBUTTON 0x9L
  455. #define BS_BITMAP 0x80L
  456. #define BS_BOTTOM 0x800L
  457. #define BS_CENTER 0x300L
  458. #define BS_CHECKBOX 0x2L
  459. #define BS_DEFPUSHBUTTON 0x1L
  460. #define BS_GROUPBOX 0x7L
  461. #define BS_ICON 0x40L
  462. #define BS_LEFT 0x100L
  463. #define BS_LEFTTEXT 0x20L
  464. #define BS_MULTILINE 0x2000L
  465. #define BS_NOTIFY 0x4000L
  466. #define BS_OWNERDRAW 0xbL
  467. #define BS_PUSHBOX 0xcL /* FIXME! What should this be? */
  468. #define BS_PUSHBUTTON 0L
  469. #define BS_PUSHLIKE 0x1000L
  470. #define BS_RADIOBUTTON 0x4L
  471. #define BS_RIGHT 0x200L
  472. #define BS_RIGHTBUTTON 0x20L
  473. #define BS_TEXT 0L
  474. #define BS_TOP 0x400L
  475. #define BS_USERBUTTON 0x8L
  476. #define BS_VCENTER 0xc00L
  477. #define CBS_AUTOHSCROLL 0x40L
  478. #define CBS_DISABLENOSCROLL 0x800L
  479. #define CBS_DROPDOWN 0x2L
  480. #define CBS_DROPDOWNLIST 0x3L
  481. #define CBS_HASSTRINGS 0x200L
  482. #define CBS_LOWERCASE 0x4000L
  483. #define CBS_NOINTEGRALHEIGHT 0x400L
  484. #define CBS_OEMCONVERT 0x80L
  485. #define CBS_OWNERDRAWFIXED 0x10L
  486. #define CBS_OWNERDRAWVARIABLE 0x20L
  487. #define CBS_SIMPLE 0x1L
  488. #define CBS_SORT 0x100L
  489. #define CBS_UPPERCASE 0x2000L
  490. #define ES_AUTOHSCROLL 0x80L
  491. #define ES_AUTOVSCROLL 0x40L
  492. #define ES_CENTER 0x1L
  493. #define ES_LEFT 0L
  494. #define ES_LOWERCASE 0x10L
  495. #define ES_MULTILINE 0x4L
  496. #define ES_NOHIDESEL 0x100L
  497. #define ES_NUMBER 0x2000L
  498. #define ES_OEMCONVERT 0x400L
  499. #define ES_PASSWORD 0x20L
  500. #define ES_READONLY 0x800L
  501. #define ES_RIGHT 0x2L
  502. #define ES_UPPERCASE 0x8L
  503. #define ES_WANTRETURN 0x1000L
  504. #define LBS_DISABLENOSCROLL 0x1000L
  505. #define LBS_EXTENDEDSEL 0x800L
  506. #define LBS_HASSTRINGS 0x40L
  507. #define LBS_MULTICOLUMN 0x200L
  508. #define LBS_MULTIPLESEL 0x8L
  509. #define LBS_NODATA 0x2000L
  510. #define LBS_NOINTEGRALHEIGHT 0x100L
  511. #define LBS_NOREDRAW 0x4L
  512. #define LBS_NOSEL 0x4000L
  513. #define LBS_NOTIFY 0x1L
  514. #define LBS_OWNERDRAWFIXED 0x10L
  515. #define LBS_OWNERDRAWVARIABLE 0x20L
  516. #define LBS_SORT 0x2L
  517. #define LBS_STANDARD 0xa00003L
  518. #define LBS_USETABSTOPS 0x80L
  519. #define LBS_WANTKEYBOARDINPUT 0x400L
  520. #define SBS_BOTTOMALIGN 0x4L
  521. #define SBS_HORZ 0L
  522. #define SBS_LEFTALIGN 0x2L
  523. #define SBS_RIGHTALIGN 0x4L
  524. #define SBS_SIZEBOX 0x8L
  525. #define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x4L
  526. #define SBS_SIZEBOXTOPLEFTALIGN 0x2L
  527. #define SBS_SIZEGRIP 0x10L
  528. #define SBS_TOPALIGN 0x2L
  529. #define SBS_VERT 0x1L
  530. #define SS_BITMAP 0xeL
  531. #define SS_BLACKFRAME 0x7L
  532. #define SS_BLACKRECT 0x4L
  533. #define SS_CENTER 0x1L
  534. #define SS_CENTERIMAGE 0x200L
  535. #define SS_ENHMETAFILE 0xfL
  536. #define SS_ETCHEDFRAME 0x12L
  537. #define SS_ETCHEDHORZ 0x10L
  538. #define SS_ETCHEDVERT 0x11L
  539. #define SS_GRAYFRAME 0x8L
  540. #define SS_GRAYRECT 0x5L
  541. #define SS_ICON 0x3L
  542. #define SS_LEFT 0L
  543. #define SS_LEFTNOWORDWRAP 0xcL
  544. #define SS_NOPREFIX 0x80L
  545. #define SS_NOTIFY 0x100L
  546. #define SS_OWNERDRAW 0xdL
  547. #define SS_REALSIZEIMAGE 0x800L
  548. #define SS_RIGHT 0x2L
  549. #define SS_RIGHTJUST 0x400L
  550. #define SS_SIMPLE 0xbL
  551. #define SS_SUNKEN 0x1000L
  552. #define SS_USERITEM 0xaL
  553. #define SS_WHITEFRAME 0x9L
  554. #define SS_WHITERECT 0x6L
  555. #define DS_3DLOOK 0x4L
  556. #define DS_ABSALIGN 0x1L
  557. #define DS_CENTER 0x800L
  558. #define DS_CENTERMOUSE 0x1000L
  559. #define DS_CONTEXTHELP 0x2000L
  560. #define DS_CONTROL 0x400L
  561. #define DS_FIXEDSYS 0x8L
  562. #define DS_LOCALEDIT 0x20L
  563. #define DS_MODALFRAME 0x80L
  564. #define DS_NOFAILCREATE 0x10L
  565. #define DS_NOIDLEMSG 0x100L
  566. #define DS_SETFONT 0x40L
  567. #define DS_SETFOREGROUND 0x200L
  568. #define DS_SYSMODAL 0x2L
  569. /* A dialog control. */
  570. typedef struct rc_dialog_control
  571. {
  572. /* Next control. */
  573. struct rc_dialog_control *next;
  574. /* ID. */
  575. rc_uint_type id;
  576. /* Style. */
  577. rc_uint_type style;
  578. /* Extended style. */
  579. rc_uint_type exstyle;
  580. /* X coordinate. */
  581. rc_uint_type x;
  582. /* Y coordinate. */
  583. rc_uint_type y;
  584. /* Width. */
  585. rc_uint_type width;
  586. /* Height. */
  587. rc_uint_type height;
  588. /* Class name. */
  589. rc_res_id class;
  590. /* Associated text. */
  591. rc_res_id text;
  592. /* Extra data for the window procedure. */
  593. struct rc_rcdata_item *data;
  594. /* Help ID. Only used in an extended dialog. */
  595. rc_uint_type help;
  596. } rc_dialog_control;
  597. struct __attribute__ ((__packed__)) bin_dialog_control
  598. {
  599. bfd_byte style[4];
  600. bfd_byte exstyle[4];
  601. bfd_byte x[2];
  602. bfd_byte y[2];
  603. bfd_byte width[2];
  604. bfd_byte height[2];
  605. bfd_byte id[2];
  606. };
  607. #define BIN_DIALOG_CONTROL_SIZE 18
  608. struct __attribute__ ((__packed__)) bin_dialogex_control
  609. {
  610. bfd_byte help[4];
  611. bfd_byte exstyle[4];
  612. bfd_byte style[4];
  613. bfd_byte x[2];
  614. bfd_byte y[2];
  615. bfd_byte width[2];
  616. bfd_byte height[2];
  617. bfd_byte id[4];
  618. };
  619. #define BIN_DIALOGEX_CONTROL_SIZE 24
  620. /* Control classes. These can be used as the ID field in a rc_dialog_control. */
  621. #define CTL_BUTTON 0x80
  622. #define CTL_EDIT 0x81
  623. #define CTL_STATIC 0x82
  624. #define CTL_LISTBOX 0x83
  625. #define CTL_SCROLLBAR 0x84
  626. #define CTL_COMBOBOX 0x85
  627. /* A fontdir resource is a list of rc_fontdir. */
  628. typedef struct rc_fontdir
  629. {
  630. struct rc_fontdir *next;
  631. /* Index of font entry. */
  632. rc_uint_type index;
  633. /* Length of font information. */
  634. rc_uint_type length;
  635. /* Font information. */
  636. const bfd_byte *data;
  637. } rc_fontdir;
  638. struct __attribute__ ((__packed__)) bin_fontdir_item
  639. {
  640. bfd_byte index[2];
  641. bfd_byte header[54];
  642. bfd_byte device_name[1];
  643. /* bfd_byte face_name[]; */
  644. };
  645. /* A group_icon resource is a list of rc_group_icon. */
  646. typedef struct rc_group_icon
  647. {
  648. /* Next icon in group. */
  649. struct rc_group_icon *next;
  650. /* Width. */
  651. bfd_byte width;
  652. /* Height. */
  653. bfd_byte height;
  654. /* Color count. */
  655. bfd_byte colors;
  656. /* Planes. */
  657. rc_uint_type planes;
  658. /* Bits per pixel. */
  659. rc_uint_type bits;
  660. /* Number of bytes in cursor resource. */
  661. rc_uint_type bytes;
  662. /* Index of cursor resource. */
  663. rc_uint_type index;
  664. } rc_group_icon;
  665. struct __attribute__ ((__packed__)) bin_group_icon
  666. {
  667. bfd_byte sig1[2];
  668. bfd_byte sig2[2];
  669. bfd_byte count[2];
  670. };
  671. #define BIN_GROUP_ICON_SIZE 6
  672. struct __attribute__ ((__packed__)) bin_group_icon_item
  673. {
  674. bfd_byte width[1];
  675. bfd_byte height[1];
  676. bfd_byte colors[1];
  677. bfd_byte pad[1];
  678. bfd_byte planes[2];
  679. bfd_byte bits[2];
  680. bfd_byte bytes[4];
  681. bfd_byte index[2];
  682. };
  683. #define BIN_GROUP_ICON_ITEM_SIZE 14
  684. /* A menu resource. */
  685. typedef struct rc_menu
  686. {
  687. /* List of menuitems. */
  688. struct rc_menuitem *items;
  689. /* Help ID. I don't think there is any way to set this in an rc
  690. file, but it can appear in the binary format. */
  691. rc_uint_type help;
  692. } rc_menu;
  693. struct __attribute__ ((__packed__)) bin_menu
  694. {
  695. bfd_byte sig1[2];
  696. bfd_byte sig2[2];
  697. };
  698. #define BIN_MENU_SIZE 4
  699. struct __attribute__ ((__packed__)) bin_menuex
  700. {
  701. bfd_byte sig1[2];
  702. bfd_byte sig2[2];
  703. bfd_byte help[4];
  704. };
  705. #define BIN_MENUEX_SIZE 8
  706. /* A menu resource is a list of rc_menuitem. */
  707. typedef struct rc_menuitem
  708. {
  709. /* Next menu item. */
  710. struct rc_menuitem *next;
  711. /* Type. In a normal menu, rather than a menuex, this is the flags
  712. field. */
  713. rc_uint_type type;
  714. /* State. This is only used in a menuex. */
  715. rc_uint_type state;
  716. /* Id. */
  717. rc_uint_type id;
  718. /* Unicode text. */
  719. unichar *text;
  720. /* Popup menu items for a popup. */
  721. struct rc_menuitem *popup;
  722. /* Help ID. This is only used in a menuex. */
  723. rc_uint_type help;
  724. } rc_menuitem;
  725. struct __attribute__ ((__packed__)) bin_menuitem
  726. {
  727. bfd_byte flags[2];
  728. bfd_byte id[2];
  729. };
  730. #define BIN_MENUITEM_SIZE 4
  731. #define BIN_MENUITEM_POPUP_SIZE 2
  732. struct __attribute__ ((__packed__)) bin_menuitemex
  733. {
  734. bfd_byte type[4];
  735. bfd_byte state[4];
  736. bfd_byte id[4];
  737. bfd_byte flags[2];
  738. /* unicode text */
  739. /* if popup: align, bfd_byte help[4], align, bin_menuitemex[]; */
  740. };
  741. #define BIN_MENUITEMEX_SIZE 14
  742. /* Menu item flags. These can appear in the flags field of a rc_menuitem. */
  743. #define MENUITEM_GRAYED 0x001
  744. #define MENUITEM_INACTIVE 0x002
  745. #define MENUITEM_BITMAP 0x004
  746. #define MENUITEM_OWNERDRAW 0x100
  747. #define MENUITEM_CHECKED 0x008
  748. #define MENUITEM_POPUP 0x010
  749. #define MENUITEM_MENUBARBREAK 0x020
  750. #define MENUITEM_MENUBREAK 0x040
  751. #define MENUITEM_ENDMENU 0x080
  752. #define MENUITEM_HELP 0x4000
  753. /* An rcdata resource is a pointer to a list of rc_rcdata_item. */
  754. typedef struct rc_rcdata_item
  755. {
  756. /* Next data item. */
  757. struct rc_rcdata_item *next;
  758. /* Type of data. */
  759. enum
  760. {
  761. RCDATA_WORD,
  762. RCDATA_DWORD,
  763. RCDATA_STRING,
  764. RCDATA_WSTRING,
  765. RCDATA_BUFFER
  766. } type;
  767. union
  768. {
  769. rc_uint_type word;
  770. rc_uint_type dword;
  771. struct
  772. {
  773. rc_uint_type length;
  774. const char *s;
  775. } string;
  776. struct
  777. {
  778. rc_uint_type length;
  779. const unichar *w;
  780. } wstring;
  781. struct
  782. {
  783. rc_uint_type length;
  784. const bfd_byte *data;
  785. } buffer;
  786. } u;
  787. } rc_rcdata_item;
  788. /* A stringtable resource is a pointer to a rc_stringtable. */
  789. typedef struct rc_stringtable
  790. {
  791. /* Each stringtable resource is a list of 16 unicode strings. */
  792. struct
  793. {
  794. /* Length of string. */
  795. rc_uint_type length;
  796. /* String data if length > 0. */
  797. unichar *string;
  798. } strings[16];
  799. } rc_stringtable;
  800. /* A versioninfo resource points to a rc_versioninfo. */
  801. typedef struct rc_versioninfo
  802. {
  803. /* Fixed version information. */
  804. struct rc_fixed_versioninfo *fixed;
  805. /* Variable version information. */
  806. struct rc_ver_info *var;
  807. } rc_versioninfo;
  808. struct __attribute__ ((__packed__)) bin_versioninfo
  809. {
  810. bfd_byte size[2];
  811. bfd_byte fixed_size[2];
  812. bfd_byte sig2[2];
  813. };
  814. #define BIN_VERSIONINFO_SIZE 6
  815. /* The fixed portion of a versioninfo resource. */
  816. typedef struct rc_fixed_versioninfo
  817. {
  818. /* The file version, which is two 32 bit integers. */
  819. rc_uint_type file_version_ms;
  820. rc_uint_type file_version_ls;
  821. /* The product version, which is two 32 bit integers. */
  822. rc_uint_type product_version_ms;
  823. rc_uint_type product_version_ls;
  824. /* The file flags mask. */
  825. rc_uint_type file_flags_mask;
  826. /* The file flags. */
  827. rc_uint_type file_flags;
  828. /* The OS type. */
  829. rc_uint_type file_os;
  830. /* The file type. */
  831. rc_uint_type file_type;
  832. /* The file subtype. */
  833. rc_uint_type file_subtype;
  834. /* The date, which in Windows is two 32 bit integers. */
  835. rc_uint_type file_date_ms;
  836. rc_uint_type file_date_ls;
  837. } rc_fixed_versioninfo;
  838. struct __attribute__ ((__packed__)) bin_fixed_versioninfo
  839. {
  840. bfd_byte sig1[4];
  841. bfd_byte sig2[4];
  842. bfd_byte file_version[4];
  843. bfd_byte file_version_ls[4];
  844. bfd_byte product_version_ms[4];
  845. bfd_byte product_version_ls[4];
  846. bfd_byte file_flags_mask[4];
  847. bfd_byte file_flags[4];
  848. bfd_byte file_os[4];
  849. bfd_byte file_type[4];
  850. bfd_byte file_subtype[4];
  851. bfd_byte file_date_ms[4];
  852. bfd_byte file_date_ls[4];
  853. };
  854. #define BIN_FIXED_VERSIONINFO_SIZE 52
  855. /* A list of string version information. */
  856. typedef struct rc_ver_stringtable
  857. {
  858. /* Next item. */
  859. struct rc_ver_stringtable *next;
  860. /* Language. */
  861. unichar *language;
  862. /* Strings. */
  863. struct rc_ver_stringinfo *strings;
  864. } rc_ver_stringtable;
  865. /* A list of variable version information. */
  866. typedef struct rc_ver_info
  867. {
  868. /* Next item. */
  869. struct rc_ver_info *next;
  870. /* Type of data. */
  871. enum { VERINFO_STRING, VERINFO_VAR } type;
  872. union
  873. {
  874. /* StringFileInfo data. */
  875. struct
  876. {
  877. /* String tables. */
  878. struct rc_ver_stringtable *stringtables;
  879. } string;
  880. /* VarFileInfo data. */
  881. struct
  882. {
  883. /* Key. */
  884. unichar *key;
  885. /* Values. */
  886. struct rc_ver_varinfo *var;
  887. } var;
  888. } u;
  889. } rc_ver_info;
  890. struct __attribute__ ((__packed__)) bin_ver_info
  891. {
  892. bfd_byte size[2];
  893. bfd_byte sig1[2];
  894. bfd_byte sig2[2];
  895. };
  896. #define BIN_VER_INFO_SIZE 6
  897. /* A list of string version information. */
  898. typedef struct rc_ver_stringinfo
  899. {
  900. /* Next string. */
  901. struct rc_ver_stringinfo *next;
  902. /* Key. */
  903. unichar *key;
  904. /* Value. */
  905. unichar *value;
  906. } rc_ver_stringinfo;
  907. /* A list of variable version information. */
  908. typedef struct rc_ver_varinfo
  909. {
  910. /* Next item. */
  911. struct rc_ver_varinfo *next;
  912. /* Language ID. */
  913. rc_uint_type language;
  914. /* Character set ID. */
  915. rc_uint_type charset;
  916. } rc_ver_varinfo;
  917. typedef struct rc_toolbar_item
  918. {
  919. struct rc_toolbar_item *next;
  920. struct rc_toolbar_item *prev;
  921. rc_res_id id;
  922. } rc_toolbar_item;
  923. struct __attribute__ ((__packed__)) bin_messagetable_item
  924. {
  925. bfd_byte length[2];
  926. bfd_byte flags[2];
  927. bfd_byte data[1];
  928. };
  929. #define BIN_MESSAGETABLE_ITEM_SIZE 4
  930. #define MESSAGE_RESOURCE_UNICODE 0x0001
  931. struct __attribute__ ((__packed__)) bin_messagetable_block
  932. {
  933. bfd_byte lowid[4];
  934. bfd_byte highid[4];
  935. bfd_byte offset[4];
  936. };
  937. #define BIN_MESSAGETABLE_BLOCK_SIZE 12
  938. struct __attribute__ ((__packed__)) bin_messagetable
  939. {
  940. bfd_byte cblocks[4];
  941. struct bin_messagetable_block items[1];
  942. };
  943. #define BIN_MESSAGETABLE_SIZE 8
  944. typedef struct rc_toolbar
  945. {
  946. rc_uint_type button_width;
  947. rc_uint_type button_height;
  948. rc_uint_type nitems;
  949. rc_toolbar_item *items;
  950. } rc_toolbar;
  951. struct __attribute__ ((__packed__)) bin_toolbar
  952. {
  953. bfd_byte button_width[4];
  954. bfd_byte button_height[4];
  955. bfd_byte nitems[4];
  956. /* { bfd_byte id[4]; } * nitems; */
  957. };
  958. #define BIN_TOOLBAR_SIZE 12
  959. extern int target_is_bigendian;
  960. typedef struct windres_bfd
  961. {
  962. bfd *abfd;
  963. asection *sec;
  964. rc_uint_type kind : 4;
  965. } windres_bfd;
  966. #define WR_KIND_TARGET 0
  967. #define WR_KIND_BFD 1
  968. #define WR_KIND_BFD_BIN_L 2
  969. #define WR_KIND_BFD_BIN_B 3
  970. #define WR_KIND(PTR) (PTR)->kind
  971. #define WR_SECTION(PTR) (PTR)->sec
  972. #define WR_BFD(PTR) (PTR)->abfd
  973. extern void set_windres_bfd_content (windres_bfd *, const void *, rc_uint_type, rc_uint_type);
  974. extern void get_windres_bfd_content (windres_bfd *, void *, rc_uint_type, rc_uint_type);
  975. extern void windres_put_8 (windres_bfd *, void *, rc_uint_type);
  976. extern void windres_put_16 (windres_bfd *, void *, rc_uint_type);
  977. extern void windres_put_32 (windres_bfd *, void *, rc_uint_type);
  978. extern rc_uint_type windres_get_8 (windres_bfd *, const void *, rc_uint_type);
  979. extern rc_uint_type windres_get_16 (windres_bfd *, const void *, rc_uint_type);
  980. extern rc_uint_type windres_get_32 (windres_bfd *, const void *, rc_uint_type);
  981. extern void set_windres_bfd (windres_bfd *, bfd *, asection *, rc_uint_type);
  982. extern void set_windres_bfd_endianness (windres_bfd *, int);
  983. #endif