summaryrefslogtreecommitdiff
path: root/Source/icon.h
blob: 38aeef91a0be7304b9504a27615e1304808e731c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * icon.h
 * 
 * This file is a part of NSIS.
 * 
 * Copyright (C) 1999-2009 Nullsoft and Contributors
 * 
 * Licensed under the zlib/libpng license (the "License");
 * you may not use this file except in compliance with the License.
 * 
 * Licence details can be found in the file COPYING.
 * 
 * This software is provided 'as-is', without any express or implied
 * warranty.
 */

#ifndef _ICON_H_
#define _ICON_H_

#include "ResourceEditor.h"

#include <vector>

typedef struct
{
  WORD wReserved;
  WORD wIsIcon;
  WORD wCount;
} IconGroupHeader;

typedef struct
{
  BYTE bWidth;
  BYTE bHeight;
  BYTE bPaletteEntries;
  BYTE bReserved;
  WORD wPlanes;
  WORD wBitsPerPixel;
  DWORD dwRawSize;
} IconGroupEntry;

typedef struct
{
  IconGroupEntry header;
  DWORD dwImageOffset;
} FileIconGroupEntry;

typedef struct
{
  IconGroupEntry header;
  WORD wRsrcId;
} RsrcIconGroupEntry;

typedef struct
{
  unsigned index;
  IconGroupEntry meta;
  LPBYTE data;
} Icon;

typedef std::vector<Icon> IconGroup;

IconGroup load_icon_file(const char* filename);
IconGroup load_icon_res(CResourceEditor* re, WORD id);
void free_loaded_icon(IconGroup icon);

void set_icon(CResourceEditor* re, WORD wIconId, IconGroup icon1, IconGroup icon2);

#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
// returns the data of the uninstaller icon (inside filename) that should replace the installer icon data
LPBYTE generate_uninstall_icon_data(IconGroup icon1, IconGroup icon2, size_t &size);
// Fill the array of icons for uninstall with their offsets
int generate_unicons_offsets(LPBYTE exeHeader, size_t exeHeaderSize, LPBYTE uninstIconData, WORD wIconId);
#endif//NSIS_CONFIG_UNINSTALL_SUPPORT

#endif//_ICON_H_