src/jdk.jpackage/windows/native/msiwrapper/Resources.cpp
author herrick
Mon, 17 Jun 2019 15:38:04 -0400
branchJDK-8200758-branch
changeset 57413 45c74e654794
child 57909 c7de06ed4b54
permissions -rw-r--r--
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files) Submitted-by: asemenyuk Reviewed-by: herrick, almatvee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57413
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     1
/*
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     4
 *
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    10
 *
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    15
 * accompanied this code).
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    16
 *
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    20
 *
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    23
 * questions.
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    24
 */
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    25
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    26
#include "Resources.h"
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    27
#include "FileUtils.h"
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    28
#include "WinErrorHandling.h"
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    29
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    30
#include <fstream>
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    31
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    32
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    33
Resource::Resource(LPCTSTR name, LPCTSTR type, HINSTANCE module) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    34
    init(name, type, module);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    35
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    36
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    37
Resource::Resource(UINT id, LPCTSTR type, HINSTANCE module) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    38
    init(MAKEINTRESOURCE(id), type, module);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    39
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    40
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    41
void Resource::init(LPCTSTR name, LPCTSTR type, HINSTANCE module) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    42
    if (IS_INTRESOURCE(name)) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    43
        std::wostringstream printer;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    44
        printer << L"#" << reinterpret_cast<size_t>(name);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    45
        nameStr = printer.str();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    46
        namePtr = name;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    47
    } else {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    48
        nameStr = name;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    49
        namePtr = nameStr.c_str();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    50
    }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    51
    if (IS_INTRESOURCE(type)) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    52
        std::wostringstream printer;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    53
        printer << L"#" << reinterpret_cast<size_t>(name);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    54
        typeStr = printer.str();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    55
        typePtr = type;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    56
    } else {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    57
        typeStr = type;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    58
        typePtr = typeStr.c_str();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    59
    }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    60
    instance = module;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    61
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    62
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    63
std::string Resource::getErrMsg(const std::string &descr) const {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    64
    return (tstrings::any() << descr << " (name='" << nameStr << "', type='" << typeStr << "')").str();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    65
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    66
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    67
HRSRC Resource::findResource() const {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    68
    LPCTSTR id = namePtr;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    69
    // string resources are stored in blocks (stringtables)
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    70
    // id of the resource is (stringId / 16 + 1)
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    71
    if (typePtr == RT_STRING) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    72
        id = MAKEINTRESOURCE(UINT(size_t(id) / 16 + 1));
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    73
    }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    74
    return FindResource(instance, id, typePtr);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    75
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    76
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    77
LPVOID Resource::getPtr(DWORD &size) const
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    78
{
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    79
    // LoadString returns the same result if value is zero-length or if if the value does not exists,
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    80
    // so wee need to ensure the stringtable exists
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    81
    HRSRC resInfo = findResource();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    82
    if (resInfo == NULL) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    83
        JP_THROW(SysError(getErrMsg("cannot find resource"), FindResource));
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    84
    }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    85
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    86
    HGLOBAL res = LoadResource(instance, resInfo);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    87
    if (res == NULL) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    88
        JP_THROW(SysError(getErrMsg("cannot load resource"), LoadResource));
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    89
    }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    90
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    91
    LPVOID ptr = LockResource(res);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    92
    if (res == NULL) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    93
        JP_THROW(SysError(getErrMsg("cannot lock resource"), LockResource));
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    94
    }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    95
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    96
    if (typePtr == RT_STRING) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    97
        // string resources are stored in stringtables and need special handling
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    98
        // The simplest way (while we don't need handle resource locale) is LoadString
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
    99
        // But this adds dependency on user32.dll, so implement custom string extraction
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   100
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   101
        // number in the block (namePtr is an integer)
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   102
        size_t num = size_t(namePtr) & 0xf;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   103
        LPWSTR strPtr = (LPWSTR)ptr;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   104
        for (size_t i = 0; i < num; i++) {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   105
            // 1st symbol contains string length
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   106
            strPtr += DWORD(*strPtr) + 1;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   107
        }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   108
        // *strPtr contains string length, string value starts at strPtr+1
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   109
        size = DWORD(*strPtr) * sizeof(wchar_t);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   110
        ptr = strPtr+1;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   111
    } else {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   112
        size = SizeofResource(instance, resInfo);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   113
    }
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   114
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   115
    return ptr;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   116
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   117
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   118
bool Resource::available() const {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   119
    return NULL != findResource();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   120
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   121
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   122
unsigned Resource::size() const {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   123
    DWORD size = 0;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   124
    getPtr(size);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   125
    return size;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   126
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   127
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   128
LPCVOID Resource::rawData() const {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   129
    DWORD size = 0;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   130
    return getPtr(size);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   131
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   132
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   133
void Resource::saveToFile(const std::wstring &filePath) const {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   134
    DWORD size = 0;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   135
    const char *resPtr = (const char *)getPtr(size);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   136
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   137
    FileUtils::FileWriter(filePath).write(resPtr, size).finalize();
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   138
}
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   139
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   140
Resource::ByteArray Resource::binary() const {
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   141
    DWORD size = 0;
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   142
    LPBYTE resPtr = (LPBYTE)getPtr(size);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   143
    return ByteArray(resPtr, resPtr+size);
45c74e654794 8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff changeset
   144
}