-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'auto_add_imp' (Issue #16)
- Loading branch information
Showing
14 changed files
with
738 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
echo "Trying to build PE-bear..." | ||
|
||
#QT check | ||
|
||
QT_VER=`qmake -v` | ||
str=$QT_VER | ||
substr="Qt version 5" | ||
|
||
echo $QT_VER | ||
if [[ $str == *"$substr"* ]]; then | ||
echo "[+] Qt5 found!" | ||
else | ||
str2=`whereis qt5` | ||
substr2="/qt5" | ||
if [[ $str2 == *"$substr2"* ]]; then | ||
echo "[+] Qt5 found!" | ||
else | ||
echo "Install Qt5 SDK first" | ||
exit -1 | ||
fi | ||
fi | ||
|
||
|
||
CMAKE_VER=`cmake --version` | ||
CMAKEV="cmake version" | ||
if echo "$CMAKE_VER" | grep -q "$CMAKEV"; then | ||
echo "[+] CMake found!" | ||
else | ||
echo "[-] CMake NOT found!" | ||
echo "Install cmake first" | ||
exit -1 | ||
fi | ||
echo $CMAKE_VER | ||
mkdir build_qt5 | ||
echo "[+] build directory created" | ||
cd build_qt5 | ||
cmake -G"CodeLite - Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=$(pwd) .. | ||
cmake --build . --target install | ||
make | ||
cd .. | ||
|
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
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,70 @@ | ||
#pragma once | ||
|
||
#include <QtCore> | ||
//--- | ||
|
||
struct ImportsAutoadderSettings | ||
{ | ||
ImportsAutoadderSettings() : addNewSec(false) {} | ||
|
||
bool addImport(const QString &dll, const QString &func) | ||
{ | ||
if (dll.length() == 0 || func.length() == 0) return false; | ||
if (dllFunctions.contains(dll)) { | ||
if (dllFunctions[dll].contains(func)) return false; // already exists | ||
} | ||
dllFunctions[dll].append(func); | ||
return true; | ||
} | ||
|
||
bool removeImport(const QString &dll, const QString &func) | ||
{ | ||
if (!dllFunctions.contains(dll)) { | ||
return false; | ||
} | ||
if (!dllFunctions[dll].contains(func)) { | ||
return false; | ||
} | ||
dllFunctions[dll].removeAll(func); | ||
if (dllFunctions[dll].size() == 0) { | ||
dllFunctions.remove(dll); | ||
} | ||
return true; | ||
} | ||
|
||
size_t calcDllNamesSpace() const | ||
{ | ||
size_t areaSize = 0; | ||
for (auto itr = dllFunctions.begin(); itr != dllFunctions.end(); ++itr) { | ||
const QString dllName = itr.key(); | ||
areaSize += dllName.length() + 1; | ||
} | ||
return areaSize; | ||
} | ||
|
||
size_t calcFuncNamesSpace() const | ||
{ | ||
size_t areaSize = 0; | ||
for (auto dItr = dllFunctions.begin(); dItr != dllFunctions.end(); ++dItr) { | ||
const QStringList funcs = dItr.value(); | ||
for (auto fItr = funcs.begin(); fItr != funcs.end(); ++fItr) { | ||
const QString func = *fItr; | ||
areaSize += func.length() + 1; | ||
} | ||
} | ||
return areaSize; | ||
} | ||
|
||
size_t calcThunksCount() const | ||
{ | ||
size_t thunksNeeded = 0; | ||
for (auto dItr = dllFunctions.begin(); dItr != dllFunctions.end(); ++dItr) { | ||
const QStringList funcs = dItr.value(); | ||
thunksNeeded = funcs.size() + 1; // records for all the functions, plus the terminator | ||
} | ||
return thunksNeeded; | ||
} | ||
|
||
bool addNewSec; | ||
QMap<QString, QStringList> dllFunctions; | ||
}; |
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
Oops, something went wrong.