forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add icon to exe file in windows export
add version_info and icon sections in "export to windows platform". add version_info and icon to godot exe file (editor & template exe). fix an problem in image class. change all default icons to android export icon (a little more rounded). create an python script for convert file to cpp byte array for use in 'splash.h'.
- Loading branch information
Showing
103 changed files
with
17,091 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Открытая бесплатная библиотека для работы с PE-файлами PE Bliss. | ||
Бесплатна к использованию, модификации и распространению. | ||
Автор: DX | ||
(c) DX 2011-2012, kaimi.ru | ||
|
||
Совместимость: Windows, Linux | ||
|
||
Возможности: | ||
[+] Создание PE или PE+ файла с нуля | ||
[+] Чтение 32-разрядных и 64-разрядных PE-файлов (PE, PE+) и единообразная работа с ними | ||
[+] Пересборка 32-разрядных и 64-разрядных PE-файлов | ||
[+] Работа с директориями и заголовками | ||
[+] Конвертирование адресов | ||
[+] Чтение и редактирование секций PE-файла | ||
[+] Чтение и редактирование таблицы импортов | ||
[+] Чтение и редактирование таблицы экспортов | ||
[+] Чтение и редактирование таблиц релокаций | ||
[+] Чтение и редактирование ресурсов | ||
[+] Чтение и редактирование TLS | ||
[+] Чтение и редактирование конфигурации образа (image config) | ||
[+] Чтение базовой информации .NET | ||
[+] Чтение и редактирование информации о привязанном импорте | ||
[+] Чтение директории исключений (только PE+) | ||
[+] Чтение отладочной директории с расширенной информацией | ||
[+] Вычисление энтропии | ||
[+] Изменение файлового выравнивания | ||
[+] Изменение базового адреса загрузки | ||
[+] Работа с DOS Stub'ом и Rich overlay | ||
[+] Высокоуровневое чтение ресурсов: картинки, иконки, курсоры, информация о версии, строковые таблицы, таблицы сообщений | ||
[+] Высокоуровневое редактирование ресурсов: картинки, иконки, курсоры, информация о версии | ||
|
||
[English] | ||
Open a free library for working with PE-file PE Bliss. | ||
Free to use, modify, and distribute. | ||
Author: DX | ||
(c) DX 2011-2012, kaimi.ru | ||
Compatibility: Windows, Linux | ||
|
||
### Capabilities: | ||
[+] Creation of PE or PE + file from scratch | ||
[+] Reading the 32-bit and 64-bit PE-file (PE, PE +) and uniform working with them | ||
[+] Rebuild 32-bit and 64-bit PE-files | ||
[+] Working with the directors and titles | ||
[+] Converting addresses | ||
[+] Reading and editing sections of PE-file | ||
[+] Reading and editing the import table | ||
[+] Reading and editing tables exports | ||
[+] Reading and editing tables relocations | ||
[+] Reading and editing resources | ||
[+] Reading and editing TLS | ||
[+] Reading and editing the configuration of the image (image config) | ||
[+] Reading data base .NET | ||
[+] Reading and editing information about tethered import | ||
[+] Read the directory exceptions (only PE +) | ||
[+] Read debug directories with extended information | ||
[+] The calculation of entropy | ||
[+] Changing file alignment | ||
[+] Change the base load address | ||
[+] Support of DOS Stub'om and Rich overlay | ||
[+] High-level reading resources: images, icons, cursors, version information, string tables, message table | ||
[+] High-level editing resources: images, icons, cursors, version information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Import('env') | ||
|
||
env.add_source_files(env.drivers_sources,"*.cpp") | ||
|
||
Export('env') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#include <cmath> | ||
#include "entropy.h" | ||
#include "utils.h" | ||
|
||
namespace pe_bliss | ||
{ | ||
//Calculates entropy for PE image section | ||
double entropy_calculator::calculate_entropy(const section& s) | ||
{ | ||
if(s.get_raw_data().empty()) //Don't count entropy for empty sections | ||
throw pe_exception("Section is empty", pe_exception::section_is_empty); | ||
|
||
return calculate_entropy(s.get_raw_data().data(), s.get_raw_data().length()); | ||
} | ||
|
||
//Calculates entropy for istream (from current position of stream) | ||
double entropy_calculator::calculate_entropy(std::istream& file) | ||
{ | ||
uint32_t byte_count[256] = {0}; //Byte count for each of 255 bytes | ||
|
||
if(file.bad()) | ||
throw pe_exception("Stream is bad", pe_exception::stream_is_bad); | ||
|
||
std::streamoff pos = file.tellg(); | ||
|
||
std::streamoff length = pe_utils::get_file_size(file); | ||
length -= file.tellg(); | ||
|
||
if(!length) //Don't calculate entropy for empty buffers | ||
throw pe_exception("Data length is zero", pe_exception::data_is_empty); | ||
|
||
//Count bytes | ||
for(std::streamoff i = 0; i != length; ++i) | ||
++byte_count[static_cast<unsigned char>(file.get())]; | ||
|
||
file.seekg(pos); | ||
|
||
return calculate_entropy(byte_count, length); | ||
} | ||
|
||
//Calculates entropy for data block | ||
double entropy_calculator::calculate_entropy(const char* data, size_t length) | ||
{ | ||
uint32_t byte_count[256] = {0}; //Byte count for each of 255 bytes | ||
|
||
if(!length) //Don't calculate entropy for empty buffers | ||
throw pe_exception("Data length is zero", pe_exception::data_is_empty); | ||
|
||
//Count bytes | ||
for(size_t i = 0; i != length; ++i) | ||
++byte_count[static_cast<unsigned char>(data[i])]; | ||
|
||
return calculate_entropy(byte_count, length); | ||
} | ||
|
||
//Calculates entropy for this PE file (only section data) | ||
double entropy_calculator::calculate_entropy(const pe_base& pe) | ||
{ | ||
uint32_t byte_count[256] = {0}; //Byte count for each of 255 bytes | ||
|
||
size_t total_data_length = 0; | ||
|
||
//Count bytes for each section | ||
for(section_list::const_iterator it = pe.get_image_sections().begin(); it != pe.get_image_sections().end(); ++it) | ||
{ | ||
const std::string& data = (*it).get_raw_data(); | ||
size_t length = data.length(); | ||
total_data_length += length; | ||
for(size_t i = 0; i != length; ++i) | ||
++byte_count[static_cast<unsigned char>(data[i])]; | ||
} | ||
|
||
return calculate_entropy(byte_count, total_data_length); | ||
} | ||
|
||
//Calculates entropy from bytes count | ||
double entropy_calculator::calculate_entropy(const uint32_t byte_count[256], std::streamoff total_length) | ||
{ | ||
double entropy = 0.; //Entropy result value | ||
//Calculate entropy | ||
for(uint32_t i = 0; i < 256; ++i) | ||
{ | ||
double temp = static_cast<double>(byte_count[i]) / total_length; | ||
if(temp > 0.) | ||
entropy += std::abs(temp * (std::log(temp) * pe_utils::log_2)); | ||
} | ||
|
||
return entropy; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
#include <istream> | ||
#include "pe_base.h" | ||
|
||
namespace pe_bliss | ||
{ | ||
class entropy_calculator | ||
{ | ||
public: | ||
//Calculates entropy for PE image section | ||
static double calculate_entropy(const section& s); | ||
|
||
//Calculates entropy for istream (from current position of stream) | ||
static double calculate_entropy(std::istream& file); | ||
|
||
//Calculates entropy for data block | ||
static double calculate_entropy(const char* data, size_t length); | ||
|
||
//Calculates entropy for this PE file (only section data) | ||
static double calculate_entropy(const pe_base& pe); | ||
|
||
private: | ||
entropy_calculator(); | ||
entropy_calculator(const entropy_calculator&); | ||
entropy_calculator& operator=(const entropy_calculator&); | ||
|
||
//Calculates entropy from bytes count | ||
static double calculate_entropy(const uint32_t byte_count[256], std::streamoff total_length); | ||
}; | ||
} |
Oops, something went wrong.