gcontini
2020-10-31 510d41ff7d12c8a8ba230d3b3f732b19a20f15e3
doc & miscellaneous changes
4个文件已修改
31 ■■■■ 已修改文件
doc/api/extend.rst 补丁 | 查看 | 原始文档 | blame | 历史
doc/api/hardware_identifiers.rst 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/base/file_utils.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/os/windows/execution_environment.cpp 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
doc/api/extend.rst
doc/api/hardware_identifiers.rst
@@ -2,8 +2,21 @@
Customize hardware signature generators 
###############################################
Customize how default strategy behaves
*****************************************
Change the hardware identification strategy
*************************************************
Included with the library there are three hardware identification strategies: `IP_ADDRESS`, `STRATEGY_ETHERNET` (mac address) and
`STRATEGY_DISK` (partition serial number). If you want to change the strategy that is used to generate the default identifier:
  - locate the file `licensecc_properties.h`` (usually in ``projects/<$project_name>/include/licensecc/<$project_name>``
  - you can change the order of the strategies in the following code block (the strategies will be tried in sequence until the first one succeeds):
.. code-block:: c
#define LCC_BARE_TO_METAL_STRATEGIES { STRATEGY_DISK, STRATEGY_ETHERNET, STRATEGY_NONE }
#define LCC_VM_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_NONE }
#define LCC_LXC_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_NONE }
#define LCC_DOCKER_STRATEGIES { STRATEGY_NONE }
#define LCC_CLOUD_STRATEGIES { STRATEGY_NONE }
Implement your own hardware signature generator 
*************************************************
src/library/base/file_utils.cpp
@@ -10,7 +10,8 @@
#include <cerrno>
#include <iostream>
#include <algorithm>
#include <errno.h>
#include <cstring>
#include "file_utils.hpp"
namespace license {
@@ -34,17 +35,19 @@
}
string get_file_contents(const char *filename, size_t max_size) {
    string contents;
    ifstream in(filename, std::ios::binary);
    if (in) {
        string contents;
        size_t index = (size_t)in.seekg(0, ios::end).tellg();
        size_t limited_size = min(index, max_size);
        contents.resize(limited_size);
        in.seekg(0, ios::beg);
        in.read(&contents[0], limited_size);
        return contents;
        in.close();
    } else {
        throw(std::strerror(errno));
    }
    throw(errno);
    return contents;
}
string remove_extension(const string& path) {
src/library/os/windows/execution_environment.cpp
@@ -20,7 +20,8 @@
namespace os {
using namespace std;
ExecutionEnvironment::ExecutionEnvironment() : m_container_type(CONTAINER_TYPE::NONE) {}
ExecutionEnvironment::ExecutionEnvironment() :
    m_container_type(CONTAINER_TYPE::NONE) {}
#define MAX_UNITS 20
CONTAINER_TYPE wine_container() {