Debian Codegraph @

Source/icon.h

raw
1 /*
2 * icon.h
3 *
4 * This file is a part of NSIS.
5 *
6 * Copyright (C) 1999-2026 Nullsoft and Contributors
7 *
8 * Licensed under the zlib/libpng license (the "License");
9 * you may not use this file except in compliance with the License.
10 *
11 * Licence details can be found in the file COPYING.
12 *
13 * This software is provided 'as-is', without any express or implied
14 * warranty.
15 */
16
17 /* Unicode support by Jim Park -- 11/16/2007 */
18
19 #ifndef _ICON_H_
20 #define _ICON_H_
21
22 #include "ResourceEditor.h"
23
24 #include <vector>
25
26 typedef struct
27 {
28 WORD wReserved;
29 WORD wType;
30 WORD wCount;
31 } IconGroupHeader;
32
33 typedef struct
34 {
35 BYTE bWidth;
36 BYTE bHeight;
37 BYTE bPaletteEntries;
38 BYTE bReserved;
39 WORD wPlanes;
40 WORD wBitsPerPixel;
41 DWORD dwRawSize;
42 } IconGroupEntry;
43
44 typedef struct
45 {
46 IconGroupEntry header;
47 DWORD dwImageOffset;
48 } FileIconGroupEntry;
49
50 typedef struct
51 {
52 IconGroupEntry header;
53 WORD wRsrcId;
54 } RsrcIconGroupEntry;
55
56 typedef struct
57 {
58 unsigned index;
59 IconGroupEntry meta;
60 LPBYTE data;
61 } Icon;
62
63 typedef std::vector<Icon> IconGroup;
64
65 IconGroup load_icon(const TCHAR* filename);
66 IconGroup load_icon_file(const TCHAR* filename);
67 IconGroup load_icon_res(CResourceEditor* re, WORD id);
68 void free_loaded_icon(IconGroup&icon);
69
70 void set_main_icon(CResourceEditor* re, WORD wIconId, IconGroup icon1, IconGroup icon2);
71
72 #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
73 // returns the data of the uninstaller icon (inside filename) that should replace the installer icon data
74 LPBYTE generate_uninstall_icon_data(IconGroup icon1, IconGroup icon2, size_t &size);
75 // Fill the array of icons for uninstall with their offsets
76 int generate_unicons_offsets(LPBYTE exeHeader, size_t exeHeaderSize, LPBYTE uninstIconData, WORD wIconId);
77 #endif//NSIS_CONFIG_UNINSTALL_SUPPORT
78
79 #endif//_ICON_H_